diff --git a/.bettercodehub.yml b/.bettercodehub.yml deleted file mode 100644 index e660e25e6..000000000 --- a/.bettercodehub.yml +++ /dev/null @@ -1,10 +0,0 @@ -exclude: -- /Hammerspoon Tests/.* -- /HammerspoonUITests/Hammerspoon_UITests.m -- /Pods/.* -component_depth: 1 -languages: -- objectivec -- python -- ruby -- script diff --git a/.flake8rc b/.flake8rc new file mode 100644 index 000000000..e44b81084 --- /dev/null +++ b/.flake8rc @@ -0,0 +1,2 @@ +[flake8] +ignore = E501 diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 000000000..6ff73f364 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,20 @@ +name: 'Close stale Issues/PRs' +on: + schedule: + - cron: '30 1 * * *' + workflow_dispatch: + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v9 + with: + stale-issue-message: 'This issue needs more information. Please see our request above.' + close-issue-message: 'No information was received, closing this Issue for now.' + stale-issue-label: 'stale' + days-before-issue-stale: 30 + days-before-issue-close: 30 + only-labels: 'needs-response' + days-before-pr-stale: -1 + days-before-pr-close: -1 diff --git a/.gitignore b/.gitignore index 411f24063..60229eb38 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ extensions/httpserver/HammerspoonCertTemplate.h ## Build generated build/ +artifacts/ DerivedData/ ## Various settings @@ -42,3 +43,6 @@ xcuserdata/ *.xccheckout *.xcscmblueprint +.vscode + +Brewfile.lock.json \ No newline at end of file diff --git a/.luacheckrc b/.luacheckrc index 0ab46c122..4ad3b2df2 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -1,2 +1,57 @@ -globals = {"hs", "rawrequire"} -ignore = {"631"} +-- +-- These globals can be set and accessed: +-- +globals = { + "rawrequire", +} + +-- +-- These globals can only be accessed: +-- +read_globals = { + "hs", + "ls", + "spoon", +} + +-- +-- Hammerspoon Tests: +-- +files["**/test_*.lua"] = { + read_globals = { + "assertFalse", + "assertGreaterThan", + "assertGreaterThanOrEqualTo", + "assertIsAlmostEqual", + "assertIsBoolean", + "assertIsEqual", + "assertIsFunction", + "assertIsNil", + "assertIsNotNil", + "assertIsNumber", + "assertIsString", + "assertIsTable", + "assertIsType", + "assertIsUserdata", + "assertIsUserdataOfType", + "assertLessThan", + "assertLessThanOrEqualTo", + "assertListsEqual", + "assertTableNotEmpty", + "assertTablesEqual", + "assertTrue", + "failure", + "success", + }, + ignore = { + "111", -- Setting an undefined global variable + "501" -- Line too long + } +} + +-- +-- Warnings to ignore: +-- +ignore = { + "631" -- Line is too long. +} diff --git a/.stickler.yml b/.stickler.yml index 961f28566..950124b82 100644 --- a/.stickler.yml +++ b/.stickler.yml @@ -1,5 +1,6 @@ linters: flake8: + config: '.flake8rc' shellcheck: shell: bash luacheck: diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c16db3499..000000000 --- a/.travis.yml +++ /dev/null @@ -1,39 +0,0 @@ -language: objective-c -osx_image: xcode9.2 -before_install: - - gem install xcpretty - - gem install xcpretty-travis-profiler-formatter - - pip install --user -r requirements.txt -before_script: - - make docs -script: - - scripts/travis-build.sh build - - scripts/travis-build.sh test -after_script: - - make build/html -after_success: - - bash <(curl -s https://codecov.io/bash) >$HOME/codecov.log 2>&1 -after_failure: - - tail -500 $HOME/build.log - - tail -500 $HOME/test.log -notifications: - irc: - channels: - - "irc.freenode.net#hammerspoon" - template: - - "%{author} @ %{repository} / %{branch} - Build:#%{build_number} : %{message} - Changes: %{compare_url} - Build details: %{build_url}" - use_notice: true - skip_join: true -addons: - artifacts: - s3_region: "eu-west-1" - bucket: hammerspoontravisartifacts - key: - secure: "HJ4xnVX6PbU+H/baT2qEAzkAKi5H3LBTDgrYEGAJ77yxB6fJbyKz19Es+pCVsD1Bqv/cNS44MiVhL8oxGmLZovdCzZeDnir578qzUKiTNAfw2WoCOGmf8Jwp5gD726mCnpLtqefiHADK9VQ53p/0DxWMNAdPAqivG8G+fbd7D+Q=" - secret: - secure: "DKxRobGmQWTxQeWNsDMWORe4FBBH8tdtlT43FTSX5/pIoJAfxBV18EHwliI2YRrxtm0kcpsZJ8rf7oeRgezPuKD2auu2CQIxVapVnOG8Lz6wEM8aHVq9OT4jbTusn1m/slKHKe8sjyJanH9thSxe3w1Q8evXzPdRUtnskXAs7Vg=" - paths: - - $HOME/build.log - - $HOME/test.log - - $HOME/codecov.log - target_paths: logs/$TRAVIS_BUILD_NUMBER diff --git a/Brewfile b/Brewfile new file mode 100644 index 000000000..c8391af18 --- /dev/null +++ b/Brewfile @@ -0,0 +1,10 @@ +tap "a7ex/homebrew-formulae" + +brew "coreutils" +brew "jq" +brew "xcbeautify" +brew "gawk" +brew "cocoapods" +brew "gh" +brew "gpg" +brew "a7ex/homebrew-formulae/xcresultparser" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 11a0dafa1..337cd89c8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,26 +1,27 @@ # Contributing to Hammerspoon -* [How is everything built?](#how-is-everything-built) - * [Making frequent local rebuilds more convenient](#making-frequent-local-rebuilds-more-convenient) -* [Contributing to the core app or LuaSkin](#contributing-to-the-core-app-or-luaskin) -* [Contributing to the extensions](#contributing-to-the-extensions) - * [Writing a new, pure-Lua extension](#writing-a-new-pure-lua-extension) - * [Writing a new mixed Lua/Objective-C extension](#writing-a-new-mixed-luaobjective-c-extension) - * [Documenting your extension](#documenting-your-extension) - * [Constants](#constants) - * [Variables](#variables) - * [Functions](#functions) - * [Methods](#methods) - * [Testing](#testing) - * [Third party extension distribution](#third-party-extension-distribution) +- [Contributing to Hammerspoon](#contributing-to-hammerspoon) + - [How is everything built?](#how-is-everything-built) + - [Making frequent local rebuilds more convenient](#making-frequent-local-rebuilds-more-convenient) + - [Contributing to the core app or LuaSkin](#contributing-to-the-core-app-or-luaskin) + - [Contributing to the extensions](#contributing-to-the-extensions) + - [Writing a new, pure-Lua extension](#writing-a-new-pure-lua-extension) + - [Writing a new mixed Lua/Objective-C extension](#writing-a-new-mixed-luaobjective-c-extension) + - [Documenting your extension](#documenting-your-extension) + - [Constants](#constants) + - [Variables](#variables) + - [Functions](#functions) + - [Methods](#methods) + - [Testing](#testing) + - [Third party extension distribution](#third-party-extension-distribution) Hammerspoon is composed of three separate logical areas - a Lua runtime wrapper framework called [LuaSkin](http://www.hammerspoon.org/docs/LuaSkin/Classes/LuaSkin/index.html#), the core Hammerspoon app which houses the LuaSkin/Lua runtime and provides the ability to load extensions, and [various extension modules](https://github.com/Hammerspoon/hammerspoon/tree/master/extensions) that [expose system APIs](http://www.hammerspoon.org/docs/) to the user's Lua code. ## How is everything built? -The app itself is built using Xcode. You must open `Hammerspoon.xcworkspace` rather than `Hammerspoon.xcodeproj`. If you open the latter, your build will fail because Xcode will not know about the Cocoapods that Hammerspoon depends on (see our [`Podfile`](https://github.com/Hammerspoon/hammerspoon/blob/master/Podfile) for the current list of required pods). +The app itself is built using Xcode. You must open `Hammerspoon.xcworkspace` rather than `Hammerspoon.xcodeproj`. If you open the latter, your build will fail because Xcode will not know about the Cocoapods that Hammerspoon depends on (see our [`Podfile`](https://github.com/Hammerspoon/hammerspoon/blob/master/Podfile) for the current list of required pods). On versions of macOS prior to Catalina [Python 3](https://www.python.org) will need to be installed for the build to work. -The extension modules are built before the core Hammerspoon binary as target dependencies. Each extension is defined as an Xcode target in its own right, although there is usually no reason to build these targets manually. During the late stages of the build process, a script ([`scripts/copy_extensions_to_bundle.sh`](https://github.com/Hammerspoon/hammerspoon/blob/master/scripts/copy_extensions_to_bundle.sh)) collects all of the compiled extension libraries and their associated Lua components, and inserts them into the final `Hammerspoon.app` bundle. +The extension modules are built before the core Hammerspoon binary as target dependencies. Each extension is defined as an Xcode target in its own right, although there is usually no reason to build these targets manually. ### Making frequent local rebuilds more convenient [Self-signing your builds](https://github.com/Hammerspoon/hammerspoon/issues/643#issuecomment-158291705) will keep you from having to re-enable permissions for your locally built copy. @@ -37,7 +38,7 @@ This is generally very simple in terms of the workflow, but there's less likely * Make the changes you want * Push them up to a fork on GitHub * Propose a Pull Request on GitHub -* Talk to us in #hammerspoon on Freenode if you need any guidance +* Talk to us in #hammerspoon on Libera if you need any guidance ## Contributing to the extensions @@ -56,13 +57,13 @@ To create such an extension: * Clone the Hammerspoon git repository * cd into the `extensions` directory * Make a directory for your extension -* Create an `init.lua` to contain your code. It should behave like any normal Lua library - that is to say, your job is to return a table containing functions/methods/constants/etc +* Create a `modulename.lua` to contain your code, giving it the appropriate name. It should behave like any normal Lua library - that is to say, your job is to return a table containing functions/methods/constants/etc * Ensure you document your API in our preferred format (see the code for almost any existing module for reference) -* Edit `scripts/copy_extensions_to_bundle.sh` and add your module name to the `HS_LUAONLY` section +* In Xcode's Project Navigator, select the Hammerspoon root entry, then choose Hammerspoon from the Targets list and find the "Copy Extension Lua Files" build phase. Add your new Lua file * Build Hammerspoon and test your extension * Push your changes up to a fork on GitHub * Propose a Pull Request on GitHub -* Talk to us in #hammerspoon on Freenode if you need any guidance +* Talk to us in #hammerspoon on Libera if you need any guidance ### Writing a new mixed Lua/Objective-C extension ### @@ -74,27 +75,27 @@ To create such an extension: * Create the directories/files for your extension: * cd into the `extensions` directory * Make a directory for your extension - * Create an `init.lua` to load your Objective-C code and contain any additional Lua code. You might find it easier to provide much of your API in Lua and just provide undocumented API from Objective C that does the minimum work possible. The choice is ultimately down to you, depending on the nature of the work the extension is doing. - * Create an `internal.m` to contain your Objective-C code. Please use the LuaSkin methods to do as much work as possible, they are well tested and in most extensions can reduce the amount of Lua C API calls to almost zero. Not all of our extensions have been fully converted to LuaSkin yet (a good example is [`hs.chooser`](https://github.com/Hammerspoon/hammerspoon/blob/master/extensions/chooser/internal.m)) - * Right click on the `extensions` group in Xcode's Project Browser and add a new sub-group for your extension, then right click on the sub-group and add your `init.lua` and `internal.m` files (and any supporting `.h`/`.c`/`.m`/etc files) - * The files you've added will probably be made members of the Hammerspoon target. You do not want this; Select each file in the Project Browser and using the File Inspector in the Utilities pane on the right of Xcode's window, deselect them from the maim Hammerspoon target. + * Create a `modulename.lua` to load your Objective-C code and contain any additional Lua code. You might find it easier to provide much of your API in Lua and just provide undocumented API from Objective C that does the minimum work possible. The choice is ultimately down to you, depending on the nature of the work the extension is doing. + * Create a `modulename.m` to contain your Objective-C code. Please use the LuaSkin methods to do as much work as possible, they are well tested and in most extensions can reduce the amount of Lua C API calls to almost zero. Not all of our extensions have been fully converted to LuaSkin yet (a good example is [`hs.chooser`](https://github.com/Hammerspoon/hammerspoon/blob/master/extensions/chooser/internal.m)) + * Right click on the `extensions` group in Xcode's Project Browser and add a new sub-group for your extension, then right click on the sub-group and add your `modulename.lua` and `modulename.m` files (and any supporting `.h`/`.c`/`.m`/etc files) + * The files you've added will probably be made members of the Hammerspoon target. You do not want this; Select each file in the Project Browser and using the File Inspector in the Utilities pane on the right of Xcode's window, deselect them from the main Hammerspoon target. * Configure Xcode to build your extension and include it in the `Hammerspoon.app` bundle: * Click on the `Hammerspoon` workspace at the very top of the Xcode Project Browser (i.e. the bar on the left) - * Right click on `alert` in the "project and targets list" and choose `Duplicate`, which creates `alert copy` at the bottom of the list. + * Right click on an existing extension target in the "project and targets list" and choose `Duplicate`, which creates `extensionname copy` at the bottom of the list. * Rename the copy and drag it to the right place in the list (alphabetically) - * Click on the target you just created, remove hs.alert's `internal.m` from the `Compile Sources` build phase, add in the `.m` files from your new module - * Check the `Link Binary With Libraries` section for any frameworks you need to add. Typically this will jsut mean `LuaSkin.framework`, plus any additional system frameworks you need to link against. + * Click on the target you just created, remove hs.alert's `extension.m` from the `Compile Sources` build phase, add in the `.m` files from your new module + * Check the `Link Binary With Libraries` section for any frameworks you need to add. Typically this will just mean `LuaSkin.framework`, plus any additional system frameworks you need to link against. * Click on the `Hammerspoon` target (not the project), and in the `Target Dependencies` build phase, add the module target you just created - * Click the menu item Product → Scheme → Manage Schemes, find `alert copy`, rename it and move it to the right place in the list of schemes - * Edit `scripts/copy_extensions_to_bundle.sh` and add your module name to the `HS_MODULES` section. *Note*: Some modules may also need to copy extra files into the app bundle, in which case add a "special copier" to the bottom of the script. + * Click the menu item Product → Scheme → Manage Schemes, find `extensionname copy`, rename it and move it to the right place in the list of schemes + * Add your `modulename.lua` to the "Copy Extension Lua Files" build phase on the Hammerspoon target, and your `modulename.dylib` to the "Copy Extension Dylibs" build phase * Build Hammerspoon and test your extension * Push your changes up to a fork on GitHub * Propose a Pull Request on GitHub -* Talk to us in #hammerspoon on Freenode if you need any guidance +* Talk to us in #hammerspoon on Libera if you need any guidance ### Documenting your extension -Both Lua and Objective-C portions of an extension should contain in-line documention of all of the functions they expose to users of the extension. +Both Lua and Objective-C portions of an extension should contain in-line documentation of all of the functions they expose to users of the extension. The format for docstrings should follow the standard described below. Note that for Lua files, the lines should begin with `---` and for Objective C files, the lines should begin with `///`. @@ -169,7 +170,7 @@ The best place to start is in the `Hammerspoon/Hammerspoon Tests` folder in Xcod * The rest of `HSfoo` should be methods named `testBar`, each of which causes some test action to take place. * There are some helper macros for use inside the test methods: * `RUN_LUA_TEST()` will cause a function from `test_foo.lua` to be run, if its name exactly matches the name of the `HSfoo` method - * `SKIP_IN_TRAVIS()` will cause this test to be skipped when running as part of our [Travis](http://www.travis-ci.org) test runs (e.g. because the Travis VMs lack hardware/network resources required to test) + * `SKIP_IN_GITHUB_ACTIONS()` will cause this test to be skipped when running as part of our GitHub Actions test runs (e.g. because the GitHub VMs lack hardware/network resources required to test) When Hammerspoon detects it is is being run by `XCTest`, it loads a special `init.lua` (`Hammerspoon/Hammerspoon Tests/init.lua`) which provides a number of helper functions, mainly related to asserting state in test functions. These functions will generate Lua errors if a test failure occurs, which will cause Xcode to report the test has failed, with an appropriate backtrace in the logs. Refer to the file for the full list of assertions, but the most useful are: diff --git a/CREDITS.md b/CREDITS.md index 55bee7058..6a5f12ea3 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -1,21 +1,10 @@ -Hammerspoon is based on Mjolnir by Steven Degutis, which is based on Hydra by Steven Degutis. +Hammerspoon is based on Mjolnir, which is based on Hydra. -The extensions included in Hammerspoon were written by: - * [Steven Degutis](https://github.com/sdegutis/) - * [Aaron Magill](https://github.com/asmagill) +Our maintainers are: * [Chris Jones](https://github.com/cmsj) - * Peter van Dijk - * Linell Bonnette - * Kepler Project - * Enrique García Cota - * Szymon Kaliski - * Brian Gilbert - * Tristan Hume - * Tyler Mandry - * Alexander Yakushev - * Jake Heinz - * Till Klocke - * Markus Engelbrecht + * [Aaron Magill](https://github.com/asmagill) * [Chris Hocking](https://github.com/latenitefilms) -The Hammerspon icon was provided by Juerd Waalboer. +Lots of additional extensions/work has been provided by [various contributors](https://github.com/Hammerspoon/hammerspoon/graphs/contributors) + +The Hammerspoon icon was provided by Juerd Waalboer. diff --git a/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/Contents.json b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..b8bd46272 --- /dev/null +++ b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "filename" : "icon_16x16.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "filename" : "icon_16x16@2x@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "filename" : "icon_32x32.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "filename" : "icon_32x32@2x@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "filename" : "icon_128x128.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "filename" : "icon_128x128@2x@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "filename" : "icon_256x256.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "filename" : "icon_256x256@2x@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "filename" : "icon_512x512.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "filename" : "icon_512x512@2x@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_128x128.png b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_128x128.png new file mode 100644 index 000000000..dc08638ec Binary files /dev/null and b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_128x128.png differ diff --git a/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x@2x.png b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x@2x.png new file mode 100644 index 000000000..27793b0c3 Binary files /dev/null and b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x@2x.png differ diff --git a/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_16x16.png b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_16x16.png new file mode 100644 index 000000000..8e5430915 Binary files /dev/null and b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_16x16.png differ diff --git a/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x@2x.png b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x@2x.png new file mode 100644 index 000000000..90e24de09 Binary files /dev/null and b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x@2x.png differ diff --git a/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_256x256.png b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_256x256.png new file mode 100644 index 000000000..27793b0c3 Binary files /dev/null and b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_256x256.png differ diff --git a/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x@2x.png b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x@2x.png new file mode 100644 index 000000000..db9eca3a6 Binary files /dev/null and b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x@2x.png differ diff --git a/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_32x32.png b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_32x32.png new file mode 100644 index 000000000..90e24de09 Binary files /dev/null and b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_32x32.png differ diff --git a/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x@2x.png b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x@2x.png new file mode 100644 index 000000000..7de8f3558 Binary files /dev/null and b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x@2x.png differ diff --git a/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_512x512.png b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_512x512.png new file mode 100644 index 000000000..db9eca3a6 Binary files /dev/null and b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_512x512.png differ diff --git a/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x@2x.png b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x@2x.png new file mode 100644 index 000000000..8eff1ff43 Binary files /dev/null and b/CommandPost Workflow Extension/Assets/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x@2x.png differ diff --git a/Hammerspoon/Images.xcassets/Contents.json b/CommandPost Workflow Extension/Assets/Assets.xcassets/Contents.json similarity index 100% rename from Hammerspoon/Images.xcassets/Contents.json rename to CommandPost Workflow Extension/Assets/Assets.xcassets/Contents.json diff --git a/CommandPost Workflow Extension/Assets/WorkflowExtension.icns b/CommandPost Workflow Extension/Assets/WorkflowExtension.icns new file mode 100644 index 000000000..70c7287e7 Binary files /dev/null and b/CommandPost Workflow Extension/Assets/WorkflowExtension.icns differ diff --git a/CommandPost Workflow Extension/CommandPost-Bridging-Header.h b/CommandPost Workflow Extension/CommandPost-Bridging-Header.h new file mode 100644 index 000000000..e79f69e84 --- /dev/null +++ b/CommandPost Workflow Extension/CommandPost-Bridging-Header.h @@ -0,0 +1 @@ +#import diff --git a/CommandPost Workflow Extension/CommandPostViewController.h b/CommandPost Workflow Extension/CommandPostViewController.h new file mode 100644 index 000000000..5ae843daf --- /dev/null +++ b/CommandPost Workflow Extension/CommandPostViewController.h @@ -0,0 +1,22 @@ +#import +#import +#import + +#import "CocoaAsyncSocket/GCDAsyncSocket.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface CommandPostViewController : NSViewController +{ + dispatch_queue_t socketQueue; + GCDAsyncSocket *listenSocket; + NSMutableArray *connectedSockets; +} + +@property id host; +@property (readonly) NSString *hostInfoString; +@property GCDAsyncSocket *socket; + +@end + +NS_ASSUME_NONNULL_END diff --git a/CommandPost Workflow Extension/CommandPostViewController.m b/CommandPost Workflow Extension/CommandPostViewController.m new file mode 100644 index 000000000..c9f265f44 --- /dev/null +++ b/CommandPost Workflow Extension/CommandPostViewController.m @@ -0,0 +1,631 @@ +#import "CommandPostViewController.h" + +/* + + COMMANDPOST WORKFLOW EXTENSION - SOCKETS API: + ============================================= + + Commands that can be SENT to the Workflow Extension: + ---- + + PING - Send a ping + INCR f - Increment by Frame (where f is number of frames) + DECR f - Decrement by Frame (where f is number of frames) + GOTO s - Goto Timeline Position (where s is number of seconds) + + + Commands that can be RECEIVED from the Workflow Extension: + -------- + + DONE - Connection successful + DEAD - Server is shutting down + PONG - Receive a pong + PLHD s - The playhead time has changed (where s is playhead position in seconds) + + SEQC sequenceName || startTime || duration || frameDuration || container || timecodeFormat || objectType + - The active sequence has changed + (sequenceName is a string) + (startTime in seconds) + (duration in seconds) + (frameDuration in seconds) + (container as a string) + (timecodeFormat as a string: DropFrame, NonDropFrame, Unspecified or Unknown) + (objectType as a string: Event, Library, Project, Sequence or Unknown) + + RNGC startTime || duration + - The active sequence time range has changed + (startTime in seconds) + (duration in seconds) + + + WORKFLOW EXTENSION API NOTES: + ----------------------------- + + * FCPXLibrary - url name + * FCPXEvent - UID name + * FCPXProject - sequence UID name + * FCPXSequence - duration, frameDuration, startTime, timecodeFormat, name + + + USEFUL LINKS: + ------------- + + * CMTime for Human Beings: https://dcordero.me/posts/cmtime-for-human-beings.html + + */ + +// +// VIEW CONTROLLER: +// + +@interface CommandPostViewController () + +@property (weak) IBOutlet NSScrollView *debugTextBox; +@property (weak) IBOutlet NSTextField *statusTextField; +@property (weak) IBOutlet NSTextField *statusHeadingTextField; + +@end + +@implementation CommandPostViewController + +#pragma mark SOCKETS SERVER + +// +// Start the Socket Server: +// +- (void) startSocketServer +{ + // Update status in Workflow Extension UI: + [self updateStatusEmoji:@"🟠"]; + [self updateStatus:@"Starting Server..." includeTimestamp:NO]; + + // Setup a new dispatch queue for socket connection: + if (!socketQueue) { + socketQueue = dispatch_queue_create("socketQueue", NULL); + } + + // Setup new CocoaAsyncSocket object: + if (!listenSocket) { + listenSocket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:socketQueue]; + } + + // Setup an array to store all accepted client connections + if (!connectedSockets) { + connectedSockets = [[NSMutableArray alloc] initWithCapacity:1]; + } + + // The socket port we want to use for communication: + UInt16 thePort = 43426; + + // Start Socket Server: + NSError *error = nil; + if (![listenSocket acceptOnPort:thePort error:&error]) { + // Update status in Workflow Extension UI: + [self updateStatusEmoji:@"🔴"]; + NSString *status = [NSString stringWithFormat:@"Socket Server Failed (Port: %hu)", thePort]; + [self updateStatus:status includeTimestamp:NO]; + + } else { + // Update status in Workflow Extension UI: + [self updateStatusEmoji:@"🟠"]; + NSString *status = [NSString stringWithFormat:@"Server Started (Port: %hu)", thePort]; + [self updateStatus:status includeTimestamp:NO]; + } +} + +// +// Stop the Socket Server: +// +- (void) stopSocketServer +{ + // Tell all our clients we're about to die: + [self sendSocketMessage:@"DEAD"]; + + // Stop accepting connections: + [listenSocket disconnect]; + + // Stop any client connections: + @synchronized(connectedSockets) + { + NSUInteger i; + for (i = 0; i < [connectedSockets count]; i++) + { + // Call disconnect on the socket, + // which will invoke the socketDidDisconnect: method, + // which will remove the socket from the list. + [[connectedSockets objectAtIndex:i] disconnect]; + } + } +} + +// +// Send a Socket Message to all the connected client sockets. +// +- (void)sendSocketMessage:(NSString*) message +{ + // Add in the correct ending: + NSString *newMessage = [NSString stringWithFormat:@"%@\r\n", message]; + + // Send the message to all connected sockets: + NSData *data = [newMessage dataUsingEncoding:NSUTF8StringEncoding]; + for (id socket in connectedSockets) { + [socket writeData:data withTimeout:-1 tag:0]; + } +} + +// +// Triggered when a new client socket connection is accepted. +// +// NOTE: This method is executed on the socketQueue (not the main thread) +// +- (void)socket:(GCDAsyncSocket *)sock didAcceptNewSocket:(GCDAsyncSocket *)newSocket +{ + // Add the new socket to connected sockets: + @synchronized(connectedSockets) + { + [connectedSockets addObject:newSocket]; + } + + // Get port name from new socket: + UInt16 port = [newSocket connectedPort]; + + // Update status in Workflow Extension UI: + [self updateStatusEmoji:@"🟢"]; + NSString *status = [NSString stringWithFormat:@"Connected (Port: %hu)", port]; + [self updateStatus:status includeTimestamp:NO]; + + // Send the success command: + [self sendSocketMessage:@"DONE"]; + + // Trigger all the notifications: + [self activeSequenceChanged]; + [self playheadTimeChanged]; + [self sequenceTimeRangeChanged]; + + // Read any data on the socket: + [newSocket readDataToData:[GCDAsyncSocket CRLFData] withTimeout:-1 tag:0]; +} + +// +// Called when a socket has completed writing the requested data. Not called if there is an error. +// +// NOTE: This method is executed on the socketQueue (not the main thread) +// +- (void)socket:(GCDAsyncSocket *)sock didWriteDataWithTag:(long)tag +{ + // Read any data on the socket: + [sock readDataToData:[GCDAsyncSocket CRLFData] withTimeout:-1 tag:0]; +} + +// +// Called when a socket has completed reading the requested data into memory. Not called if there is an error. +// +// NOTE: This method is executed on the socketQueue (not the main thread) +// +- (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag +{ + // Strip off the end of the data: + NSData *trimmedData = [data subdataWithRange:NSMakeRange(0, [data length] - 2)]; + + // Convert the data into a string: + NSString *message = [[NSString alloc] initWithData:trimmedData encoding:NSUTF8StringEncoding]; + if (!message) { + // Update status in Workflow Extension UI: + [self updateStatus:@"⛔️ Incoming data was invalid" includeTimestamp:NO]; + return; + } + + // Get the command from the message: + NSString *command = [message substringToIndex:4];; + if (!command) { + [self updateStatus:@"⛔️ No command detected" includeTimestamp:NO]; + return; + } + + // Get the value from the message: + NSString *value = nil; + if ([message length] > 4) { + NSRange valueRange = NSMakeRange(5, [message length] - 5); + value = [message substringWithRange:valueRange]; + } + + // Make sure we're running any UI stuff on the main thread: + dispatch_async(dispatch_get_main_queue(), ^{ + @autoreleasepool { + // + // Process Commands: + // + NSArray *items = @[@"PING", @"INCR", @"DECR", @"GOTO"]; + unsigned long item = [items indexOfObject:command]; + switch (item) { + case 0: { + // + // PING - no additional attributes + // + [self sendSocketMessage:@"PONG"]; + + // Update Status: + [self updateStatus:@"🏓 Ping Received" includeTimestamp:YES]; + + break; + } + case 1: { + // + // INCR f - where f is number of frames + // + NSNumber *frames = [self stringToNumber:value]; + [self shiftTimelineInFrames:frames]; + break; + } + case 2: { + // + // DECR f - where f is number of frames + // + NSNumber *frames = [self stringToNumber:value]; + NSNumber *reverseFrames = @(- frames.floatValue); + [self shiftTimelineInFrames:reverseFrames]; + break; + } + case 3: { + // + // GOTO s - where s is number of seconds + // + NSNumber *seconds = [self stringToNumber:value]; + [self gotoTimelineValueInSeconds:seconds]; + break; + } + default: { + // + // UNKNOWN COMMAND: + // + NSString *status = [NSString stringWithFormat:@"⛔️ Unknown Command: %@", command]; + [self updateStatus:status includeTimestamp:NO]; + break; + } + } + } + }); + + // Read any data on connected sockets: + for (id socket in connectedSockets) { + [socket readDataToData:[GCDAsyncSocket CRLFData] withTimeout:-1 tag:0]; + } +} + +// +// Called when a socket disconnects with or without error. +// +- (void)socketDidDisconnect:(GCDAsyncSocket *)sock withError:(NSError *)err +{ + if (sock != listenSocket) + { + // Update status: + [self updateStatusEmoji:@"🟠"]; + [self updateStatus:@"Disconnected" includeTimestamp:NO]; + + // Remove the disconnected socket from connected sockets: + @synchronized(connectedSockets) + { + [connectedSockets removeObject:sock]; + } + } +} + +#pragma mark CONNECT TO FINAL CUT PRO + +- (void) connectToFinalCutPro +{ + // + // Connect to the Final Cut Pro host: + // + id host = (id)ProExtensionHostSingleton(); + self.host = host; + + // + // Add a new timeline observer: + // + [host.timeline addTimelineObserver:self]; +} + +#pragma mark CONTROL FINAL CUT PRO + +// +// Shift Timeline In Frames: +// +- (void) shiftTimelineInFrames:(NSNumber*) frames +{ + // Get the timeline: + FCPXTimeline *timeline = self.host.timeline; + + // Get the active sequence: + FCPXSequence *activeSequence = timeline.activeSequence; + + // Get frame duration for active sequence: + CMTime frameDuration = activeSequence.frameDuration; + + // Multiply the Frame Duration by how many frames to move: + CMTime howManyFrames = CMTimeMultiply(frameDuration, [frames floatValue]); + + // Get the current playhead time: + CMTime time = [self.host.timeline playheadTime]; + + // Add the current playhead time with how many frames: + CMTime newTime = CMTimeAdd(time, howManyFrames); + + // Tell Final Cut Pro to move the playhead: + [self.host.timeline movePlayheadTo:newTime]; + + // Update Status: + NSString *status; + if ([frames intValue] > 0) { + status = [NSString stringWithFormat:@"▶️ Move Playhead %@", frames]; + } else { + status = [NSString stringWithFormat:@"◀️ Move Playhead %@", frames]; + } + [self updateStatus:status includeTimestamp:YES]; +} + +// +// Go to Timeline Value in Seconds: +// +- (void) gotoTimelineValueInSeconds:(NSNumber*) seconds +{ + CMTime newTime = CMTimeMakeWithSeconds([seconds floatValue], NSEC_PER_SEC); + [self.host.timeline movePlayheadTo:newTime]; + + // Update Status: + NSString *status = [NSString stringWithFormat:@"⏯ Goto %@", seconds]; + [self updateStatus:status includeTimestamp:YES]; +} + +#pragma mark FINAL CUT PRO OBSERVERS + +// +// A callback method that gets invoked when there is a change in the current timeline sequence. +// +- (void) activeSequenceChanged +{ + // Get the timeline: + FCPXTimeline *timeline = self.host.timeline; + + // Get the active sequence: + FCPXSequence *activeSequence = timeline.activeSequence; + + // Get sequence parameters: + NSString *name = activeSequence.name; + + CMTime startTime = activeSequence.startTime; + CMTime duration = activeSequence.duration; + CMTime frameDuration = activeSequence.frameDuration; + + FCPXObject *container = activeSequence.container; + NSString *containerString = container.debugDescription; + + FCPXSequenceTimecodeFormat timecodeFormat = activeSequence.timecodeFormat; + NSString *fcpxSequenceTimecodeFormatString = [self fcpxSequenceTimecodeFormatString:timecodeFormat]; + + FCPXObjectType objectType = activeSequence.objectType; + NSString *fcpxObjectTypeString = [self fcpxObjectTypeString:objectType]; + + // Convert the parameters into something human readable: + NSString *combined = [NSString stringWithFormat:@"%@ || %f || %f || %f || %@ || %@ || %@", + name, + CMTimeGetSeconds(startTime), + CMTimeGetSeconds(duration), + CMTimeGetSeconds(frameDuration), + containerString, + fcpxSequenceTimecodeFormatString, + fcpxObjectTypeString]; + + // Write message to Socket: + NSString *socketMessage = [NSString stringWithFormat:@"SEQC %@", combined]; + [self sendSocketMessage:socketMessage]; +} + +// +// A callback method that gets invoked when the playhead position changes in the Final Cut Pro timeline. +// +// Final Cut Pro invokes this method when: +// * A user clicks the Final Cut Pro timeline view to move the playhead to a new position. +// * A user drags the timeline playhead to a new position. +// * Playback of the timeline sequence stops. +// * A user clicks one of the markers displayed in the Tags tab on the Index panel. +// +// NOTE: Final Cut Pro does not invoke this method while a user is skimming through the +// timeline or when the timeline sequence is playing. +// +- (void)playheadTimeChanged { + // Get the current playhead time: + CMTime time = [self.host.timeline playheadTime]; + + // Write message to Socket: + NSString *socketMessage = [NSString stringWithFormat:@"PLHD %f", CMTimeGetSeconds(time)]; + [self sendSocketMessage:socketMessage]; +} + +// +// A callback method that gets invoked when the time range of an active sequence changes in the Final Cut Pro timeline. +// +// By observing for the changes in the time range of an active sequence, an extension can verify whether the data it +// has for the sequence is in sync with what is presented in Final Cut Pro. +// +- (void)sequenceTimeRangeChanged { + // Get the timeline: + FCPXTimeline *timeline = self.host.timeline; + + // Get the sequence time range: + CMTimeRange sequenceTimeRange = timeline.sequenceTimeRange; + + CMTime start = sequenceTimeRange.start; + CMTime duration = sequenceTimeRange.duration; + + // Write message to Socket: + NSString *socketMessage = [NSString stringWithFormat:@"RNGC %f || %f", CMTimeGetSeconds(start), CMTimeGetSeconds(duration)]; + [self sendSocketMessage:socketMessage]; +} + +# pragma mark FINAL CUT PRO HELPER FUNCTIONS + +// +// Converts a NSString into a NSNumber: +// +- (NSNumber*)stringToNumber:(NSString*) value { + NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; + formatter.numberStyle = NSNumberFormatterDecimalStyle; + NSNumber *frames = [formatter numberFromString:value]; + return frames; +} + +// +// Converts CMTime object into a human-readable string: +// +- (NSString*)CMTimeString:(CMTime) time { + NSString *timeDescription = (NSString *)CFBridgingRelease(CMTimeCopyDescription(NULL, time)); + return timeDescription; +} + +// +// Converts FCPXSequenceTimecodeFormat object into a human-readable string: +// +- (NSString*)fcpxSequenceTimecodeFormatString:(FCPXSequenceTimecodeFormat) timecodeFormat { + NSString *fcpxSequenceTimecodeFormatString; + if (timecodeFormat == kFCPXSequenceTimecodeFormat_DropFrame) { + fcpxSequenceTimecodeFormatString = @"DropFrame"; + } else if (timecodeFormat == kFCPXSequenceTimecodeFormat_NonDropFrame) { + fcpxSequenceTimecodeFormatString = @"NonDropFrame"; + } else if (timecodeFormat == kFCPXSequenceTimecodeFormat_Unspecified) { + fcpxSequenceTimecodeFormatString = @"Unspecified"; + } else { + fcpxSequenceTimecodeFormatString = @"Unknown"; + } + return fcpxSequenceTimecodeFormatString; +} + +// +// Converts FCPXObjectType object into a human-readable string: +// +- (NSString*)fcpxObjectTypeString:(FCPXObjectType) objectType { + NSString *fcpxObjectTypeString; + if (objectType == kFCPXObjectType_Event) { + fcpxObjectTypeString = @"Event"; + } else if (objectType == kFCPXObjectType_Library) { + fcpxObjectTypeString = @"Library"; + } else if (objectType == kFCPXObjectType_Project) { + fcpxObjectTypeString = @"Project"; + } else if (objectType == kFCPXObjectType_Sequence) { + fcpxObjectTypeString = @"Sequence"; + } else { + fcpxObjectTypeString = @"Unknown"; + } + return fcpxObjectTypeString; +} + +# pragma mark VIEW CONTROLLER MANAGEMENT + +- (void) awakeFromNib +{ + [super awakeFromNib]; + + // Connect to Final Cut Pro: + [self connectToFinalCutPro]; +} + +- (NSString*) nibName +{ + // Return the NIB name: + return @"CommandPostViewController"; +} + +- (void)viewWillAppear +{ + [super viewWillAppear]; + + // Start the Socket Server: + [self startSocketServer]; +} + + +- (void)viewWillDisappear +{ + [super viewWillDisappear]; + + // Stop the Socket Server: + [self stopSocketServer]; +} + +#pragma mark USER INTERFACE + +// +// Update the Status Text in the Workflow Extension UI: +// +- (void)updateStatus:(NSString*) message includeTimestamp:(BOOL)includeTimestamp { + dispatch_async(dispatch_get_main_queue(), ^{ + @autoreleasepool { + if (self && message) { + NSString *newMessage = message; + if (includeTimestamp) { + CFAbsoluteTime timeInSeconds = CFAbsoluteTimeGetCurrent(); + newMessage = [NSString stringWithFormat:@"%@ (%f)", message, timeInSeconds]; + } + self.statusTextField.stringValue = newMessage; + } + } + }); +} + +// +// Update the Status Text in the Workflow Extension UI: +// +- (void)updateStatusEmoji:(NSString*) emoji { + dispatch_async(dispatch_get_main_queue(), ^{ + @autoreleasepool { + if (self && emoji) { + self.statusHeadingTextField.stringValue = [NSString stringWithFormat:@"Status: %@", emoji]; + } + } + }); +} + +// +// Open website when you click "Learn More": +// +- (IBAction)learnMoreButton:(id)sender { + dispatch_async(dispatch_get_main_queue(), ^{ + @autoreleasepool { + NSURL *url = [NSURL URLWithString:@"https://help.commandpost.io/workflow-extension/"]; + [[NSWorkspace sharedWorkspace] openURL:url]; + } + }); + +} + +#pragma mark MISC + +// +// Attempt to commit pending edits, returning an error in the case of failure. +// +// During autosaving, commit editing may fail, due to a pending edit. Rather than interrupt the user with an +// unexpected alert, this method provides the caller with the option to either present the error or fail +// silently, leaving the pending edit in place and the user's editing uninterrupted. In your implementation of +// this method, you should attempt to commit editing, but if there is a failure return NO and in error an +// error object to be presented or ignored as appropriate. +// +// Return YES if the commit is successful, otherwise NO. +// +- (BOOL)commitEditingAndReturnError:(NSError *__autoreleasing _Nullable * _Nullable)error +{ + return YES; +} + +// +// Encodes the receiver using a given archiver. +// +// You don’t call this method directly. It’s called by a NSCoder subclass if it needs to serialize that +// object. If you want to encode an object graph use the class methods archivedDataWithRootObject: or +// archiveRootObject:toFile: of NSKeyedArchiver. This in turn will call the encodeWithCoder: method of your +// objects. Also note that every object in your array has to implement the NSCoding protocol. +// +- (void)encodeWithCoder:(nonnull NSCoder *)coder { +} + +@end diff --git a/CommandPost Workflow Extension/Extras/CocoaAsyncSocket/GCDAsyncSocket.h b/CommandPost Workflow Extension/Extras/CocoaAsyncSocket/GCDAsyncSocket.h new file mode 100644 index 000000000..c339f8abc --- /dev/null +++ b/CommandPost Workflow Extension/Extras/CocoaAsyncSocket/GCDAsyncSocket.h @@ -0,0 +1,1226 @@ +// +// GCDAsyncSocket.h +// +// This class is in the public domain. +// Originally created by Robbie Hanson in Q3 2010. +// Updated and maintained by Deusty LLC and the Apple development community. +// +// https://github.com/robbiehanson/CocoaAsyncSocket +// + +#import +#import +#import +#import +#import + +#include // AF_INET, AF_INET6 + +@class GCDAsyncReadPacket; +@class GCDAsyncWritePacket; +@class GCDAsyncSocketPreBuffer; +@protocol GCDAsyncSocketDelegate; + +NS_ASSUME_NONNULL_BEGIN + +extern NSString *const GCDAsyncSocketException; +extern NSString *const GCDAsyncSocketErrorDomain; + +extern NSString *const GCDAsyncSocketQueueName; +extern NSString *const GCDAsyncSocketThreadName; + +extern NSString *const GCDAsyncSocketManuallyEvaluateTrust; +#if TARGET_OS_IPHONE +extern NSString *const GCDAsyncSocketUseCFStreamForTLS; +#endif +#define GCDAsyncSocketSSLPeerName (NSString *)kCFStreamSSLPeerName +#define GCDAsyncSocketSSLCertificates (NSString *)kCFStreamSSLCertificates +#define GCDAsyncSocketSSLIsServer (NSString *)kCFStreamSSLIsServer +extern NSString *const GCDAsyncSocketSSLPeerID; +extern NSString *const GCDAsyncSocketSSLProtocolVersionMin; +extern NSString *const GCDAsyncSocketSSLProtocolVersionMax; +extern NSString *const GCDAsyncSocketSSLSessionOptionFalseStart; +extern NSString *const GCDAsyncSocketSSLSessionOptionSendOneByteRecord; +extern NSString *const GCDAsyncSocketSSLCipherSuites; +extern NSString *const GCDAsyncSocketSSLALPN; +#if !TARGET_OS_IPHONE +extern NSString *const GCDAsyncSocketSSLDiffieHellmanParameters; +#endif + +#define GCDAsyncSocketLoggingContext 65535 + + +typedef NS_ERROR_ENUM(GCDAsyncSocketErrorDomain, GCDAsyncSocketError) { + GCDAsyncSocketNoError = 0, // Never used + GCDAsyncSocketBadConfigError, // Invalid configuration + GCDAsyncSocketBadParamError, // Invalid parameter was passed + GCDAsyncSocketConnectTimeoutError, // A connect operation timed out + GCDAsyncSocketReadTimeoutError, // A read operation timed out + GCDAsyncSocketWriteTimeoutError, // A write operation timed out + GCDAsyncSocketReadMaxedOutError, // Reached set maxLength without completing + GCDAsyncSocketClosedError, // The remote peer closed the connection + GCDAsyncSocketOtherError, // Description provided in userInfo +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + +@interface GCDAsyncSocket : NSObject + +/** + * GCDAsyncSocket uses the standard delegate paradigm, + * but executes all delegate callbacks on a given delegate dispatch queue. + * This allows for maximum concurrency, while at the same time providing easy thread safety. + * + * You MUST set a delegate AND delegate dispatch queue before attempting to + * use the socket, or you will get an error. + * + * The socket queue is optional. + * If you pass NULL, GCDAsyncSocket will automatically create it's own socket queue. + * If you choose to provide a socket queue, the socket queue must not be a concurrent queue. + * If you choose to provide a socket queue, and the socket queue has a configured target queue, + * then please see the discussion for the method markSocketQueueTargetQueue. + * + * The delegate queue and socket queue can optionally be the same. +**/ +- (instancetype)init; +- (instancetype)initWithSocketQueue:(nullable dispatch_queue_t)sq; +- (instancetype)initWithDelegate:(nullable id)aDelegate delegateQueue:(nullable dispatch_queue_t)dq; +- (instancetype)initWithDelegate:(nullable id)aDelegate delegateQueue:(nullable dispatch_queue_t)dq socketQueue:(nullable dispatch_queue_t)sq NS_DESIGNATED_INITIALIZER; + +/** + * Create GCDAsyncSocket from already connect BSD socket file descriptor +**/ ++ (nullable instancetype)socketFromConnectedSocketFD:(int)socketFD socketQueue:(nullable dispatch_queue_t)sq error:(NSError**)error; + ++ (nullable instancetype)socketFromConnectedSocketFD:(int)socketFD delegate:(nullable id)aDelegate delegateQueue:(nullable dispatch_queue_t)dq error:(NSError**)error; + ++ (nullable instancetype)socketFromConnectedSocketFD:(int)socketFD delegate:(nullable id)aDelegate delegateQueue:(nullable dispatch_queue_t)dq socketQueue:(nullable dispatch_queue_t)sq error:(NSError **)error; + +#pragma mark Configuration + +@property (atomic, weak, readwrite, nullable) id delegate; +#if OS_OBJECT_USE_OBJC +@property (atomic, strong, readwrite, nullable) dispatch_queue_t delegateQueue; +#else +@property (atomic, assign, readwrite, nullable) dispatch_queue_t delegateQueue; +#endif + +- (void)getDelegate:(id __nullable * __nullable)delegatePtr delegateQueue:(dispatch_queue_t __nullable * __nullable)delegateQueuePtr; +- (void)setDelegate:(nullable id)delegate delegateQueue:(nullable dispatch_queue_t)delegateQueue; + +/** + * If you are setting the delegate to nil within the delegate's dealloc method, + * you may need to use the synchronous versions below. +**/ +- (void)synchronouslySetDelegate:(nullable id)delegate; +- (void)synchronouslySetDelegateQueue:(nullable dispatch_queue_t)delegateQueue; +- (void)synchronouslySetDelegate:(nullable id)delegate delegateQueue:(nullable dispatch_queue_t)delegateQueue; + +/** + * By default, both IPv4 and IPv6 are enabled. + * + * For accepting incoming connections, this means GCDAsyncSocket automatically supports both protocols, + * and can simulataneously accept incoming connections on either protocol. + * + * For outgoing connections, this means GCDAsyncSocket can connect to remote hosts running either protocol. + * If a DNS lookup returns only IPv4 results, GCDAsyncSocket will automatically use IPv4. + * If a DNS lookup returns only IPv6 results, GCDAsyncSocket will automatically use IPv6. + * If a DNS lookup returns both IPv4 and IPv6 results, the preferred protocol will be chosen. + * By default, the preferred protocol is IPv4, but may be configured as desired. +**/ + +@property (atomic, assign, readwrite, getter=isIPv4Enabled) BOOL IPv4Enabled; +@property (atomic, assign, readwrite, getter=isIPv6Enabled) BOOL IPv6Enabled; + +@property (atomic, assign, readwrite, getter=isIPv4PreferredOverIPv6) BOOL IPv4PreferredOverIPv6; + +/** + * When connecting to both IPv4 and IPv6 using Happy Eyeballs (RFC 6555) https://tools.ietf.org/html/rfc6555 + * this is the delay between connecting to the preferred protocol and the fallback protocol. + * + * Defaults to 300ms. +**/ +@property (atomic, assign, readwrite) NSTimeInterval alternateAddressDelay; + +/** + * User data allows you to associate arbitrary information with the socket. + * This data is not used internally by socket in any way. +**/ +@property (atomic, strong, readwrite, nullable) id userData; + +#pragma mark Accepting + +/** + * Tells the socket to begin listening and accepting connections on the given port. + * When a connection is accepted, a new instance of GCDAsyncSocket will be spawned to handle it, + * and the socket:didAcceptNewSocket: delegate method will be invoked. + * + * The socket will listen on all available interfaces (e.g. wifi, ethernet, etc) +**/ +- (BOOL)acceptOnPort:(uint16_t)port error:(NSError **)errPtr; + +/** + * This method is the same as acceptOnPort:error: with the + * additional option of specifying which interface to listen on. + * + * For example, you could specify that the socket should only accept connections over ethernet, + * and not other interfaces such as wifi. + * + * The interface may be specified by name (e.g. "en1" or "lo0") or by IP address (e.g. "192.168.4.34"). + * You may also use the special strings "localhost" or "loopback" to specify that + * the socket only accept connections from the local machine. + * + * You can see the list of interfaces via the command line utility "ifconfig", + * or programmatically via the getifaddrs() function. + * + * To accept connections on any interface pass nil, or simply use the acceptOnPort:error: method. +**/ +- (BOOL)acceptOnInterface:(nullable NSString *)interface port:(uint16_t)port error:(NSError **)errPtr; + +/** + * Tells the socket to begin listening and accepting connections on the unix domain at the given url. + * When a connection is accepted, a new instance of GCDAsyncSocket will be spawned to handle it, + * and the socket:didAcceptNewSocket: delegate method will be invoked. + * + * The socket will listen on all available interfaces (e.g. wifi, ethernet, etc) + **/ +- (BOOL)acceptOnUrl:(NSURL *)url error:(NSError **)errPtr; + +#pragma mark Connecting + +/** + * Connects to the given host and port. + * + * This method invokes connectToHost:onPort:viaInterface:withTimeout:error: + * and uses the default interface, and no timeout. +**/ +- (BOOL)connectToHost:(NSString *)host onPort:(uint16_t)port error:(NSError **)errPtr; + +/** + * Connects to the given host and port with an optional timeout. + * + * This method invokes connectToHost:onPort:viaInterface:withTimeout:error: and uses the default interface. +**/ +- (BOOL)connectToHost:(NSString *)host + onPort:(uint16_t)port + withTimeout:(NSTimeInterval)timeout + error:(NSError **)errPtr; + +/** + * Connects to the given host & port, via the optional interface, with an optional timeout. + * + * The host may be a domain name (e.g. "deusty.com") or an IP address string (e.g. "192.168.0.2"). + * The host may also be the special strings "localhost" or "loopback" to specify connecting + * to a service on the local machine. + * + * The interface may be a name (e.g. "en1" or "lo0") or the corresponding IP address (e.g. "192.168.4.35"). + * The interface may also be used to specify the local port (see below). + * + * To not time out use a negative time interval. + * + * This method will return NO if an error is detected, and set the error pointer (if one was given). + * Possible errors would be a nil host, invalid interface, or socket is already connected. + * + * If no errors are detected, this method will start a background connect operation and immediately return YES. + * The delegate callbacks are used to notify you when the socket connects, or if the host was unreachable. + * + * Since this class supports queued reads and writes, you can immediately start reading and/or writing. + * All read/write operations will be queued, and upon socket connection, + * the operations will be dequeued and processed in order. + * + * The interface may optionally contain a port number at the end of the string, separated by a colon. + * This allows you to specify the local port that should be used for the outgoing connection. (read paragraph to end) + * To specify both interface and local port: "en1:8082" or "192.168.4.35:2424". + * To specify only local port: ":8082". + * Please note this is an advanced feature, and is somewhat hidden on purpose. + * You should understand that 99.999% of the time you should NOT specify the local port for an outgoing connection. + * If you think you need to, there is a very good chance you have a fundamental misunderstanding somewhere. + * Local ports do NOT need to match remote ports. In fact, they almost never do. + * This feature is here for networking professionals using very advanced techniques. +**/ +- (BOOL)connectToHost:(NSString *)host + onPort:(uint16_t)port + viaInterface:(nullable NSString *)interface + withTimeout:(NSTimeInterval)timeout + error:(NSError **)errPtr; + +/** + * Connects to the given address, specified as a sockaddr structure wrapped in a NSData object. + * For example, a NSData object returned from NSNetService's addresses method. + * + * If you have an existing struct sockaddr you can convert it to a NSData object like so: + * struct sockaddr sa -> NSData *dsa = [NSData dataWithBytes:&remoteAddr length:remoteAddr.sa_len]; + * struct sockaddr *sa -> NSData *dsa = [NSData dataWithBytes:remoteAddr length:remoteAddr->sa_len]; + * + * This method invokes connectToAddress:remoteAddr viaInterface:nil withTimeout:-1 error:errPtr. +**/ +- (BOOL)connectToAddress:(NSData *)remoteAddr error:(NSError **)errPtr; + +/** + * This method is the same as connectToAddress:error: with an additional timeout option. + * To not time out use a negative time interval, or simply use the connectToAddress:error: method. +**/ +- (BOOL)connectToAddress:(NSData *)remoteAddr withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr; + +/** + * Connects to the given address, using the specified interface and timeout. + * + * The address is specified as a sockaddr structure wrapped in a NSData object. + * For example, a NSData object returned from NSNetService's addresses method. + * + * If you have an existing struct sockaddr you can convert it to a NSData object like so: + * struct sockaddr sa -> NSData *dsa = [NSData dataWithBytes:&remoteAddr length:remoteAddr.sa_len]; + * struct sockaddr *sa -> NSData *dsa = [NSData dataWithBytes:remoteAddr length:remoteAddr->sa_len]; + * + * The interface may be a name (e.g. "en1" or "lo0") or the corresponding IP address (e.g. "192.168.4.35"). + * The interface may also be used to specify the local port (see below). + * + * The timeout is optional. To not time out use a negative time interval. + * + * This method will return NO if an error is detected, and set the error pointer (if one was given). + * Possible errors would be a nil host, invalid interface, or socket is already connected. + * + * If no errors are detected, this method will start a background connect operation and immediately return YES. + * The delegate callbacks are used to notify you when the socket connects, or if the host was unreachable. + * + * Since this class supports queued reads and writes, you can immediately start reading and/or writing. + * All read/write operations will be queued, and upon socket connection, + * the operations will be dequeued and processed in order. + * + * The interface may optionally contain a port number at the end of the string, separated by a colon. + * This allows you to specify the local port that should be used for the outgoing connection. (read paragraph to end) + * To specify both interface and local port: "en1:8082" or "192.168.4.35:2424". + * To specify only local port: ":8082". + * Please note this is an advanced feature, and is somewhat hidden on purpose. + * You should understand that 99.999% of the time you should NOT specify the local port for an outgoing connection. + * If you think you need to, there is a very good chance you have a fundamental misunderstanding somewhere. + * Local ports do NOT need to match remote ports. In fact, they almost never do. + * This feature is here for networking professionals using very advanced techniques. +**/ +- (BOOL)connectToAddress:(NSData *)remoteAddr + viaInterface:(nullable NSString *)interface + withTimeout:(NSTimeInterval)timeout + error:(NSError **)errPtr; +/** + * Connects to the unix domain socket at the given url, using the specified timeout. + */ +- (BOOL)connectToUrl:(NSURL *)url withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr; + +/** + * Iterates over the given NetService's addresses in order, and invokes connectToAddress:error:. Stops at the + * first invocation that succeeds and returns YES; otherwise returns NO. + */ +- (BOOL)connectToNetService:(NSNetService *)netService error:(NSError **)errPtr; + +#pragma mark Disconnecting + +/** + * Disconnects immediately (synchronously). Any pending reads or writes are dropped. + * + * If the socket is not already disconnected, an invocation to the socketDidDisconnect:withError: delegate method + * will be queued onto the delegateQueue asynchronously (behind any previously queued delegate methods). + * In other words, the disconnected delegate method will be invoked sometime shortly after this method returns. + * + * Please note the recommended way of releasing a GCDAsyncSocket instance (e.g. in a dealloc method) + * [asyncSocket setDelegate:nil]; + * [asyncSocket disconnect]; + * [asyncSocket release]; + * + * If you plan on disconnecting the socket, and then immediately asking it to connect again, + * you'll likely want to do so like this: + * [asyncSocket setDelegate:nil]; + * [asyncSocket disconnect]; + * [asyncSocket setDelegate:self]; + * [asyncSocket connect...]; +**/ +- (void)disconnect; + +/** + * Disconnects after all pending reads have completed. + * After calling this, the read and write methods will do nothing. + * The socket will disconnect even if there are still pending writes. +**/ +- (void)disconnectAfterReading; + +/** + * Disconnects after all pending writes have completed. + * After calling this, the read and write methods will do nothing. + * The socket will disconnect even if there are still pending reads. +**/ +- (void)disconnectAfterWriting; + +/** + * Disconnects after all pending reads and writes have completed. + * After calling this, the read and write methods will do nothing. +**/ +- (void)disconnectAfterReadingAndWriting; + +#pragma mark Diagnostics + +/** + * Returns whether the socket is disconnected or connected. + * + * A disconnected socket may be recycled. + * That is, it can be used again for connecting or listening. + * + * If a socket is in the process of connecting, it may be neither disconnected nor connected. +**/ +@property (atomic, readonly) BOOL isDisconnected; +@property (atomic, readonly) BOOL isConnected; + +/** + * Returns the local or remote host and port to which this socket is connected, or nil and 0 if not connected. + * The host will be an IP address. +**/ +@property (atomic, readonly, nullable) NSString *connectedHost; +@property (atomic, readonly) uint16_t connectedPort; +@property (atomic, readonly, nullable) NSURL *connectedUrl; + +@property (atomic, readonly, nullable) NSString *localHost; +@property (atomic, readonly) uint16_t localPort; + +/** + * Returns the local or remote address to which this socket is connected, + * specified as a sockaddr structure wrapped in a NSData object. + * + * @seealso connectedHost + * @seealso connectedPort + * @seealso localHost + * @seealso localPort +**/ +@property (atomic, readonly, nullable) NSData *connectedAddress; +@property (atomic, readonly, nullable) NSData *localAddress; + +/** + * Returns whether the socket is IPv4 or IPv6. + * An accepting socket may be both. +**/ +@property (atomic, readonly) BOOL isIPv4; +@property (atomic, readonly) BOOL isIPv6; + +/** + * Returns whether or not the socket has been secured via SSL/TLS. + * + * See also the startTLS method. +**/ +@property (atomic, readonly) BOOL isSecure; + +#pragma mark Reading + +// The readData and writeData methods won't block (they are asynchronous). +// +// When a read is complete the socket:didReadData:withTag: delegate method is dispatched on the delegateQueue. +// When a write is complete the socket:didWriteDataWithTag: delegate method is dispatched on the delegateQueue. +// +// You may optionally set a timeout for any read/write operation. (To not timeout, use a negative time interval.) +// If a read/write opertion times out, the corresponding "socket:shouldTimeout..." delegate method +// is called to optionally allow you to extend the timeout. +// Upon a timeout, the "socket:didDisconnectWithError:" method is called +// +// The tag is for your convenience. +// You can use it as an array index, step number, state id, pointer, etc. + +/** + * Reads the first available bytes that become available on the socket. + * + * If the timeout value is negative, the read operation will not use a timeout. +**/ +- (void)readDataWithTimeout:(NSTimeInterval)timeout tag:(long)tag; + +/** + * Reads the first available bytes that become available on the socket. + * The bytes will be appended to the given byte buffer starting at the given offset. + * The given buffer will automatically be increased in size if needed. + * + * If the timeout value is negative, the read operation will not use a timeout. + * If the buffer is nil, the socket will create a buffer for you. + * + * If the bufferOffset is greater than the length of the given buffer, + * the method will do nothing, and the delegate will not be called. + * + * If you pass a buffer, you must not alter it in any way while the socket is using it. + * After completion, the data returned in socket:didReadData:withTag: will be a subset of the given buffer. + * That is, it will reference the bytes that were appended to the given buffer via + * the method [NSData dataWithBytesNoCopy:length:freeWhenDone:NO]. +**/ +- (void)readDataWithTimeout:(NSTimeInterval)timeout + buffer:(nullable NSMutableData *)buffer + bufferOffset:(NSUInteger)offset + tag:(long)tag; + +/** + * Reads the first available bytes that become available on the socket. + * The bytes will be appended to the given byte buffer starting at the given offset. + * The given buffer will automatically be increased in size if needed. + * A maximum of length bytes will be read. + * + * If the timeout value is negative, the read operation will not use a timeout. + * If the buffer is nil, a buffer will automatically be created for you. + * If maxLength is zero, no length restriction is enforced. + * + * If the bufferOffset is greater than the length of the given buffer, + * the method will do nothing, and the delegate will not be called. + * + * If you pass a buffer, you must not alter it in any way while the socket is using it. + * After completion, the data returned in socket:didReadData:withTag: will be a subset of the given buffer. + * That is, it will reference the bytes that were appended to the given buffer via + * the method [NSData dataWithBytesNoCopy:length:freeWhenDone:NO]. +**/ +- (void)readDataWithTimeout:(NSTimeInterval)timeout + buffer:(nullable NSMutableData *)buffer + bufferOffset:(NSUInteger)offset + maxLength:(NSUInteger)length + tag:(long)tag; + +/** + * Reads the given number of bytes. + * + * If the timeout value is negative, the read operation will not use a timeout. + * + * If the length is 0, this method does nothing and the delegate is not called. +**/ +- (void)readDataToLength:(NSUInteger)length withTimeout:(NSTimeInterval)timeout tag:(long)tag; + +/** + * Reads the given number of bytes. + * The bytes will be appended to the given byte buffer starting at the given offset. + * The given buffer will automatically be increased in size if needed. + * + * If the timeout value is negative, the read operation will not use a timeout. + * If the buffer is nil, a buffer will automatically be created for you. + * + * If the length is 0, this method does nothing and the delegate is not called. + * If the bufferOffset is greater than the length of the given buffer, + * the method will do nothing, and the delegate will not be called. + * + * If you pass a buffer, you must not alter it in any way while AsyncSocket is using it. + * After completion, the data returned in socket:didReadData:withTag: will be a subset of the given buffer. + * That is, it will reference the bytes that were appended to the given buffer via + * the method [NSData dataWithBytesNoCopy:length:freeWhenDone:NO]. +**/ +- (void)readDataToLength:(NSUInteger)length + withTimeout:(NSTimeInterval)timeout + buffer:(nullable NSMutableData *)buffer + bufferOffset:(NSUInteger)offset + tag:(long)tag; + +/** + * Reads bytes until (and including) the passed "data" parameter, which acts as a separator. + * + * If the timeout value is negative, the read operation will not use a timeout. + * + * If you pass nil or zero-length data as the "data" parameter, + * the method will do nothing (except maybe print a warning), and the delegate will not be called. + * + * To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter. + * If you're developing your own custom protocol, be sure your separator can not occur naturally as + * part of the data between separators. + * For example, imagine you want to send several small documents over a socket. + * Using CRLF as a separator is likely unwise, as a CRLF could easily exist within the documents. + * In this particular example, it would be better to use a protocol similar to HTTP with + * a header that includes the length of the document. + * Also be careful that your separator cannot occur naturally as part of the encoding for a character. + * + * The given data (separator) parameter should be immutable. + * For performance reasons, the socket will retain it, not copy it. + * So if it is immutable, don't modify it while the socket is using it. +**/ +- (void)readDataToData:(nullable NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag; + +/** + * Reads bytes until (and including) the passed "data" parameter, which acts as a separator. + * The bytes will be appended to the given byte buffer starting at the given offset. + * The given buffer will automatically be increased in size if needed. + * + * If the timeout value is negative, the read operation will not use a timeout. + * If the buffer is nil, a buffer will automatically be created for you. + * + * If the bufferOffset is greater than the length of the given buffer, + * the method will do nothing (except maybe print a warning), and the delegate will not be called. + * + * If you pass a buffer, you must not alter it in any way while the socket is using it. + * After completion, the data returned in socket:didReadData:withTag: will be a subset of the given buffer. + * That is, it will reference the bytes that were appended to the given buffer via + * the method [NSData dataWithBytesNoCopy:length:freeWhenDone:NO]. + * + * To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter. + * If you're developing your own custom protocol, be sure your separator can not occur naturally as + * part of the data between separators. + * For example, imagine you want to send several small documents over a socket. + * Using CRLF as a separator is likely unwise, as a CRLF could easily exist within the documents. + * In this particular example, it would be better to use a protocol similar to HTTP with + * a header that includes the length of the document. + * Also be careful that your separator cannot occur naturally as part of the encoding for a character. + * + * The given data (separator) parameter should be immutable. + * For performance reasons, the socket will retain it, not copy it. + * So if it is immutable, don't modify it while the socket is using it. +**/ +- (void)readDataToData:(NSData *)data + withTimeout:(NSTimeInterval)timeout + buffer:(nullable NSMutableData *)buffer + bufferOffset:(NSUInteger)offset + tag:(long)tag; + +/** + * Reads bytes until (and including) the passed "data" parameter, which acts as a separator. + * + * If the timeout value is negative, the read operation will not use a timeout. + * + * If maxLength is zero, no length restriction is enforced. + * Otherwise if maxLength bytes are read without completing the read, + * it is treated similarly to a timeout - the socket is closed with a GCDAsyncSocketReadMaxedOutError. + * The read will complete successfully if exactly maxLength bytes are read and the given data is found at the end. + * + * If you pass nil or zero-length data as the "data" parameter, + * the method will do nothing (except maybe print a warning), and the delegate will not be called. + * If you pass a maxLength parameter that is less than the length of the data parameter, + * the method will do nothing (except maybe print a warning), and the delegate will not be called. + * + * To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter. + * If you're developing your own custom protocol, be sure your separator can not occur naturally as + * part of the data between separators. + * For example, imagine you want to send several small documents over a socket. + * Using CRLF as a separator is likely unwise, as a CRLF could easily exist within the documents. + * In this particular example, it would be better to use a protocol similar to HTTP with + * a header that includes the length of the document. + * Also be careful that your separator cannot occur naturally as part of the encoding for a character. + * + * The given data (separator) parameter should be immutable. + * For performance reasons, the socket will retain it, not copy it. + * So if it is immutable, don't modify it while the socket is using it. +**/ +- (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout maxLength:(NSUInteger)length tag:(long)tag; + +/** + * Reads bytes until (and including) the passed "data" parameter, which acts as a separator. + * The bytes will be appended to the given byte buffer starting at the given offset. + * The given buffer will automatically be increased in size if needed. + * + * If the timeout value is negative, the read operation will not use a timeout. + * If the buffer is nil, a buffer will automatically be created for you. + * + * If maxLength is zero, no length restriction is enforced. + * Otherwise if maxLength bytes are read without completing the read, + * it is treated similarly to a timeout - the socket is closed with a GCDAsyncSocketReadMaxedOutError. + * The read will complete successfully if exactly maxLength bytes are read and the given data is found at the end. + * + * If you pass a maxLength parameter that is less than the length of the data (separator) parameter, + * the method will do nothing (except maybe print a warning), and the delegate will not be called. + * If the bufferOffset is greater than the length of the given buffer, + * the method will do nothing (except maybe print a warning), and the delegate will not be called. + * + * If you pass a buffer, you must not alter it in any way while the socket is using it. + * After completion, the data returned in socket:didReadData:withTag: will be a subset of the given buffer. + * That is, it will reference the bytes that were appended to the given buffer via + * the method [NSData dataWithBytesNoCopy:length:freeWhenDone:NO]. + * + * To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter. + * If you're developing your own custom protocol, be sure your separator can not occur naturally as + * part of the data between separators. + * For example, imagine you want to send several small documents over a socket. + * Using CRLF as a separator is likely unwise, as a CRLF could easily exist within the documents. + * In this particular example, it would be better to use a protocol similar to HTTP with + * a header that includes the length of the document. + * Also be careful that your separator cannot occur naturally as part of the encoding for a character. + * + * The given data (separator) parameter should be immutable. + * For performance reasons, the socket will retain it, not copy it. + * So if it is immutable, don't modify it while the socket is using it. +**/ +- (void)readDataToData:(NSData *)data + withTimeout:(NSTimeInterval)timeout + buffer:(nullable NSMutableData *)buffer + bufferOffset:(NSUInteger)offset + maxLength:(NSUInteger)length + tag:(long)tag; + +/** + * Returns progress of the current read, from 0.0 to 1.0, or NaN if no current read (use isnan() to check). + * The parameters "tag", "done" and "total" will be filled in if they aren't NULL. +**/ +- (float)progressOfReadReturningTag:(nullable long *)tagPtr bytesDone:(nullable NSUInteger *)donePtr total:(nullable NSUInteger *)totalPtr; + +#pragma mark Writing + +/** + * Writes data to the socket, and calls the delegate when finished. + * + * If you pass in nil or zero-length data, this method does nothing and the delegate will not be called. + * If the timeout value is negative, the write operation will not use a timeout. + * + * Thread-Safety Note: + * If the given data parameter is mutable (NSMutableData) then you MUST NOT alter the data while + * the socket is writing it. In other words, it's not safe to alter the data until after the delegate method + * socket:didWriteDataWithTag: is invoked signifying that this particular write operation has completed. + * This is due to the fact that GCDAsyncSocket does NOT copy the data. It simply retains it. + * This is for performance reasons. Often times, if NSMutableData is passed, it is because + * a request/response was built up in memory. Copying this data adds an unwanted/unneeded overhead. + * If you need to write data from an immutable buffer, and you need to alter the buffer before the socket + * completes writing the bytes (which is NOT immediately after this method returns, but rather at a later time + * when the delegate method notifies you), then you should first copy the bytes, and pass the copy to this method. +**/ +- (void)writeData:(nullable NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag; + +/** + * Returns progress of the current write, from 0.0 to 1.0, or NaN if no current write (use isnan() to check). + * The parameters "tag", "done" and "total" will be filled in if they aren't NULL. +**/ +- (float)progressOfWriteReturningTag:(nullable long *)tagPtr bytesDone:(nullable NSUInteger *)donePtr total:(nullable NSUInteger *)totalPtr; + +#pragma mark Security + +/** + * Secures the connection using SSL/TLS. + * + * This method may be called at any time, and the TLS handshake will occur after all pending reads and writes + * are finished. This allows one the option of sending a protocol dependent StartTLS message, and queuing + * the upgrade to TLS at the same time, without having to wait for the write to finish. + * Any reads or writes scheduled after this method is called will occur over the secured connection. + * + * ==== The available TOP-LEVEL KEYS are: + * + * - GCDAsyncSocketManuallyEvaluateTrust + * The value must be of type NSNumber, encapsulating a BOOL value. + * If you set this to YES, then the underlying SecureTransport system will not evaluate the SecTrustRef of the peer. + * Instead it will pause at the moment evaulation would typically occur, + * and allow us to handle the security evaluation however we see fit. + * So GCDAsyncSocket will invoke the delegate method socket:shouldTrustPeer: passing the SecTrustRef. + * + * Note that if you set this option, then all other configuration keys are ignored. + * Evaluation will be completely up to you during the socket:didReceiveTrust:completionHandler: delegate method. + * + * For more information on trust evaluation see: + * Apple's Technical Note TN2232 - HTTPS Server Trust Evaluation + * https://developer.apple.com/library/ios/technotes/tn2232/_index.html + * + * If unspecified, the default value is NO. + * + * - GCDAsyncSocketUseCFStreamForTLS (iOS only) + * The value must be of type NSNumber, encapsulating a BOOL value. + * By default GCDAsyncSocket will use the SecureTransport layer to perform encryption. + * This gives us more control over the security protocol (many more configuration options), + * plus it allows us to optimize things like sys calls and buffer allocation. + * + * However, if you absolutely must, you can instruct GCDAsyncSocket to use the old-fashioned encryption + * technique by going through the CFStream instead. So instead of using SecureTransport, GCDAsyncSocket + * will instead setup a CFRead/CFWriteStream. And then set the kCFStreamPropertySSLSettings property + * (via CFReadStreamSetProperty / CFWriteStreamSetProperty) and will pass the given options to this method. + * + * Thus all the other keys in the given dictionary will be ignored by GCDAsyncSocket, + * and will passed directly CFReadStreamSetProperty / CFWriteStreamSetProperty. + * For more infomation on these keys, please see the documentation for kCFStreamPropertySSLSettings. + * + * If unspecified, the default value is NO. + * + * ==== The available CONFIGURATION KEYS are: + * + * - kCFStreamSSLPeerName + * The value must be of type NSString. + * It should match the name in the X.509 certificate given by the remote party. + * See Apple's documentation for SSLSetPeerDomainName. + * + * - kCFStreamSSLCertificates + * The value must be of type NSArray. + * See Apple's documentation for SSLSetCertificate. + * + * - kCFStreamSSLIsServer + * The value must be of type NSNumber, encapsulationg a BOOL value. + * See Apple's documentation for SSLCreateContext for iOS. + * This is optional for iOS. If not supplied, a NO value is the default. + * This is not needed for Mac OS X, and the value is ignored. + * + * - GCDAsyncSocketSSLPeerID + * The value must be of type NSData. + * You must set this value if you want to use TLS session resumption. + * See Apple's documentation for SSLSetPeerID. + * + * - GCDAsyncSocketSSLProtocolVersionMin + * - GCDAsyncSocketSSLProtocolVersionMax + * The value(s) must be of type NSNumber, encapsulting a SSLProtocol value. + * See Apple's documentation for SSLSetProtocolVersionMin & SSLSetProtocolVersionMax. + * See also the SSLProtocol typedef. + * + * - GCDAsyncSocketSSLSessionOptionFalseStart + * The value must be of type NSNumber, encapsulating a BOOL value. + * See Apple's documentation for kSSLSessionOptionFalseStart. + * + * - GCDAsyncSocketSSLSessionOptionSendOneByteRecord + * The value must be of type NSNumber, encapsulating a BOOL value. + * See Apple's documentation for kSSLSessionOptionSendOneByteRecord. + * + * - GCDAsyncSocketSSLCipherSuites + * The values must be of type NSArray. + * Each item within the array must be a NSNumber, encapsulating an SSLCipherSuite. + * See Apple's documentation for SSLSetEnabledCiphers. + * See also the SSLCipherSuite typedef. + * + * - GCDAsyncSocketSSLDiffieHellmanParameters (Mac OS X only) + * The value must be of type NSData. + * See Apple's documentation for SSLSetDiffieHellmanParams. + * + * ==== The following UNAVAILABLE KEYS are: (with throw an exception) + * + * - kCFStreamSSLAllowsAnyRoot (UNAVAILABLE) + * You MUST use manual trust evaluation instead (see GCDAsyncSocketManuallyEvaluateTrust). + * Corresponding deprecated method: SSLSetAllowsAnyRoot + * + * - kCFStreamSSLAllowsExpiredRoots (UNAVAILABLE) + * You MUST use manual trust evaluation instead (see GCDAsyncSocketManuallyEvaluateTrust). + * Corresponding deprecated method: SSLSetAllowsExpiredRoots + * + * - kCFStreamSSLAllowsExpiredCertificates (UNAVAILABLE) + * You MUST use manual trust evaluation instead (see GCDAsyncSocketManuallyEvaluateTrust). + * Corresponding deprecated method: SSLSetAllowsExpiredCerts + * + * - kCFStreamSSLValidatesCertificateChain (UNAVAILABLE) + * You MUST use manual trust evaluation instead (see GCDAsyncSocketManuallyEvaluateTrust). + * Corresponding deprecated method: SSLSetEnableCertVerify + * + * - kCFStreamSSLLevel (UNAVAILABLE) + * You MUST use GCDAsyncSocketSSLProtocolVersionMin & GCDAsyncSocketSSLProtocolVersionMin instead. + * Corresponding deprecated method: SSLSetProtocolVersionEnabled + * + * + * Please refer to Apple's documentation for corresponding SSLFunctions. + * + * If you pass in nil or an empty dictionary, the default settings will be used. + * + * IMPORTANT SECURITY NOTE: + * The default settings will check to make sure the remote party's certificate is signed by a + * trusted 3rd party certificate agency (e.g. verisign) and that the certificate is not expired. + * However it will not verify the name on the certificate unless you + * give it a name to verify against via the kCFStreamSSLPeerName key. + * The security implications of this are important to understand. + * Imagine you are attempting to create a secure connection to MySecureServer.com, + * but your socket gets directed to MaliciousServer.com because of a hacked DNS server. + * If you simply use the default settings, and MaliciousServer.com has a valid certificate, + * the default settings will not detect any problems since the certificate is valid. + * To properly secure your connection in this particular scenario you + * should set the kCFStreamSSLPeerName property to "MySecureServer.com". + * + * You can also perform additional validation in socketDidSecure. +**/ +- (void)startTLS:(nullable NSDictionary *)tlsSettings; + +#pragma mark Advanced + +/** + * Traditionally sockets are not closed until the conversation is over. + * However, it is technically possible for the remote enpoint to close its write stream. + * Our socket would then be notified that there is no more data to be read, + * but our socket would still be writeable and the remote endpoint could continue to receive our data. + * + * The argument for this confusing functionality stems from the idea that a client could shut down its + * write stream after sending a request to the server, thus notifying the server there are to be no further requests. + * In practice, however, this technique did little to help server developers. + * + * To make matters worse, from a TCP perspective there is no way to tell the difference from a read stream close + * and a full socket close. They both result in the TCP stack receiving a FIN packet. The only way to tell + * is by continuing to write to the socket. If it was only a read stream close, then writes will continue to work. + * Otherwise an error will be occur shortly (when the remote end sends us a RST packet). + * + * In addition to the technical challenges and confusion, many high level socket/stream API's provide + * no support for dealing with the problem. If the read stream is closed, the API immediately declares the + * socket to be closed, and shuts down the write stream as well. In fact, this is what Apple's CFStream API does. + * It might sound like poor design at first, but in fact it simplifies development. + * + * The vast majority of the time if the read stream is closed it's because the remote endpoint closed its socket. + * Thus it actually makes sense to close the socket at this point. + * And in fact this is what most networking developers want and expect to happen. + * However, if you are writing a server that interacts with a plethora of clients, + * you might encounter a client that uses the discouraged technique of shutting down its write stream. + * If this is the case, you can set this property to NO, + * and make use of the socketDidCloseReadStream delegate method. + * + * The default value is YES. +**/ +@property (atomic, assign, readwrite) BOOL autoDisconnectOnClosedReadStream; + +/** + * GCDAsyncSocket maintains thread safety by using an internal serial dispatch_queue. + * In most cases, the instance creates this queue itself. + * However, to allow for maximum flexibility, the internal queue may be passed in the init method. + * This allows for some advanced options such as controlling socket priority via target queues. + * However, when one begins to use target queues like this, they open the door to some specific deadlock issues. + * + * For example, imagine there are 2 queues: + * dispatch_queue_t socketQueue; + * dispatch_queue_t socketTargetQueue; + * + * If you do this (pseudo-code): + * socketQueue.targetQueue = socketTargetQueue; + * + * Then all socketQueue operations will actually get run on the given socketTargetQueue. + * This is fine and works great in most situations. + * But if you run code directly from within the socketTargetQueue that accesses the socket, + * you could potentially get deadlock. Imagine the following code: + * + * - (BOOL)socketHasSomething + * { + * __block BOOL result = NO; + * dispatch_block_t block = ^{ + * result = [self someInternalMethodToBeRunOnlyOnSocketQueue]; + * } + * if (is_executing_on_queue(socketQueue)) + * block(); + * else + * dispatch_sync(socketQueue, block); + * + * return result; + * } + * + * What happens if you call this method from the socketTargetQueue? The result is deadlock. + * This is because the GCD API offers no mechanism to discover a queue's targetQueue. + * Thus we have no idea if our socketQueue is configured with a targetQueue. + * If we had this information, we could easily avoid deadlock. + * But, since these API's are missing or unfeasible, you'll have to explicitly set it. + * + * IF you pass a socketQueue via the init method, + * AND you've configured the passed socketQueue with a targetQueue, + * THEN you should pass the end queue in the target hierarchy. + * + * For example, consider the following queue hierarchy: + * socketQueue -> ipQueue -> moduleQueue + * + * This example demonstrates priority shaping within some server. + * All incoming client connections from the same IP address are executed on the same target queue. + * And all connections for a particular module are executed on the same target queue. + * Thus, the priority of all networking for the entire module can be changed on the fly. + * Additionally, networking traffic from a single IP cannot monopolize the module. + * + * Here's how you would accomplish something like that: + * - (dispatch_queue_t)newSocketQueueForConnectionFromAddress:(NSData *)address onSocket:(GCDAsyncSocket *)sock + * { + * dispatch_queue_t socketQueue = dispatch_queue_create("", NULL); + * dispatch_queue_t ipQueue = [self ipQueueForAddress:address]; + * + * dispatch_set_target_queue(socketQueue, ipQueue); + * dispatch_set_target_queue(iqQueue, moduleQueue); + * + * return socketQueue; + * } + * - (void)socket:(GCDAsyncSocket *)sock didAcceptNewSocket:(GCDAsyncSocket *)newSocket + * { + * [clientConnections addObject:newSocket]; + * [newSocket markSocketQueueTargetQueue:moduleQueue]; + * } + * + * Note: This workaround is ONLY needed if you intend to execute code directly on the ipQueue or moduleQueue. + * This is often NOT the case, as such queues are used solely for execution shaping. +**/ +- (void)markSocketQueueTargetQueue:(dispatch_queue_t)socketQueuesPreConfiguredTargetQueue; +- (void)unmarkSocketQueueTargetQueue:(dispatch_queue_t)socketQueuesPreviouslyConfiguredTargetQueue; + +/** + * It's not thread-safe to access certain variables from outside the socket's internal queue. + * + * For example, the socket file descriptor. + * File descriptors are simply integers which reference an index in the per-process file table. + * However, when one requests a new file descriptor (by opening a file or socket), + * the file descriptor returned is guaranteed to be the lowest numbered unused descriptor. + * So if we're not careful, the following could be possible: + * + * - Thread A invokes a method which returns the socket's file descriptor. + * - The socket is closed via the socket's internal queue on thread B. + * - Thread C opens a file, and subsequently receives the file descriptor that was previously the socket's FD. + * - Thread A is now accessing/altering the file instead of the socket. + * + * In addition to this, other variables are not actually objects, + * and thus cannot be retained/released or even autoreleased. + * An example is the sslContext, of type SSLContextRef, which is actually a malloc'd struct. + * + * Although there are internal variables that make it difficult to maintain thread-safety, + * it is important to provide access to these variables + * to ensure this class can be used in a wide array of environments. + * This method helps to accomplish this by invoking the current block on the socket's internal queue. + * The methods below can be invoked from within the block to access + * those generally thread-unsafe internal variables in a thread-safe manner. + * The given block will be invoked synchronously on the socket's internal queue. + * + * If you save references to any protected variables and use them outside the block, you do so at your own peril. +**/ +- (void)performBlock:(dispatch_block_t)block; + +/** + * These methods are only available from within the context of a performBlock: invocation. + * See the documentation for the performBlock: method above. + * + * Provides access to the socket's file descriptor(s). + * If the socket is a server socket (is accepting incoming connections), + * it might actually have multiple internal socket file descriptors - one for IPv4 and one for IPv6. +**/ +- (int)socketFD; +- (int)socket4FD; +- (int)socket6FD; + +#if TARGET_OS_IPHONE + +/** + * These methods are only available from within the context of a performBlock: invocation. + * See the documentation for the performBlock: method above. + * + * Provides access to the socket's internal CFReadStream/CFWriteStream. + * + * These streams are only used as workarounds for specific iOS shortcomings: + * + * - Apple has decided to keep the SecureTransport framework private is iOS. + * This means the only supplied way to do SSL/TLS is via CFStream or some other API layered on top of it. + * Thus, in order to provide SSL/TLS support on iOS we are forced to rely on CFStream, + * instead of the preferred and faster and more powerful SecureTransport. + * + * - If a socket doesn't have backgrounding enabled, and that socket is closed while the app is backgrounded, + * Apple only bothers to notify us via the CFStream API. + * The faster and more powerful GCD API isn't notified properly in this case. + * + * See also: (BOOL)enableBackgroundingOnSocket +**/ +- (nullable CFReadStreamRef)readStream; +- (nullable CFWriteStreamRef)writeStream; + +/** + * This method is only available from within the context of a performBlock: invocation. + * See the documentation for the performBlock: method above. + * + * Configures the socket to allow it to operate when the iOS application has been backgrounded. + * In other words, this method creates a read & write stream, and invokes: + * + * CFReadStreamSetProperty(readStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); + * CFWriteStreamSetProperty(writeStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); + * + * Returns YES if successful, NO otherwise. + * + * Note: Apple does not officially support backgrounding server sockets. + * That is, if your socket is accepting incoming connections, Apple does not officially support + * allowing iOS applications to accept incoming connections while an app is backgrounded. + * + * Example usage: + * + * - (void)socket:(GCDAsyncSocket *)sock didConnectToHost:(NSString *)host port:(uint16_t)port + * { + * [asyncSocket performBlock:^{ + * [asyncSocket enableBackgroundingOnSocket]; + * }]; + * } +**/ +- (BOOL)enableBackgroundingOnSocket; + +#endif + +/** + * This method is only available from within the context of a performBlock: invocation. + * See the documentation for the performBlock: method above. + * + * Provides access to the socket's SSLContext, if SSL/TLS has been started on the socket. +**/ +- (nullable SSLContextRef)sslContext; + +#pragma mark Utilities + +/** + * The address lookup utility used by the class. + * This method is synchronous, so it's recommended you use it on a background thread/queue. + * + * The special strings "localhost" and "loopback" return the loopback address for IPv4 and IPv6. + * + * @returns + * A mutable array with all IPv4 and IPv6 addresses returned by getaddrinfo. + * The addresses are specifically for TCP connections. + * You can filter the addresses, if needed, using the other utility methods provided by the class. +**/ ++ (nullable NSMutableArray *)lookupHost:(NSString *)host port:(uint16_t)port error:(NSError **)errPtr; + +/** + * Extracting host and port information from raw address data. +**/ + ++ (nullable NSString *)hostFromAddress:(NSData *)address; ++ (uint16_t)portFromAddress:(NSData *)address; + ++ (BOOL)isIPv4Address:(NSData *)address; ++ (BOOL)isIPv6Address:(NSData *)address; + ++ (BOOL)getHost:( NSString * __nullable * __nullable)hostPtr port:(nullable uint16_t *)portPtr fromAddress:(NSData *)address; + ++ (BOOL)getHost:(NSString * __nullable * __nullable)hostPtr port:(nullable uint16_t *)portPtr family:(nullable sa_family_t *)afPtr fromAddress:(NSData *)address; + +/** + * A few common line separators, for use with the readDataToData:... methods. +**/ ++ (NSData *)CRLFData; // 0x0D0A ++ (NSData *)CRData; // 0x0D ++ (NSData *)LFData; // 0x0A ++ (NSData *)ZeroData; // 0x00 + +@end + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +@protocol GCDAsyncSocketDelegate +@optional + +/** + * This method is called immediately prior to socket:didAcceptNewSocket:. + * It optionally allows a listening socket to specify the socketQueue for a new accepted socket. + * If this method is not implemented, or returns NULL, the new accepted socket will create its own default queue. + * + * Since you cannot autorelease a dispatch_queue, + * this method uses the "new" prefix in its name to specify that the returned queue has been retained. + * + * Thus you could do something like this in the implementation: + * return dispatch_queue_create("MyQueue", NULL); + * + * If you are placing multiple sockets on the same queue, + * then care should be taken to increment the retain count each time this method is invoked. + * + * For example, your implementation might look something like this: + * dispatch_retain(myExistingQueue); + * return myExistingQueue; +**/ +- (nullable dispatch_queue_t)newSocketQueueForConnectionFromAddress:(NSData *)address onSocket:(GCDAsyncSocket *)sock; + +/** + * Called when a socket accepts a connection. + * Another socket is automatically spawned to handle it. + * + * You must retain the newSocket if you wish to handle the connection. + * Otherwise the newSocket instance will be released and the spawned connection will be closed. + * + * By default the new socket will have the same delegate and delegateQueue. + * You may, of course, change this at any time. +**/ +- (void)socket:(GCDAsyncSocket *)sock didAcceptNewSocket:(GCDAsyncSocket *)newSocket; + +/** + * Called when a socket connects and is ready for reading and writing. + * The host parameter will be an IP address, not a DNS name. +**/ +- (void)socket:(GCDAsyncSocket *)sock didConnectToHost:(NSString *)host port:(uint16_t)port; + +/** + * Called when a socket connects and is ready for reading and writing. + * The host parameter will be an IP address, not a DNS name. + **/ +- (void)socket:(GCDAsyncSocket *)sock didConnectToUrl:(NSURL *)url; + +/** + * Called when a socket has completed reading the requested data into memory. + * Not called if there is an error. +**/ +- (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag; + +/** + * Called when a socket has read in data, but has not yet completed the read. + * This would occur if using readToData: or readToLength: methods. + * It may be used for things such as updating progress bars. +**/ +- (void)socket:(GCDAsyncSocket *)sock didReadPartialDataOfLength:(NSUInteger)partialLength tag:(long)tag; + +/** + * Called when a socket has completed writing the requested data. Not called if there is an error. +**/ +- (void)socket:(GCDAsyncSocket *)sock didWriteDataWithTag:(long)tag; + +/** + * Called when a socket has written some data, but has not yet completed the entire write. + * It may be used for things such as updating progress bars. +**/ +- (void)socket:(GCDAsyncSocket *)sock didWritePartialDataOfLength:(NSUInteger)partialLength tag:(long)tag; + +/** + * Called if a read operation has reached its timeout without completing. + * This method allows you to optionally extend the timeout. + * If you return a positive time interval (> 0) the read's timeout will be extended by the given amount. + * If you don't implement this method, or return a non-positive time interval (<= 0) the read will timeout as usual. + * + * The elapsed parameter is the sum of the original timeout, plus any additions previously added via this method. + * The length parameter is the number of bytes that have been read so far for the read operation. + * + * Note that this method may be called multiple times for a single read if you return positive numbers. +**/ +- (NSTimeInterval)socket:(GCDAsyncSocket *)sock shouldTimeoutReadWithTag:(long)tag + elapsed:(NSTimeInterval)elapsed + bytesDone:(NSUInteger)length; + +/** + * Called if a write operation has reached its timeout without completing. + * This method allows you to optionally extend the timeout. + * If you return a positive time interval (> 0) the write's timeout will be extended by the given amount. + * If you don't implement this method, or return a non-positive time interval (<= 0) the write will timeout as usual. + * + * The elapsed parameter is the sum of the original timeout, plus any additions previously added via this method. + * The length parameter is the number of bytes that have been written so far for the write operation. + * + * Note that this method may be called multiple times for a single write if you return positive numbers. +**/ +- (NSTimeInterval)socket:(GCDAsyncSocket *)sock shouldTimeoutWriteWithTag:(long)tag + elapsed:(NSTimeInterval)elapsed + bytesDone:(NSUInteger)length; + +/** + * Conditionally called if the read stream closes, but the write stream may still be writeable. + * + * This delegate method is only called if autoDisconnectOnClosedReadStream has been set to NO. + * See the discussion on the autoDisconnectOnClosedReadStream method for more information. +**/ +- (void)socketDidCloseReadStream:(GCDAsyncSocket *)sock; + +/** + * Called when a socket disconnects with or without error. + * + * If you call the disconnect method, and the socket wasn't already disconnected, + * then an invocation of this delegate method will be enqueued on the delegateQueue + * before the disconnect method returns. + * + * Note: If the GCDAsyncSocket instance is deallocated while it is still connected, + * and the delegate is not also deallocated, then this method will be invoked, + * but the sock parameter will be nil. (It must necessarily be nil since it is no longer available.) + * This is a generally rare, but is possible if one writes code like this: + * + * asyncSocket = nil; // I'm implicitly disconnecting the socket + * + * In this case it may preferrable to nil the delegate beforehand, like this: + * + * asyncSocket.delegate = nil; // Don't invoke my delegate method + * asyncSocket = nil; // I'm implicitly disconnecting the socket + * + * Of course, this depends on how your state machine is configured. +**/ +- (void)socketDidDisconnect:(GCDAsyncSocket *)sock withError:(nullable NSError *)err; + +/** + * Called after the socket has successfully completed SSL/TLS negotiation. + * This method is not called unless you use the provided startTLS method. + * + * If a SSL/TLS negotiation fails (invalid certificate, etc) then the socket will immediately close, + * and the socketDidDisconnect:withError: delegate method will be called with the specific SSL error code. +**/ +- (void)socketDidSecure:(GCDAsyncSocket *)sock; + +/** + * Allows a socket delegate to hook into the TLS handshake and manually validate the peer it's connecting to. + * + * This is only called if startTLS is invoked with options that include: + * - GCDAsyncSocketManuallyEvaluateTrust == YES + * + * Typically the delegate will use SecTrustEvaluate (and related functions) to properly validate the peer. + * + * Note from Apple's documentation: + * Because [SecTrustEvaluate] might look on the network for certificates in the certificate chain, + * [it] might block while attempting network access. You should never call it from your main thread; + * call it only from within a function running on a dispatch queue or on a separate thread. + * + * Thus this method uses a completionHandler block rather than a normal return value. + * The completionHandler block is thread-safe, and may be invoked from a background queue/thread. + * It is safe to invoke the completionHandler block even if the socket has been closed. +**/ +- (void)socket:(GCDAsyncSocket *)sock didReceiveTrust:(SecTrustRef)trust + completionHandler:(void (^)(BOOL shouldTrustPeer))completionHandler; + +@end +NS_ASSUME_NONNULL_END diff --git a/CommandPost Workflow Extension/Extras/CommandPost.entitlements b/CommandPost Workflow Extension/Extras/CommandPost.entitlements new file mode 100644 index 000000000..5a48de899 --- /dev/null +++ b/CommandPost Workflow Extension/Extras/CommandPost.entitlements @@ -0,0 +1,27 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.automation.apple-events + + com.apple.security.cs.disable-library-validation + + com.apple.security.network.client + + com.apple.security.network.server + + com.apple.security.scripting-targets + + com.apple.FinalCut + + com.apple.FinalCut.library.inspection + + com.apple.FinalCutTrial + + com.apple.FinalCut.library.inspection + + + + diff --git a/CommandPost Workflow Extension/Extras/Info.plist b/CommandPost Workflow Extension/Extras/Info.plist new file mode 100644 index 000000000..6eec6ec53 --- /dev/null +++ b/CommandPost Workflow Extension/Extras/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleIconFile + ExtensionIcon + NSExtension + + NSExtensionPointIdentifier + com.apple.FinalCut.WorkflowExtension + ProExtensionAttributes + + ContentViewMinimumHeight + 0 + ContentViewMinimumWidth + 0 + + ProExtensionPrincipalViewControllerClass + CommandPostViewController + + + diff --git a/CommandPost Workflow Extension/GCDAsyncSocket.m b/CommandPost Workflow Extension/GCDAsyncSocket.m new file mode 100755 index 000000000..1769f7a47 --- /dev/null +++ b/CommandPost Workflow Extension/GCDAsyncSocket.m @@ -0,0 +1,8529 @@ +// +// GCDAsyncSocket.m +// +// This class is in the public domain. +// Originally created by Robbie Hanson in Q4 2010. +// Updated and maintained by Deusty LLC and the Apple development community. +// +// https://github.com/robbiehanson/CocoaAsyncSocket +// + +#import "GCDAsyncSocket.h" + +#if TARGET_OS_IPHONE +#import +#endif + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +#if ! __has_feature(objc_arc) +#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). +// For more information see: https://github.com/robbiehanson/CocoaAsyncSocket/wiki/ARC +#endif + + +#ifndef GCDAsyncSocketLoggingEnabled +#define GCDAsyncSocketLoggingEnabled 0 +#endif + +#if GCDAsyncSocketLoggingEnabled + +// Logging Enabled - See log level below + +// Logging uses the CocoaLumberjack framework (which is also GCD based). +// https://github.com/robbiehanson/CocoaLumberjack +// +// It allows us to do a lot of logging without significantly slowing down the code. +#import "DDLog.h" + +#define LogAsync YES +#define LogContext GCDAsyncSocketLoggingContext + +#define LogObjc(flg, frmt, ...) LOG_OBJC_MAYBE(LogAsync, logLevel, flg, LogContext, frmt, ##__VA_ARGS__) +#define LogC(flg, frmt, ...) LOG_C_MAYBE(LogAsync, logLevel, flg, LogContext, frmt, ##__VA_ARGS__) + +#define LogError(frmt, ...) LogObjc(LOG_FLAG_ERROR, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) +#define LogWarn(frmt, ...) LogObjc(LOG_FLAG_WARN, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) +#define LogInfo(frmt, ...) LogObjc(LOG_FLAG_INFO, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) +#define LogVerbose(frmt, ...) LogObjc(LOG_FLAG_VERBOSE, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) + +#define LogCError(frmt, ...) LogC(LOG_FLAG_ERROR, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) +#define LogCWarn(frmt, ...) LogC(LOG_FLAG_WARN, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) +#define LogCInfo(frmt, ...) LogC(LOG_FLAG_INFO, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) +#define LogCVerbose(frmt, ...) LogC(LOG_FLAG_VERBOSE, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) + +#define LogTrace() LogObjc(LOG_FLAG_VERBOSE, @"%@: %@", THIS_FILE, THIS_METHOD) +#define LogCTrace() LogC(LOG_FLAG_VERBOSE, @"%@: %s", THIS_FILE, __FUNCTION__) + +#ifndef GCDAsyncSocketLogLevel +#define GCDAsyncSocketLogLevel LOG_LEVEL_VERBOSE +#endif + +// Log levels : off, error, warn, info, verbose +static const int logLevel = GCDAsyncSocketLogLevel; + +#else + +// Logging Disabled + +#define LogError(frmt, ...) {} +#define LogWarn(frmt, ...) {} +#define LogInfo(frmt, ...) {} +#define LogVerbose(frmt, ...) {} + +#define LogCError(frmt, ...) {} +#define LogCWarn(frmt, ...) {} +#define LogCInfo(frmt, ...) {} +#define LogCVerbose(frmt, ...) {} + +#define LogTrace() {} +#define LogCTrace(frmt, ...) {} + +#endif + +/** + * Seeing a return statements within an inner block + * can sometimes be mistaken for a return point of the enclosing method. + * This makes inline blocks a bit easier to read. +**/ +#define return_from_block return + +/** + * A socket file descriptor is really just an integer. + * It represents the index of the socket within the kernel. + * This makes invalid file descriptor comparisons easier to read. +**/ +#define SOCKET_NULL -1 + + +NSString *const GCDAsyncSocketException = @"GCDAsyncSocketException"; +NSString *const GCDAsyncSocketErrorDomain = @"GCDAsyncSocketErrorDomain"; + +NSString *const GCDAsyncSocketQueueName = @"GCDAsyncSocket"; +NSString *const GCDAsyncSocketThreadName = @"GCDAsyncSocket-CFStream"; + +NSString *const GCDAsyncSocketManuallyEvaluateTrust = @"GCDAsyncSocketManuallyEvaluateTrust"; +#if TARGET_OS_IPHONE +NSString *const GCDAsyncSocketUseCFStreamForTLS = @"GCDAsyncSocketUseCFStreamForTLS"; +#endif +NSString *const GCDAsyncSocketSSLPeerID = @"GCDAsyncSocketSSLPeerID"; +NSString *const GCDAsyncSocketSSLProtocolVersionMin = @"GCDAsyncSocketSSLProtocolVersionMin"; +NSString *const GCDAsyncSocketSSLProtocolVersionMax = @"GCDAsyncSocketSSLProtocolVersionMax"; +NSString *const GCDAsyncSocketSSLSessionOptionFalseStart = @"GCDAsyncSocketSSLSessionOptionFalseStart"; +NSString *const GCDAsyncSocketSSLSessionOptionSendOneByteRecord = @"GCDAsyncSocketSSLSessionOptionSendOneByteRecord"; +NSString *const GCDAsyncSocketSSLCipherSuites = @"GCDAsyncSocketSSLCipherSuites"; +NSString *const GCDAsyncSocketSSLALPN = @"GCDAsyncSocketSSLALPN"; +#if !TARGET_OS_IPHONE +NSString *const GCDAsyncSocketSSLDiffieHellmanParameters = @"GCDAsyncSocketSSLDiffieHellmanParameters"; +#endif + +enum GCDAsyncSocketFlags +{ + kSocketStarted = 1 << 0, // If set, socket has been started (accepting/connecting) + kConnected = 1 << 1, // If set, the socket is connected + kForbidReadsWrites = 1 << 2, // If set, no new reads or writes are allowed + kReadsPaused = 1 << 3, // If set, reads are paused due to possible timeout + kWritesPaused = 1 << 4, // If set, writes are paused due to possible timeout + kDisconnectAfterReads = 1 << 5, // If set, disconnect after no more reads are queued + kDisconnectAfterWrites = 1 << 6, // If set, disconnect after no more writes are queued + kSocketCanAcceptBytes = 1 << 7, // If set, we know socket can accept bytes. If unset, it's unknown. + kReadSourceSuspended = 1 << 8, // If set, the read source is suspended + kWriteSourceSuspended = 1 << 9, // If set, the write source is suspended + kQueuedTLS = 1 << 10, // If set, we've queued an upgrade to TLS + kStartingReadTLS = 1 << 11, // If set, we're waiting for TLS negotiation to complete + kStartingWriteTLS = 1 << 12, // If set, we're waiting for TLS negotiation to complete + kSocketSecure = 1 << 13, // If set, socket is using secure communication via SSL/TLS + kSocketHasReadEOF = 1 << 14, // If set, we have read EOF from socket + kReadStreamClosed = 1 << 15, // If set, we've read EOF plus prebuffer has been drained + kDealloc = 1 << 16, // If set, the socket is being deallocated +#if TARGET_OS_IPHONE + kAddedStreamsToRunLoop = 1 << 17, // If set, CFStreams have been added to listener thread + kUsingCFStreamForTLS = 1 << 18, // If set, we're forced to use CFStream instead of SecureTransport + kSecureSocketHasBytesAvailable = 1 << 19, // If set, CFReadStream has notified us of bytes available +#endif +}; + +enum GCDAsyncSocketConfig +{ + kIPv4Disabled = 1 << 0, // If set, IPv4 is disabled + kIPv6Disabled = 1 << 1, // If set, IPv6 is disabled + kPreferIPv6 = 1 << 2, // If set, IPv6 is preferred over IPv4 + kAllowHalfDuplexConnection = 1 << 3, // If set, the socket will stay open even if the read stream closes +}; + +#if TARGET_OS_IPHONE + static NSThread *cfstreamThread; // Used for CFStreams + + + static uint64_t cfstreamThreadRetainCount; // setup & teardown + static dispatch_queue_t cfstreamThreadSetupQueue; // setup & teardown +#endif + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * A PreBuffer is used when there is more data available on the socket + * than is being requested by current read request. + * In this case we slurp up all data from the socket (to minimize sys calls), + * and store additional yet unread data in a "prebuffer". + * + * The prebuffer is entirely drained before we read from the socket again. + * In other words, a large chunk of data is written is written to the prebuffer. + * The prebuffer is then drained via a series of one or more reads (for subsequent read request(s)). + * + * A ring buffer was once used for this purpose. + * But a ring buffer takes up twice as much memory as needed (double the size for mirroring). + * In fact, it generally takes up more than twice the needed size as everything has to be rounded up to vm_page_size. + * And since the prebuffer is always completely drained after being written to, a full ring buffer isn't needed. + * + * The current design is very simple and straight-forward, while also keeping memory requirements lower. +**/ + +@interface GCDAsyncSocketPreBuffer : NSObject +{ + uint8_t *preBuffer; + size_t preBufferSize; + + uint8_t *readPointer; + uint8_t *writePointer; +} + +- (instancetype)initWithCapacity:(size_t)numBytes NS_DESIGNATED_INITIALIZER; + +- (void)ensureCapacityForWrite:(size_t)numBytes; + +- (size_t)availableBytes; +- (uint8_t *)readBuffer; + +- (void)getReadBuffer:(uint8_t **)bufferPtr availableBytes:(size_t *)availableBytesPtr; + +- (size_t)availableSpace; +- (uint8_t *)writeBuffer; + +- (void)getWriteBuffer:(uint8_t **)bufferPtr availableSpace:(size_t *)availableSpacePtr; + +- (void)didRead:(size_t)bytesRead; +- (void)didWrite:(size_t)bytesWritten; + +- (void)reset; + +@end + +@implementation GCDAsyncSocketPreBuffer + +// Cover the superclass' designated initializer +- (instancetype)init NS_UNAVAILABLE +{ + NSAssert(0, @"Use the designated initializer"); + return nil; +} + +- (instancetype)initWithCapacity:(size_t)numBytes +{ + if ((self = [super init])) + { + preBufferSize = numBytes; + preBuffer = malloc(preBufferSize); + + readPointer = preBuffer; + writePointer = preBuffer; + } + return self; +} + +- (void)dealloc +{ + if (preBuffer) + free(preBuffer); +} + +- (void)ensureCapacityForWrite:(size_t)numBytes +{ + size_t availableSpace = [self availableSpace]; + + if (numBytes > availableSpace) + { + size_t additionalBytes = numBytes - availableSpace; + + size_t newPreBufferSize = preBufferSize + additionalBytes; + uint8_t *newPreBuffer = realloc(preBuffer, newPreBufferSize); + + size_t readPointerOffset = readPointer - preBuffer; + size_t writePointerOffset = writePointer - preBuffer; + + preBuffer = newPreBuffer; + preBufferSize = newPreBufferSize; + + readPointer = preBuffer + readPointerOffset; + writePointer = preBuffer + writePointerOffset; + } +} + +- (size_t)availableBytes +{ + return writePointer - readPointer; +} + +- (uint8_t *)readBuffer +{ + return readPointer; +} + +- (void)getReadBuffer:(uint8_t **)bufferPtr availableBytes:(size_t *)availableBytesPtr +{ + if (bufferPtr) *bufferPtr = readPointer; + if (availableBytesPtr) *availableBytesPtr = [self availableBytes]; +} + +- (void)didRead:(size_t)bytesRead +{ + readPointer += bytesRead; + + if (readPointer == writePointer) + { + // The prebuffer has been drained. Reset pointers. + readPointer = preBuffer; + writePointer = preBuffer; + } +} + +- (size_t)availableSpace +{ + return preBufferSize - (writePointer - preBuffer); +} + +- (uint8_t *)writeBuffer +{ + return writePointer; +} + +- (void)getWriteBuffer:(uint8_t **)bufferPtr availableSpace:(size_t *)availableSpacePtr +{ + if (bufferPtr) *bufferPtr = writePointer; + if (availableSpacePtr) *availableSpacePtr = [self availableSpace]; +} + +- (void)didWrite:(size_t)bytesWritten +{ + writePointer += bytesWritten; +} + +- (void)reset +{ + readPointer = preBuffer; + writePointer = preBuffer; +} + +@end + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * The GCDAsyncReadPacket encompasses the instructions for any given read. + * The content of a read packet allows the code to determine if we're: + * - reading to a certain length + * - reading to a certain separator + * - or simply reading the first chunk of available data +**/ +@interface GCDAsyncReadPacket : NSObject +{ + @public + NSMutableData *buffer; + NSUInteger startOffset; + NSUInteger bytesDone; + NSUInteger maxLength; + NSTimeInterval timeout; + NSUInteger readLength; + NSData *term; + BOOL bufferOwner; + NSUInteger originalBufferLength; + long tag; +} +- (instancetype)initWithData:(NSMutableData *)d + startOffset:(NSUInteger)s + maxLength:(NSUInteger)m + timeout:(NSTimeInterval)t + readLength:(NSUInteger)l + terminator:(NSData *)e + tag:(long)i NS_DESIGNATED_INITIALIZER; + +- (void)ensureCapacityForAdditionalDataOfLength:(NSUInteger)bytesToRead; + +- (NSUInteger)optimalReadLengthWithDefault:(NSUInteger)defaultValue shouldPreBuffer:(BOOL *)shouldPreBufferPtr; + +- (NSUInteger)readLengthForNonTermWithHint:(NSUInteger)bytesAvailable; +- (NSUInteger)readLengthForTermWithHint:(NSUInteger)bytesAvailable shouldPreBuffer:(BOOL *)shouldPreBufferPtr; +- (NSUInteger)readLengthForTermWithPreBuffer:(GCDAsyncSocketPreBuffer *)preBuffer found:(BOOL *)foundPtr; + +- (NSInteger)searchForTermAfterPreBuffering:(ssize_t)numBytes; + +@end + +@implementation GCDAsyncReadPacket + +// Cover the superclass' designated initializer +- (instancetype)init NS_UNAVAILABLE +{ + NSAssert(0, @"Use the designated initializer"); + return nil; +} + +- (instancetype)initWithData:(NSMutableData *)d + startOffset:(NSUInteger)s + maxLength:(NSUInteger)m + timeout:(NSTimeInterval)t + readLength:(NSUInteger)l + terminator:(NSData *)e + tag:(long)i +{ + if((self = [super init])) + { + bytesDone = 0; + maxLength = m; + timeout = t; + readLength = l; + term = [e copy]; + tag = i; + + if (d) + { + buffer = d; + startOffset = s; + bufferOwner = NO; + originalBufferLength = [d length]; + } + else + { + if (readLength > 0) + buffer = [[NSMutableData alloc] initWithLength:readLength]; + else + buffer = [[NSMutableData alloc] initWithLength:0]; + + startOffset = 0; + bufferOwner = YES; + originalBufferLength = 0; + } + } + return self; +} + +/** + * Increases the length of the buffer (if needed) to ensure a read of the given size will fit. +**/ +- (void)ensureCapacityForAdditionalDataOfLength:(NSUInteger)bytesToRead +{ + NSUInteger buffSize = [buffer length]; + NSUInteger buffUsed = startOffset + bytesDone; + + NSUInteger buffSpace = buffSize - buffUsed; + + if (bytesToRead > buffSpace) + { + NSUInteger buffInc = bytesToRead - buffSpace; + + [buffer increaseLengthBy:buffInc]; + } +} + +/** + * This method is used when we do NOT know how much data is available to be read from the socket. + * This method returns the default value unless it exceeds the specified readLength or maxLength. + * + * Furthermore, the shouldPreBuffer decision is based upon the packet type, + * and whether the returned value would fit in the current buffer without requiring a resize of the buffer. +**/ +- (NSUInteger)optimalReadLengthWithDefault:(NSUInteger)defaultValue shouldPreBuffer:(BOOL *)shouldPreBufferPtr +{ + NSUInteger result; + + if (readLength > 0) + { + // Read a specific length of data + result = readLength - bytesDone; + + // There is no need to prebuffer since we know exactly how much data we need to read. + // Even if the buffer isn't currently big enough to fit this amount of data, + // it would have to be resized eventually anyway. + + if (shouldPreBufferPtr) + *shouldPreBufferPtr = NO; + } + else + { + // Either reading until we find a specified terminator, + // or we're simply reading all available data. + // + // In other words, one of: + // + // - readDataToData packet + // - readDataWithTimeout packet + + if (maxLength > 0) + result = MIN(defaultValue, (maxLength - bytesDone)); + else + result = defaultValue; + + // Since we don't know the size of the read in advance, + // the shouldPreBuffer decision is based upon whether the returned value would fit + // in the current buffer without requiring a resize of the buffer. + // + // This is because, in all likelyhood, the amount read from the socket will be less than the default value. + // Thus we should avoid over-allocating the read buffer when we can simply use the pre-buffer instead. + + if (shouldPreBufferPtr) + { + NSUInteger buffSize = [buffer length]; + NSUInteger buffUsed = startOffset + bytesDone; + + NSUInteger buffSpace = buffSize - buffUsed; + + if (buffSpace >= result) + *shouldPreBufferPtr = NO; + else + *shouldPreBufferPtr = YES; + } + } + + return result; +} + +/** + * For read packets without a set terminator, returns the amount of data + * that can be read without exceeding the readLength or maxLength. + * + * The given parameter indicates the number of bytes estimated to be available on the socket, + * which is taken into consideration during the calculation. + * + * The given hint MUST be greater than zero. +**/ +- (NSUInteger)readLengthForNonTermWithHint:(NSUInteger)bytesAvailable +{ + NSAssert(term == nil, @"This method does not apply to term reads"); + NSAssert(bytesAvailable > 0, @"Invalid parameter: bytesAvailable"); + + if (readLength > 0) + { + // Read a specific length of data + + return MIN(bytesAvailable, (readLength - bytesDone)); + + // No need to avoid resizing the buffer. + // If the user provided their own buffer, + // and told us to read a certain length of data that exceeds the size of the buffer, + // then it is clear that our code will resize the buffer during the read operation. + // + // This method does not actually do any resizing. + // The resizing will happen elsewhere if needed. + } + else + { + // Read all available data + + NSUInteger result = bytesAvailable; + + if (maxLength > 0) + { + result = MIN(result, (maxLength - bytesDone)); + } + + // No need to avoid resizing the buffer. + // If the user provided their own buffer, + // and told us to read all available data without giving us a maxLength, + // then it is clear that our code might resize the buffer during the read operation. + // + // This method does not actually do any resizing. + // The resizing will happen elsewhere if needed. + + return result; + } +} + +/** + * For read packets with a set terminator, returns the amount of data + * that can be read without exceeding the maxLength. + * + * The given parameter indicates the number of bytes estimated to be available on the socket, + * which is taken into consideration during the calculation. + * + * To optimize memory allocations, mem copies, and mem moves + * the shouldPreBuffer boolean value will indicate if the data should be read into a prebuffer first, + * or if the data can be read directly into the read packet's buffer. +**/ +- (NSUInteger)readLengthForTermWithHint:(NSUInteger)bytesAvailable shouldPreBuffer:(BOOL *)shouldPreBufferPtr +{ + NSAssert(term != nil, @"This method does not apply to non-term reads"); + NSAssert(bytesAvailable > 0, @"Invalid parameter: bytesAvailable"); + + + NSUInteger result = bytesAvailable; + + if (maxLength > 0) + { + result = MIN(result, (maxLength - bytesDone)); + } + + // Should the data be read into the read packet's buffer, or into a pre-buffer first? + // + // One would imagine the preferred option is the faster one. + // So which one is faster? + // + // Reading directly into the packet's buffer requires: + // 1. Possibly resizing packet buffer (malloc/realloc) + // 2. Filling buffer (read) + // 3. Searching for term (memcmp) + // 4. Possibly copying overflow into prebuffer (malloc/realloc, memcpy) + // + // Reading into prebuffer first: + // 1. Possibly resizing prebuffer (malloc/realloc) + // 2. Filling buffer (read) + // 3. Searching for term (memcmp) + // 4. Copying underflow into packet buffer (malloc/realloc, memcpy) + // 5. Removing underflow from prebuffer (memmove) + // + // Comparing the performance of the two we can see that reading + // data into the prebuffer first is slower due to the extra memove. + // + // However: + // The implementation of NSMutableData is open source via core foundation's CFMutableData. + // Decreasing the length of a mutable data object doesn't cause a realloc. + // In other words, the capacity of a mutable data object can grow, but doesn't shrink. + // + // This means the prebuffer will rarely need a realloc. + // The packet buffer, on the other hand, may often need a realloc. + // This is especially true if we are the buffer owner. + // Furthermore, if we are constantly realloc'ing the packet buffer, + // and then moving the overflow into the prebuffer, + // then we're consistently over-allocating memory for each term read. + // And now we get into a bit of a tradeoff between speed and memory utilization. + // + // The end result is that the two perform very similarly. + // And we can answer the original question very simply by another means. + // + // If we can read all the data directly into the packet's buffer without resizing it first, + // then we do so. Otherwise we use the prebuffer. + + if (shouldPreBufferPtr) + { + NSUInteger buffSize = [buffer length]; + NSUInteger buffUsed = startOffset + bytesDone; + + if ((buffSize - buffUsed) >= result) + *shouldPreBufferPtr = NO; + else + *shouldPreBufferPtr = YES; + } + + return result; +} + +/** + * For read packets with a set terminator, + * returns the amount of data that can be read from the given preBuffer, + * without going over a terminator or the maxLength. + * + * It is assumed the terminator has not already been read. +**/ +- (NSUInteger)readLengthForTermWithPreBuffer:(GCDAsyncSocketPreBuffer *)preBuffer found:(BOOL *)foundPtr +{ + NSAssert(term != nil, @"This method does not apply to non-term reads"); + NSAssert([preBuffer availableBytes] > 0, @"Invoked with empty pre buffer!"); + + // We know that the terminator, as a whole, doesn't exist in our own buffer. + // But it is possible that a _portion_ of it exists in our buffer. + // So we're going to look for the terminator starting with a portion of our own buffer. + // + // Example: + // + // term length = 3 bytes + // bytesDone = 5 bytes + // preBuffer length = 5 bytes + // + // If we append the preBuffer to our buffer, + // it would look like this: + // + // --------------------- + // |B|B|B|B|B|P|P|P|P|P| + // --------------------- + // + // So we start our search here: + // + // --------------------- + // |B|B|B|B|B|P|P|P|P|P| + // -------^-^-^--------- + // + // And move forwards... + // + // --------------------- + // |B|B|B|B|B|P|P|P|P|P| + // ---------^-^-^------- + // + // Until we find the terminator or reach the end. + // + // --------------------- + // |B|B|B|B|B|P|P|P|P|P| + // ---------------^-^-^- + + BOOL found = NO; + + NSUInteger termLength = [term length]; + NSUInteger preBufferLength = [preBuffer availableBytes]; + + if ((bytesDone + preBufferLength) < termLength) + { + // Not enough data for a full term sequence yet + return preBufferLength; + } + + NSUInteger maxPreBufferLength; + if (maxLength > 0) { + maxPreBufferLength = MIN(preBufferLength, (maxLength - bytesDone)); + + // Note: maxLength >= termLength + } + else { + maxPreBufferLength = preBufferLength; + } + + uint8_t seq[termLength]; + const void *termBuf = [term bytes]; + + NSUInteger bufLen = MIN(bytesDone, (termLength - 1)); + uint8_t *buf = (uint8_t *)[buffer mutableBytes] + startOffset + bytesDone - bufLen; + + NSUInteger preLen = termLength - bufLen; + const uint8_t *pre = [preBuffer readBuffer]; + + NSUInteger loopCount = bufLen + maxPreBufferLength - termLength + 1; // Plus one. See example above. + + NSUInteger result = maxPreBufferLength; + + NSUInteger i; + for (i = 0; i < loopCount; i++) + { + if (bufLen > 0) + { + // Combining bytes from buffer and preBuffer + + memcpy(seq, buf, bufLen); + memcpy(seq + bufLen, pre, preLen); + + if (memcmp(seq, termBuf, termLength) == 0) + { + result = preLen; + found = YES; + break; + } + + buf++; + bufLen--; + preLen++; + } + else + { + // Comparing directly from preBuffer + + if (memcmp(pre, termBuf, termLength) == 0) + { + NSUInteger preOffset = pre - [preBuffer readBuffer]; // pointer arithmetic + + result = preOffset + termLength; + found = YES; + break; + } + + pre++; + } + } + + // There is no need to avoid resizing the buffer in this particular situation. + + if (foundPtr) *foundPtr = found; + return result; +} + +/** + * For read packets with a set terminator, scans the packet buffer for the term. + * It is assumed the terminator had not been fully read prior to the new bytes. + * + * If the term is found, the number of excess bytes after the term are returned. + * If the term is not found, this method will return -1. + * + * Note: A return value of zero means the term was found at the very end. + * + * Prerequisites: + * The given number of bytes have been added to the end of our buffer. + * Our bytesDone variable has NOT been changed due to the prebuffered bytes. +**/ +- (NSInteger)searchForTermAfterPreBuffering:(ssize_t)numBytes +{ + NSAssert(term != nil, @"This method does not apply to non-term reads"); + + // The implementation of this method is very similar to the above method. + // See the above method for a discussion of the algorithm used here. + + uint8_t *buff = [buffer mutableBytes]; + NSUInteger buffLength = bytesDone + numBytes; + + const void *termBuff = [term bytes]; + NSUInteger termLength = [term length]; + + // Note: We are dealing with unsigned integers, + // so make sure the math doesn't go below zero. + + NSUInteger i = ((buffLength - numBytes) >= termLength) ? (buffLength - numBytes - termLength + 1) : 0; + + while (i + termLength <= buffLength) + { + uint8_t *subBuffer = buff + startOffset + i; + + if (memcmp(subBuffer, termBuff, termLength) == 0) + { + return buffLength - (i + termLength); + } + + i++; + } + + return -1; +} + + +@end + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * The GCDAsyncWritePacket encompasses the instructions for any given write. +**/ +@interface GCDAsyncWritePacket : NSObject +{ + @public + NSData *buffer; + NSUInteger bytesDone; + long tag; + NSTimeInterval timeout; +} +- (instancetype)initWithData:(NSData *)d timeout:(NSTimeInterval)t tag:(long)i NS_DESIGNATED_INITIALIZER; +@end + +@implementation GCDAsyncWritePacket + +// Cover the superclass' designated initializer +- (instancetype)init NS_UNAVAILABLE +{ + NSAssert(0, @"Use the designated initializer"); + return nil; +} + +- (instancetype)initWithData:(NSData *)d timeout:(NSTimeInterval)t tag:(long)i +{ + if((self = [super init])) + { + buffer = d; // Retain not copy. For performance as documented in header file. + bytesDone = 0; + timeout = t; + tag = i; + } + return self; +} + + +@end + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * The GCDAsyncSpecialPacket encompasses special instructions for interruptions in the read/write queues. + * This class my be altered to support more than just TLS in the future. +**/ +@interface GCDAsyncSpecialPacket : NSObject +{ + @public + NSDictionary *tlsSettings; +} +- (instancetype)initWithTLSSettings:(NSDictionary *)settings NS_DESIGNATED_INITIALIZER; +@end + +@implementation GCDAsyncSpecialPacket + +// Cover the superclass' designated initializer +- (instancetype)init NS_UNAVAILABLE +{ + NSAssert(0, @"Use the designated initializer"); + return nil; +} + +- (instancetype)initWithTLSSettings:(NSDictionary *)settings +{ + if((self = [super init])) + { + tlsSettings = [settings copy]; + } + return self; +} + + +@end + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +@implementation GCDAsyncSocket +{ + uint32_t flags; + uint16_t config; + + __weak id delegate; + dispatch_queue_t delegateQueue; + + int socket4FD; + int socket6FD; + int socketUN; + NSURL *socketUrl; + int stateIndex; + NSData * connectInterface4; + NSData * connectInterface6; + NSData * connectInterfaceUN; + + dispatch_queue_t socketQueue; + + dispatch_source_t accept4Source; + dispatch_source_t accept6Source; + dispatch_source_t acceptUNSource; + dispatch_source_t connectTimer; + dispatch_source_t readSource; + dispatch_source_t writeSource; + dispatch_source_t readTimer; + dispatch_source_t writeTimer; + + NSMutableArray *readQueue; + NSMutableArray *writeQueue; + + GCDAsyncReadPacket *currentRead; + GCDAsyncWritePacket *currentWrite; + + unsigned long socketFDBytesAvailable; + + GCDAsyncSocketPreBuffer *preBuffer; + +#if TARGET_OS_IPHONE + CFStreamClientContext streamContext; + CFReadStreamRef readStream; + CFWriteStreamRef writeStream; +#endif + SSLContextRef sslContext; + GCDAsyncSocketPreBuffer *sslPreBuffer; + size_t sslWriteCachedLength; + OSStatus sslErrCode; + OSStatus lastSSLHandshakeError; + + void *IsOnSocketQueueOrTargetQueueKey; + + id userData; + NSTimeInterval alternateAddressDelay; +} + +- (instancetype)init +{ + return [self initWithDelegate:nil delegateQueue:NULL socketQueue:NULL]; +} + +- (instancetype)initWithSocketQueue:(dispatch_queue_t)sq +{ + return [self initWithDelegate:nil delegateQueue:NULL socketQueue:sq]; +} + +- (instancetype)initWithDelegate:(id)aDelegate delegateQueue:(dispatch_queue_t)dq +{ + return [self initWithDelegate:aDelegate delegateQueue:dq socketQueue:NULL]; +} + +- (instancetype)initWithDelegate:(id)aDelegate delegateQueue:(dispatch_queue_t)dq socketQueue:(dispatch_queue_t)sq +{ + if((self = [super init])) + { + delegate = aDelegate; + delegateQueue = dq; + + #if !OS_OBJECT_USE_OBJC + if (dq) dispatch_retain(dq); + #endif + + socket4FD = SOCKET_NULL; + socket6FD = SOCKET_NULL; + socketUN = SOCKET_NULL; + socketUrl = nil; + stateIndex = 0; + + if (sq) + { + NSAssert(sq != dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), + @"The given socketQueue parameter must not be a concurrent queue."); + NSAssert(sq != dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), + @"The given socketQueue parameter must not be a concurrent queue."); + NSAssert(sq != dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), + @"The given socketQueue parameter must not be a concurrent queue."); + + socketQueue = sq; + #if !OS_OBJECT_USE_OBJC + dispatch_retain(sq); + #endif + } + else + { + socketQueue = dispatch_queue_create([GCDAsyncSocketQueueName UTF8String], NULL); + } + + // The dispatch_queue_set_specific() and dispatch_get_specific() functions take a "void *key" parameter. + // From the documentation: + // + // > Keys are only compared as pointers and are never dereferenced. + // > Thus, you can use a pointer to a static variable for a specific subsystem or + // > any other value that allows you to identify the value uniquely. + // + // We're just going to use the memory address of an ivar. + // Specifically an ivar that is explicitly named for our purpose to make the code more readable. + // + // However, it feels tedious (and less readable) to include the "&" all the time: + // dispatch_get_specific(&IsOnSocketQueueOrTargetQueueKey) + // + // So we're going to make it so it doesn't matter if we use the '&' or not, + // by assigning the value of the ivar to the address of the ivar. + // Thus: IsOnSocketQueueOrTargetQueueKey == &IsOnSocketQueueOrTargetQueueKey; + + IsOnSocketQueueOrTargetQueueKey = &IsOnSocketQueueOrTargetQueueKey; + + void *nonNullUnusedPointer = (__bridge void *)self; + dispatch_queue_set_specific(socketQueue, IsOnSocketQueueOrTargetQueueKey, nonNullUnusedPointer, NULL); + + readQueue = [[NSMutableArray alloc] initWithCapacity:5]; + currentRead = nil; + + writeQueue = [[NSMutableArray alloc] initWithCapacity:5]; + currentWrite = nil; + + preBuffer = [[GCDAsyncSocketPreBuffer alloc] initWithCapacity:(1024 * 4)]; + alternateAddressDelay = 0.3; + } + return self; +} + +- (void)dealloc +{ + LogInfo(@"%@ - %@ (start)", THIS_METHOD, self); + + // Set dealloc flag. + // This is used by closeWithError to ensure we don't accidentally retain ourself. + flags |= kDealloc; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + [self closeWithError:nil]; + } + else + { + dispatch_sync(socketQueue, ^{ + [self closeWithError:nil]; + }); + } + + delegate = nil; + + #if !OS_OBJECT_USE_OBJC + if (delegateQueue) dispatch_release(delegateQueue); + #endif + delegateQueue = NULL; + + #if !OS_OBJECT_USE_OBJC + if (socketQueue) dispatch_release(socketQueue); + #endif + socketQueue = NULL; + + LogInfo(@"%@ - %@ (finish)", THIS_METHOD, self); +} + +#pragma mark - + ++ (nullable instancetype)socketFromConnectedSocketFD:(int)socketFD socketQueue:(nullable dispatch_queue_t)sq error:(NSError**)error { + return [self socketFromConnectedSocketFD:socketFD delegate:nil delegateQueue:NULL socketQueue:sq error:error]; +} + ++ (nullable instancetype)socketFromConnectedSocketFD:(int)socketFD delegate:(nullable id)aDelegate delegateQueue:(nullable dispatch_queue_t)dq error:(NSError**)error { + return [self socketFromConnectedSocketFD:socketFD delegate:aDelegate delegateQueue:dq socketQueue:NULL error:error]; +} + ++ (nullable instancetype)socketFromConnectedSocketFD:(int)socketFD delegate:(nullable id)aDelegate delegateQueue:(nullable dispatch_queue_t)dq socketQueue:(nullable dispatch_queue_t)sq error:(NSError* __autoreleasing *)error +{ + __block BOOL errorOccured = NO; + __block NSError *thisError = nil; + + GCDAsyncSocket *socket = [[[self class] alloc] initWithDelegate:aDelegate delegateQueue:dq socketQueue:sq]; + + dispatch_sync(socket->socketQueue, ^{ @autoreleasepool { + struct sockaddr addr; + socklen_t addr_size = sizeof(struct sockaddr); + int retVal = getpeername(socketFD, (struct sockaddr *)&addr, &addr_size); + if (retVal) + { + NSString *errMsg = NSLocalizedStringWithDefaultValue(@"GCDAsyncSocketOtherError", + @"GCDAsyncSocket", [NSBundle mainBundle], + @"Attempt to create socket from socket FD failed. getpeername() failed", nil); + + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; + + errorOccured = YES; + thisError = [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketOtherError userInfo:userInfo]; + return; + } + + if (addr.sa_family == AF_INET) + { + socket->socket4FD = socketFD; + } + else if (addr.sa_family == AF_INET6) + { + socket->socket6FD = socketFD; + } + else + { + NSString *errMsg = NSLocalizedStringWithDefaultValue(@"GCDAsyncSocketOtherError", + @"GCDAsyncSocket", [NSBundle mainBundle], + @"Attempt to create socket from socket FD failed. socket FD is neither IPv4 nor IPv6", nil); + + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; + + errorOccured = YES; + thisError = [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketOtherError userInfo:userInfo]; + return; + } + + socket->flags = kSocketStarted; + [socket didConnect:socket->stateIndex]; + }}); + + if (error && thisError) { + *error = thisError; + } + + return errorOccured? nil: socket; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Configuration +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +- (id)delegate +{ + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + return delegate; + } + else + { + __block id result; + + dispatch_sync(socketQueue, ^{ + result = self->delegate; + }); + + return result; + } +} + +- (void)setDelegate:(id)newDelegate synchronously:(BOOL)synchronously +{ + dispatch_block_t block = ^{ + self->delegate = newDelegate; + }; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { + block(); + } + else { + if (synchronously) + dispatch_sync(socketQueue, block); + else + dispatch_async(socketQueue, block); + } +} + +- (void)setDelegate:(id)newDelegate +{ + [self setDelegate:newDelegate synchronously:NO]; +} + +- (void)synchronouslySetDelegate:(id)newDelegate +{ + [self setDelegate:newDelegate synchronously:YES]; +} + +- (dispatch_queue_t)delegateQueue +{ + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + return delegateQueue; + } + else + { + __block dispatch_queue_t result; + + dispatch_sync(socketQueue, ^{ + result = self->delegateQueue; + }); + + return result; + } +} + +- (void)setDelegateQueue:(dispatch_queue_t)newDelegateQueue synchronously:(BOOL)synchronously +{ + dispatch_block_t block = ^{ + + #if !OS_OBJECT_USE_OBJC + if (self->delegateQueue) dispatch_release(self->delegateQueue); + if (newDelegateQueue) dispatch_retain(newDelegateQueue); + #endif + + self->delegateQueue = newDelegateQueue; + }; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { + block(); + } + else { + if (synchronously) + dispatch_sync(socketQueue, block); + else + dispatch_async(socketQueue, block); + } +} + +- (void)setDelegateQueue:(dispatch_queue_t)newDelegateQueue +{ + [self setDelegateQueue:newDelegateQueue synchronously:NO]; +} + +- (void)synchronouslySetDelegateQueue:(dispatch_queue_t)newDelegateQueue +{ + [self setDelegateQueue:newDelegateQueue synchronously:YES]; +} + +- (void)getDelegate:(id *)delegatePtr delegateQueue:(dispatch_queue_t *)delegateQueuePtr +{ + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + if (delegatePtr) *delegatePtr = delegate; + if (delegateQueuePtr) *delegateQueuePtr = delegateQueue; + } + else + { + __block id dPtr = NULL; + __block dispatch_queue_t dqPtr = NULL; + + dispatch_sync(socketQueue, ^{ + dPtr = self->delegate; + dqPtr = self->delegateQueue; + }); + + if (delegatePtr) *delegatePtr = dPtr; + if (delegateQueuePtr) *delegateQueuePtr = dqPtr; + } +} + +- (void)setDelegate:(id)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue synchronously:(BOOL)synchronously +{ + dispatch_block_t block = ^{ + + self->delegate = newDelegate; + + #if !OS_OBJECT_USE_OBJC + if (self->delegateQueue) dispatch_release(self->delegateQueue); + if (newDelegateQueue) dispatch_retain(newDelegateQueue); + #endif + + self->delegateQueue = newDelegateQueue; + }; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { + block(); + } + else { + if (synchronously) + dispatch_sync(socketQueue, block); + else + dispatch_async(socketQueue, block); + } +} + +- (void)setDelegate:(id)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue +{ + [self setDelegate:newDelegate delegateQueue:newDelegateQueue synchronously:NO]; +} + +- (void)synchronouslySetDelegate:(id)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue +{ + [self setDelegate:newDelegate delegateQueue:newDelegateQueue synchronously:YES]; +} + +- (BOOL)isIPv4Enabled +{ + // Note: YES means kIPv4Disabled is OFF + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + return ((config & kIPv4Disabled) == 0); + } + else + { + __block BOOL result; + + dispatch_sync(socketQueue, ^{ + result = ((self->config & kIPv4Disabled) == 0); + }); + + return result; + } +} + +- (void)setIPv4Enabled:(BOOL)flag +{ + // Note: YES means kIPv4Disabled is OFF + + dispatch_block_t block = ^{ + + if (flag) + self->config &= ~kIPv4Disabled; + else + self->config |= kIPv4Disabled; + }; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_async(socketQueue, block); +} + +- (BOOL)isIPv6Enabled +{ + // Note: YES means kIPv6Disabled is OFF + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + return ((config & kIPv6Disabled) == 0); + } + else + { + __block BOOL result; + + dispatch_sync(socketQueue, ^{ + result = ((self->config & kIPv6Disabled) == 0); + }); + + return result; + } +} + +- (void)setIPv6Enabled:(BOOL)flag +{ + // Note: YES means kIPv6Disabled is OFF + + dispatch_block_t block = ^{ + + if (flag) + self->config &= ~kIPv6Disabled; + else + self->config |= kIPv6Disabled; + }; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_async(socketQueue, block); +} + +- (BOOL)isIPv4PreferredOverIPv6 +{ + // Note: YES means kPreferIPv6 is OFF + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + return ((config & kPreferIPv6) == 0); + } + else + { + __block BOOL result; + + dispatch_sync(socketQueue, ^{ + result = ((self->config & kPreferIPv6) == 0); + }); + + return result; + } +} + +- (void)setIPv4PreferredOverIPv6:(BOOL)flag +{ + // Note: YES means kPreferIPv6 is OFF + + dispatch_block_t block = ^{ + + if (flag) + self->config &= ~kPreferIPv6; + else + self->config |= kPreferIPv6; + }; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_async(socketQueue, block); +} + +- (NSTimeInterval) alternateAddressDelay { + __block NSTimeInterval delay; + dispatch_block_t block = ^{ + delay = self->alternateAddressDelay; + }; + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_sync(socketQueue, block); + return delay; +} + +- (void) setAlternateAddressDelay:(NSTimeInterval)delay { + dispatch_block_t block = ^{ + self->alternateAddressDelay = delay; + }; + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_async(socketQueue, block); +} + +- (id)userData +{ + __block id result = nil; + + dispatch_block_t block = ^{ + + result = self->userData; + }; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_sync(socketQueue, block); + + return result; +} + +- (void)setUserData:(id)arbitraryUserData +{ + dispatch_block_t block = ^{ + + if (self->userData != arbitraryUserData) + { + self->userData = arbitraryUserData; + } + }; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_async(socketQueue, block); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Accepting +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +- (BOOL)acceptOnPort:(uint16_t)port error:(NSError **)errPtr +{ + return [self acceptOnInterface:nil port:port error:errPtr]; +} + +- (BOOL)acceptOnInterface:(NSString *)inInterface port:(uint16_t)port error:(NSError **)errPtr +{ + LogTrace(); + + // Just in-case interface parameter is immutable. + NSString *interface = [inInterface copy]; + + __block BOOL result = NO; + __block NSError *err = nil; + + // CreateSocket Block + // This block will be invoked within the dispatch block below. + + int(^createSocket)(int, NSData*) = ^int (int domain, NSData *interfaceAddr) { + + int socketFD = socket(domain, SOCK_STREAM, 0); + + if (socketFD == SOCKET_NULL) + { + NSString *reason = @"Error in socket() function"; + err = [self errorWithErrno:errno reason:reason]; + + return SOCKET_NULL; + } + + int status; + + // Set socket options + + status = fcntl(socketFD, F_SETFL, O_NONBLOCK); + if (status == -1) + { + NSString *reason = @"Error enabling non-blocking IO on socket (fcntl)"; + err = [self errorWithErrno:errno reason:reason]; + + LogVerbose(@"close(socketFD)"); + close(socketFD); + return SOCKET_NULL; + } + + int reuseOn = 1; + status = setsockopt(socketFD, SOL_SOCKET, SO_REUSEADDR, &reuseOn, sizeof(reuseOn)); + if (status == -1) + { + NSString *reason = @"Error enabling address reuse (setsockopt)"; + err = [self errorWithErrno:errno reason:reason]; + + LogVerbose(@"close(socketFD)"); + close(socketFD); + return SOCKET_NULL; + } + + // Bind socket + + status = bind(socketFD, (const struct sockaddr *)[interfaceAddr bytes], (socklen_t)[interfaceAddr length]); + if (status == -1) + { + NSString *reason = @"Error in bind() function"; + err = [self errorWithErrno:errno reason:reason]; + + LogVerbose(@"close(socketFD)"); + close(socketFD); + return SOCKET_NULL; + } + + // Listen + + status = listen(socketFD, 1024); + if (status == -1) + { + NSString *reason = @"Error in listen() function"; + err = [self errorWithErrno:errno reason:reason]; + + LogVerbose(@"close(socketFD)"); + close(socketFD); + return SOCKET_NULL; + } + + return socketFD; + }; + + // Create dispatch block and run on socketQueue + + dispatch_block_t block = ^{ @autoreleasepool { + + if (self->delegate == nil) // Must have delegate set + { + NSString *msg = @"Attempting to accept without a delegate. Set a delegate first."; + err = [self badConfigError:msg]; + + return_from_block; + } + + if (self->delegateQueue == NULL) // Must have delegate queue set + { + NSString *msg = @"Attempting to accept without a delegate queue. Set a delegate queue first."; + err = [self badConfigError:msg]; + + return_from_block; + } + + BOOL isIPv4Disabled = (self->config & kIPv4Disabled) ? YES : NO; + BOOL isIPv6Disabled = (self->config & kIPv6Disabled) ? YES : NO; + + if (isIPv4Disabled && isIPv6Disabled) // Must have IPv4 or IPv6 enabled + { + NSString *msg = @"Both IPv4 and IPv6 have been disabled. Must enable at least one protocol first."; + err = [self badConfigError:msg]; + + return_from_block; + } + + if (![self isDisconnected]) // Must be disconnected + { + NSString *msg = @"Attempting to accept while connected or accepting connections. Disconnect first."; + err = [self badConfigError:msg]; + + return_from_block; + } + + // Clear queues (spurious read/write requests post disconnect) + [self->readQueue removeAllObjects]; + [self->writeQueue removeAllObjects]; + + // Resolve interface from description + + NSMutableData *interface4 = nil; + NSMutableData *interface6 = nil; + + [self getInterfaceAddress4:&interface4 address6:&interface6 fromDescription:interface port:port]; + + if ((interface4 == nil) && (interface6 == nil)) + { + NSString *msg = @"Unknown interface. Specify valid interface by name (e.g. \"en1\") or IP address."; + err = [self badParamError:msg]; + + return_from_block; + } + + if (isIPv4Disabled && (interface6 == nil)) + { + NSString *msg = @"IPv4 has been disabled and specified interface doesn't support IPv6."; + err = [self badParamError:msg]; + + return_from_block; + } + + if (isIPv6Disabled && (interface4 == nil)) + { + NSString *msg = @"IPv6 has been disabled and specified interface doesn't support IPv4."; + err = [self badParamError:msg]; + + return_from_block; + } + + BOOL enableIPv4 = !isIPv4Disabled && (interface4 != nil); + BOOL enableIPv6 = !isIPv6Disabled && (interface6 != nil); + + // Create sockets, configure, bind, and listen + + if (enableIPv4) + { + LogVerbose(@"Creating IPv4 socket"); + self->socket4FD = createSocket(AF_INET, interface4); + + if (self->socket4FD == SOCKET_NULL) + { + return_from_block; + } + } + + if (enableIPv6) + { + LogVerbose(@"Creating IPv6 socket"); + + if (enableIPv4 && (port == 0)) + { + // No specific port was specified, so we allowed the OS to pick an available port for us. + // Now we need to make sure the IPv6 socket listens on the same port as the IPv4 socket. + + struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)[interface6 mutableBytes]; + addr6->sin6_port = htons([self localPort4]); + } + + self->socket6FD = createSocket(AF_INET6, interface6); + + if (self->socket6FD == SOCKET_NULL) + { + if (self->socket4FD != SOCKET_NULL) + { + LogVerbose(@"close(socket4FD)"); + close(self->socket4FD); + self->socket4FD = SOCKET_NULL; + } + + return_from_block; + } + } + + // Create accept sources + + if (enableIPv4) + { + self->accept4Source = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, self->socket4FD, 0, self->socketQueue); + + int socketFD = self->socket4FD; + dispatch_source_t acceptSource = self->accept4Source; + + __weak GCDAsyncSocket *weakSelf = self; + + dispatch_source_set_event_handler(self->accept4Source, ^{ @autoreleasepool { + #pragma clang diagnostic push + #pragma clang diagnostic warning "-Wimplicit-retain-self" + + __strong GCDAsyncSocket *strongSelf = weakSelf; + if (strongSelf == nil) return_from_block; + + LogVerbose(@"event4Block"); + + unsigned long i = 0; + unsigned long numPendingConnections = dispatch_source_get_data(acceptSource); + + LogVerbose(@"numPendingConnections: %lu", numPendingConnections); + + while ([strongSelf doAccept:socketFD] && (++i < numPendingConnections)); + + #pragma clang diagnostic pop + }}); + + + dispatch_source_set_cancel_handler(self->accept4Source, ^{ + #pragma clang diagnostic push + #pragma clang diagnostic warning "-Wimplicit-retain-self" + + #if !OS_OBJECT_USE_OBJC + LogVerbose(@"dispatch_release(accept4Source)"); + dispatch_release(acceptSource); + #endif + + LogVerbose(@"close(socket4FD)"); + close(socketFD); + + #pragma clang diagnostic pop + }); + + LogVerbose(@"dispatch_resume(accept4Source)"); + dispatch_resume(self->accept4Source); + } + + if (enableIPv6) + { + self->accept6Source = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, self->socket6FD, 0, self->socketQueue); + + int socketFD = self->socket6FD; + dispatch_source_t acceptSource = self->accept6Source; + + __weak GCDAsyncSocket *weakSelf = self; + + dispatch_source_set_event_handler(self->accept6Source, ^{ @autoreleasepool { + #pragma clang diagnostic push + #pragma clang diagnostic warning "-Wimplicit-retain-self" + + __strong GCDAsyncSocket *strongSelf = weakSelf; + if (strongSelf == nil) return_from_block; + + LogVerbose(@"event6Block"); + + unsigned long i = 0; + unsigned long numPendingConnections = dispatch_source_get_data(acceptSource); + + LogVerbose(@"numPendingConnections: %lu", numPendingConnections); + + while ([strongSelf doAccept:socketFD] && (++i < numPendingConnections)); + + #pragma clang diagnostic pop + }}); + + dispatch_source_set_cancel_handler(self->accept6Source, ^{ + #pragma clang diagnostic push + #pragma clang diagnostic warning "-Wimplicit-retain-self" + + #if !OS_OBJECT_USE_OBJC + LogVerbose(@"dispatch_release(accept6Source)"); + dispatch_release(acceptSource); + #endif + + LogVerbose(@"close(socket6FD)"); + close(socketFD); + + #pragma clang diagnostic pop + }); + + LogVerbose(@"dispatch_resume(accept6Source)"); + dispatch_resume(self->accept6Source); + } + + self->flags |= kSocketStarted; + + result = YES; + }}; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_sync(socketQueue, block); + + if (result == NO) + { + LogInfo(@"Error in accept: %@", err); + + if (errPtr) + *errPtr = err; + } + + return result; +} + +- (BOOL)acceptOnUrl:(NSURL *)url error:(NSError **)errPtr +{ + LogTrace(); + + __block BOOL result = NO; + __block NSError *err = nil; + + // CreateSocket Block + // This block will be invoked within the dispatch block below. + + int(^createSocket)(int, NSData*) = ^int (int domain, NSData *interfaceAddr) { + + int socketFD = socket(domain, SOCK_STREAM, 0); + + if (socketFD == SOCKET_NULL) + { + NSString *reason = @"Error in socket() function"; + err = [self errorWithErrno:errno reason:reason]; + + return SOCKET_NULL; + } + + int status; + + // Set socket options + + status = fcntl(socketFD, F_SETFL, O_NONBLOCK); + if (status == -1) + { + NSString *reason = @"Error enabling non-blocking IO on socket (fcntl)"; + err = [self errorWithErrno:errno reason:reason]; + + LogVerbose(@"close(socketFD)"); + close(socketFD); + return SOCKET_NULL; + } + + int reuseOn = 1; + status = setsockopt(socketFD, SOL_SOCKET, SO_REUSEADDR, &reuseOn, sizeof(reuseOn)); + if (status == -1) + { + NSString *reason = @"Error enabling address reuse (setsockopt)"; + err = [self errorWithErrno:errno reason:reason]; + + LogVerbose(@"close(socketFD)"); + close(socketFD); + return SOCKET_NULL; + } + + // Bind socket + + status = bind(socketFD, (const struct sockaddr *)[interfaceAddr bytes], (socklen_t)[interfaceAddr length]); + if (status == -1) + { + NSString *reason = @"Error in bind() function"; + err = [self errorWithErrno:errno reason:reason]; + + LogVerbose(@"close(socketFD)"); + close(socketFD); + return SOCKET_NULL; + } + + // Listen + + status = listen(socketFD, 1024); + if (status == -1) + { + NSString *reason = @"Error in listen() function"; + err = [self errorWithErrno:errno reason:reason]; + + LogVerbose(@"close(socketFD)"); + close(socketFD); + return SOCKET_NULL; + } + + return socketFD; + }; + + // Create dispatch block and run on socketQueue + + dispatch_block_t block = ^{ @autoreleasepool { + + if (self->delegate == nil) // Must have delegate set + { + NSString *msg = @"Attempting to accept without a delegate. Set a delegate first."; + err = [self badConfigError:msg]; + + return_from_block; + } + + if (self->delegateQueue == NULL) // Must have delegate queue set + { + NSString *msg = @"Attempting to accept without a delegate queue. Set a delegate queue first."; + err = [self badConfigError:msg]; + + return_from_block; + } + + if (![self isDisconnected]) // Must be disconnected + { + NSString *msg = @"Attempting to accept while connected or accepting connections. Disconnect first."; + err = [self badConfigError:msg]; + + return_from_block; + } + + // Clear queues (spurious read/write requests post disconnect) + [self->readQueue removeAllObjects]; + [self->writeQueue removeAllObjects]; + + // Remove a previous socket + + NSError *error = nil; + NSFileManager *fileManager = [NSFileManager defaultManager]; + NSString *urlPath = url.path; + if (urlPath && [fileManager fileExistsAtPath:urlPath]) { + if (![fileManager removeItemAtURL:url error:&error]) { + NSString *msg = @"Could not remove previous unix domain socket at given url."; + err = [self otherError:msg]; + + return_from_block; + } + } + + // Resolve interface from description + + NSData *interface = [self getInterfaceAddressFromUrl:url]; + + if (interface == nil) + { + NSString *msg = @"Invalid unix domain url. Specify a valid file url that does not exist (e.g. \"file:///tmp/socket\")"; + err = [self badParamError:msg]; + + return_from_block; + } + + // Create sockets, configure, bind, and listen + + LogVerbose(@"Creating unix domain socket"); + self->socketUN = createSocket(AF_UNIX, interface); + + if (self->socketUN == SOCKET_NULL) + { + return_from_block; + } + + self->socketUrl = url; + + // Create accept sources + + self->acceptUNSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, self->socketUN, 0, self->socketQueue); + + int socketFD = self->socketUN; + dispatch_source_t acceptSource = self->acceptUNSource; + + __weak GCDAsyncSocket *weakSelf = self; + + dispatch_source_set_event_handler(self->acceptUNSource, ^{ @autoreleasepool { + + __strong GCDAsyncSocket *strongSelf = weakSelf; + + LogVerbose(@"eventUNBlock"); + + unsigned long i = 0; + unsigned long numPendingConnections = dispatch_source_get_data(acceptSource); + + LogVerbose(@"numPendingConnections: %lu", numPendingConnections); + + while ([strongSelf doAccept:socketFD] && (++i < numPendingConnections)); + }}); + + dispatch_source_set_cancel_handler(self->acceptUNSource, ^{ + +#if !OS_OBJECT_USE_OBJC + LogVerbose(@"dispatch_release(acceptUNSource)"); + dispatch_release(acceptSource); +#endif + + LogVerbose(@"close(socketUN)"); + close(socketFD); + }); + + LogVerbose(@"dispatch_resume(acceptUNSource)"); + dispatch_resume(self->acceptUNSource); + + self->flags |= kSocketStarted; + + result = YES; + }}; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_sync(socketQueue, block); + + if (result == NO) + { + LogInfo(@"Error in accept: %@", err); + + if (errPtr) + *errPtr = err; + } + + return result; +} + +- (BOOL)doAccept:(int)parentSocketFD +{ + LogTrace(); + + int socketType; + int childSocketFD; + NSData *childSocketAddress; + + if (parentSocketFD == socket4FD) + { + socketType = 0; + + struct sockaddr_in addr; + socklen_t addrLen = sizeof(addr); + + childSocketFD = accept(parentSocketFD, (struct sockaddr *)&addr, &addrLen); + + if (childSocketFD == -1) + { + LogWarn(@"Accept failed with error: %@", [self errnoError]); + return NO; + } + + childSocketAddress = [NSData dataWithBytes:&addr length:addrLen]; + } + else if (parentSocketFD == socket6FD) + { + socketType = 1; + + struct sockaddr_in6 addr; + socklen_t addrLen = sizeof(addr); + + childSocketFD = accept(parentSocketFD, (struct sockaddr *)&addr, &addrLen); + + if (childSocketFD == -1) + { + LogWarn(@"Accept failed with error: %@", [self errnoError]); + return NO; + } + + childSocketAddress = [NSData dataWithBytes:&addr length:addrLen]; + } + else // if (parentSocketFD == socketUN) + { + socketType = 2; + + struct sockaddr_un addr; + socklen_t addrLen = sizeof(addr); + + childSocketFD = accept(parentSocketFD, (struct sockaddr *)&addr, &addrLen); + + if (childSocketFD == -1) + { + LogWarn(@"Accept failed with error: %@", [self errnoError]); + return NO; + } + + childSocketAddress = [NSData dataWithBytes:&addr length:addrLen]; + } + + // Enable non-blocking IO on the socket + + int result = fcntl(childSocketFD, F_SETFL, O_NONBLOCK); + if (result == -1) + { + LogWarn(@"Error enabling non-blocking IO on accepted socket (fcntl)"); + LogVerbose(@"close(childSocketFD)"); + close(childSocketFD); + return NO; + } + + // Prevent SIGPIPE signals + + int nosigpipe = 1; + setsockopt(childSocketFD, SOL_SOCKET, SO_NOSIGPIPE, &nosigpipe, sizeof(nosigpipe)); + + // Notify delegate + + if (delegateQueue) + { + __strong id theDelegate = delegate; + + dispatch_async(delegateQueue, ^{ @autoreleasepool { + + // Query delegate for custom socket queue + + dispatch_queue_t childSocketQueue = NULL; + + if ([theDelegate respondsToSelector:@selector(newSocketQueueForConnectionFromAddress:onSocket:)]) + { + childSocketQueue = [theDelegate newSocketQueueForConnectionFromAddress:childSocketAddress + onSocket:self]; + } + + // Create GCDAsyncSocket instance for accepted socket + + GCDAsyncSocket *acceptedSocket = [[[self class] alloc] initWithDelegate:theDelegate + delegateQueue:self->delegateQueue + socketQueue:childSocketQueue]; + + if (socketType == 0) + acceptedSocket->socket4FD = childSocketFD; + else if (socketType == 1) + acceptedSocket->socket6FD = childSocketFD; + else + acceptedSocket->socketUN = childSocketFD; + + acceptedSocket->flags = (kSocketStarted | kConnected); + + // Setup read and write sources for accepted socket + + dispatch_async(acceptedSocket->socketQueue, ^{ @autoreleasepool { + + [acceptedSocket setupReadAndWriteSourcesForNewlyConnectedSocket:childSocketFD]; + }}); + + // Notify delegate + + if ([theDelegate respondsToSelector:@selector(socket:didAcceptNewSocket:)]) + { + [theDelegate socket:self didAcceptNewSocket:acceptedSocket]; + } + + // Release the socket queue returned from the delegate (it was retained by acceptedSocket) + #if !OS_OBJECT_USE_OBJC + if (childSocketQueue) dispatch_release(childSocketQueue); + #endif + + // The accepted socket should have been retained by the delegate. + // Otherwise it gets properly released when exiting the block. + }}); + } + + return YES; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Connecting +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * This method runs through the various checks required prior to a connection attempt. + * It is shared between the connectToHost and connectToAddress methods. + * +**/ +- (BOOL)preConnectWithInterface:(NSString *)interface error:(NSError **)errPtr +{ + NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); + + if (delegate == nil) // Must have delegate set + { + if (errPtr) + { + NSString *msg = @"Attempting to connect without a delegate. Set a delegate first."; + *errPtr = [self badConfigError:msg]; + } + return NO; + } + + if (delegateQueue == NULL) // Must have delegate queue set + { + if (errPtr) + { + NSString *msg = @"Attempting to connect without a delegate queue. Set a delegate queue first."; + *errPtr = [self badConfigError:msg]; + } + return NO; + } + + if (![self isDisconnected]) // Must be disconnected + { + if (errPtr) + { + NSString *msg = @"Attempting to connect while connected or accepting connections. Disconnect first."; + *errPtr = [self badConfigError:msg]; + } + return NO; + } + + BOOL isIPv4Disabled = (config & kIPv4Disabled) ? YES : NO; + BOOL isIPv6Disabled = (config & kIPv6Disabled) ? YES : NO; + + if (isIPv4Disabled && isIPv6Disabled) // Must have IPv4 or IPv6 enabled + { + if (errPtr) + { + NSString *msg = @"Both IPv4 and IPv6 have been disabled. Must enable at least one protocol first."; + *errPtr = [self badConfigError:msg]; + } + return NO; + } + + if (interface) + { + NSMutableData *interface4 = nil; + NSMutableData *interface6 = nil; + + [self getInterfaceAddress4:&interface4 address6:&interface6 fromDescription:interface port:0]; + + if ((interface4 == nil) && (interface6 == nil)) + { + if (errPtr) + { + NSString *msg = @"Unknown interface. Specify valid interface by name (e.g. \"en1\") or IP address."; + *errPtr = [self badParamError:msg]; + } + return NO; + } + + if (isIPv4Disabled && (interface6 == nil)) + { + if (errPtr) + { + NSString *msg = @"IPv4 has been disabled and specified interface doesn't support IPv6."; + *errPtr = [self badParamError:msg]; + } + return NO; + } + + if (isIPv6Disabled && (interface4 == nil)) + { + if (errPtr) + { + NSString *msg = @"IPv6 has been disabled and specified interface doesn't support IPv4."; + *errPtr = [self badParamError:msg]; + } + return NO; + } + + connectInterface4 = interface4; + connectInterface6 = interface6; + } + + // Clear queues (spurious read/write requests post disconnect) + [readQueue removeAllObjects]; + [writeQueue removeAllObjects]; + + return YES; +} + +- (BOOL)preConnectWithUrl:(NSURL *)url error:(NSError **)errPtr +{ + NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); + + if (delegate == nil) // Must have delegate set + { + if (errPtr) + { + NSString *msg = @"Attempting to connect without a delegate. Set a delegate first."; + *errPtr = [self badConfigError:msg]; + } + return NO; + } + + if (delegateQueue == NULL) // Must have delegate queue set + { + if (errPtr) + { + NSString *msg = @"Attempting to connect without a delegate queue. Set a delegate queue first."; + *errPtr = [self badConfigError:msg]; + } + return NO; + } + + if (![self isDisconnected]) // Must be disconnected + { + if (errPtr) + { + NSString *msg = @"Attempting to connect while connected or accepting connections. Disconnect first."; + *errPtr = [self badConfigError:msg]; + } + return NO; + } + + NSData *interface = [self getInterfaceAddressFromUrl:url]; + + if (interface == nil) + { + if (errPtr) + { + NSString *msg = @"Unknown interface. Specify valid interface by name (e.g. \"en1\") or IP address."; + *errPtr = [self badParamError:msg]; + } + return NO; + } + + connectInterfaceUN = interface; + + // Clear queues (spurious read/write requests post disconnect) + [readQueue removeAllObjects]; + [writeQueue removeAllObjects]; + + return YES; +} + +- (BOOL)connectToHost:(NSString*)host onPort:(uint16_t)port error:(NSError **)errPtr +{ + return [self connectToHost:host onPort:port withTimeout:-1 error:errPtr]; +} + +- (BOOL)connectToHost:(NSString *)host + onPort:(uint16_t)port + withTimeout:(NSTimeInterval)timeout + error:(NSError **)errPtr +{ + return [self connectToHost:host onPort:port viaInterface:nil withTimeout:timeout error:errPtr]; +} + +- (BOOL)connectToHost:(NSString *)inHost + onPort:(uint16_t)port + viaInterface:(NSString *)inInterface + withTimeout:(NSTimeInterval)timeout + error:(NSError **)errPtr +{ + LogTrace(); + + // Just in case immutable objects were passed + NSString *host = [inHost copy]; + NSString *interface = [inInterface copy]; + + __block BOOL result = NO; + __block NSError *preConnectErr = nil; + + dispatch_block_t block = ^{ @autoreleasepool { + + // Check for problems with host parameter + + if ([host length] == 0) + { + NSString *msg = @"Invalid host parameter (nil or \"\"). Should be a domain name or IP address string."; + preConnectErr = [self badParamError:msg]; + + return_from_block; + } + + // Run through standard pre-connect checks + + if (![self preConnectWithInterface:interface error:&preConnectErr]) + { + return_from_block; + } + + // We've made it past all the checks. + // It's time to start the connection process. + + self->flags |= kSocketStarted; + + LogVerbose(@"Dispatching DNS lookup..."); + + // It's possible that the given host parameter is actually a NSMutableString. + // So we want to copy it now, within this block that will be executed synchronously. + // This way the asynchronous lookup block below doesn't have to worry about it changing. + + NSString *hostCpy = [host copy]; + + int aStateIndex = self->stateIndex; + __weak GCDAsyncSocket *weakSelf = self; + + dispatch_queue_t globalConcurrentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); + dispatch_async(globalConcurrentQueue, ^{ @autoreleasepool { + #pragma clang diagnostic push + #pragma clang diagnostic warning "-Wimplicit-retain-self" + + NSError *lookupErr = nil; + NSMutableArray *addresses = [[self class] lookupHost:hostCpy port:port error:&lookupErr]; + + __strong GCDAsyncSocket *strongSelf = weakSelf; + if (strongSelf == nil) return_from_block; + + if (lookupErr) + { + dispatch_async(strongSelf->socketQueue, ^{ @autoreleasepool { + + [strongSelf lookup:aStateIndex didFail:lookupErr]; + }}); + } + else + { + NSData *address4 = nil; + NSData *address6 = nil; + + for (NSData *address in addresses) + { + if (!address4 && [[self class] isIPv4Address:address]) + { + address4 = address; + } + else if (!address6 && [[self class] isIPv6Address:address]) + { + address6 = address; + } + } + + dispatch_async(strongSelf->socketQueue, ^{ @autoreleasepool { + + [strongSelf lookup:aStateIndex didSucceedWithAddress4:address4 address6:address6]; + }}); + } + + #pragma clang diagnostic pop + }}); + + [self startConnectTimeout:timeout]; + + result = YES; + }}; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_sync(socketQueue, block); + + + if (errPtr) *errPtr = preConnectErr; + return result; +} + +- (BOOL)connectToAddress:(NSData *)remoteAddr error:(NSError **)errPtr +{ + return [self connectToAddress:remoteAddr viaInterface:nil withTimeout:-1 error:errPtr]; +} + +- (BOOL)connectToAddress:(NSData *)remoteAddr withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr +{ + return [self connectToAddress:remoteAddr viaInterface:nil withTimeout:timeout error:errPtr]; +} + +- (BOOL)connectToAddress:(NSData *)inRemoteAddr + viaInterface:(NSString *)inInterface + withTimeout:(NSTimeInterval)timeout + error:(NSError **)errPtr +{ + LogTrace(); + + // Just in case immutable objects were passed + NSData *remoteAddr = [inRemoteAddr copy]; + NSString *interface = [inInterface copy]; + + __block BOOL result = NO; + __block NSError *err = nil; + + dispatch_block_t block = ^{ @autoreleasepool { + + // Check for problems with remoteAddr parameter + + NSData *address4 = nil; + NSData *address6 = nil; + + if ([remoteAddr length] >= sizeof(struct sockaddr)) + { + const struct sockaddr *sockaddr = (const struct sockaddr *)[remoteAddr bytes]; + + if (sockaddr->sa_family == AF_INET) + { + if ([remoteAddr length] == sizeof(struct sockaddr_in)) + { + address4 = remoteAddr; + } + } + else if (sockaddr->sa_family == AF_INET6) + { + if ([remoteAddr length] == sizeof(struct sockaddr_in6)) + { + address6 = remoteAddr; + } + } + } + + if ((address4 == nil) && (address6 == nil)) + { + NSString *msg = @"A valid IPv4 or IPv6 address was not given"; + err = [self badParamError:msg]; + + return_from_block; + } + + BOOL isIPv4Disabled = (self->config & kIPv4Disabled) ? YES : NO; + BOOL isIPv6Disabled = (self->config & kIPv6Disabled) ? YES : NO; + + if (isIPv4Disabled && (address4 != nil)) + { + NSString *msg = @"IPv4 has been disabled and an IPv4 address was passed."; + err = [self badParamError:msg]; + + return_from_block; + } + + if (isIPv6Disabled && (address6 != nil)) + { + NSString *msg = @"IPv6 has been disabled and an IPv6 address was passed."; + err = [self badParamError:msg]; + + return_from_block; + } + + // Run through standard pre-connect checks + + if (![self preConnectWithInterface:interface error:&err]) + { + return_from_block; + } + + // We've made it past all the checks. + // It's time to start the connection process. + + if (![self connectWithAddress4:address4 address6:address6 error:&err]) + { + return_from_block; + } + + self->flags |= kSocketStarted; + + [self startConnectTimeout:timeout]; + + result = YES; + }}; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_sync(socketQueue, block); + + if (result == NO) + { + if (errPtr) + *errPtr = err; + } + + return result; +} + +- (BOOL)connectToUrl:(NSURL *)url withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr +{ + LogTrace(); + + __block BOOL result = NO; + __block NSError *err = nil; + + dispatch_block_t block = ^{ @autoreleasepool { + + // Check for problems with host parameter + + if ([url.path length] == 0) + { + NSString *msg = @"Invalid unix domain socket url."; + err = [self badParamError:msg]; + + return_from_block; + } + + // Run through standard pre-connect checks + + if (![self preConnectWithUrl:url error:&err]) + { + return_from_block; + } + + // We've made it past all the checks. + // It's time to start the connection process. + + self->flags |= kSocketStarted; + + // Start the normal connection process + + NSError *connectError = nil; + if (![self connectWithAddressUN:self->connectInterfaceUN error:&connectError]) + { + [self closeWithError:connectError]; + + return_from_block; + } + + [self startConnectTimeout:timeout]; + + result = YES; + }}; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_sync(socketQueue, block); + + if (result == NO) + { + if (errPtr) + *errPtr = err; + } + + return result; +} + +- (BOOL)connectToNetService:(NSNetService *)netService error:(NSError **)errPtr +{ + NSArray* addresses = [netService addresses]; + for (NSData* address in addresses) + { + BOOL result = [self connectToAddress:address error:errPtr]; + if (result) + { + return YES; + } + } + + return NO; +} + +- (void)lookup:(int)aStateIndex didSucceedWithAddress4:(NSData *)address4 address6:(NSData *)address6 +{ + LogTrace(); + + NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); + NSAssert(address4 || address6, @"Expected at least one valid address"); + + if (aStateIndex != stateIndex) + { + LogInfo(@"Ignoring lookupDidSucceed, already disconnected"); + + // The connect operation has been cancelled. + // That is, socket was disconnected, or connection has already timed out. + return; + } + + // Check for problems + + BOOL isIPv4Disabled = (config & kIPv4Disabled) ? YES : NO; + BOOL isIPv6Disabled = (config & kIPv6Disabled) ? YES : NO; + + if (isIPv4Disabled && (address6 == nil)) + { + NSString *msg = @"IPv4 has been disabled and DNS lookup found no IPv6 address."; + + [self closeWithError:[self otherError:msg]]; + return; + } + + if (isIPv6Disabled && (address4 == nil)) + { + NSString *msg = @"IPv6 has been disabled and DNS lookup found no IPv4 address."; + + [self closeWithError:[self otherError:msg]]; + return; + } + + // Start the normal connection process + + NSError *err = nil; + if (![self connectWithAddress4:address4 address6:address6 error:&err]) + { + [self closeWithError:err]; + } +} + +/** + * This method is called if the DNS lookup fails. + * This method is executed on the socketQueue. + * + * Since the DNS lookup executed synchronously on a global concurrent queue, + * the original connection request may have already been cancelled or timed-out by the time this method is invoked. + * The lookupIndex tells us whether the lookup is still valid or not. +**/ +- (void)lookup:(int)aStateIndex didFail:(NSError *)error +{ + LogTrace(); + + NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); + + + if (aStateIndex != stateIndex) + { + LogInfo(@"Ignoring lookup:didFail: - already disconnected"); + + // The connect operation has been cancelled. + // That is, socket was disconnected, or connection has already timed out. + return; + } + + [self endConnectTimeout]; + [self closeWithError:error]; +} + +- (BOOL)bindSocket:(int)socketFD toInterface:(NSData *)connectInterface error:(NSError **)errPtr +{ + // Bind the socket to the desired interface (if needed) + + if (connectInterface) + { + LogVerbose(@"Binding socket..."); + + if ([[self class] portFromAddress:connectInterface] > 0) + { + // Since we're going to be binding to a specific port, + // we should turn on reuseaddr to allow us to override sockets in time_wait. + + int reuseOn = 1; + setsockopt(socketFD, SOL_SOCKET, SO_REUSEADDR, &reuseOn, sizeof(reuseOn)); + } + + const struct sockaddr *interfaceAddr = (const struct sockaddr *)[connectInterface bytes]; + + int result = bind(socketFD, interfaceAddr, (socklen_t)[connectInterface length]); + if (result != 0) + { + if (errPtr) + *errPtr = [self errorWithErrno:errno reason:@"Error in bind() function"]; + + return NO; + } + } + + return YES; +} + +- (int)createSocket:(int)family connectInterface:(NSData *)connectInterface errPtr:(NSError **)errPtr +{ + int socketFD = socket(family, SOCK_STREAM, 0); + + if (socketFD == SOCKET_NULL) + { + if (errPtr) + *errPtr = [self errorWithErrno:errno reason:@"Error in socket() function"]; + + return socketFD; + } + + if (![self bindSocket:socketFD toInterface:connectInterface error:errPtr]) + { + [self closeSocket:socketFD]; + + return SOCKET_NULL; + } + + // Prevent SIGPIPE signals + + int nosigpipe = 1; + setsockopt(socketFD, SOL_SOCKET, SO_NOSIGPIPE, &nosigpipe, sizeof(nosigpipe)); + + return socketFD; +} + +- (void)connectSocket:(int)socketFD address:(NSData *)address stateIndex:(int)aStateIndex +{ + // If there already is a socket connected, we close socketFD and return + if (self.isConnected) + { + [self closeSocket:socketFD]; + return; + } + + // Start the connection process in a background queue + + __weak GCDAsyncSocket *weakSelf = self; + + dispatch_queue_t globalConcurrentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); + dispatch_async(globalConcurrentQueue, ^{ +#pragma clang diagnostic push +#pragma clang diagnostic warning "-Wimplicit-retain-self" + + int result = connect(socketFD, (const struct sockaddr *)[address bytes], (socklen_t)[address length]); + int err = errno; + + __strong GCDAsyncSocket *strongSelf = weakSelf; + if (strongSelf == nil) return_from_block; + + dispatch_async(strongSelf->socketQueue, ^{ @autoreleasepool { + + if (strongSelf.isConnected) + { + [strongSelf closeSocket:socketFD]; + return_from_block; + } + + if (result == 0) + { + [self closeUnusedSocket:socketFD]; + + [strongSelf didConnect:aStateIndex]; + } + else + { + [strongSelf closeSocket:socketFD]; + + // If there are no more sockets trying to connect, we inform the error to the delegate + if (strongSelf.socket4FD == SOCKET_NULL && strongSelf.socket6FD == SOCKET_NULL) + { + NSError *error = [strongSelf errorWithErrno:err reason:@"Error in connect() function"]; + [strongSelf didNotConnect:aStateIndex error:error]; + } + } + }}); + +#pragma clang diagnostic pop + }); + + LogVerbose(@"Connecting..."); +} + +- (void)closeSocket:(int)socketFD +{ + if (socketFD != SOCKET_NULL && + (socketFD == socket6FD || socketFD == socket4FD)) + { + close(socketFD); + + if (socketFD == socket4FD) + { + LogVerbose(@"close(socket4FD)"); + socket4FD = SOCKET_NULL; + } + else if (socketFD == socket6FD) + { + LogVerbose(@"close(socket6FD)"); + socket6FD = SOCKET_NULL; + } + } +} + +- (void)closeUnusedSocket:(int)usedSocketFD +{ + if (usedSocketFD != socket4FD) + { + [self closeSocket:socket4FD]; + } + else if (usedSocketFD != socket6FD) + { + [self closeSocket:socket6FD]; + } +} + +- (BOOL)connectWithAddress4:(NSData *)address4 address6:(NSData *)address6 error:(NSError **)errPtr +{ + LogTrace(); + + NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); + + LogVerbose(@"IPv4: %@:%hu", [[self class] hostFromAddress:address4], [[self class] portFromAddress:address4]); + LogVerbose(@"IPv6: %@:%hu", [[self class] hostFromAddress:address6], [[self class] portFromAddress:address6]); + + // Determine socket type + + BOOL preferIPv6 = (config & kPreferIPv6) ? YES : NO; + + // Create and bind the sockets + + if (address4) + { + LogVerbose(@"Creating IPv4 socket"); + + socket4FD = [self createSocket:AF_INET connectInterface:connectInterface4 errPtr:errPtr]; + } + + if (address6) + { + LogVerbose(@"Creating IPv6 socket"); + + socket6FD = [self createSocket:AF_INET6 connectInterface:connectInterface6 errPtr:errPtr]; + } + + if (socket4FD == SOCKET_NULL && socket6FD == SOCKET_NULL) + { + return NO; + } + + int socketFD, alternateSocketFD; + NSData *address, *alternateAddress; + + if ((preferIPv6 && socket6FD != SOCKET_NULL) || socket4FD == SOCKET_NULL) + { + socketFD = socket6FD; + alternateSocketFD = socket4FD; + address = address6; + alternateAddress = address4; + } + else + { + socketFD = socket4FD; + alternateSocketFD = socket6FD; + address = address4; + alternateAddress = address6; + } + + int aStateIndex = stateIndex; + + [self connectSocket:socketFD address:address stateIndex:aStateIndex]; + + if (alternateAddress) + { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(alternateAddressDelay * NSEC_PER_SEC)), socketQueue, ^{ + [self connectSocket:alternateSocketFD address:alternateAddress stateIndex:aStateIndex]; + }); + } + + return YES; +} + +- (BOOL)connectWithAddressUN:(NSData *)address error:(NSError **)errPtr +{ + LogTrace(); + + NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); + + // Create the socket + + int socketFD; + + LogVerbose(@"Creating unix domain socket"); + + socketUN = socket(AF_UNIX, SOCK_STREAM, 0); + + socketFD = socketUN; + + if (socketFD == SOCKET_NULL) + { + if (errPtr) + *errPtr = [self errorWithErrno:errno reason:@"Error in socket() function"]; + + return NO; + } + + // Bind the socket to the desired interface (if needed) + + LogVerbose(@"Binding socket..."); + + int reuseOn = 1; + setsockopt(socketFD, SOL_SOCKET, SO_REUSEADDR, &reuseOn, sizeof(reuseOn)); + +// const struct sockaddr *interfaceAddr = (const struct sockaddr *)[address bytes]; +// +// int result = bind(socketFD, interfaceAddr, (socklen_t)[address length]); +// if (result != 0) +// { +// if (errPtr) +// *errPtr = [self errnoErrorWithReason:@"Error in bind() function"]; +// +// return NO; +// } + + // Prevent SIGPIPE signals + + int nosigpipe = 1; + setsockopt(socketFD, SOL_SOCKET, SO_NOSIGPIPE, &nosigpipe, sizeof(nosigpipe)); + + // Start the connection process in a background queue + + int aStateIndex = stateIndex; + + dispatch_queue_t globalConcurrentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); + dispatch_async(globalConcurrentQueue, ^{ + + const struct sockaddr *addr = (const struct sockaddr *)[address bytes]; + int result = connect(socketFD, addr, addr->sa_len); + if (result == 0) + { + dispatch_async(self->socketQueue, ^{ @autoreleasepool { + + [self didConnect:aStateIndex]; + }}); + } + else + { + // TODO: Bad file descriptor + perror("connect"); + NSError *error = [self errorWithErrno:errno reason:@"Error in connect() function"]; + + dispatch_async(self->socketQueue, ^{ @autoreleasepool { + + [self didNotConnect:aStateIndex error:error]; + }}); + } + }); + + LogVerbose(@"Connecting..."); + + return YES; +} + +- (void)didConnect:(int)aStateIndex +{ + LogTrace(); + + NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); + + + if (aStateIndex != stateIndex) + { + LogInfo(@"Ignoring didConnect, already disconnected"); + + // The connect operation has been cancelled. + // That is, socket was disconnected, or connection has already timed out. + return; + } + + flags |= kConnected; + + [self endConnectTimeout]; + + #if TARGET_OS_IPHONE + // The endConnectTimeout method executed above incremented the stateIndex. + aStateIndex = stateIndex; + #endif + + // Setup read/write streams (as workaround for specific shortcomings in the iOS platform) + // + // Note: + // There may be configuration options that must be set by the delegate before opening the streams. + // The primary example is the kCFStreamNetworkServiceTypeVoIP flag, which only works on an unopened stream. + // + // Thus we wait until after the socket:didConnectToHost:port: delegate method has completed. + // This gives the delegate time to properly configure the streams if needed. + + dispatch_block_t SetupStreamsPart1 = ^{ + #if TARGET_OS_IPHONE + + if (![self createReadAndWriteStream]) + { + [self closeWithError:[self otherError:@"Error creating CFStreams"]]; + return; + } + + if (![self registerForStreamCallbacksIncludingReadWrite:NO]) + { + [self closeWithError:[self otherError:@"Error in CFStreamSetClient"]]; + return; + } + + #endif + }; + dispatch_block_t SetupStreamsPart2 = ^{ + #if TARGET_OS_IPHONE + + if (aStateIndex != self->stateIndex) + { + // The socket has been disconnected. + return; + } + + if (![self addStreamsToRunLoop]) + { + [self closeWithError:[self otherError:@"Error in CFStreamScheduleWithRunLoop"]]; + return; + } + + if (![self openStreams]) + { + [self closeWithError:[self otherError:@"Error creating CFStreams"]]; + return; + } + + #endif + }; + + // Notify delegate + + NSString *host = [self connectedHost]; + uint16_t port = [self connectedPort]; + NSURL *url = [self connectedUrl]; + + __strong id theDelegate = delegate; + + if (delegateQueue && host != nil && [theDelegate respondsToSelector:@selector(socket:didConnectToHost:port:)]) + { + SetupStreamsPart1(); + + dispatch_async(delegateQueue, ^{ @autoreleasepool { + + [theDelegate socket:self didConnectToHost:host port:port]; + + dispatch_async(self->socketQueue, ^{ @autoreleasepool { + + SetupStreamsPart2(); + }}); + }}); + } + else if (delegateQueue && url != nil && [theDelegate respondsToSelector:@selector(socket:didConnectToUrl:)]) + { + SetupStreamsPart1(); + + dispatch_async(delegateQueue, ^{ @autoreleasepool { + + [theDelegate socket:self didConnectToUrl:url]; + + dispatch_async(self->socketQueue, ^{ @autoreleasepool { + + SetupStreamsPart2(); + }}); + }}); + } + else + { + SetupStreamsPart1(); + SetupStreamsPart2(); + } + + // Get the connected socket + + int socketFD = (socket4FD != SOCKET_NULL) ? socket4FD : (socket6FD != SOCKET_NULL) ? socket6FD : socketUN; + + // Enable non-blocking IO on the socket + + int result = fcntl(socketFD, F_SETFL, O_NONBLOCK); + if (result == -1) + { + NSString *errMsg = @"Error enabling non-blocking IO on socket (fcntl)"; + [self closeWithError:[self otherError:errMsg]]; + + return; + } + + // Setup our read/write sources + + [self setupReadAndWriteSourcesForNewlyConnectedSocket:socketFD]; + + // Dequeue any pending read/write requests + + [self maybeDequeueRead]; + [self maybeDequeueWrite]; +} + +- (void)didNotConnect:(int)aStateIndex error:(NSError *)error +{ + LogTrace(); + + NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); + + + if (aStateIndex != stateIndex) + { + LogInfo(@"Ignoring didNotConnect, already disconnected"); + + // The connect operation has been cancelled. + // That is, socket was disconnected, or connection has already timed out. + return; + } + + [self closeWithError:error]; +} + +- (void)startConnectTimeout:(NSTimeInterval)timeout +{ + if (timeout >= 0.0) + { + connectTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, socketQueue); + + __weak GCDAsyncSocket *weakSelf = self; + + dispatch_source_set_event_handler(connectTimer, ^{ @autoreleasepool { + #pragma clang diagnostic push + #pragma clang diagnostic warning "-Wimplicit-retain-self" + + __strong GCDAsyncSocket *strongSelf = weakSelf; + if (strongSelf == nil) return_from_block; + + [strongSelf doConnectTimeout]; + + #pragma clang diagnostic pop + }}); + + #if !OS_OBJECT_USE_OBJC + dispatch_source_t theConnectTimer = connectTimer; + dispatch_source_set_cancel_handler(connectTimer, ^{ + #pragma clang diagnostic push + #pragma clang diagnostic warning "-Wimplicit-retain-self" + + LogVerbose(@"dispatch_release(connectTimer)"); + dispatch_release(theConnectTimer); + + #pragma clang diagnostic pop + }); + #endif + + dispatch_time_t tt = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeout * NSEC_PER_SEC)); + dispatch_source_set_timer(connectTimer, tt, DISPATCH_TIME_FOREVER, 0); + + dispatch_resume(connectTimer); + } +} + +- (void)endConnectTimeout +{ + LogTrace(); + + if (connectTimer) + { + dispatch_source_cancel(connectTimer); + connectTimer = NULL; + } + + // Increment stateIndex. + // This will prevent us from processing results from any related background asynchronous operations. + // + // Note: This should be called from close method even if connectTimer is NULL. + // This is because one might disconnect a socket prior to a successful connection which had no timeout. + + stateIndex++; + + if (connectInterface4) + { + connectInterface4 = nil; + } + if (connectInterface6) + { + connectInterface6 = nil; + } +} + +- (void)doConnectTimeout +{ + LogTrace(); + + [self endConnectTimeout]; + [self closeWithError:[self connectTimeoutError]]; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Disconnecting +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +- (void)closeWithError:(NSError *)error +{ + LogTrace(); + NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); + + [self endConnectTimeout]; + + if (currentRead != nil) [self endCurrentRead]; + if (currentWrite != nil) [self endCurrentWrite]; + + [readQueue removeAllObjects]; + [writeQueue removeAllObjects]; + + [preBuffer reset]; + + #if TARGET_OS_IPHONE + { + if (readStream || writeStream) + { + [self removeStreamsFromRunLoop]; + + if (readStream) + { + CFReadStreamSetClient(readStream, kCFStreamEventNone, NULL, NULL); + CFReadStreamClose(readStream); + CFRelease(readStream); + readStream = NULL; + } + if (writeStream) + { + CFWriteStreamSetClient(writeStream, kCFStreamEventNone, NULL, NULL); + CFWriteStreamClose(writeStream); + CFRelease(writeStream); + writeStream = NULL; + } + } + } + #endif + + [sslPreBuffer reset]; + sslErrCode = lastSSLHandshakeError = noErr; + + if (sslContext) + { + // Getting a linker error here about the SSLx() functions? + // You need to add the Security Framework to your application. + + SSLClose(sslContext); + + #if TARGET_OS_IPHONE || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1080) + CFRelease(sslContext); + #else + SSLDisposeContext(sslContext); + #endif + + sslContext = NULL; + } + + // For some crazy reason (in my opinion), cancelling a dispatch source doesn't + // invoke the cancel handler if the dispatch source is paused. + // So we have to unpause the source if needed. + // This allows the cancel handler to be run, which in turn releases the source and closes the socket. + + if (!accept4Source && !accept6Source && !acceptUNSource && !readSource && !writeSource) + { + LogVerbose(@"manually closing close"); + + if (socket4FD != SOCKET_NULL) + { + LogVerbose(@"close(socket4FD)"); + close(socket4FD); + socket4FD = SOCKET_NULL; + } + + if (socket6FD != SOCKET_NULL) + { + LogVerbose(@"close(socket6FD)"); + close(socket6FD); + socket6FD = SOCKET_NULL; + } + + if (socketUN != SOCKET_NULL) + { + LogVerbose(@"close(socketUN)"); + close(socketUN); + socketUN = SOCKET_NULL; + unlink(socketUrl.path.fileSystemRepresentation); + socketUrl = nil; + } + } + else + { + if (accept4Source) + { + LogVerbose(@"dispatch_source_cancel(accept4Source)"); + dispatch_source_cancel(accept4Source); + + // We never suspend accept4Source + + accept4Source = NULL; + } + + if (accept6Source) + { + LogVerbose(@"dispatch_source_cancel(accept6Source)"); + dispatch_source_cancel(accept6Source); + + // We never suspend accept6Source + + accept6Source = NULL; + } + + if (acceptUNSource) + { + LogVerbose(@"dispatch_source_cancel(acceptUNSource)"); + dispatch_source_cancel(acceptUNSource); + + // We never suspend acceptUNSource + + acceptUNSource = NULL; + } + + if (readSource) + { + LogVerbose(@"dispatch_source_cancel(readSource)"); + dispatch_source_cancel(readSource); + + [self resumeReadSource]; + + readSource = NULL; + } + + if (writeSource) + { + LogVerbose(@"dispatch_source_cancel(writeSource)"); + dispatch_source_cancel(writeSource); + + [self resumeWriteSource]; + + writeSource = NULL; + } + + // The sockets will be closed by the cancel handlers of the corresponding source + + socket4FD = SOCKET_NULL; + socket6FD = SOCKET_NULL; + socketUN = SOCKET_NULL; + } + + // If the client has passed the connect/accept method, then the connection has at least begun. + // Notify delegate that it is now ending. + BOOL shouldCallDelegate = (flags & kSocketStarted) ? YES : NO; + BOOL isDeallocating = (flags & kDealloc) ? YES : NO; + + // Clear stored socket info and all flags (config remains as is) + socketFDBytesAvailable = 0; + flags = 0; + sslWriteCachedLength = 0; + + if (shouldCallDelegate) + { + __strong id theDelegate = delegate; + __strong id theSelf = isDeallocating ? nil : self; + + if (delegateQueue && [theDelegate respondsToSelector: @selector(socketDidDisconnect:withError:)]) + { + dispatch_async(delegateQueue, ^{ @autoreleasepool { + + [theDelegate socketDidDisconnect:theSelf withError:error]; + }}); + } + } +} + +- (void)disconnect +{ + dispatch_block_t block = ^{ @autoreleasepool { + + if (self->flags & kSocketStarted) + { + [self closeWithError:nil]; + } + }}; + + // Synchronous disconnection, as documented in the header file + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_sync(socketQueue, block); +} + +- (void)disconnectAfterReading +{ + dispatch_async(socketQueue, ^{ @autoreleasepool { + + if (self->flags & kSocketStarted) + { + self->flags |= (kForbidReadsWrites | kDisconnectAfterReads); + [self maybeClose]; + } + }}); +} + +- (void)disconnectAfterWriting +{ + dispatch_async(socketQueue, ^{ @autoreleasepool { + + if (self->flags & kSocketStarted) + { + self->flags |= (kForbidReadsWrites | kDisconnectAfterWrites); + [self maybeClose]; + } + }}); +} + +- (void)disconnectAfterReadingAndWriting +{ + dispatch_async(socketQueue, ^{ @autoreleasepool { + + if (self->flags & kSocketStarted) + { + self->flags |= (kForbidReadsWrites | kDisconnectAfterReads | kDisconnectAfterWrites); + [self maybeClose]; + } + }}); +} + +/** + * Closes the socket if possible. + * That is, if all writes have completed, and we're set to disconnect after writing, + * or if all reads have completed, and we're set to disconnect after reading. +**/ +- (void)maybeClose +{ + NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); + + BOOL shouldClose = NO; + + if (flags & kDisconnectAfterReads) + { + if (([readQueue count] == 0) && (currentRead == nil)) + { + if (flags & kDisconnectAfterWrites) + { + if (([writeQueue count] == 0) && (currentWrite == nil)) + { + shouldClose = YES; + } + } + else + { + shouldClose = YES; + } + } + } + else if (flags & kDisconnectAfterWrites) + { + if (([writeQueue count] == 0) && (currentWrite == nil)) + { + shouldClose = YES; + } + } + + if (shouldClose) + { + [self closeWithError:nil]; + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Errors +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +- (NSError *)badConfigError:(NSString *)errMsg +{ + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; + + return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketBadConfigError userInfo:userInfo]; +} + +- (NSError *)badParamError:(NSString *)errMsg +{ + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; + + return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketBadParamError userInfo:userInfo]; +} + ++ (NSError *)gaiError:(int)gai_error +{ + NSString *errMsg = [NSString stringWithCString:gai_strerror(gai_error) encoding:NSASCIIStringEncoding]; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; + + return [NSError errorWithDomain:@"kCFStreamErrorDomainNetDB" code:gai_error userInfo:userInfo]; +} + +- (NSError *)errorWithErrno:(int)err reason:(NSString *)reason +{ + NSString *errMsg = [NSString stringWithUTF8String:strerror(err)]; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg, + NSLocalizedFailureReasonErrorKey : reason}; + + return [NSError errorWithDomain:NSPOSIXErrorDomain code:err userInfo:userInfo]; +} + +- (NSError *)errnoError +{ + NSString *errMsg = [NSString stringWithUTF8String:strerror(errno)]; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; + + return [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:userInfo]; +} + +- (NSError *)sslError:(OSStatus)ssl_error +{ + NSString *msg = @"Error code definition can be found in Apple's SecureTransport.h"; + NSDictionary *userInfo = @{NSLocalizedRecoverySuggestionErrorKey : msg}; + + return [NSError errorWithDomain:@"kCFStreamErrorDomainSSL" code:ssl_error userInfo:userInfo]; +} + +- (NSError *)connectTimeoutError +{ + NSString *errMsg = NSLocalizedStringWithDefaultValue(@"GCDAsyncSocketConnectTimeoutError", + @"GCDAsyncSocket", [NSBundle mainBundle], + @"Attempt to connect to host timed out", nil); + + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; + + return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketConnectTimeoutError userInfo:userInfo]; +} + +/** + * Returns a standard AsyncSocket maxed out error. +**/ +- (NSError *)readMaxedOutError +{ + NSString *errMsg = NSLocalizedStringWithDefaultValue(@"GCDAsyncSocketReadMaxedOutError", + @"GCDAsyncSocket", [NSBundle mainBundle], + @"Read operation reached set maximum length", nil); + + NSDictionary *info = @{NSLocalizedDescriptionKey : errMsg}; + + return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketReadMaxedOutError userInfo:info]; +} + +/** + * Returns a standard AsyncSocket write timeout error. +**/ +- (NSError *)readTimeoutError +{ + NSString *errMsg = NSLocalizedStringWithDefaultValue(@"GCDAsyncSocketReadTimeoutError", + @"GCDAsyncSocket", [NSBundle mainBundle], + @"Read operation timed out", nil); + + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; + + return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketReadTimeoutError userInfo:userInfo]; +} + +/** + * Returns a standard AsyncSocket write timeout error. +**/ +- (NSError *)writeTimeoutError +{ + NSString *errMsg = NSLocalizedStringWithDefaultValue(@"GCDAsyncSocketWriteTimeoutError", + @"GCDAsyncSocket", [NSBundle mainBundle], + @"Write operation timed out", nil); + + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; + + return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketWriteTimeoutError userInfo:userInfo]; +} + +- (NSError *)connectionClosedError +{ + NSString *errMsg = NSLocalizedStringWithDefaultValue(@"GCDAsyncSocketClosedError", + @"GCDAsyncSocket", [NSBundle mainBundle], + @"Socket closed by remote peer", nil); + + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; + + return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketClosedError userInfo:userInfo]; +} + +- (NSError *)otherError:(NSString *)errMsg +{ + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; + + return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketOtherError userInfo:userInfo]; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Diagnostics +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +- (BOOL)isDisconnected +{ + __block BOOL result = NO; + + dispatch_block_t block = ^{ + result = (self->flags & kSocketStarted) ? NO : YES; + }; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_sync(socketQueue, block); + + return result; +} + +- (BOOL)isConnected +{ + __block BOOL result = NO; + + dispatch_block_t block = ^{ + result = (self->flags & kConnected) ? YES : NO; + }; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_sync(socketQueue, block); + + return result; +} + +- (NSString *)connectedHost +{ + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + if (socket4FD != SOCKET_NULL) + return [self connectedHostFromSocket4:socket4FD]; + if (socket6FD != SOCKET_NULL) + return [self connectedHostFromSocket6:socket6FD]; + + return nil; + } + else + { + __block NSString *result = nil; + + dispatch_sync(socketQueue, ^{ @autoreleasepool { + + if (self->socket4FD != SOCKET_NULL) + result = [self connectedHostFromSocket4:self->socket4FD]; + else if (self->socket6FD != SOCKET_NULL) + result = [self connectedHostFromSocket6:self->socket6FD]; + }}); + + return result; + } +} + +- (uint16_t)connectedPort +{ + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + if (socket4FD != SOCKET_NULL) + return [self connectedPortFromSocket4:socket4FD]; + if (socket6FD != SOCKET_NULL) + return [self connectedPortFromSocket6:socket6FD]; + + return 0; + } + else + { + __block uint16_t result = 0; + + dispatch_sync(socketQueue, ^{ + // No need for autorelease pool + + if (self->socket4FD != SOCKET_NULL) + result = [self connectedPortFromSocket4:self->socket4FD]; + else if (self->socket6FD != SOCKET_NULL) + result = [self connectedPortFromSocket6:self->socket6FD]; + }); + + return result; + } +} + +- (NSURL *)connectedUrl +{ + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + if (socketUN != SOCKET_NULL) + return [self connectedUrlFromSocketUN:socketUN]; + + return nil; + } + else + { + __block NSURL *result = nil; + + dispatch_sync(socketQueue, ^{ @autoreleasepool { + + if (self->socketUN != SOCKET_NULL) + result = [self connectedUrlFromSocketUN:self->socketUN]; + }}); + + return result; + } +} + +- (NSString *)localHost +{ + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + if (socket4FD != SOCKET_NULL) + return [self localHostFromSocket4:socket4FD]; + if (socket6FD != SOCKET_NULL) + return [self localHostFromSocket6:socket6FD]; + + return nil; + } + else + { + __block NSString *result = nil; + + dispatch_sync(socketQueue, ^{ @autoreleasepool { + + if (self->socket4FD != SOCKET_NULL) + result = [self localHostFromSocket4:self->socket4FD]; + else if (self->socket6FD != SOCKET_NULL) + result = [self localHostFromSocket6:self->socket6FD]; + }}); + + return result; + } +} + +- (uint16_t)localPort +{ + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + if (socket4FD != SOCKET_NULL) + return [self localPortFromSocket4:socket4FD]; + if (socket6FD != SOCKET_NULL) + return [self localPortFromSocket6:socket6FD]; + + return 0; + } + else + { + __block uint16_t result = 0; + + dispatch_sync(socketQueue, ^{ + // No need for autorelease pool + + if (self->socket4FD != SOCKET_NULL) + result = [self localPortFromSocket4:self->socket4FD]; + else if (self->socket6FD != SOCKET_NULL) + result = [self localPortFromSocket6:self->socket6FD]; + }); + + return result; + } +} + +- (NSString *)connectedHost4 +{ + if (socket4FD != SOCKET_NULL) + return [self connectedHostFromSocket4:socket4FD]; + + return nil; +} + +- (NSString *)connectedHost6 +{ + if (socket6FD != SOCKET_NULL) + return [self connectedHostFromSocket6:socket6FD]; + + return nil; +} + +- (uint16_t)connectedPort4 +{ + if (socket4FD != SOCKET_NULL) + return [self connectedPortFromSocket4:socket4FD]; + + return 0; +} + +- (uint16_t)connectedPort6 +{ + if (socket6FD != SOCKET_NULL) + return [self connectedPortFromSocket6:socket6FD]; + + return 0; +} + +- (NSString *)localHost4 +{ + if (socket4FD != SOCKET_NULL) + return [self localHostFromSocket4:socket4FD]; + + return nil; +} + +- (NSString *)localHost6 +{ + if (socket6FD != SOCKET_NULL) + return [self localHostFromSocket6:socket6FD]; + + return nil; +} + +- (uint16_t)localPort4 +{ + if (socket4FD != SOCKET_NULL) + return [self localPortFromSocket4:socket4FD]; + + return 0; +} + +- (uint16_t)localPort6 +{ + if (socket6FD != SOCKET_NULL) + return [self localPortFromSocket6:socket6FD]; + + return 0; +} + +- (NSString *)connectedHostFromSocket4:(int)socketFD +{ + struct sockaddr_in sockaddr4; + socklen_t sockaddr4len = sizeof(sockaddr4); + + if (getpeername(socketFD, (struct sockaddr *)&sockaddr4, &sockaddr4len) < 0) + { + return nil; + } + return [[self class] hostFromSockaddr4:&sockaddr4]; +} + +- (NSString *)connectedHostFromSocket6:(int)socketFD +{ + struct sockaddr_in6 sockaddr6; + socklen_t sockaddr6len = sizeof(sockaddr6); + + if (getpeername(socketFD, (struct sockaddr *)&sockaddr6, &sockaddr6len) < 0) + { + return nil; + } + return [[self class] hostFromSockaddr6:&sockaddr6]; +} + +- (uint16_t)connectedPortFromSocket4:(int)socketFD +{ + struct sockaddr_in sockaddr4; + socklen_t sockaddr4len = sizeof(sockaddr4); + + if (getpeername(socketFD, (struct sockaddr *)&sockaddr4, &sockaddr4len) < 0) + { + return 0; + } + return [[self class] portFromSockaddr4:&sockaddr4]; +} + +- (uint16_t)connectedPortFromSocket6:(int)socketFD +{ + struct sockaddr_in6 sockaddr6; + socklen_t sockaddr6len = sizeof(sockaddr6); + + if (getpeername(socketFD, (struct sockaddr *)&sockaddr6, &sockaddr6len) < 0) + { + return 0; + } + return [[self class] portFromSockaddr6:&sockaddr6]; +} + +- (NSURL *)connectedUrlFromSocketUN:(int)socketFD +{ + struct sockaddr_un sockaddr; + socklen_t sockaddrlen = sizeof(sockaddr); + + if (getpeername(socketFD, (struct sockaddr *)&sockaddr, &sockaddrlen) < 0) + { + return 0; + } + return [[self class] urlFromSockaddrUN:&sockaddr]; +} + +- (NSString *)localHostFromSocket4:(int)socketFD +{ + struct sockaddr_in sockaddr4; + socklen_t sockaddr4len = sizeof(sockaddr4); + + if (getsockname(socketFD, (struct sockaddr *)&sockaddr4, &sockaddr4len) < 0) + { + return nil; + } + return [[self class] hostFromSockaddr4:&sockaddr4]; +} + +- (NSString *)localHostFromSocket6:(int)socketFD +{ + struct sockaddr_in6 sockaddr6; + socklen_t sockaddr6len = sizeof(sockaddr6); + + if (getsockname(socketFD, (struct sockaddr *)&sockaddr6, &sockaddr6len) < 0) + { + return nil; + } + return [[self class] hostFromSockaddr6:&sockaddr6]; +} + +- (uint16_t)localPortFromSocket4:(int)socketFD +{ + struct sockaddr_in sockaddr4; + socklen_t sockaddr4len = sizeof(sockaddr4); + + if (getsockname(socketFD, (struct sockaddr *)&sockaddr4, &sockaddr4len) < 0) + { + return 0; + } + return [[self class] portFromSockaddr4:&sockaddr4]; +} + +- (uint16_t)localPortFromSocket6:(int)socketFD +{ + struct sockaddr_in6 sockaddr6; + socklen_t sockaddr6len = sizeof(sockaddr6); + + if (getsockname(socketFD, (struct sockaddr *)&sockaddr6, &sockaddr6len) < 0) + { + return 0; + } + return [[self class] portFromSockaddr6:&sockaddr6]; +} + +- (NSData *)connectedAddress +{ + __block NSData *result = nil; + + dispatch_block_t block = ^{ + if (self->socket4FD != SOCKET_NULL) + { + struct sockaddr_in sockaddr4; + socklen_t sockaddr4len = sizeof(sockaddr4); + + if (getpeername(self->socket4FD, (struct sockaddr *)&sockaddr4, &sockaddr4len) == 0) + { + result = [[NSData alloc] initWithBytes:&sockaddr4 length:sockaddr4len]; + } + } + + if (self->socket6FD != SOCKET_NULL) + { + struct sockaddr_in6 sockaddr6; + socklen_t sockaddr6len = sizeof(sockaddr6); + + if (getpeername(self->socket6FD, (struct sockaddr *)&sockaddr6, &sockaddr6len) == 0) + { + result = [[NSData alloc] initWithBytes:&sockaddr6 length:sockaddr6len]; + } + } + }; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_sync(socketQueue, block); + + return result; +} + +- (NSData *)localAddress +{ + __block NSData *result = nil; + + dispatch_block_t block = ^{ + if (self->socket4FD != SOCKET_NULL) + { + struct sockaddr_in sockaddr4; + socklen_t sockaddr4len = sizeof(sockaddr4); + + if (getsockname(self->socket4FD, (struct sockaddr *)&sockaddr4, &sockaddr4len) == 0) + { + result = [[NSData alloc] initWithBytes:&sockaddr4 length:sockaddr4len]; + } + } + + if (self->socket6FD != SOCKET_NULL) + { + struct sockaddr_in6 sockaddr6; + socklen_t sockaddr6len = sizeof(sockaddr6); + + if (getsockname(self->socket6FD, (struct sockaddr *)&sockaddr6, &sockaddr6len) == 0) + { + result = [[NSData alloc] initWithBytes:&sockaddr6 length:sockaddr6len]; + } + } + }; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_sync(socketQueue, block); + + return result; +} + +- (BOOL)isIPv4 +{ + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + return (socket4FD != SOCKET_NULL); + } + else + { + __block BOOL result = NO; + + dispatch_sync(socketQueue, ^{ + result = (self->socket4FD != SOCKET_NULL); + }); + + return result; + } +} + +- (BOOL)isIPv6 +{ + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + return (socket6FD != SOCKET_NULL); + } + else + { + __block BOOL result = NO; + + dispatch_sync(socketQueue, ^{ + result = (self->socket6FD != SOCKET_NULL); + }); + + return result; + } +} + +- (BOOL)isSecure +{ + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + return (flags & kSocketSecure) ? YES : NO; + } + else + { + __block BOOL result; + + dispatch_sync(socketQueue, ^{ + result = (self->flags & kSocketSecure) ? YES : NO; + }); + + return result; + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Utilities +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * Finds the address of an interface description. + * An inteface description may be an interface name (en0, en1, lo0) or corresponding IP (192.168.4.34). + * + * The interface description may optionally contain a port number at the end, separated by a colon. + * If a non-zero port parameter is provided, any port number in the interface description is ignored. + * + * The returned value is a 'struct sockaddr' wrapped in an NSMutableData object. +**/ +- (void)getInterfaceAddress4:(NSMutableData **)interfaceAddr4Ptr + address6:(NSMutableData **)interfaceAddr6Ptr + fromDescription:(NSString *)interfaceDescription + port:(uint16_t)port +{ + NSMutableData *addr4 = nil; + NSMutableData *addr6 = nil; + + NSString *interface = nil; + + NSArray *components = [interfaceDescription componentsSeparatedByString:@":"]; + if ([components count] > 0) + { + NSString *temp = [components objectAtIndex:0]; + if ([temp length] > 0) + { + interface = temp; + } + } + if ([components count] > 1 && port == 0) + { + NSString *temp = [components objectAtIndex:1]; + long portL = strtol([temp UTF8String], NULL, 10); + + if (portL > 0 && portL <= UINT16_MAX) + { + port = (uint16_t)portL; + } + } + + if (interface == nil) + { + // ANY address + + struct sockaddr_in sockaddr4; + memset(&sockaddr4, 0, sizeof(sockaddr4)); + + sockaddr4.sin_len = sizeof(sockaddr4); + sockaddr4.sin_family = AF_INET; + sockaddr4.sin_port = htons(port); + sockaddr4.sin_addr.s_addr = htonl(INADDR_ANY); + + struct sockaddr_in6 sockaddr6; + memset(&sockaddr6, 0, sizeof(sockaddr6)); + + sockaddr6.sin6_len = sizeof(sockaddr6); + sockaddr6.sin6_family = AF_INET6; + sockaddr6.sin6_port = htons(port); + sockaddr6.sin6_addr = in6addr_any; + + addr4 = [NSMutableData dataWithBytes:&sockaddr4 length:sizeof(sockaddr4)]; + addr6 = [NSMutableData dataWithBytes:&sockaddr6 length:sizeof(sockaddr6)]; + } + else if ([interface isEqualToString:@"localhost"] || [interface isEqualToString:@"loopback"]) + { + // LOOPBACK address + + struct sockaddr_in sockaddr4; + memset(&sockaddr4, 0, sizeof(sockaddr4)); + + sockaddr4.sin_len = sizeof(sockaddr4); + sockaddr4.sin_family = AF_INET; + sockaddr4.sin_port = htons(port); + sockaddr4.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + + struct sockaddr_in6 sockaddr6; + memset(&sockaddr6, 0, sizeof(sockaddr6)); + + sockaddr6.sin6_len = sizeof(sockaddr6); + sockaddr6.sin6_family = AF_INET6; + sockaddr6.sin6_port = htons(port); + sockaddr6.sin6_addr = in6addr_loopback; + + addr4 = [NSMutableData dataWithBytes:&sockaddr4 length:sizeof(sockaddr4)]; + addr6 = [NSMutableData dataWithBytes:&sockaddr6 length:sizeof(sockaddr6)]; + } + else + { + const char *iface = [interface UTF8String]; + + struct ifaddrs *addrs; + const struct ifaddrs *cursor; + + if ((getifaddrs(&addrs) == 0)) + { + cursor = addrs; + while (cursor != NULL) + { + if ((addr4 == nil) && (cursor->ifa_addr->sa_family == AF_INET)) + { + // IPv4 + + struct sockaddr_in nativeAddr4; + memcpy(&nativeAddr4, cursor->ifa_addr, sizeof(nativeAddr4)); + + if (strcmp(cursor->ifa_name, iface) == 0) + { + // Name match + + nativeAddr4.sin_port = htons(port); + + addr4 = [NSMutableData dataWithBytes:&nativeAddr4 length:sizeof(nativeAddr4)]; + } + else + { + char ip[INET_ADDRSTRLEN]; + + const char *conversion = inet_ntop(AF_INET, &nativeAddr4.sin_addr, ip, sizeof(ip)); + + if ((conversion != NULL) && (strcmp(ip, iface) == 0)) + { + // IP match + + nativeAddr4.sin_port = htons(port); + + addr4 = [NSMutableData dataWithBytes:&nativeAddr4 length:sizeof(nativeAddr4)]; + } + } + } + else if ((addr6 == nil) && (cursor->ifa_addr->sa_family == AF_INET6)) + { + // IPv6 + + struct sockaddr_in6 nativeAddr6; + memcpy(&nativeAddr6, cursor->ifa_addr, sizeof(nativeAddr6)); + + if (strcmp(cursor->ifa_name, iface) == 0) + { + // Name match + + nativeAddr6.sin6_port = htons(port); + + addr6 = [NSMutableData dataWithBytes:&nativeAddr6 length:sizeof(nativeAddr6)]; + } + else + { + char ip[INET6_ADDRSTRLEN]; + + const char *conversion = inet_ntop(AF_INET6, &nativeAddr6.sin6_addr, ip, sizeof(ip)); + + if ((conversion != NULL) && (strcmp(ip, iface) == 0)) + { + // IP match + + nativeAddr6.sin6_port = htons(port); + + addr6 = [NSMutableData dataWithBytes:&nativeAddr6 length:sizeof(nativeAddr6)]; + } + } + } + + cursor = cursor->ifa_next; + } + + freeifaddrs(addrs); + } + } + + if (interfaceAddr4Ptr) *interfaceAddr4Ptr = addr4; + if (interfaceAddr6Ptr) *interfaceAddr6Ptr = addr6; +} + +- (NSData *)getInterfaceAddressFromUrl:(NSURL *)url +{ + NSString *path = url.path; + if (path.length == 0) { + return nil; + } + + struct sockaddr_un nativeAddr; + nativeAddr.sun_family = AF_UNIX; + strlcpy(nativeAddr.sun_path, path.fileSystemRepresentation, sizeof(nativeAddr.sun_path)); + nativeAddr.sun_len = (unsigned char)SUN_LEN(&nativeAddr); + NSData *interface = [NSData dataWithBytes:&nativeAddr length:sizeof(struct sockaddr_un)]; + + return interface; +} + +- (void)setupReadAndWriteSourcesForNewlyConnectedSocket:(int)socketFD +{ + readSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, socketFD, 0, socketQueue); + writeSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_WRITE, socketFD, 0, socketQueue); + + // Setup event handlers + + __weak GCDAsyncSocket *weakSelf = self; + + dispatch_source_set_event_handler(readSource, ^{ @autoreleasepool { + #pragma clang diagnostic push + #pragma clang diagnostic warning "-Wimplicit-retain-self" + + __strong GCDAsyncSocket *strongSelf = weakSelf; + if (strongSelf == nil) return_from_block; + + LogVerbose(@"readEventBlock"); + + strongSelf->socketFDBytesAvailable = dispatch_source_get_data(strongSelf->readSource); + LogVerbose(@"socketFDBytesAvailable: %lu", strongSelf->socketFDBytesAvailable); + + if (strongSelf->socketFDBytesAvailable > 0) + [strongSelf doReadData]; + else + [strongSelf doReadEOF]; + + #pragma clang diagnostic pop + }}); + + dispatch_source_set_event_handler(writeSource, ^{ @autoreleasepool { + #pragma clang diagnostic push + #pragma clang diagnostic warning "-Wimplicit-retain-self" + + __strong GCDAsyncSocket *strongSelf = weakSelf; + if (strongSelf == nil) return_from_block; + + LogVerbose(@"writeEventBlock"); + + strongSelf->flags |= kSocketCanAcceptBytes; + [strongSelf doWriteData]; + + #pragma clang diagnostic pop + }}); + + // Setup cancel handlers + + __block int socketFDRefCount = 2; + + #if !OS_OBJECT_USE_OBJC + dispatch_source_t theReadSource = readSource; + dispatch_source_t theWriteSource = writeSource; + #endif + + dispatch_source_set_cancel_handler(readSource, ^{ + #pragma clang diagnostic push + #pragma clang diagnostic warning "-Wimplicit-retain-self" + + LogVerbose(@"readCancelBlock"); + + #if !OS_OBJECT_USE_OBJC + LogVerbose(@"dispatch_release(readSource)"); + dispatch_release(theReadSource); + #endif + + if (--socketFDRefCount == 0) + { + LogVerbose(@"close(socketFD)"); + close(socketFD); + } + + #pragma clang diagnostic pop + }); + + dispatch_source_set_cancel_handler(writeSource, ^{ + #pragma clang diagnostic push + #pragma clang diagnostic warning "-Wimplicit-retain-self" + + LogVerbose(@"writeCancelBlock"); + + #if !OS_OBJECT_USE_OBJC + LogVerbose(@"dispatch_release(writeSource)"); + dispatch_release(theWriteSource); + #endif + + if (--socketFDRefCount == 0) + { + LogVerbose(@"close(socketFD)"); + close(socketFD); + } + + #pragma clang diagnostic pop + }); + + // We will not be able to read until data arrives. + // But we should be able to write immediately. + + socketFDBytesAvailable = 0; + flags &= ~kReadSourceSuspended; + + LogVerbose(@"dispatch_resume(readSource)"); + dispatch_resume(readSource); + + flags |= kSocketCanAcceptBytes; + flags |= kWriteSourceSuspended; +} + +- (BOOL)usingCFStreamForTLS +{ + #if TARGET_OS_IPHONE + + if ((flags & kSocketSecure) && (flags & kUsingCFStreamForTLS)) + { + // The startTLS method was given the GCDAsyncSocketUseCFStreamForTLS flag. + + return YES; + } + + #endif + + return NO; +} + +- (BOOL)usingSecureTransportForTLS +{ + // Invoking this method is equivalent to ![self usingCFStreamForTLS] (just more readable) + + #if TARGET_OS_IPHONE + + if ((flags & kSocketSecure) && (flags & kUsingCFStreamForTLS)) + { + // The startTLS method was given the GCDAsyncSocketUseCFStreamForTLS flag. + + return NO; + } + + #endif + + return YES; +} + +- (void)suspendReadSource +{ + if (!(flags & kReadSourceSuspended)) + { + LogVerbose(@"dispatch_suspend(readSource)"); + + dispatch_suspend(readSource); + flags |= kReadSourceSuspended; + } +} + +- (void)resumeReadSource +{ + if (flags & kReadSourceSuspended) + { + LogVerbose(@"dispatch_resume(readSource)"); + + dispatch_resume(readSource); + flags &= ~kReadSourceSuspended; + } +} + +- (void)suspendWriteSource +{ + if (!(flags & kWriteSourceSuspended)) + { + LogVerbose(@"dispatch_suspend(writeSource)"); + + dispatch_suspend(writeSource); + flags |= kWriteSourceSuspended; + } +} + +- (void)resumeWriteSource +{ + if (flags & kWriteSourceSuspended) + { + LogVerbose(@"dispatch_resume(writeSource)"); + + dispatch_resume(writeSource); + flags &= ~kWriteSourceSuspended; + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Reading +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +- (void)readDataWithTimeout:(NSTimeInterval)timeout tag:(long)tag +{ + [self readDataWithTimeout:timeout buffer:nil bufferOffset:0 maxLength:0 tag:tag]; +} + +- (void)readDataWithTimeout:(NSTimeInterval)timeout + buffer:(NSMutableData *)buffer + bufferOffset:(NSUInteger)offset + tag:(long)tag +{ + [self readDataWithTimeout:timeout buffer:buffer bufferOffset:offset maxLength:0 tag:tag]; +} + +- (void)readDataWithTimeout:(NSTimeInterval)timeout + buffer:(NSMutableData *)buffer + bufferOffset:(NSUInteger)offset + maxLength:(NSUInteger)length + tag:(long)tag +{ + if (offset > [buffer length]) { + LogWarn(@"Cannot read: offset > [buffer length]"); + return; + } + + GCDAsyncReadPacket *packet = [[GCDAsyncReadPacket alloc] initWithData:buffer + startOffset:offset + maxLength:length + timeout:timeout + readLength:0 + terminator:nil + tag:tag]; + + dispatch_async(socketQueue, ^{ @autoreleasepool { + + LogTrace(); + + if ((self->flags & kSocketStarted) && !(self->flags & kForbidReadsWrites)) + { + [self->readQueue addObject:packet]; + [self maybeDequeueRead]; + } + }}); + + // Do not rely on the block being run in order to release the packet, + // as the queue might get released without the block completing. +} + +- (void)readDataToLength:(NSUInteger)length withTimeout:(NSTimeInterval)timeout tag:(long)tag +{ + [self readDataToLength:length withTimeout:timeout buffer:nil bufferOffset:0 tag:tag]; +} + +- (void)readDataToLength:(NSUInteger)length + withTimeout:(NSTimeInterval)timeout + buffer:(NSMutableData *)buffer + bufferOffset:(NSUInteger)offset + tag:(long)tag +{ + if (length == 0) { + LogWarn(@"Cannot read: length == 0"); + return; + } + if (offset > [buffer length]) { + LogWarn(@"Cannot read: offset > [buffer length]"); + return; + } + + GCDAsyncReadPacket *packet = [[GCDAsyncReadPacket alloc] initWithData:buffer + startOffset:offset + maxLength:0 + timeout:timeout + readLength:length + terminator:nil + tag:tag]; + + dispatch_async(socketQueue, ^{ @autoreleasepool { + + LogTrace(); + + if ((self->flags & kSocketStarted) && !(self->flags & kForbidReadsWrites)) + { + [self->readQueue addObject:packet]; + [self maybeDequeueRead]; + } + }}); + + // Do not rely on the block being run in order to release the packet, + // as the queue might get released without the block completing. +} + +- (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag +{ + [self readDataToData:data withTimeout:timeout buffer:nil bufferOffset:0 maxLength:0 tag:tag]; +} + +- (void)readDataToData:(NSData *)data + withTimeout:(NSTimeInterval)timeout + buffer:(NSMutableData *)buffer + bufferOffset:(NSUInteger)offset + tag:(long)tag +{ + [self readDataToData:data withTimeout:timeout buffer:buffer bufferOffset:offset maxLength:0 tag:tag]; +} + +- (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout maxLength:(NSUInteger)length tag:(long)tag +{ + [self readDataToData:data withTimeout:timeout buffer:nil bufferOffset:0 maxLength:length tag:tag]; +} + +- (void)readDataToData:(NSData *)data + withTimeout:(NSTimeInterval)timeout + buffer:(NSMutableData *)buffer + bufferOffset:(NSUInteger)offset + maxLength:(NSUInteger)maxLength + tag:(long)tag +{ + if ([data length] == 0) { + LogWarn(@"Cannot read: [data length] == 0"); + return; + } + if (offset > [buffer length]) { + LogWarn(@"Cannot read: offset > [buffer length]"); + return; + } + if (maxLength > 0 && maxLength < [data length]) { + LogWarn(@"Cannot read: maxLength > 0 && maxLength < [data length]"); + return; + } + + GCDAsyncReadPacket *packet = [[GCDAsyncReadPacket alloc] initWithData:buffer + startOffset:offset + maxLength:maxLength + timeout:timeout + readLength:0 + terminator:data + tag:tag]; + + dispatch_async(socketQueue, ^{ @autoreleasepool { + + LogTrace(); + + if ((self->flags & kSocketStarted) && !(self->flags & kForbidReadsWrites)) + { + [self->readQueue addObject:packet]; + [self maybeDequeueRead]; + } + }}); + + // Do not rely on the block being run in order to release the packet, + // as the queue might get released without the block completing. +} + +- (float)progressOfReadReturningTag:(long *)tagPtr bytesDone:(NSUInteger *)donePtr total:(NSUInteger *)totalPtr +{ + __block float result = 0.0F; + + dispatch_block_t block = ^{ + + if (!self->currentRead || ![self->currentRead isKindOfClass:[GCDAsyncReadPacket class]]) + { + // We're not reading anything right now. + + if (tagPtr != NULL) *tagPtr = 0; + if (donePtr != NULL) *donePtr = 0; + if (totalPtr != NULL) *totalPtr = 0; + + result = NAN; + } + else + { + // It's only possible to know the progress of our read if we're reading to a certain length. + // If we're reading to data, we of course have no idea when the data will arrive. + // If we're reading to timeout, then we have no idea when the next chunk of data will arrive. + + NSUInteger done = self->currentRead->bytesDone; + NSUInteger total = self->currentRead->readLength; + + if (tagPtr != NULL) *tagPtr = self->currentRead->tag; + if (donePtr != NULL) *donePtr = done; + if (totalPtr != NULL) *totalPtr = total; + + if (total > 0) + result = (float)done / (float)total; + else + result = 1.0F; + } + }; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_sync(socketQueue, block); + + return result; +} + +/** + * This method starts a new read, if needed. + * + * It is called when: + * - a user requests a read + * - after a read request has finished (to handle the next request) + * - immediately after the socket opens to handle any pending requests + * + * This method also handles auto-disconnect post read/write completion. +**/ +- (void)maybeDequeueRead +{ + LogTrace(); + NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); + + // If we're not currently processing a read AND we have an available read stream + if ((currentRead == nil) && (flags & kConnected)) + { + if ([readQueue count] > 0) + { + // Dequeue the next object in the write queue + currentRead = [readQueue objectAtIndex:0]; + [readQueue removeObjectAtIndex:0]; + + + if ([currentRead isKindOfClass:[GCDAsyncSpecialPacket class]]) + { + LogVerbose(@"Dequeued GCDAsyncSpecialPacket"); + + // Attempt to start TLS + flags |= kStartingReadTLS; + + // This method won't do anything unless both kStartingReadTLS and kStartingWriteTLS are set + [self maybeStartTLS]; + } + else + { + LogVerbose(@"Dequeued GCDAsyncReadPacket"); + + // Setup read timer (if needed) + [self setupReadTimerWithTimeout:currentRead->timeout]; + + // Immediately read, if possible + [self doReadData]; + } + } + else if (flags & kDisconnectAfterReads) + { + if (flags & kDisconnectAfterWrites) + { + if (([writeQueue count] == 0) && (currentWrite == nil)) + { + [self closeWithError:nil]; + } + } + else + { + [self closeWithError:nil]; + } + } + else if (flags & kSocketSecure) + { + [self flushSSLBuffers]; + + // Edge case: + // + // We just drained all data from the ssl buffers, + // and all known data from the socket (socketFDBytesAvailable). + // + // If we didn't get any data from this process, + // then we may have reached the end of the TCP stream. + // + // Be sure callbacks are enabled so we're notified about a disconnection. + + if ([preBuffer availableBytes] == 0) + { + if ([self usingCFStreamForTLS]) { + // Callbacks never disabled + } + else { + [self resumeReadSource]; + } + } + } + } +} + +- (void)flushSSLBuffers +{ + LogTrace(); + + NSAssert((flags & kSocketSecure), @"Cannot flush ssl buffers on non-secure socket"); + + if ([preBuffer availableBytes] > 0) + { + // Only flush the ssl buffers if the prebuffer is empty. + // This is to avoid growing the prebuffer inifinitely large. + + return; + } + + #if TARGET_OS_IPHONE + + if ([self usingCFStreamForTLS]) + { + if ((flags & kSecureSocketHasBytesAvailable) && CFReadStreamHasBytesAvailable(readStream)) + { + LogVerbose(@"%@ - Flushing ssl buffers into prebuffer...", THIS_METHOD); + + CFIndex defaultBytesToRead = (1024 * 4); + + [preBuffer ensureCapacityForWrite:defaultBytesToRead]; + + uint8_t *buffer = [preBuffer writeBuffer]; + + CFIndex result = CFReadStreamRead(readStream, buffer, defaultBytesToRead); + LogVerbose(@"%@ - CFReadStreamRead(): result = %i", THIS_METHOD, (int)result); + + if (result > 0) + { + [preBuffer didWrite:result]; + } + + flags &= ~kSecureSocketHasBytesAvailable; + } + + return; + } + + #endif + + __block NSUInteger estimatedBytesAvailable = 0; + + dispatch_block_t updateEstimatedBytesAvailable = ^{ + + // Figure out if there is any data available to be read + // + // socketFDBytesAvailable <- Number of encrypted bytes we haven't read from the bsd socket + // [sslPreBuffer availableBytes] <- Number of encrypted bytes we've buffered from bsd socket + // sslInternalBufSize <- Number of decrypted bytes SecureTransport has buffered + // + // We call the variable "estimated" because we don't know how many decrypted bytes we'll get + // from the encrypted bytes in the sslPreBuffer. + // However, we do know this is an upper bound on the estimation. + + estimatedBytesAvailable = self->socketFDBytesAvailable + [self->sslPreBuffer availableBytes]; + + size_t sslInternalBufSize = 0; + SSLGetBufferedReadSize(self->sslContext, &sslInternalBufSize); + + estimatedBytesAvailable += sslInternalBufSize; + }; + + updateEstimatedBytesAvailable(); + + if (estimatedBytesAvailable > 0) + { + LogVerbose(@"%@ - Flushing ssl buffers into prebuffer...", THIS_METHOD); + + BOOL done = NO; + do + { + LogVerbose(@"%@ - estimatedBytesAvailable = %lu", THIS_METHOD, (unsigned long)estimatedBytesAvailable); + + // Make sure there's enough room in the prebuffer + + [preBuffer ensureCapacityForWrite:estimatedBytesAvailable]; + + // Read data into prebuffer + + uint8_t *buffer = [preBuffer writeBuffer]; + size_t bytesRead = 0; + + OSStatus result = SSLRead(sslContext, buffer, (size_t)estimatedBytesAvailable, &bytesRead); + LogVerbose(@"%@ - read from secure socket = %u", THIS_METHOD, (unsigned)bytesRead); + + if (bytesRead > 0) + { + [preBuffer didWrite:bytesRead]; + } + + LogVerbose(@"%@ - prebuffer.length = %zu", THIS_METHOD, [preBuffer availableBytes]); + + if (result != noErr) + { + done = YES; + } + else + { + updateEstimatedBytesAvailable(); + } + + } while (!done && estimatedBytesAvailable > 0); + } +} + +- (void)doReadData +{ + LogTrace(); + + // This method is called on the socketQueue. + // It might be called directly, or via the readSource when data is available to be read. + + if ((currentRead == nil) || (flags & kReadsPaused)) + { + LogVerbose(@"No currentRead or kReadsPaused"); + + // Unable to read at this time + + if (flags & kSocketSecure) + { + // Here's the situation: + // + // We have an established secure connection. + // There may not be a currentRead, but there might be encrypted data sitting around for us. + // When the user does get around to issuing a read, that encrypted data will need to be decrypted. + // + // So why make the user wait? + // We might as well get a head start on decrypting some data now. + // + // The other reason we do this has to do with detecting a socket disconnection. + // The SSL/TLS protocol has it's own disconnection handshake. + // So when a secure socket is closed, a "goodbye" packet comes across the wire. + // We want to make sure we read the "goodbye" packet so we can properly detect the TCP disconnection. + + [self flushSSLBuffers]; + } + + if ([self usingCFStreamForTLS]) + { + // CFReadStream only fires once when there is available data. + // It won't fire again until we've invoked CFReadStreamRead. + } + else + { + // If the readSource is firing, we need to pause it + // or else it will continue to fire over and over again. + // + // If the readSource is not firing, + // we want it to continue monitoring the socket. + + if (socketFDBytesAvailable > 0) + { + [self suspendReadSource]; + } + } + return; + } + + BOOL hasBytesAvailable = NO; + unsigned long estimatedBytesAvailable = 0; + + if ([self usingCFStreamForTLS]) + { + #if TARGET_OS_IPHONE + + // Requested CFStream, rather than SecureTransport, for TLS (via GCDAsyncSocketUseCFStreamForTLS) + + estimatedBytesAvailable = 0; + if ((flags & kSecureSocketHasBytesAvailable) && CFReadStreamHasBytesAvailable(readStream)) + hasBytesAvailable = YES; + else + hasBytesAvailable = NO; + + #endif + } + else + { + estimatedBytesAvailable = socketFDBytesAvailable; + + if (flags & kSocketSecure) + { + // There are 2 buffers to be aware of here. + // + // We are using SecureTransport, a TLS/SSL security layer which sits atop TCP. + // We issue a read to the SecureTranport API, which in turn issues a read to our SSLReadFunction. + // Our SSLReadFunction then reads from the BSD socket and returns the encrypted data to SecureTransport. + // SecureTransport then decrypts the data, and finally returns the decrypted data back to us. + // + // The first buffer is one we create. + // SecureTransport often requests small amounts of data. + // This has to do with the encypted packets that are coming across the TCP stream. + // But it's non-optimal to do a bunch of small reads from the BSD socket. + // So our SSLReadFunction reads all available data from the socket (optimizing the sys call) + // and may store excess in the sslPreBuffer. + + estimatedBytesAvailable += [sslPreBuffer availableBytes]; + + // The second buffer is within SecureTransport. + // As mentioned earlier, there are encrypted packets coming across the TCP stream. + // SecureTransport needs the entire packet to decrypt it. + // But if the entire packet produces X bytes of decrypted data, + // and we only asked SecureTransport for X/2 bytes of data, + // it must store the extra X/2 bytes of decrypted data for the next read. + // + // The SSLGetBufferedReadSize function will tell us the size of this internal buffer. + // From the documentation: + // + // "This function does not block or cause any low-level read operations to occur." + + size_t sslInternalBufSize = 0; + SSLGetBufferedReadSize(sslContext, &sslInternalBufSize); + + estimatedBytesAvailable += sslInternalBufSize; + } + + hasBytesAvailable = (estimatedBytesAvailable > 0); + } + + if ((hasBytesAvailable == NO) && ([preBuffer availableBytes] == 0)) + { + LogVerbose(@"No data available to read..."); + + // No data available to read. + + if (![self usingCFStreamForTLS]) + { + // Need to wait for readSource to fire and notify us of + // available data in the socket's internal read buffer. + + [self resumeReadSource]; + } + return; + } + + if (flags & kStartingReadTLS) + { + LogVerbose(@"Waiting for SSL/TLS handshake to complete"); + + // The readQueue is waiting for SSL/TLS handshake to complete. + + if (flags & kStartingWriteTLS) + { + if ([self usingSecureTransportForTLS] && lastSSLHandshakeError == errSSLWouldBlock) + { + // We are in the process of a SSL Handshake. + // We were waiting for incoming data which has just arrived. + + [self ssl_continueSSLHandshake]; + } + } + else + { + // We are still waiting for the writeQueue to drain and start the SSL/TLS process. + // We now know data is available to read. + + if (![self usingCFStreamForTLS]) + { + // Suspend the read source or else it will continue to fire nonstop. + + [self suspendReadSource]; + } + } + + return; + } + + BOOL done = NO; // Completed read operation + NSError *error = nil; // Error occurred + + NSUInteger totalBytesReadForCurrentRead = 0; + + // + // STEP 1 - READ FROM PREBUFFER + // + + if ([preBuffer availableBytes] > 0) + { + // There are 3 types of read packets: + // + // 1) Read all available data. + // 2) Read a specific length of data. + // 3) Read up to a particular terminator. + + NSUInteger bytesToCopy; + + if (currentRead->term != nil) + { + // Read type #3 - read up to a terminator + + bytesToCopy = [currentRead readLengthForTermWithPreBuffer:preBuffer found:&done]; + } + else + { + // Read type #1 or #2 + + bytesToCopy = [currentRead readLengthForNonTermWithHint:[preBuffer availableBytes]]; + } + + // Make sure we have enough room in the buffer for our read. + + [currentRead ensureCapacityForAdditionalDataOfLength:bytesToCopy]; + + // Copy bytes from prebuffer into packet buffer + + uint8_t *buffer = (uint8_t *)[currentRead->buffer mutableBytes] + currentRead->startOffset + + currentRead->bytesDone; + + memcpy(buffer, [preBuffer readBuffer], bytesToCopy); + + // Remove the copied bytes from the preBuffer + [preBuffer didRead:bytesToCopy]; + + LogVerbose(@"copied(%lu) preBufferLength(%zu)", (unsigned long)bytesToCopy, [preBuffer availableBytes]); + + // Update totals + + currentRead->bytesDone += bytesToCopy; + totalBytesReadForCurrentRead += bytesToCopy; + + // Check to see if the read operation is done + + if (currentRead->readLength > 0) + { + // Read type #2 - read a specific length of data + + done = (currentRead->bytesDone == currentRead->readLength); + } + else if (currentRead->term != nil) + { + // Read type #3 - read up to a terminator + + // Our 'done' variable was updated via the readLengthForTermWithPreBuffer:found: method + + if (!done && currentRead->maxLength > 0) + { + // We're not done and there's a set maxLength. + // Have we reached that maxLength yet? + + if (currentRead->bytesDone >= currentRead->maxLength) + { + error = [self readMaxedOutError]; + } + } + } + else + { + // Read type #1 - read all available data + // + // We're done as soon as + // - we've read all available data (in prebuffer and socket) + // - we've read the maxLength of read packet. + + done = ((currentRead->maxLength > 0) && (currentRead->bytesDone == currentRead->maxLength)); + } + + } + + // + // STEP 2 - READ FROM SOCKET + // + + BOOL socketEOF = (flags & kSocketHasReadEOF) ? YES : NO; // Nothing more to read via socket (end of file) + BOOL waiting = !done && !error && !socketEOF && !hasBytesAvailable; // Ran out of data, waiting for more + + if (!done && !error && !socketEOF && hasBytesAvailable) + { + NSAssert(([preBuffer availableBytes] == 0), @"Invalid logic"); + + BOOL readIntoPreBuffer = NO; + uint8_t *buffer = NULL; + size_t bytesRead = 0; + + if (flags & kSocketSecure) + { + if ([self usingCFStreamForTLS]) + { + #if TARGET_OS_IPHONE + + // Using CFStream, rather than SecureTransport, for TLS + + NSUInteger defaultReadLength = (1024 * 32); + + NSUInteger bytesToRead = [currentRead optimalReadLengthWithDefault:defaultReadLength + shouldPreBuffer:&readIntoPreBuffer]; + + // Make sure we have enough room in the buffer for our read. + // + // We are either reading directly into the currentRead->buffer, + // or we're reading into the temporary preBuffer. + + if (readIntoPreBuffer) + { + [preBuffer ensureCapacityForWrite:bytesToRead]; + + buffer = [preBuffer writeBuffer]; + } + else + { + [currentRead ensureCapacityForAdditionalDataOfLength:bytesToRead]; + + buffer = (uint8_t *)[currentRead->buffer mutableBytes] + + currentRead->startOffset + + currentRead->bytesDone; + } + + // Read data into buffer + + CFIndex result = CFReadStreamRead(readStream, buffer, (CFIndex)bytesToRead); + LogVerbose(@"CFReadStreamRead(): result = %i", (int)result); + + if (result < 0) + { + error = (__bridge_transfer NSError *)CFReadStreamCopyError(readStream); + } + else if (result == 0) + { + socketEOF = YES; + } + else + { + waiting = YES; + bytesRead = (size_t)result; + } + + // We only know how many decrypted bytes were read. + // The actual number of bytes read was likely more due to the overhead of the encryption. + // So we reset our flag, and rely on the next callback to alert us of more data. + flags &= ~kSecureSocketHasBytesAvailable; + + #endif + } + else + { + // Using SecureTransport for TLS + // + // We know: + // - how many bytes are available on the socket + // - how many encrypted bytes are sitting in the sslPreBuffer + // - how many decypted bytes are sitting in the sslContext + // + // But we do NOT know: + // - how many encypted bytes are sitting in the sslContext + // + // So we play the regular game of using an upper bound instead. + + NSUInteger defaultReadLength = (1024 * 32); + + if (defaultReadLength < estimatedBytesAvailable) { + defaultReadLength = estimatedBytesAvailable + (1024 * 16); + } + + NSUInteger bytesToRead = [currentRead optimalReadLengthWithDefault:defaultReadLength + shouldPreBuffer:&readIntoPreBuffer]; + + if (bytesToRead > SIZE_MAX) { // NSUInteger may be bigger than size_t + bytesToRead = SIZE_MAX; + } + + // Make sure we have enough room in the buffer for our read. + // + // We are either reading directly into the currentRead->buffer, + // or we're reading into the temporary preBuffer. + + if (readIntoPreBuffer) + { + [preBuffer ensureCapacityForWrite:bytesToRead]; + + buffer = [preBuffer writeBuffer]; + } + else + { + [currentRead ensureCapacityForAdditionalDataOfLength:bytesToRead]; + + buffer = (uint8_t *)[currentRead->buffer mutableBytes] + + currentRead->startOffset + + currentRead->bytesDone; + } + + // The documentation from Apple states: + // + // "a read operation might return errSSLWouldBlock, + // indicating that less data than requested was actually transferred" + // + // However, starting around 10.7, the function will sometimes return noErr, + // even if it didn't read as much data as requested. So we need to watch out for that. + + OSStatus result; + do + { + void *loop_buffer = buffer + bytesRead; + size_t loop_bytesToRead = (size_t)bytesToRead - bytesRead; + size_t loop_bytesRead = 0; + + result = SSLRead(sslContext, loop_buffer, loop_bytesToRead, &loop_bytesRead); + LogVerbose(@"read from secure socket = %u", (unsigned)loop_bytesRead); + + bytesRead += loop_bytesRead; + + } while ((result == noErr) && (bytesRead < bytesToRead)); + + + if (result != noErr) + { + if (result == errSSLWouldBlock) + waiting = YES; + else + { + if (result == errSSLClosedGraceful || result == errSSLClosedAbort) + { + // We've reached the end of the stream. + // Handle this the same way we would an EOF from the socket. + socketEOF = YES; + sslErrCode = result; + } + else + { + error = [self sslError:result]; + } + } + // It's possible that bytesRead > 0, even if the result was errSSLWouldBlock. + // This happens when the SSLRead function is able to read some data, + // but not the entire amount we requested. + + if (bytesRead <= 0) + { + bytesRead = 0; + } + } + + // Do not modify socketFDBytesAvailable. + // It will be updated via the SSLReadFunction(). + } + } + else + { + // Normal socket operation + + NSUInteger bytesToRead; + + // There are 3 types of read packets: + // + // 1) Read all available data. + // 2) Read a specific length of data. + // 3) Read up to a particular terminator. + + if (currentRead->term != nil) + { + // Read type #3 - read up to a terminator + + bytesToRead = [currentRead readLengthForTermWithHint:estimatedBytesAvailable + shouldPreBuffer:&readIntoPreBuffer]; + } + else + { + // Read type #1 or #2 + + bytesToRead = [currentRead readLengthForNonTermWithHint:estimatedBytesAvailable]; + } + + if (bytesToRead > SIZE_MAX) { // NSUInteger may be bigger than size_t (read param 3) + bytesToRead = SIZE_MAX; + } + + // Make sure we have enough room in the buffer for our read. + // + // We are either reading directly into the currentRead->buffer, + // or we're reading into the temporary preBuffer. + + if (readIntoPreBuffer) + { + [preBuffer ensureCapacityForWrite:bytesToRead]; + + buffer = [preBuffer writeBuffer]; + } + else + { + [currentRead ensureCapacityForAdditionalDataOfLength:bytesToRead]; + + buffer = (uint8_t *)[currentRead->buffer mutableBytes] + + currentRead->startOffset + + currentRead->bytesDone; + } + + // Read data into buffer + + int socketFD = (socket4FD != SOCKET_NULL) ? socket4FD : (socket6FD != SOCKET_NULL) ? socket6FD : socketUN; + + ssize_t result = read(socketFD, buffer, (size_t)bytesToRead); + LogVerbose(@"read from socket = %i", (int)result); + + if (result < 0) + { + if (errno == EWOULDBLOCK) + waiting = YES; + else + error = [self errorWithErrno:errno reason:@"Error in read() function"]; + + socketFDBytesAvailable = 0; + } + else if (result == 0) + { + socketEOF = YES; + socketFDBytesAvailable = 0; + } + else + { + bytesRead = result; + + if (bytesRead < bytesToRead) + { + // The read returned less data than requested. + // This means socketFDBytesAvailable was a bit off due to timing, + // because we read from the socket right when the readSource event was firing. + socketFDBytesAvailable = 0; + } + else + { + if (socketFDBytesAvailable <= bytesRead) + socketFDBytesAvailable = 0; + else + socketFDBytesAvailable -= bytesRead; + } + + if (socketFDBytesAvailable == 0) + { + waiting = YES; + } + } + } + + if (bytesRead > 0) + { + // Check to see if the read operation is done + + if (currentRead->readLength > 0) + { + // Read type #2 - read a specific length of data + // + // Note: We should never be using a prebuffer when we're reading a specific length of data. + + NSAssert(readIntoPreBuffer == NO, @"Invalid logic"); + + currentRead->bytesDone += bytesRead; + totalBytesReadForCurrentRead += bytesRead; + + done = (currentRead->bytesDone == currentRead->readLength); + } + else if (currentRead->term != nil) + { + // Read type #3 - read up to a terminator + + if (readIntoPreBuffer) + { + // We just read a big chunk of data into the preBuffer + + [preBuffer didWrite:bytesRead]; + LogVerbose(@"read data into preBuffer - preBuffer.length = %zu", [preBuffer availableBytes]); + + // Search for the terminating sequence + + NSUInteger bytesToCopy = [currentRead readLengthForTermWithPreBuffer:preBuffer found:&done]; + LogVerbose(@"copying %lu bytes from preBuffer", (unsigned long)bytesToCopy); + + // Ensure there's room on the read packet's buffer + + [currentRead ensureCapacityForAdditionalDataOfLength:bytesToCopy]; + + // Copy bytes from prebuffer into read buffer + + uint8_t *readBuf = (uint8_t *)[currentRead->buffer mutableBytes] + currentRead->startOffset + + currentRead->bytesDone; + + memcpy(readBuf, [preBuffer readBuffer], bytesToCopy); + + // Remove the copied bytes from the prebuffer + [preBuffer didRead:bytesToCopy]; + LogVerbose(@"preBuffer.length = %zu", [preBuffer availableBytes]); + + // Update totals + currentRead->bytesDone += bytesToCopy; + totalBytesReadForCurrentRead += bytesToCopy; + + // Our 'done' variable was updated via the readLengthForTermWithPreBuffer:found: method above + } + else + { + // We just read a big chunk of data directly into the packet's buffer. + // We need to move any overflow into the prebuffer. + + NSInteger overflow = [currentRead searchForTermAfterPreBuffering:bytesRead]; + + if (overflow == 0) + { + // Perfect match! + // Every byte we read stays in the read buffer, + // and the last byte we read was the last byte of the term. + + currentRead->bytesDone += bytesRead; + totalBytesReadForCurrentRead += bytesRead; + done = YES; + } + else if (overflow > 0) + { + // The term was found within the data that we read, + // and there are extra bytes that extend past the end of the term. + // We need to move these excess bytes out of the read packet and into the prebuffer. + + NSInteger underflow = bytesRead - overflow; + + // Copy excess data into preBuffer + + LogVerbose(@"copying %ld overflow bytes into preBuffer", (long)overflow); + [preBuffer ensureCapacityForWrite:overflow]; + + uint8_t *overflowBuffer = buffer + underflow; + memcpy([preBuffer writeBuffer], overflowBuffer, overflow); + + [preBuffer didWrite:overflow]; + LogVerbose(@"preBuffer.length = %zu", [preBuffer availableBytes]); + + // Note: The completeCurrentRead method will trim the buffer for us. + + currentRead->bytesDone += underflow; + totalBytesReadForCurrentRead += underflow; + done = YES; + } + else + { + // The term was not found within the data that we read. + + currentRead->bytesDone += bytesRead; + totalBytesReadForCurrentRead += bytesRead; + done = NO; + } + } + + if (!done && currentRead->maxLength > 0) + { + // We're not done and there's a set maxLength. + // Have we reached that maxLength yet? + + if (currentRead->bytesDone >= currentRead->maxLength) + { + error = [self readMaxedOutError]; + } + } + } + else + { + // Read type #1 - read all available data + + if (readIntoPreBuffer) + { + // We just read a chunk of data into the preBuffer + + [preBuffer didWrite:bytesRead]; + + // Now copy the data into the read packet. + // + // Recall that we didn't read directly into the packet's buffer to avoid + // over-allocating memory since we had no clue how much data was available to be read. + // + // Ensure there's room on the read packet's buffer + + [currentRead ensureCapacityForAdditionalDataOfLength:bytesRead]; + + // Copy bytes from prebuffer into read buffer + + uint8_t *readBuf = (uint8_t *)[currentRead->buffer mutableBytes] + currentRead->startOffset + + currentRead->bytesDone; + + memcpy(readBuf, [preBuffer readBuffer], bytesRead); + + // Remove the copied bytes from the prebuffer + [preBuffer didRead:bytesRead]; + + // Update totals + currentRead->bytesDone += bytesRead; + totalBytesReadForCurrentRead += bytesRead; + } + else + { + currentRead->bytesDone += bytesRead; + totalBytesReadForCurrentRead += bytesRead; + } + + done = YES; + } + + } // if (bytesRead > 0) + + } // if (!done && !error && !socketEOF && hasBytesAvailable) + + + if (!done && currentRead->readLength == 0 && currentRead->term == nil) + { + // Read type #1 - read all available data + // + // We might arrive here if we read data from the prebuffer but not from the socket. + + done = (totalBytesReadForCurrentRead > 0); + } + + // Check to see if we're done, or if we've made progress + + if (done) + { + [self completeCurrentRead]; + + if (!error && (!socketEOF || [preBuffer availableBytes] > 0)) + { + [self maybeDequeueRead]; + } + } + else if (totalBytesReadForCurrentRead > 0) + { + // We're not done read type #2 or #3 yet, but we have read in some bytes + // + // We ensure that `waiting` is set in order to resume the readSource (if it is suspended). It is + // possible to reach this point and `waiting` not be set, if the current read's length is + // sufficiently large. In that case, we may have read to some upperbound successfully, but + // that upperbound could be smaller than the desired length. + waiting = YES; + + __strong id theDelegate = delegate; + + if (delegateQueue && [theDelegate respondsToSelector:@selector(socket:didReadPartialDataOfLength:tag:)]) + { + long theReadTag = currentRead->tag; + + dispatch_async(delegateQueue, ^{ @autoreleasepool { + + [theDelegate socket:self didReadPartialDataOfLength:totalBytesReadForCurrentRead tag:theReadTag]; + }}); + } + } + + // Check for errors + + if (error) + { + [self closeWithError:error]; + } + else if (socketEOF) + { + [self doReadEOF]; + } + else if (waiting) + { + if (![self usingCFStreamForTLS]) + { + // Monitor the socket for readability (if we're not already doing so) + [self resumeReadSource]; + } + } + + // Do not add any code here without first adding return statements in the error cases above. +} + +- (void)doReadEOF +{ + LogTrace(); + + // This method may be called more than once. + // If the EOF is read while there is still data in the preBuffer, + // then this method may be called continually after invocations of doReadData to see if it's time to disconnect. + + flags |= kSocketHasReadEOF; + + if (flags & kSocketSecure) + { + // If the SSL layer has any buffered data, flush it into the preBuffer now. + + [self flushSSLBuffers]; + } + + BOOL shouldDisconnect = NO; + NSError *error = nil; + + if ((flags & kStartingReadTLS) || (flags & kStartingWriteTLS)) + { + // We received an EOF during or prior to startTLS. + // The SSL/TLS handshake is now impossible, so this is an unrecoverable situation. + + shouldDisconnect = YES; + + if ([self usingSecureTransportForTLS]) + { + error = [self sslError:errSSLClosedAbort]; + } + } + else if (flags & kReadStreamClosed) + { + // The preBuffer has already been drained. + // The config allows half-duplex connections. + // We've previously checked the socket, and it appeared writeable. + // So we marked the read stream as closed and notified the delegate. + // + // As per the half-duplex contract, the socket will be closed when a write fails, + // or when the socket is manually closed. + + shouldDisconnect = NO; + } + else if ([preBuffer availableBytes] > 0) + { + LogVerbose(@"Socket reached EOF, but there is still data available in prebuffer"); + + // Although we won't be able to read any more data from the socket, + // there is existing data that has been prebuffered that we can read. + + shouldDisconnect = NO; + } + else if (config & kAllowHalfDuplexConnection) + { + // We just received an EOF (end of file) from the socket's read stream. + // This means the remote end of the socket (the peer we're connected to) + // has explicitly stated that it will not be sending us any more data. + // + // Query the socket to see if it is still writeable. (Perhaps the peer will continue reading data from us) + + int socketFD = (socket4FD != SOCKET_NULL) ? socket4FD : (socket6FD != SOCKET_NULL) ? socket6FD : socketUN; + + struct pollfd pfd[1]; + pfd[0].fd = socketFD; + pfd[0].events = POLLOUT; + pfd[0].revents = 0; + + poll(pfd, 1, 0); + + if (pfd[0].revents & POLLOUT) + { + // Socket appears to still be writeable + + shouldDisconnect = NO; + flags |= kReadStreamClosed; + + // Notify the delegate that we're going half-duplex + + __strong id theDelegate = delegate; + + if (delegateQueue && [theDelegate respondsToSelector:@selector(socketDidCloseReadStream:)]) + { + dispatch_async(delegateQueue, ^{ @autoreleasepool { + + [theDelegate socketDidCloseReadStream:self]; + }}); + } + } + else + { + shouldDisconnect = YES; + } + } + else + { + shouldDisconnect = YES; + } + + + if (shouldDisconnect) + { + if (error == nil) + { + if ([self usingSecureTransportForTLS]) + { + if (sslErrCode != noErr && sslErrCode != errSSLClosedGraceful) + { + error = [self sslError:sslErrCode]; + } + else + { + error = [self connectionClosedError]; + } + } + else + { + error = [self connectionClosedError]; + } + } + [self closeWithError:error]; + } + else + { + if (![self usingCFStreamForTLS]) + { + // Suspend the read source (if needed) + + [self suspendReadSource]; + } + } +} + +- (void)completeCurrentRead +{ + LogTrace(); + + NSAssert(currentRead, @"Trying to complete current read when there is no current read."); + + + NSData *result = nil; + + if (currentRead->bufferOwner) + { + // We created the buffer on behalf of the user. + // Trim our buffer to be the proper size. + [currentRead->buffer setLength:currentRead->bytesDone]; + + result = currentRead->buffer; + } + else + { + // We did NOT create the buffer. + // The buffer is owned by the caller. + // Only trim the buffer if we had to increase its size. + + if ([currentRead->buffer length] > currentRead->originalBufferLength) + { + NSUInteger readSize = currentRead->startOffset + currentRead->bytesDone; + NSUInteger origSize = currentRead->originalBufferLength; + + NSUInteger buffSize = MAX(readSize, origSize); + + [currentRead->buffer setLength:buffSize]; + } + + uint8_t *buffer = (uint8_t *)[currentRead->buffer mutableBytes] + currentRead->startOffset; + + result = [NSData dataWithBytesNoCopy:buffer length:currentRead->bytesDone freeWhenDone:NO]; + } + + __strong id theDelegate = delegate; + + if (delegateQueue && [theDelegate respondsToSelector:@selector(socket:didReadData:withTag:)]) + { + GCDAsyncReadPacket *theRead = currentRead; // Ensure currentRead retained since result may not own buffer + + dispatch_async(delegateQueue, ^{ @autoreleasepool { + + [theDelegate socket:self didReadData:result withTag:theRead->tag]; + }}); + } + + [self endCurrentRead]; +} + +- (void)endCurrentRead +{ + if (readTimer) + { + dispatch_source_cancel(readTimer); + readTimer = NULL; + } + + currentRead = nil; +} + +- (void)setupReadTimerWithTimeout:(NSTimeInterval)timeout +{ + if (timeout >= 0.0) + { + readTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, socketQueue); + + __weak GCDAsyncSocket *weakSelf = self; + + dispatch_source_set_event_handler(readTimer, ^{ @autoreleasepool { + #pragma clang diagnostic push + #pragma clang diagnostic warning "-Wimplicit-retain-self" + + __strong GCDAsyncSocket *strongSelf = weakSelf; + if (strongSelf == nil) return_from_block; + + [strongSelf doReadTimeout]; + + #pragma clang diagnostic pop + }}); + + #if !OS_OBJECT_USE_OBJC + dispatch_source_t theReadTimer = readTimer; + dispatch_source_set_cancel_handler(readTimer, ^{ + #pragma clang diagnostic push + #pragma clang diagnostic warning "-Wimplicit-retain-self" + + LogVerbose(@"dispatch_release(readTimer)"); + dispatch_release(theReadTimer); + + #pragma clang diagnostic pop + }); + #endif + + dispatch_time_t tt = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeout * NSEC_PER_SEC)); + + dispatch_source_set_timer(readTimer, tt, DISPATCH_TIME_FOREVER, 0); + dispatch_resume(readTimer); + } +} + +- (void)doReadTimeout +{ + // This is a little bit tricky. + // Ideally we'd like to synchronously query the delegate about a timeout extension. + // But if we do so synchronously we risk a possible deadlock. + // So instead we have to do so asynchronously, and callback to ourselves from within the delegate block. + + flags |= kReadsPaused; + + __strong id theDelegate = delegate; + + if (delegateQueue && [theDelegate respondsToSelector:@selector(socket:shouldTimeoutReadWithTag:elapsed:bytesDone:)]) + { + GCDAsyncReadPacket *theRead = currentRead; + + dispatch_async(delegateQueue, ^{ @autoreleasepool { + + NSTimeInterval timeoutExtension = 0.0; + + timeoutExtension = [theDelegate socket:self shouldTimeoutReadWithTag:theRead->tag + elapsed:theRead->timeout + bytesDone:theRead->bytesDone]; + + dispatch_async(self->socketQueue, ^{ @autoreleasepool { + + [self doReadTimeoutWithExtension:timeoutExtension]; + }}); + }}); + } + else + { + [self doReadTimeoutWithExtension:0.0]; + } +} + +- (void)doReadTimeoutWithExtension:(NSTimeInterval)timeoutExtension +{ + if (currentRead) + { + if (timeoutExtension > 0.0) + { + currentRead->timeout += timeoutExtension; + + // Reschedule the timer + dispatch_time_t tt = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeoutExtension * NSEC_PER_SEC)); + dispatch_source_set_timer(readTimer, tt, DISPATCH_TIME_FOREVER, 0); + + // Unpause reads, and continue + flags &= ~kReadsPaused; + [self doReadData]; + } + else + { + LogVerbose(@"ReadTimeout"); + + [self closeWithError:[self readTimeoutError]]; + } + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Writing +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +- (void)writeData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag +{ + if ([data length] == 0) return; + + GCDAsyncWritePacket *packet = [[GCDAsyncWritePacket alloc] initWithData:data timeout:timeout tag:tag]; + + dispatch_async(socketQueue, ^{ @autoreleasepool { + + LogTrace(); + + if ((self->flags & kSocketStarted) && !(self->flags & kForbidReadsWrites)) + { + [self->writeQueue addObject:packet]; + [self maybeDequeueWrite]; + } + }}); + + // Do not rely on the block being run in order to release the packet, + // as the queue might get released without the block completing. +} + +- (float)progressOfWriteReturningTag:(long *)tagPtr bytesDone:(NSUInteger *)donePtr total:(NSUInteger *)totalPtr +{ + __block float result = 0.0F; + + dispatch_block_t block = ^{ + + if (!self->currentWrite || ![self->currentWrite isKindOfClass:[GCDAsyncWritePacket class]]) + { + // We're not writing anything right now. + + if (tagPtr != NULL) *tagPtr = 0; + if (donePtr != NULL) *donePtr = 0; + if (totalPtr != NULL) *totalPtr = 0; + + result = NAN; + } + else + { + NSUInteger done = self->currentWrite->bytesDone; + NSUInteger total = [self->currentWrite->buffer length]; + + if (tagPtr != NULL) *tagPtr = self->currentWrite->tag; + if (donePtr != NULL) *donePtr = done; + if (totalPtr != NULL) *totalPtr = total; + + result = (float)done / (float)total; + } + }; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_sync(socketQueue, block); + + return result; +} + +/** + * Conditionally starts a new write. + * + * It is called when: + * - a user requests a write + * - after a write request has finished (to handle the next request) + * - immediately after the socket opens to handle any pending requests + * + * This method also handles auto-disconnect post read/write completion. +**/ +- (void)maybeDequeueWrite +{ + LogTrace(); + NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); + + + // If we're not currently processing a write AND we have an available write stream + if ((currentWrite == nil) && (flags & kConnected)) + { + if ([writeQueue count] > 0) + { + // Dequeue the next object in the write queue + currentWrite = [writeQueue objectAtIndex:0]; + [writeQueue removeObjectAtIndex:0]; + + + if ([currentWrite isKindOfClass:[GCDAsyncSpecialPacket class]]) + { + LogVerbose(@"Dequeued GCDAsyncSpecialPacket"); + + // Attempt to start TLS + flags |= kStartingWriteTLS; + + // This method won't do anything unless both kStartingReadTLS and kStartingWriteTLS are set + [self maybeStartTLS]; + } + else + { + LogVerbose(@"Dequeued GCDAsyncWritePacket"); + + // Setup write timer (if needed) + [self setupWriteTimerWithTimeout:currentWrite->timeout]; + + // Immediately write, if possible + [self doWriteData]; + } + } + else if (flags & kDisconnectAfterWrites) + { + if (flags & kDisconnectAfterReads) + { + if (([readQueue count] == 0) && (currentRead == nil)) + { + [self closeWithError:nil]; + } + } + else + { + [self closeWithError:nil]; + } + } + } +} + +- (void)doWriteData +{ + LogTrace(); + + // This method is called by the writeSource via the socketQueue + + if ((currentWrite == nil) || (flags & kWritesPaused)) + { + LogVerbose(@"No currentWrite or kWritesPaused"); + + // Unable to write at this time + + if ([self usingCFStreamForTLS]) + { + // CFWriteStream only fires once when there is available data. + // It won't fire again until we've invoked CFWriteStreamWrite. + } + else + { + // If the writeSource is firing, we need to pause it + // or else it will continue to fire over and over again. + + if (flags & kSocketCanAcceptBytes) + { + [self suspendWriteSource]; + } + } + return; + } + + if (!(flags & kSocketCanAcceptBytes)) + { + LogVerbose(@"No space available to write..."); + + // No space available to write. + + if (![self usingCFStreamForTLS]) + { + // Need to wait for writeSource to fire and notify us of + // available space in the socket's internal write buffer. + + [self resumeWriteSource]; + } + return; + } + + if (flags & kStartingWriteTLS) + { + LogVerbose(@"Waiting for SSL/TLS handshake to complete"); + + // The writeQueue is waiting for SSL/TLS handshake to complete. + + if (flags & kStartingReadTLS) + { + if ([self usingSecureTransportForTLS] && lastSSLHandshakeError == errSSLWouldBlock) + { + // We are in the process of a SSL Handshake. + // We were waiting for available space in the socket's internal OS buffer to continue writing. + + [self ssl_continueSSLHandshake]; + } + } + else + { + // We are still waiting for the readQueue to drain and start the SSL/TLS process. + // We now know we can write to the socket. + + if (![self usingCFStreamForTLS]) + { + // Suspend the write source or else it will continue to fire nonstop. + + [self suspendWriteSource]; + } + } + + return; + } + + // Note: This method is not called if currentWrite is a GCDAsyncSpecialPacket (startTLS packet) + + BOOL waiting = NO; + NSError *error = nil; + size_t bytesWritten = 0; + + if (flags & kSocketSecure) + { + if ([self usingCFStreamForTLS]) + { + #if TARGET_OS_IPHONE + + // + // Writing data using CFStream (over internal TLS) + // + + const uint8_t *buffer = (const uint8_t *)[currentWrite->buffer bytes] + currentWrite->bytesDone; + + NSUInteger bytesToWrite = [currentWrite->buffer length] - currentWrite->bytesDone; + + if (bytesToWrite > SIZE_MAX) // NSUInteger may be bigger than size_t (write param 3) + { + bytesToWrite = SIZE_MAX; + } + + CFIndex result = CFWriteStreamWrite(writeStream, buffer, (CFIndex)bytesToWrite); + LogVerbose(@"CFWriteStreamWrite(%lu) = %li", (unsigned long)bytesToWrite, result); + + if (result < 0) + { + error = (__bridge_transfer NSError *)CFWriteStreamCopyError(writeStream); + } + else + { + bytesWritten = (size_t)result; + + // We always set waiting to true in this scenario. + // CFStream may have altered our underlying socket to non-blocking. + // Thus if we attempt to write without a callback, we may end up blocking our queue. + waiting = YES; + } + + #endif + } + else + { + // We're going to use the SSLWrite function. + // + // OSStatus SSLWrite(SSLContextRef context, const void *data, size_t dataLength, size_t *processed) + // + // Parameters: + // context - An SSL session context reference. + // data - A pointer to the buffer of data to write. + // dataLength - The amount, in bytes, of data to write. + // processed - On return, the length, in bytes, of the data actually written. + // + // It sounds pretty straight-forward, + // but there are a few caveats you should be aware of. + // + // The SSLWrite method operates in a non-obvious (and rather annoying) manner. + // According to the documentation: + // + // Because you may configure the underlying connection to operate in a non-blocking manner, + // a write operation might return errSSLWouldBlock, indicating that less data than requested + // was actually transferred. In this case, you should repeat the call to SSLWrite until some + // other result is returned. + // + // This sounds perfect, but when our SSLWriteFunction returns errSSLWouldBlock, + // then the SSLWrite method returns (with the proper errSSLWouldBlock return value), + // but it sets processed to dataLength !! + // + // In other words, if the SSLWrite function doesn't completely write all the data we tell it to, + // then it doesn't tell us how many bytes were actually written. So, for example, if we tell it to + // write 256 bytes then it might actually write 128 bytes, but then report 0 bytes written. + // + // You might be wondering: + // If the SSLWrite function doesn't tell us how many bytes were written, + // then how in the world are we supposed to update our parameters (buffer & bytesToWrite) + // for the next time we invoke SSLWrite? + // + // The answer is that SSLWrite cached all the data we told it to write, + // and it will push out that data next time we call SSLWrite. + // If we call SSLWrite with new data, it will push out the cached data first, and then the new data. + // If we call SSLWrite with empty data, then it will simply push out the cached data. + // + // For this purpose we're going to break large writes into a series of smaller writes. + // This allows us to report progress back to the delegate. + + OSStatus result; + + BOOL hasCachedDataToWrite = (sslWriteCachedLength > 0); + BOOL hasNewDataToWrite = YES; + + if (hasCachedDataToWrite) + { + size_t processed = 0; + + result = SSLWrite(sslContext, NULL, 0, &processed); + + if (result == noErr) + { + bytesWritten = sslWriteCachedLength; + sslWriteCachedLength = 0; + + if ([currentWrite->buffer length] == (currentWrite->bytesDone + bytesWritten)) + { + // We've written all data for the current write. + hasNewDataToWrite = NO; + } + } + else + { + if (result == errSSLWouldBlock) + { + waiting = YES; + } + else + { + error = [self sslError:result]; + } + + // Can't write any new data since we were unable to write the cached data. + hasNewDataToWrite = NO; + } + } + + if (hasNewDataToWrite) + { + const uint8_t *buffer = (const uint8_t *)[currentWrite->buffer bytes] + + currentWrite->bytesDone + + bytesWritten; + + NSUInteger bytesToWrite = [currentWrite->buffer length] - currentWrite->bytesDone - bytesWritten; + + if (bytesToWrite > SIZE_MAX) // NSUInteger may be bigger than size_t (write param 3) + { + bytesToWrite = SIZE_MAX; + } + + size_t bytesRemaining = bytesToWrite; + + BOOL keepLooping = YES; + while (keepLooping) + { + const size_t sslMaxBytesToWrite = 32768; + size_t sslBytesToWrite = MIN(bytesRemaining, sslMaxBytesToWrite); + size_t sslBytesWritten = 0; + + result = SSLWrite(sslContext, buffer, sslBytesToWrite, &sslBytesWritten); + + if (result == noErr) + { + buffer += sslBytesWritten; + bytesWritten += sslBytesWritten; + bytesRemaining -= sslBytesWritten; + + keepLooping = (bytesRemaining > 0); + } + else + { + if (result == errSSLWouldBlock) + { + waiting = YES; + sslWriteCachedLength = sslBytesToWrite; + } + else + { + error = [self sslError:result]; + } + + keepLooping = NO; + } + + } // while (keepLooping) + + } // if (hasNewDataToWrite) + } + } + else + { + // + // Writing data directly over raw socket + // + + int socketFD = (socket4FD != SOCKET_NULL) ? socket4FD : (socket6FD != SOCKET_NULL) ? socket6FD : socketUN; + + const uint8_t *buffer = (const uint8_t *)[currentWrite->buffer bytes] + currentWrite->bytesDone; + + NSUInteger bytesToWrite = [currentWrite->buffer length] - currentWrite->bytesDone; + + if (bytesToWrite > SIZE_MAX) // NSUInteger may be bigger than size_t (write param 3) + { + bytesToWrite = SIZE_MAX; + } + + ssize_t result = write(socketFD, buffer, (size_t)bytesToWrite); + LogVerbose(@"wrote to socket = %zd", result); + + // Check results + if (result < 0) + { + if (errno == EWOULDBLOCK) + { + waiting = YES; + } + else + { + error = [self errorWithErrno:errno reason:@"Error in write() function"]; + } + } + else + { + bytesWritten = result; + } + } + + // We're done with our writing. + // If we explictly ran into a situation where the socket told us there was no room in the buffer, + // then we immediately resume listening for notifications. + // + // We must do this before we dequeue another write, + // as that may in turn invoke this method again. + // + // Note that if CFStream is involved, it may have maliciously put our socket in blocking mode. + + if (waiting) + { + flags &= ~kSocketCanAcceptBytes; + + if (![self usingCFStreamForTLS]) + { + [self resumeWriteSource]; + } + } + + // Check our results + + BOOL done = NO; + + if (bytesWritten > 0) + { + // Update total amount read for the current write + currentWrite->bytesDone += bytesWritten; + LogVerbose(@"currentWrite->bytesDone = %lu", (unsigned long)currentWrite->bytesDone); + + // Is packet done? + done = (currentWrite->bytesDone == [currentWrite->buffer length]); + } + + if (done) + { + [self completeCurrentWrite]; + + if (!error) + { + dispatch_async(socketQueue, ^{ @autoreleasepool{ + + [self maybeDequeueWrite]; + }}); + } + } + else + { + // We were unable to finish writing the data, + // so we're waiting for another callback to notify us of available space in the lower-level output buffer. + + if (!waiting && !error) + { + // This would be the case if our write was able to accept some data, but not all of it. + + flags &= ~kSocketCanAcceptBytes; + + if (![self usingCFStreamForTLS]) + { + [self resumeWriteSource]; + } + } + + if (bytesWritten > 0) + { + // We're not done with the entire write, but we have written some bytes + + __strong id theDelegate = delegate; + + if (delegateQueue && [theDelegate respondsToSelector:@selector(socket:didWritePartialDataOfLength:tag:)]) + { + long theWriteTag = currentWrite->tag; + + dispatch_async(delegateQueue, ^{ @autoreleasepool { + + [theDelegate socket:self didWritePartialDataOfLength:bytesWritten tag:theWriteTag]; + }}); + } + } + } + + // Check for errors + + if (error) + { + [self closeWithError:[self errorWithErrno:errno reason:@"Error in write() function"]]; + } + + // Do not add any code here without first adding a return statement in the error case above. +} + +- (void)completeCurrentWrite +{ + LogTrace(); + + NSAssert(currentWrite, @"Trying to complete current write when there is no current write."); + + + __strong id theDelegate = delegate; + + if (delegateQueue && [theDelegate respondsToSelector:@selector(socket:didWriteDataWithTag:)]) + { + long theWriteTag = currentWrite->tag; + + dispatch_async(delegateQueue, ^{ @autoreleasepool { + + [theDelegate socket:self didWriteDataWithTag:theWriteTag]; + }}); + } + + [self endCurrentWrite]; +} + +- (void)endCurrentWrite +{ + if (writeTimer) + { + dispatch_source_cancel(writeTimer); + writeTimer = NULL; + } + + currentWrite = nil; +} + +- (void)setupWriteTimerWithTimeout:(NSTimeInterval)timeout +{ + if (timeout >= 0.0) + { + writeTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, socketQueue); + + __weak GCDAsyncSocket *weakSelf = self; + + dispatch_source_set_event_handler(writeTimer, ^{ @autoreleasepool { + #pragma clang diagnostic push + #pragma clang diagnostic warning "-Wimplicit-retain-self" + + __strong GCDAsyncSocket *strongSelf = weakSelf; + if (strongSelf == nil) return_from_block; + + [strongSelf doWriteTimeout]; + + #pragma clang diagnostic pop + }}); + + #if !OS_OBJECT_USE_OBJC + dispatch_source_t theWriteTimer = writeTimer; + dispatch_source_set_cancel_handler(writeTimer, ^{ + #pragma clang diagnostic push + #pragma clang diagnostic warning "-Wimplicit-retain-self" + + LogVerbose(@"dispatch_release(writeTimer)"); + dispatch_release(theWriteTimer); + + #pragma clang diagnostic pop + }); + #endif + + dispatch_time_t tt = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeout * NSEC_PER_SEC)); + + dispatch_source_set_timer(writeTimer, tt, DISPATCH_TIME_FOREVER, 0); + dispatch_resume(writeTimer); + } +} + +- (void)doWriteTimeout +{ + // This is a little bit tricky. + // Ideally we'd like to synchronously query the delegate about a timeout extension. + // But if we do so synchronously we risk a possible deadlock. + // So instead we have to do so asynchronously, and callback to ourselves from within the delegate block. + + flags |= kWritesPaused; + + __strong id theDelegate = delegate; + + if (delegateQueue && [theDelegate respondsToSelector:@selector(socket:shouldTimeoutWriteWithTag:elapsed:bytesDone:)]) + { + GCDAsyncWritePacket *theWrite = currentWrite; + + dispatch_async(delegateQueue, ^{ @autoreleasepool { + + NSTimeInterval timeoutExtension = 0.0; + + timeoutExtension = [theDelegate socket:self shouldTimeoutWriteWithTag:theWrite->tag + elapsed:theWrite->timeout + bytesDone:theWrite->bytesDone]; + + dispatch_async(self->socketQueue, ^{ @autoreleasepool { + + [self doWriteTimeoutWithExtension:timeoutExtension]; + }}); + }}); + } + else + { + [self doWriteTimeoutWithExtension:0.0]; + } +} + +- (void)doWriteTimeoutWithExtension:(NSTimeInterval)timeoutExtension +{ + if (currentWrite) + { + if (timeoutExtension > 0.0) + { + currentWrite->timeout += timeoutExtension; + + // Reschedule the timer + dispatch_time_t tt = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeoutExtension * NSEC_PER_SEC)); + dispatch_source_set_timer(writeTimer, tt, DISPATCH_TIME_FOREVER, 0); + + // Unpause writes, and continue + flags &= ~kWritesPaused; + [self doWriteData]; + } + else + { + LogVerbose(@"WriteTimeout"); + + [self closeWithError:[self writeTimeoutError]]; + } + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Security +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +- (void)startTLS:(NSDictionary *)tlsSettings +{ + LogTrace(); + + if (tlsSettings == nil) + { + // Passing nil/NULL to CFReadStreamSetProperty will appear to work the same as passing an empty dictionary, + // but causes problems if we later try to fetch the remote host's certificate. + // + // To be exact, it causes the following to return NULL instead of the normal result: + // CFReadStreamCopyProperty(readStream, kCFStreamPropertySSLPeerCertificates) + // + // So we use an empty dictionary instead, which works perfectly. + + tlsSettings = [NSDictionary dictionary]; + } + + GCDAsyncSpecialPacket *packet = [[GCDAsyncSpecialPacket alloc] initWithTLSSettings:tlsSettings]; + + dispatch_async(socketQueue, ^{ @autoreleasepool { + + if ((self->flags & kSocketStarted) && !(self->flags & kQueuedTLS) && !(self->flags & kForbidReadsWrites)) + { + [self->readQueue addObject:packet]; + [self->writeQueue addObject:packet]; + + self->flags |= kQueuedTLS; + + [self maybeDequeueRead]; + [self maybeDequeueWrite]; + } + }}); + +} + +- (void)maybeStartTLS +{ + // We can't start TLS until: + // - All queued reads prior to the user calling startTLS are complete + // - All queued writes prior to the user calling startTLS are complete + // + // We'll know these conditions are met when both kStartingReadTLS and kStartingWriteTLS are set + + if ((flags & kStartingReadTLS) && (flags & kStartingWriteTLS)) + { + BOOL useSecureTransport = YES; + + #if TARGET_OS_IPHONE + { + GCDAsyncSpecialPacket *tlsPacket = (GCDAsyncSpecialPacket *)currentRead; + NSDictionary *tlsSettings = @{}; + if (tlsPacket) { + tlsSettings = tlsPacket->tlsSettings; + } + NSNumber *value = [tlsSettings objectForKey:GCDAsyncSocketUseCFStreamForTLS]; + if (value && [value boolValue]) + useSecureTransport = NO; + } + #endif + + if (useSecureTransport) + { + [self ssl_startTLS]; + } + else + { + #if TARGET_OS_IPHONE + [self cf_startTLS]; + #endif + } + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Security via SecureTransport +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +- (OSStatus)sslReadWithBuffer:(void *)buffer length:(size_t *)bufferLength +{ + LogVerbose(@"sslReadWithBuffer:%p length:%lu", buffer, (unsigned long)*bufferLength); + + if ((socketFDBytesAvailable == 0) && ([sslPreBuffer availableBytes] == 0)) + { + LogVerbose(@"%@ - No data available to read...", THIS_METHOD); + + // No data available to read. + // + // Need to wait for readSource to fire and notify us of + // available data in the socket's internal read buffer. + + [self resumeReadSource]; + + *bufferLength = 0; + return errSSLWouldBlock; + } + + size_t totalBytesRead = 0; + size_t totalBytesLeftToBeRead = *bufferLength; + + BOOL done = NO; + BOOL socketError = NO; + + // + // STEP 1 : READ FROM SSL PRE BUFFER + // + + size_t sslPreBufferLength = [sslPreBuffer availableBytes]; + + if (sslPreBufferLength > 0) + { + LogVerbose(@"%@: Reading from SSL pre buffer...", THIS_METHOD); + + size_t bytesToCopy; + if (sslPreBufferLength > totalBytesLeftToBeRead) + bytesToCopy = totalBytesLeftToBeRead; + else + bytesToCopy = sslPreBufferLength; + + LogVerbose(@"%@: Copying %zu bytes from sslPreBuffer", THIS_METHOD, bytesToCopy); + + memcpy(buffer, [sslPreBuffer readBuffer], bytesToCopy); + [sslPreBuffer didRead:bytesToCopy]; + + LogVerbose(@"%@: sslPreBuffer.length = %zu", THIS_METHOD, [sslPreBuffer availableBytes]); + + totalBytesRead += bytesToCopy; + totalBytesLeftToBeRead -= bytesToCopy; + + done = (totalBytesLeftToBeRead == 0); + + if (done) LogVerbose(@"%@: Complete", THIS_METHOD); + } + + // + // STEP 2 : READ FROM SOCKET + // + + if (!done && (socketFDBytesAvailable > 0)) + { + LogVerbose(@"%@: Reading from socket...", THIS_METHOD); + + int socketFD = (socket4FD != SOCKET_NULL) ? socket4FD : (socket6FD != SOCKET_NULL) ? socket6FD : socketUN; + + BOOL readIntoPreBuffer; + size_t bytesToRead; + uint8_t *buf; + + if (socketFDBytesAvailable > totalBytesLeftToBeRead) + { + // Read all available data from socket into sslPreBuffer. + // Then copy requested amount into dataBuffer. + + LogVerbose(@"%@: Reading into sslPreBuffer...", THIS_METHOD); + + [sslPreBuffer ensureCapacityForWrite:socketFDBytesAvailable]; + + readIntoPreBuffer = YES; + bytesToRead = (size_t)socketFDBytesAvailable; + buf = [sslPreBuffer writeBuffer]; + } + else + { + // Read available data from socket directly into dataBuffer. + + LogVerbose(@"%@: Reading directly into dataBuffer...", THIS_METHOD); + + readIntoPreBuffer = NO; + bytesToRead = totalBytesLeftToBeRead; + buf = (uint8_t *)buffer + totalBytesRead; + } + + ssize_t result = read(socketFD, buf, bytesToRead); + LogVerbose(@"%@: read from socket = %zd", THIS_METHOD, result); + + if (result < 0) + { + LogVerbose(@"%@: read errno = %i", THIS_METHOD, errno); + + if (errno != EWOULDBLOCK) + { + socketError = YES; + } + + socketFDBytesAvailable = 0; + } + else if (result == 0) + { + LogVerbose(@"%@: read EOF", THIS_METHOD); + + socketError = YES; + socketFDBytesAvailable = 0; + } + else + { + size_t bytesReadFromSocket = result; + + if (socketFDBytesAvailable > bytesReadFromSocket) + socketFDBytesAvailable -= bytesReadFromSocket; + else + socketFDBytesAvailable = 0; + + if (readIntoPreBuffer) + { + [sslPreBuffer didWrite:bytesReadFromSocket]; + + size_t bytesToCopy = MIN(totalBytesLeftToBeRead, bytesReadFromSocket); + + LogVerbose(@"%@: Copying %zu bytes out of sslPreBuffer", THIS_METHOD, bytesToCopy); + + memcpy((uint8_t *)buffer + totalBytesRead, [sslPreBuffer readBuffer], bytesToCopy); + [sslPreBuffer didRead:bytesToCopy]; + + totalBytesRead += bytesToCopy; + totalBytesLeftToBeRead -= bytesToCopy; + + LogVerbose(@"%@: sslPreBuffer.length = %zu", THIS_METHOD, [sslPreBuffer availableBytes]); + } + else + { + totalBytesRead += bytesReadFromSocket; + totalBytesLeftToBeRead -= bytesReadFromSocket; + } + + done = (totalBytesLeftToBeRead == 0); + + if (done) LogVerbose(@"%@: Complete", THIS_METHOD); + } + } + + *bufferLength = totalBytesRead; + + if (done) + return noErr; + + if (socketError) + return errSSLClosedAbort; + + return errSSLWouldBlock; +} + +- (OSStatus)sslWriteWithBuffer:(const void *)buffer length:(size_t *)bufferLength +{ + if (!(flags & kSocketCanAcceptBytes)) + { + // Unable to write. + // + // Need to wait for writeSource to fire and notify us of + // available space in the socket's internal write buffer. + + [self resumeWriteSource]; + + *bufferLength = 0; + return errSSLWouldBlock; + } + + size_t bytesToWrite = *bufferLength; + size_t bytesWritten = 0; + + BOOL done = NO; + BOOL socketError = NO; + + int socketFD = (socket4FD != SOCKET_NULL) ? socket4FD : (socket6FD != SOCKET_NULL) ? socket6FD : socketUN; + + ssize_t result = write(socketFD, buffer, bytesToWrite); + + if (result < 0) + { + if (errno != EWOULDBLOCK) + { + socketError = YES; + } + + flags &= ~kSocketCanAcceptBytes; + } + else if (result == 0) + { + flags &= ~kSocketCanAcceptBytes; + } + else + { + bytesWritten = result; + + done = (bytesWritten == bytesToWrite); + } + + *bufferLength = bytesWritten; + + if (done) + return noErr; + + if (socketError) + return errSSLClosedAbort; + + return errSSLWouldBlock; +} + +static OSStatus SSLReadFunction(SSLConnectionRef connection, void *data, size_t *dataLength) +{ + GCDAsyncSocket *asyncSocket = (__bridge GCDAsyncSocket *)connection; + + NSCAssert(dispatch_get_specific(asyncSocket->IsOnSocketQueueOrTargetQueueKey), @"What the deuce?"); + + return [asyncSocket sslReadWithBuffer:data length:dataLength]; +} + +static OSStatus SSLWriteFunction(SSLConnectionRef connection, const void *data, size_t *dataLength) +{ + GCDAsyncSocket *asyncSocket = (__bridge GCDAsyncSocket *)connection; + + NSCAssert(dispatch_get_specific(asyncSocket->IsOnSocketQueueOrTargetQueueKey), @"What the deuce?"); + + return [asyncSocket sslWriteWithBuffer:data length:dataLength]; +} + +- (void)ssl_startTLS +{ + LogTrace(); + + LogVerbose(@"Starting TLS (via SecureTransport)..."); + + OSStatus status; + + GCDAsyncSpecialPacket *tlsPacket = (GCDAsyncSpecialPacket *)currentRead; + if (tlsPacket == nil) // Code to quiet the analyzer + { + NSAssert(NO, @"Logic error"); + + [self closeWithError:[self otherError:@"Logic error"]]; + return; + } + NSDictionary *tlsSettings = tlsPacket->tlsSettings; + + // Create SSLContext, and setup IO callbacks and connection ref + + NSNumber *isServerNumber = [tlsSettings objectForKey:(__bridge NSString *)kCFStreamSSLIsServer]; + BOOL isServer = [isServerNumber boolValue]; + + #if TARGET_OS_IPHONE || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1080) + { + if (isServer) + sslContext = SSLCreateContext(kCFAllocatorDefault, kSSLServerSide, kSSLStreamType); + else + sslContext = SSLCreateContext(kCFAllocatorDefault, kSSLClientSide, kSSLStreamType); + + if (sslContext == NULL) + { + [self closeWithError:[self otherError:@"Error in SSLCreateContext"]]; + return; + } + } + #else // (__MAC_OS_X_VERSION_MIN_REQUIRED < 1080) + { + status = SSLNewContext(isServer, &sslContext); + if (status != noErr) + { + [self closeWithError:[self otherError:@"Error in SSLNewContext"]]; + return; + } + } + #endif + + status = SSLSetIOFuncs(sslContext, &SSLReadFunction, &SSLWriteFunction); + if (status != noErr) + { + [self closeWithError:[self otherError:@"Error in SSLSetIOFuncs"]]; + return; + } + + status = SSLSetConnection(sslContext, (__bridge SSLConnectionRef)self); + if (status != noErr) + { + [self closeWithError:[self otherError:@"Error in SSLSetConnection"]]; + return; + } + + + NSNumber *shouldManuallyEvaluateTrust = [tlsSettings objectForKey:GCDAsyncSocketManuallyEvaluateTrust]; + if ([shouldManuallyEvaluateTrust boolValue]) + { + if (isServer) + { + [self closeWithError:[self otherError:@"Manual trust validation is not supported for server sockets"]]; + return; + } + + status = SSLSetSessionOption(sslContext, kSSLSessionOptionBreakOnServerAuth, true); + if (status != noErr) + { + [self closeWithError:[self otherError:@"Error in SSLSetSessionOption"]]; + return; + } + + #if !TARGET_OS_IPHONE && (__MAC_OS_X_VERSION_MIN_REQUIRED < 1080) + + // Note from Apple's documentation: + // + // It is only necessary to call SSLSetEnableCertVerify on the Mac prior to OS X 10.8. + // On OS X 10.8 and later setting kSSLSessionOptionBreakOnServerAuth always disables the + // built-in trust evaluation. All versions of iOS behave like OS X 10.8 and thus + // SSLSetEnableCertVerify is not available on that platform at all. + + status = SSLSetEnableCertVerify(sslContext, NO); + if (status != noErr) + { + [self closeWithError:[self otherError:@"Error in SSLSetEnableCertVerify"]]; + return; + } + + #endif + } + + // Configure SSLContext from given settings + // + // Checklist: + // 1. kCFStreamSSLPeerName + // 2. kCFStreamSSLCertificates + // 3. GCDAsyncSocketSSLPeerID + // 4. GCDAsyncSocketSSLProtocolVersionMin + // 5. GCDAsyncSocketSSLProtocolVersionMax + // 6. GCDAsyncSocketSSLSessionOptionFalseStart + // 7. GCDAsyncSocketSSLSessionOptionSendOneByteRecord + // 8. GCDAsyncSocketSSLCipherSuites + // 9. GCDAsyncSocketSSLDiffieHellmanParameters (Mac) + // 10. GCDAsyncSocketSSLALPN + // + // Deprecated (throw error): + // 10. kCFStreamSSLAllowsAnyRoot + // 11. kCFStreamSSLAllowsExpiredRoots + // 12. kCFStreamSSLAllowsExpiredCertificates + // 13. kCFStreamSSLValidatesCertificateChain + // 14. kCFStreamSSLLevel + + NSObject *value; + + // 1. kCFStreamSSLPeerName + + value = [tlsSettings objectForKey:(__bridge NSString *)kCFStreamSSLPeerName]; + if ([value isKindOfClass:[NSString class]]) + { + NSString *peerName = (NSString *)value; + + const char *peer = [peerName UTF8String]; + size_t peerLen = strlen(peer); + + status = SSLSetPeerDomainName(sslContext, peer, peerLen); + if (status != noErr) + { + [self closeWithError:[self otherError:@"Error in SSLSetPeerDomainName"]]; + return; + } + } + else if (value) + { + NSAssert(NO, @"Invalid value for kCFStreamSSLPeerName. Value must be of type NSString."); + + [self closeWithError:[self otherError:@"Invalid value for kCFStreamSSLPeerName."]]; + return; + } + + // 2. kCFStreamSSLCertificates + + value = [tlsSettings objectForKey:(__bridge NSString *)kCFStreamSSLCertificates]; + if ([value isKindOfClass:[NSArray class]]) + { + NSArray *certs = (NSArray *)value; + + status = SSLSetCertificate(sslContext, (__bridge CFArrayRef)certs); + if (status != noErr) + { + [self closeWithError:[self otherError:@"Error in SSLSetCertificate"]]; + return; + } + } + else if (value) + { + NSAssert(NO, @"Invalid value for kCFStreamSSLCertificates. Value must be of type NSArray."); + + [self closeWithError:[self otherError:@"Invalid value for kCFStreamSSLCertificates."]]; + return; + } + + // 3. GCDAsyncSocketSSLPeerID + + value = [tlsSettings objectForKey:GCDAsyncSocketSSLPeerID]; + if ([value isKindOfClass:[NSData class]]) + { + NSData *peerIdData = (NSData *)value; + + status = SSLSetPeerID(sslContext, [peerIdData bytes], [peerIdData length]); + if (status != noErr) + { + [self closeWithError:[self otherError:@"Error in SSLSetPeerID"]]; + return; + } + } + else if (value) + { + NSAssert(NO, @"Invalid value for GCDAsyncSocketSSLPeerID. Value must be of type NSData." + @" (You can convert strings to data using a method like" + @" [string dataUsingEncoding:NSUTF8StringEncoding])"); + + [self closeWithError:[self otherError:@"Invalid value for GCDAsyncSocketSSLPeerID."]]; + return; + } + + // 4. GCDAsyncSocketSSLProtocolVersionMin + + value = [tlsSettings objectForKey:GCDAsyncSocketSSLProtocolVersionMin]; + if ([value isKindOfClass:[NSNumber class]]) + { + SSLProtocol minProtocol = (SSLProtocol)[(NSNumber *)value intValue]; + if (minProtocol != kSSLProtocolUnknown) + { + status = SSLSetProtocolVersionMin(sslContext, minProtocol); + if (status != noErr) + { + [self closeWithError:[self otherError:@"Error in SSLSetProtocolVersionMin"]]; + return; + } + } + } + else if (value) + { + NSAssert(NO, @"Invalid value for GCDAsyncSocketSSLProtocolVersionMin. Value must be of type NSNumber."); + + [self closeWithError:[self otherError:@"Invalid value for GCDAsyncSocketSSLProtocolVersionMin."]]; + return; + } + + // 5. GCDAsyncSocketSSLProtocolVersionMax + + value = [tlsSettings objectForKey:GCDAsyncSocketSSLProtocolVersionMax]; + if ([value isKindOfClass:[NSNumber class]]) + { + SSLProtocol maxProtocol = (SSLProtocol)[(NSNumber *)value intValue]; + if (maxProtocol != kSSLProtocolUnknown) + { + status = SSLSetProtocolVersionMax(sslContext, maxProtocol); + if (status != noErr) + { + [self closeWithError:[self otherError:@"Error in SSLSetProtocolVersionMax"]]; + return; + } + } + } + else if (value) + { + NSAssert(NO, @"Invalid value for GCDAsyncSocketSSLProtocolVersionMax. Value must be of type NSNumber."); + + [self closeWithError:[self otherError:@"Invalid value for GCDAsyncSocketSSLProtocolVersionMax."]]; + return; + } + + // 6. GCDAsyncSocketSSLSessionOptionFalseStart + + value = [tlsSettings objectForKey:GCDAsyncSocketSSLSessionOptionFalseStart]; + if ([value isKindOfClass:[NSNumber class]]) + { + NSNumber *falseStart = (NSNumber *)value; + status = SSLSetSessionOption(sslContext, kSSLSessionOptionFalseStart, [falseStart boolValue]); + if (status != noErr) + { + [self closeWithError:[self otherError:@"Error in SSLSetSessionOption (kSSLSessionOptionFalseStart)"]]; + return; + } + } + else if (value) + { + NSAssert(NO, @"Invalid value for GCDAsyncSocketSSLSessionOptionFalseStart. Value must be of type NSNumber."); + + [self closeWithError:[self otherError:@"Invalid value for GCDAsyncSocketSSLSessionOptionFalseStart."]]; + return; + } + + // 7. GCDAsyncSocketSSLSessionOptionSendOneByteRecord + + value = [tlsSettings objectForKey:GCDAsyncSocketSSLSessionOptionSendOneByteRecord]; + if ([value isKindOfClass:[NSNumber class]]) + { + NSNumber *oneByteRecord = (NSNumber *)value; + status = SSLSetSessionOption(sslContext, kSSLSessionOptionSendOneByteRecord, [oneByteRecord boolValue]); + if (status != noErr) + { + [self closeWithError: + [self otherError:@"Error in SSLSetSessionOption (kSSLSessionOptionSendOneByteRecord)"]]; + return; + } + } + else if (value) + { + NSAssert(NO, @"Invalid value for GCDAsyncSocketSSLSessionOptionSendOneByteRecord." + @" Value must be of type NSNumber."); + + [self closeWithError:[self otherError:@"Invalid value for GCDAsyncSocketSSLSessionOptionSendOneByteRecord."]]; + return; + } + + // 8. GCDAsyncSocketSSLCipherSuites + + value = [tlsSettings objectForKey:GCDAsyncSocketSSLCipherSuites]; + if ([value isKindOfClass:[NSArray class]]) + { + NSArray *cipherSuites = (NSArray *)value; + NSUInteger numberCiphers = [cipherSuites count]; + SSLCipherSuite ciphers[numberCiphers]; + + NSUInteger cipherIndex; + for (cipherIndex = 0; cipherIndex < numberCiphers; cipherIndex++) + { + NSNumber *cipherObject = [cipherSuites objectAtIndex:cipherIndex]; + ciphers[cipherIndex] = (SSLCipherSuite)[cipherObject unsignedIntValue]; + } + + status = SSLSetEnabledCiphers(sslContext, ciphers, numberCiphers); + if (status != noErr) + { + [self closeWithError:[self otherError:@"Error in SSLSetEnabledCiphers"]]; + return; + } + } + else if (value) + { + NSAssert(NO, @"Invalid value for GCDAsyncSocketSSLCipherSuites. Value must be of type NSArray."); + + [self closeWithError:[self otherError:@"Invalid value for GCDAsyncSocketSSLCipherSuites."]]; + return; + } + + // 9. GCDAsyncSocketSSLDiffieHellmanParameters + + #if !TARGET_OS_IPHONE + value = [tlsSettings objectForKey:GCDAsyncSocketSSLDiffieHellmanParameters]; + if ([value isKindOfClass:[NSData class]]) + { + NSData *diffieHellmanData = (NSData *)value; + + status = SSLSetDiffieHellmanParams(sslContext, [diffieHellmanData bytes], [diffieHellmanData length]); + if (status != noErr) + { + [self closeWithError:[self otherError:@"Error in SSLSetDiffieHellmanParams"]]; + return; + } + } + else if (value) + { + NSAssert(NO, @"Invalid value for GCDAsyncSocketSSLDiffieHellmanParameters. Value must be of type NSData."); + + [self closeWithError:[self otherError:@"Invalid value for GCDAsyncSocketSSLDiffieHellmanParameters."]]; + return; + } + #endif + + // 10. kCFStreamSSLCertificates + value = [tlsSettings objectForKey:GCDAsyncSocketSSLALPN]; + if ([value isKindOfClass:[NSArray class]]) + { + if (@available(iOS 11.0, macOS 10.13, tvOS 11.0, *)) + { + CFArrayRef protocols = (__bridge CFArrayRef)((NSArray *) value); + status = SSLSetALPNProtocols(sslContext, protocols); + if (status != noErr) + { + [self closeWithError:[self otherError:@"Error in SSLSetALPNProtocols"]]; + return; + } + } + else + { + NSAssert(NO, @"Security option unavailable - GCDAsyncSocketSSLALPN" + @" - iOS 11.0, macOS 10.13 required"); + [self closeWithError:[self otherError:@"Security option unavailable - GCDAsyncSocketSSLALPN"]]; + } + } + else if (value) + { + NSAssert(NO, @"Invalid value for GCDAsyncSocketSSLALPN. Value must be of type NSArray."); + + [self closeWithError:[self otherError:@"Invalid value for GCDAsyncSocketSSLALPN."]]; + return; + } + + // DEPRECATED checks + + // 10. kCFStreamSSLAllowsAnyRoot + + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-declarations" + value = [tlsSettings objectForKey:(__bridge NSString *)kCFStreamSSLAllowsAnyRoot]; + #pragma clang diagnostic pop + if (value) + { + NSAssert(NO, @"Security option unavailable - kCFStreamSSLAllowsAnyRoot" + @" - You must use manual trust evaluation"); + + [self closeWithError:[self otherError:@"Security option unavailable - kCFStreamSSLAllowsAnyRoot"]]; + return; + } + + // 11. kCFStreamSSLAllowsExpiredRoots + + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-declarations" + value = [tlsSettings objectForKey:(__bridge NSString *)kCFStreamSSLAllowsExpiredRoots]; + #pragma clang diagnostic pop + if (value) + { + NSAssert(NO, @"Security option unavailable - kCFStreamSSLAllowsExpiredRoots" + @" - You must use manual trust evaluation"); + + [self closeWithError:[self otherError:@"Security option unavailable - kCFStreamSSLAllowsExpiredRoots"]]; + return; + } + + // 12. kCFStreamSSLValidatesCertificateChain + + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-declarations" + value = [tlsSettings objectForKey:(__bridge NSString *)kCFStreamSSLValidatesCertificateChain]; + #pragma clang diagnostic pop + if (value) + { + NSAssert(NO, @"Security option unavailable - kCFStreamSSLValidatesCertificateChain" + @" - You must use manual trust evaluation"); + + [self closeWithError:[self otherError:@"Security option unavailable - kCFStreamSSLValidatesCertificateChain"]]; + return; + } + + // 13. kCFStreamSSLAllowsExpiredCertificates + + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-declarations" + value = [tlsSettings objectForKey:(__bridge NSString *)kCFStreamSSLAllowsExpiredCertificates]; + #pragma clang diagnostic pop + if (value) + { + NSAssert(NO, @"Security option unavailable - kCFStreamSSLAllowsExpiredCertificates" + @" - You must use manual trust evaluation"); + + [self closeWithError:[self otherError:@"Security option unavailable - kCFStreamSSLAllowsExpiredCertificates"]]; + return; + } + + // 14. kCFStreamSSLLevel + + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-declarations" + value = [tlsSettings objectForKey:(__bridge NSString *)kCFStreamSSLLevel]; + #pragma clang diagnostic pop + if (value) + { + NSAssert(NO, @"Security option unavailable - kCFStreamSSLLevel" + @" - You must use GCDAsyncSocketSSLProtocolVersionMin & GCDAsyncSocketSSLProtocolVersionMax"); + + [self closeWithError:[self otherError:@"Security option unavailable - kCFStreamSSLLevel"]]; + return; + } + + // Setup the sslPreBuffer + // + // Any data in the preBuffer needs to be moved into the sslPreBuffer, + // as this data is now part of the secure read stream. + + sslPreBuffer = [[GCDAsyncSocketPreBuffer alloc] initWithCapacity:(1024 * 4)]; + + size_t preBufferLength = [preBuffer availableBytes]; + + if (preBufferLength > 0) + { + [sslPreBuffer ensureCapacityForWrite:preBufferLength]; + + memcpy([sslPreBuffer writeBuffer], [preBuffer readBuffer], preBufferLength); + [preBuffer didRead:preBufferLength]; + [sslPreBuffer didWrite:preBufferLength]; + } + + sslErrCode = lastSSLHandshakeError = noErr; + + // Start the SSL Handshake process + + [self ssl_continueSSLHandshake]; +} + +- (void)ssl_continueSSLHandshake +{ + LogTrace(); + + // If the return value is noErr, the session is ready for normal secure communication. + // If the return value is errSSLWouldBlock, the SSLHandshake function must be called again. + // If the return value is errSSLServerAuthCompleted, we ask delegate if we should trust the + // server and then call SSLHandshake again to resume the handshake or close the connection + // errSSLPeerBadCert SSL error. + // Otherwise, the return value indicates an error code. + + OSStatus status = SSLHandshake(sslContext); + lastSSLHandshakeError = status; + + if (status == noErr) + { + LogVerbose(@"SSLHandshake complete"); + + flags &= ~kStartingReadTLS; + flags &= ~kStartingWriteTLS; + + flags |= kSocketSecure; + + __strong id theDelegate = delegate; + + if (delegateQueue && [theDelegate respondsToSelector:@selector(socketDidSecure:)]) + { + dispatch_async(delegateQueue, ^{ @autoreleasepool { + + [theDelegate socketDidSecure:self]; + }}); + } + + [self endCurrentRead]; + [self endCurrentWrite]; + + [self maybeDequeueRead]; + [self maybeDequeueWrite]; + } + else if (status == errSSLPeerAuthCompleted) + { + LogVerbose(@"SSLHandshake peerAuthCompleted - awaiting delegate approval"); + + __block SecTrustRef trust = NULL; + status = SSLCopyPeerTrust(sslContext, &trust); + if (status != noErr) + { + [self closeWithError:[self sslError:status]]; + return; + } + + int aStateIndex = stateIndex; + dispatch_queue_t theSocketQueue = socketQueue; + + __weak GCDAsyncSocket *weakSelf = self; + + void (^comletionHandler)(BOOL) = ^(BOOL shouldTrust){ @autoreleasepool { + #pragma clang diagnostic push + #pragma clang diagnostic warning "-Wimplicit-retain-self" + + dispatch_async(theSocketQueue, ^{ @autoreleasepool { + + if (trust) { + CFRelease(trust); + trust = NULL; + } + + __strong GCDAsyncSocket *strongSelf = weakSelf; + if (strongSelf) + { + [strongSelf ssl_shouldTrustPeer:shouldTrust stateIndex:aStateIndex]; + } + }}); + + #pragma clang diagnostic pop + }}; + + __strong id theDelegate = delegate; + + if (delegateQueue && [theDelegate respondsToSelector:@selector(socket:didReceiveTrust:completionHandler:)]) + { + dispatch_async(delegateQueue, ^{ @autoreleasepool { + + [theDelegate socket:self didReceiveTrust:trust completionHandler:comletionHandler]; + }}); + } + else + { + if (trust) { + CFRelease(trust); + trust = NULL; + } + + NSString *msg = @"GCDAsyncSocketManuallyEvaluateTrust specified in tlsSettings," + @" but delegate doesn't implement socket:shouldTrustPeer:"; + + [self closeWithError:[self otherError:msg]]; + return; + } + } + else if (status == errSSLWouldBlock) + { + LogVerbose(@"SSLHandshake continues..."); + + // Handshake continues... + // + // This method will be called again from doReadData or doWriteData. + } + else + { + [self closeWithError:[self sslError:status]]; + } +} + +- (void)ssl_shouldTrustPeer:(BOOL)shouldTrust stateIndex:(int)aStateIndex +{ + LogTrace(); + + if (aStateIndex != stateIndex) + { + LogInfo(@"Ignoring ssl_shouldTrustPeer - invalid state (maybe disconnected)"); + + // One of the following is true + // - the socket was disconnected + // - the startTLS operation timed out + // - the completionHandler was already invoked once + + return; + } + + // Increment stateIndex to ensure completionHandler can only be called once. + stateIndex++; + + if (shouldTrust) + { + NSAssert(lastSSLHandshakeError == errSSLPeerAuthCompleted, @"ssl_shouldTrustPeer called when last error is %d and not errSSLPeerAuthCompleted", (int)lastSSLHandshakeError); + [self ssl_continueSSLHandshake]; + } + else + { + [self closeWithError:[self sslError:errSSLPeerBadCert]]; + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Security via CFStream +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +#if TARGET_OS_IPHONE + +- (void)cf_finishSSLHandshake +{ + LogTrace(); + + if ((flags & kStartingReadTLS) && (flags & kStartingWriteTLS)) + { + flags &= ~kStartingReadTLS; + flags &= ~kStartingWriteTLS; + + flags |= kSocketSecure; + + __strong id theDelegate = delegate; + + if (delegateQueue && [theDelegate respondsToSelector:@selector(socketDidSecure:)]) + { + dispatch_async(delegateQueue, ^{ @autoreleasepool { + + [theDelegate socketDidSecure:self]; + }}); + } + + [self endCurrentRead]; + [self endCurrentWrite]; + + [self maybeDequeueRead]; + [self maybeDequeueWrite]; + } +} + +- (void)cf_abortSSLHandshake:(NSError *)error +{ + LogTrace(); + + if ((flags & kStartingReadTLS) && (flags & kStartingWriteTLS)) + { + flags &= ~kStartingReadTLS; + flags &= ~kStartingWriteTLS; + + [self closeWithError:error]; + } +} + +- (void)cf_startTLS +{ + LogTrace(); + + LogVerbose(@"Starting TLS (via CFStream)..."); + + if ([preBuffer availableBytes] > 0) + { + NSString *msg = @"Invalid TLS transition. Handshake has already been read from socket."; + + [self closeWithError:[self otherError:msg]]; + return; + } + + [self suspendReadSource]; + [self suspendWriteSource]; + + socketFDBytesAvailable = 0; + flags &= ~kSocketCanAcceptBytes; + flags &= ~kSecureSocketHasBytesAvailable; + + flags |= kUsingCFStreamForTLS; + + if (![self createReadAndWriteStream]) + { + [self closeWithError:[self otherError:@"Error in CFStreamCreatePairWithSocket"]]; + return; + } + + if (![self registerForStreamCallbacksIncludingReadWrite:YES]) + { + [self closeWithError:[self otherError:@"Error in CFStreamSetClient"]]; + return; + } + + if (![self addStreamsToRunLoop]) + { + [self closeWithError:[self otherError:@"Error in CFStreamScheduleWithRunLoop"]]; + return; + } + + NSAssert([currentRead isKindOfClass:[GCDAsyncSpecialPacket class]], @"Invalid read packet for startTLS"); + NSAssert([currentWrite isKindOfClass:[GCDAsyncSpecialPacket class]], @"Invalid write packet for startTLS"); + + GCDAsyncSpecialPacket *tlsPacket = (GCDAsyncSpecialPacket *)currentRead; + CFDictionaryRef tlsSettings = (__bridge CFDictionaryRef)tlsPacket->tlsSettings; + + // Getting an error concerning kCFStreamPropertySSLSettings ? + // You need to add the CFNetwork framework to your iOS application. + + BOOL r1 = CFReadStreamSetProperty(readStream, kCFStreamPropertySSLSettings, tlsSettings); + BOOL r2 = CFWriteStreamSetProperty(writeStream, kCFStreamPropertySSLSettings, tlsSettings); + + // For some reason, starting around the time of iOS 4.3, + // the first call to set the kCFStreamPropertySSLSettings will return true, + // but the second will return false. + // + // Order doesn't seem to matter. + // So you could call CFReadStreamSetProperty and then CFWriteStreamSetProperty, or you could reverse the order. + // Either way, the first call will return true, and the second returns false. + // + // Interestingly, this doesn't seem to affect anything. + // Which is not altogether unusual, as the documentation seems to suggest that (for many settings) + // setting it on one side of the stream automatically sets it for the other side of the stream. + // + // Although there isn't anything in the documentation to suggest that the second attempt would fail. + // + // Furthermore, this only seems to affect streams that are negotiating a security upgrade. + // In other words, the socket gets connected, there is some back-and-forth communication over the unsecure + // connection, and then a startTLS is issued. + // So this mostly affects newer protocols (XMPP, IMAP) as opposed to older protocols (HTTPS). + + if (!r1 && !r2) // Yes, the && is correct - workaround for apple bug. + { + [self closeWithError:[self otherError:@"Error in CFStreamSetProperty"]]; + return; + } + + if (![self openStreams]) + { + [self closeWithError:[self otherError:@"Error in CFStreamOpen"]]; + return; + } + + LogVerbose(@"Waiting for SSL Handshake to complete..."); +} + +#endif + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark CFStream +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +#if TARGET_OS_IPHONE + ++ (void)ignore:(id)_ +{} + ++ (void)startCFStreamThreadIfNeeded +{ + LogTrace(); + + static dispatch_once_t predicate; + dispatch_once(&predicate, ^{ + + cfstreamThreadRetainCount = 0; + cfstreamThreadSetupQueue = dispatch_queue_create("GCDAsyncSocket-CFStreamThreadSetup", DISPATCH_QUEUE_SERIAL); + }); + + dispatch_sync(cfstreamThreadSetupQueue, ^{ @autoreleasepool { + + if (++cfstreamThreadRetainCount == 1) + { + cfstreamThread = [[NSThread alloc] initWithTarget:self + selector:@selector(cfstreamThread:) + object:nil]; + [cfstreamThread start]; + } + }}); +} + ++ (void)stopCFStreamThreadIfNeeded +{ + LogTrace(); + + // The creation of the cfstreamThread is relatively expensive. + // So we'd like to keep it available for recycling. + // However, there's a tradeoff here, because it shouldn't remain alive forever. + // So what we're going to do is use a little delay before taking it down. + // This way it can be reused properly in situations where multiple sockets are continually in flux. + + int delayInSeconds = 30; + dispatch_time_t when = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); + dispatch_after(when, cfstreamThreadSetupQueue, ^{ @autoreleasepool { + #pragma clang diagnostic push + #pragma clang diagnostic warning "-Wimplicit-retain-self" + + if (cfstreamThreadRetainCount == 0) + { + LogWarn(@"Logic error concerning cfstreamThread start / stop"); + return_from_block; + } + + if (--cfstreamThreadRetainCount == 0) + { + [cfstreamThread cancel]; // set isCancelled flag + + // wake up the thread + [[self class] performSelector:@selector(ignore:) + onThread:cfstreamThread + withObject:[NSNull null] + waitUntilDone:NO]; + + cfstreamThread = nil; + } + + #pragma clang diagnostic pop + }}); +} + ++ (void)cfstreamThread:(id)unused { @autoreleasepool +{ + [[NSThread currentThread] setName:GCDAsyncSocketThreadName]; + + LogInfo(@"CFStreamThread: Started"); + + // We can't run the run loop unless it has an associated input source or a timer. + // So we'll just create a timer that will never fire - unless the server runs for decades. + [NSTimer scheduledTimerWithTimeInterval:[[NSDate distantFuture] timeIntervalSinceNow] + target:self + selector:@selector(ignore:) + userInfo:nil + repeats:YES]; + + NSThread *currentThread = [NSThread currentThread]; + NSRunLoop *currentRunLoop = [NSRunLoop currentRunLoop]; + + BOOL isCancelled = [currentThread isCancelled]; + + while (!isCancelled && [currentRunLoop runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]) + { + isCancelled = [currentThread isCancelled]; + } + + LogInfo(@"CFStreamThread: Stopped"); +}} + ++ (void)scheduleCFStreams:(GCDAsyncSocket *)asyncSocket +{ + LogTrace(); + NSAssert([NSThread currentThread] == cfstreamThread, @"Invoked on wrong thread"); + + CFRunLoopRef runLoop = CFRunLoopGetCurrent(); + + if (asyncSocket->readStream) + CFReadStreamScheduleWithRunLoop(asyncSocket->readStream, runLoop, kCFRunLoopDefaultMode); + + if (asyncSocket->writeStream) + CFWriteStreamScheduleWithRunLoop(asyncSocket->writeStream, runLoop, kCFRunLoopDefaultMode); +} + ++ (void)unscheduleCFStreams:(GCDAsyncSocket *)asyncSocket +{ + LogTrace(); + NSAssert([NSThread currentThread] == cfstreamThread, @"Invoked on wrong thread"); + + CFRunLoopRef runLoop = CFRunLoopGetCurrent(); + + if (asyncSocket->readStream) + CFReadStreamUnscheduleFromRunLoop(asyncSocket->readStream, runLoop, kCFRunLoopDefaultMode); + + if (asyncSocket->writeStream) + CFWriteStreamUnscheduleFromRunLoop(asyncSocket->writeStream, runLoop, kCFRunLoopDefaultMode); +} + +static void CFReadStreamCallback (CFReadStreamRef stream, CFStreamEventType type, void *pInfo) +{ + GCDAsyncSocket *asyncSocket = (__bridge GCDAsyncSocket *)pInfo; + + switch(type) + { + case kCFStreamEventHasBytesAvailable: + { + dispatch_async(asyncSocket->socketQueue, ^{ @autoreleasepool { + + LogCVerbose(@"CFReadStreamCallback - HasBytesAvailable"); + + if (asyncSocket->readStream != stream) + return_from_block; + + if ((asyncSocket->flags & kStartingReadTLS) && (asyncSocket->flags & kStartingWriteTLS)) + { + // If we set kCFStreamPropertySSLSettings before we opened the streams, this might be a lie. + // (A callback related to the tcp stream, but not to the SSL layer). + + if (CFReadStreamHasBytesAvailable(asyncSocket->readStream)) + { + asyncSocket->flags |= kSecureSocketHasBytesAvailable; + [asyncSocket cf_finishSSLHandshake]; + } + } + else + { + asyncSocket->flags |= kSecureSocketHasBytesAvailable; + [asyncSocket doReadData]; + } + }}); + + break; + } + default: + { + NSError *error = (__bridge_transfer NSError *)CFReadStreamCopyError(stream); + + if (error == nil && type == kCFStreamEventEndEncountered) + { + error = [asyncSocket connectionClosedError]; + } + + dispatch_async(asyncSocket->socketQueue, ^{ @autoreleasepool { + + LogCVerbose(@"CFReadStreamCallback - Other"); + + if (asyncSocket->readStream != stream) + return_from_block; + + if ((asyncSocket->flags & kStartingReadTLS) && (asyncSocket->flags & kStartingWriteTLS)) + { + [asyncSocket cf_abortSSLHandshake:error]; + } + else + { + [asyncSocket closeWithError:error]; + } + }}); + + break; + } + } + +} + +static void CFWriteStreamCallback (CFWriteStreamRef stream, CFStreamEventType type, void *pInfo) +{ + GCDAsyncSocket *asyncSocket = (__bridge GCDAsyncSocket *)pInfo; + + switch(type) + { + case kCFStreamEventCanAcceptBytes: + { + dispatch_async(asyncSocket->socketQueue, ^{ @autoreleasepool { + + LogCVerbose(@"CFWriteStreamCallback - CanAcceptBytes"); + + if (asyncSocket->writeStream != stream) + return_from_block; + + if ((asyncSocket->flags & kStartingReadTLS) && (asyncSocket->flags & kStartingWriteTLS)) + { + // If we set kCFStreamPropertySSLSettings before we opened the streams, this might be a lie. + // (A callback related to the tcp stream, but not to the SSL layer). + + if (CFWriteStreamCanAcceptBytes(asyncSocket->writeStream)) + { + asyncSocket->flags |= kSocketCanAcceptBytes; + [asyncSocket cf_finishSSLHandshake]; + } + } + else + { + asyncSocket->flags |= kSocketCanAcceptBytes; + [asyncSocket doWriteData]; + } + }}); + + break; + } + default: + { + NSError *error = (__bridge_transfer NSError *)CFWriteStreamCopyError(stream); + + if (error == nil && type == kCFStreamEventEndEncountered) + { + error = [asyncSocket connectionClosedError]; + } + + dispatch_async(asyncSocket->socketQueue, ^{ @autoreleasepool { + + LogCVerbose(@"CFWriteStreamCallback - Other"); + + if (asyncSocket->writeStream != stream) + return_from_block; + + if ((asyncSocket->flags & kStartingReadTLS) && (asyncSocket->flags & kStartingWriteTLS)) + { + [asyncSocket cf_abortSSLHandshake:error]; + } + else + { + [asyncSocket closeWithError:error]; + } + }}); + + break; + } + } + +} + +- (BOOL)createReadAndWriteStream +{ + LogTrace(); + + NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); + + + if (readStream || writeStream) + { + // Streams already created + return YES; + } + + int socketFD = (socket4FD != SOCKET_NULL) ? socket4FD : (socket6FD != SOCKET_NULL) ? socket6FD : socketUN; + + if (socketFD == SOCKET_NULL) + { + // Cannot create streams without a file descriptor + return NO; + } + + if (![self isConnected]) + { + // Cannot create streams until file descriptor is connected + return NO; + } + + LogVerbose(@"Creating read and write stream..."); + + CFStreamCreatePairWithSocket(NULL, (CFSocketNativeHandle)socketFD, &readStream, &writeStream); + + // The kCFStreamPropertyShouldCloseNativeSocket property should be false by default (for our case). + // But let's not take any chances. + + if (readStream) + CFReadStreamSetProperty(readStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanFalse); + if (writeStream) + CFWriteStreamSetProperty(writeStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanFalse); + + if ((readStream == NULL) || (writeStream == NULL)) + { + LogWarn(@"Unable to create read and write stream..."); + + if (readStream) + { + CFReadStreamClose(readStream); + CFRelease(readStream); + readStream = NULL; + } + if (writeStream) + { + CFWriteStreamClose(writeStream); + CFRelease(writeStream); + writeStream = NULL; + } + + return NO; + } + + return YES; +} + +- (BOOL)registerForStreamCallbacksIncludingReadWrite:(BOOL)includeReadWrite +{ + LogVerbose(@"%@ %@", THIS_METHOD, (includeReadWrite ? @"YES" : @"NO")); + + NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); + NSAssert((readStream != NULL && writeStream != NULL), @"Read/Write stream is null"); + + streamContext.version = 0; + streamContext.info = (__bridge void *)(self); + streamContext.retain = nil; + streamContext.release = nil; + streamContext.copyDescription = nil; + + CFOptionFlags readStreamEvents = kCFStreamEventErrorOccurred | kCFStreamEventEndEncountered; + if (includeReadWrite) + readStreamEvents |= kCFStreamEventHasBytesAvailable; + + if (!CFReadStreamSetClient(readStream, readStreamEvents, &CFReadStreamCallback, &streamContext)) + { + return NO; + } + + CFOptionFlags writeStreamEvents = kCFStreamEventErrorOccurred | kCFStreamEventEndEncountered; + if (includeReadWrite) + writeStreamEvents |= kCFStreamEventCanAcceptBytes; + + if (!CFWriteStreamSetClient(writeStream, writeStreamEvents, &CFWriteStreamCallback, &streamContext)) + { + return NO; + } + + return YES; +} + +- (BOOL)addStreamsToRunLoop +{ + LogTrace(); + + NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); + NSAssert((readStream != NULL && writeStream != NULL), @"Read/Write stream is null"); + + if (!(flags & kAddedStreamsToRunLoop)) + { + LogVerbose(@"Adding streams to runloop..."); + + [[self class] startCFStreamThreadIfNeeded]; + dispatch_sync(cfstreamThreadSetupQueue, ^{ + [[self class] performSelector:@selector(scheduleCFStreams:) + onThread:cfstreamThread + withObject:self + waitUntilDone:YES]; + }); + flags |= kAddedStreamsToRunLoop; + } + + return YES; +} + +- (void)removeStreamsFromRunLoop +{ + LogTrace(); + + NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); + NSAssert((readStream != NULL && writeStream != NULL), @"Read/Write stream is null"); + + if (flags & kAddedStreamsToRunLoop) + { + LogVerbose(@"Removing streams from runloop..."); + + dispatch_sync(cfstreamThreadSetupQueue, ^{ + [[self class] performSelector:@selector(unscheduleCFStreams:) + onThread:cfstreamThread + withObject:self + waitUntilDone:YES]; + }); + [[self class] stopCFStreamThreadIfNeeded]; + + flags &= ~kAddedStreamsToRunLoop; + } +} + +- (BOOL)openStreams +{ + LogTrace(); + + NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); + NSAssert((readStream != NULL && writeStream != NULL), @"Read/Write stream is null"); + + CFStreamStatus readStatus = CFReadStreamGetStatus(readStream); + CFStreamStatus writeStatus = CFWriteStreamGetStatus(writeStream); + + if ((readStatus == kCFStreamStatusNotOpen) || (writeStatus == kCFStreamStatusNotOpen)) + { + LogVerbose(@"Opening read and write stream..."); + + BOOL r1 = CFReadStreamOpen(readStream); + BOOL r2 = CFWriteStreamOpen(writeStream); + + if (!r1 || !r2) + { + LogError(@"Error in CFStreamOpen"); + return NO; + } + } + + return YES; +} + +#endif + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Advanced +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * See header file for big discussion of this method. +**/ +- (BOOL)autoDisconnectOnClosedReadStream +{ + // Note: YES means kAllowHalfDuplexConnection is OFF + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + return ((config & kAllowHalfDuplexConnection) == 0); + } + else + { + __block BOOL result; + + dispatch_sync(socketQueue, ^{ + result = ((self->config & kAllowHalfDuplexConnection) == 0); + }); + + return result; + } +} + +/** + * See header file for big discussion of this method. +**/ +- (void)setAutoDisconnectOnClosedReadStream:(BOOL)flag +{ + // Note: YES means kAllowHalfDuplexConnection is OFF + + dispatch_block_t block = ^{ + + if (flag) + self->config &= ~kAllowHalfDuplexConnection; + else + self->config |= kAllowHalfDuplexConnection; + }; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_async(socketQueue, block); +} + + +/** + * See header file for big discussion of this method. +**/ +- (void)markSocketQueueTargetQueue:(dispatch_queue_t)socketNewTargetQueue +{ + void *nonNullUnusedPointer = (__bridge void *)self; + dispatch_queue_set_specific(socketNewTargetQueue, IsOnSocketQueueOrTargetQueueKey, nonNullUnusedPointer, NULL); +} + +/** + * See header file for big discussion of this method. +**/ +- (void)unmarkSocketQueueTargetQueue:(dispatch_queue_t)socketOldTargetQueue +{ + dispatch_queue_set_specific(socketOldTargetQueue, IsOnSocketQueueOrTargetQueueKey, NULL, NULL); +} + +/** + * See header file for big discussion of this method. +**/ +- (void)performBlock:(dispatch_block_t)block +{ + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_sync(socketQueue, block); +} + +/** + * Questions? Have you read the header file? +**/ +- (int)socketFD +{ + if (!dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + LogWarn(@"%@ - Method only available from within the context of a performBlock: invocation", THIS_METHOD); + return SOCKET_NULL; + } + + if (socket4FD != SOCKET_NULL) + return socket4FD; + else + return socket6FD; +} + +/** + * Questions? Have you read the header file? +**/ +- (int)socket4FD +{ + if (!dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + LogWarn(@"%@ - Method only available from within the context of a performBlock: invocation", THIS_METHOD); + return SOCKET_NULL; + } + + return socket4FD; +} + +/** + * Questions? Have you read the header file? +**/ +- (int)socket6FD +{ + if (!dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + LogWarn(@"%@ - Method only available from within the context of a performBlock: invocation", THIS_METHOD); + return SOCKET_NULL; + } + + return socket6FD; +} + +#if TARGET_OS_IPHONE + +/** + * Questions? Have you read the header file? +**/ +- (CFReadStreamRef)readStream +{ + if (!dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + LogWarn(@"%@ - Method only available from within the context of a performBlock: invocation", THIS_METHOD); + return NULL; + } + + if (readStream == NULL) + [self createReadAndWriteStream]; + + return readStream; +} + +/** + * Questions? Have you read the header file? +**/ +- (CFWriteStreamRef)writeStream +{ + if (!dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + LogWarn(@"%@ - Method only available from within the context of a performBlock: invocation", THIS_METHOD); + return NULL; + } + + if (writeStream == NULL) + [self createReadAndWriteStream]; + + return writeStream; +} + +- (BOOL)enableBackgroundingOnSocketWithCaveat:(BOOL)caveat +{ + if (![self createReadAndWriteStream]) + { + // Error occurred creating streams (perhaps socket isn't open) + return NO; + } + + BOOL r1, r2; + + LogVerbose(@"Enabling backgrouding on socket"); + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + r1 = CFReadStreamSetProperty(readStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); + r2 = CFWriteStreamSetProperty(writeStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); +#pragma clang diagnostic pop + + if (!r1 || !r2) + { + return NO; + } + + if (!caveat) + { + if (![self openStreams]) + { + return NO; + } + } + + return YES; +} + +/** + * Questions? Have you read the header file? +**/ +- (BOOL)enableBackgroundingOnSocket +{ + LogTrace(); + + if (!dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + LogWarn(@"%@ - Method only available from within the context of a performBlock: invocation", THIS_METHOD); + return NO; + } + + return [self enableBackgroundingOnSocketWithCaveat:NO]; +} + +- (BOOL)enableBackgroundingOnSocketWithCaveat // Deprecated in iOS 4.??? +{ + // This method was created as a workaround for a bug in iOS. + // Apple has since fixed this bug. + // I'm not entirely sure which version of iOS they fixed it in... + + LogTrace(); + + if (!dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + LogWarn(@"%@ - Method only available from within the context of a performBlock: invocation", THIS_METHOD); + return NO; + } + + return [self enableBackgroundingOnSocketWithCaveat:YES]; +} + +#endif + +- (SSLContextRef)sslContext +{ + if (!dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + { + LogWarn(@"%@ - Method only available from within the context of a performBlock: invocation", THIS_METHOD); + return NULL; + } + + return sslContext; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Class Utilities +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ++ (NSMutableArray *)lookupHost:(NSString *)host port:(uint16_t)port error:(NSError **)errPtr +{ + LogTrace(); + + NSMutableArray *addresses = nil; + NSError *error = nil; + + if ([host isEqualToString:@"localhost"] || [host isEqualToString:@"loopback"]) + { + // Use LOOPBACK address + struct sockaddr_in nativeAddr4; + nativeAddr4.sin_len = sizeof(struct sockaddr_in); + nativeAddr4.sin_family = AF_INET; + nativeAddr4.sin_port = htons(port); + nativeAddr4.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + memset(&(nativeAddr4.sin_zero), 0, sizeof(nativeAddr4.sin_zero)); + + struct sockaddr_in6 nativeAddr6; + nativeAddr6.sin6_len = sizeof(struct sockaddr_in6); + nativeAddr6.sin6_family = AF_INET6; + nativeAddr6.sin6_port = htons(port); + nativeAddr6.sin6_flowinfo = 0; + nativeAddr6.sin6_addr = in6addr_loopback; + nativeAddr6.sin6_scope_id = 0; + + // Wrap the native address structures + + NSData *address4 = [NSData dataWithBytes:&nativeAddr4 length:sizeof(nativeAddr4)]; + NSData *address6 = [NSData dataWithBytes:&nativeAddr6 length:sizeof(nativeAddr6)]; + + addresses = [NSMutableArray arrayWithCapacity:2]; + [addresses addObject:address4]; + [addresses addObject:address6]; + } + else + { + NSString *portStr = [NSString stringWithFormat:@"%hu", port]; + + struct addrinfo hints, *res, *res0; + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; + + int gai_error = getaddrinfo([host UTF8String], [portStr UTF8String], &hints, &res0); + + if (gai_error) + { + error = [self gaiError:gai_error]; + } + else + { + NSUInteger capacity = 0; + for (res = res0; res; res = res->ai_next) + { + if (res->ai_family == AF_INET || res->ai_family == AF_INET6) { + capacity++; + } + } + + addresses = [NSMutableArray arrayWithCapacity:capacity]; + + for (res = res0; res; res = res->ai_next) + { + if (res->ai_family == AF_INET) + { + // Found IPv4 address. + // Wrap the native address structure, and add to results. + + NSData *address4 = [NSData dataWithBytes:res->ai_addr length:res->ai_addrlen]; + [addresses addObject:address4]; + } + else if (res->ai_family == AF_INET6) + { + // Fixes connection issues with IPv6 + // https://github.com/robbiehanson/CocoaAsyncSocket/issues/429#issuecomment-222477158 + + // Found IPv6 address. + // Wrap the native address structure, and add to results. + + struct sockaddr_in6 *sockaddr = (struct sockaddr_in6 *)(void *)res->ai_addr; + in_port_t *portPtr = &sockaddr->sin6_port; + if ((portPtr != NULL) && (*portPtr == 0)) { + *portPtr = htons(port); + } + + NSData *address6 = [NSData dataWithBytes:res->ai_addr length:res->ai_addrlen]; + [addresses addObject:address6]; + } + } + freeaddrinfo(res0); + + if ([addresses count] == 0) + { + error = [self gaiError:EAI_FAIL]; + } + } + } + + if (errPtr) *errPtr = error; + return addresses; +} + ++ (NSString *)hostFromSockaddr4:(const struct sockaddr_in *)pSockaddr4 +{ + char addrBuf[INET_ADDRSTRLEN]; + + if (inet_ntop(AF_INET, &pSockaddr4->sin_addr, addrBuf, (socklen_t)sizeof(addrBuf)) == NULL) + { + addrBuf[0] = '\0'; + } + + return [NSString stringWithCString:addrBuf encoding:NSASCIIStringEncoding]; +} + ++ (NSString *)hostFromSockaddr6:(const struct sockaddr_in6 *)pSockaddr6 +{ + char addrBuf[INET6_ADDRSTRLEN]; + + if (inet_ntop(AF_INET6, &pSockaddr6->sin6_addr, addrBuf, (socklen_t)sizeof(addrBuf)) == NULL) + { + addrBuf[0] = '\0'; + } + + return [NSString stringWithCString:addrBuf encoding:NSASCIIStringEncoding]; +} + ++ (uint16_t)portFromSockaddr4:(const struct sockaddr_in *)pSockaddr4 +{ + return ntohs(pSockaddr4->sin_port); +} + ++ (uint16_t)portFromSockaddr6:(const struct sockaddr_in6 *)pSockaddr6 +{ + return ntohs(pSockaddr6->sin6_port); +} + ++ (NSURL *)urlFromSockaddrUN:(const struct sockaddr_un *)pSockaddr +{ + NSString *path = [NSString stringWithUTF8String:pSockaddr->sun_path]; + return [NSURL fileURLWithPath:path]; +} + ++ (NSString *)hostFromAddress:(NSData *)address +{ + NSString *host; + + if ([self getHost:&host port:NULL fromAddress:address]) + return host; + else + return nil; +} + ++ (uint16_t)portFromAddress:(NSData *)address +{ + uint16_t port; + + if ([self getHost:NULL port:&port fromAddress:address]) + return port; + else + return 0; +} + ++ (BOOL)isIPv4Address:(NSData *)address +{ + if ([address length] >= sizeof(struct sockaddr)) + { + const struct sockaddr *sockaddrX = [address bytes]; + + if (sockaddrX->sa_family == AF_INET) { + return YES; + } + } + + return NO; +} + ++ (BOOL)isIPv6Address:(NSData *)address +{ + if ([address length] >= sizeof(struct sockaddr)) + { + const struct sockaddr *sockaddrX = [address bytes]; + + if (sockaddrX->sa_family == AF_INET6) { + return YES; + } + } + + return NO; +} + ++ (BOOL)getHost:(NSString **)hostPtr port:(uint16_t *)portPtr fromAddress:(NSData *)address +{ + return [self getHost:hostPtr port:portPtr family:NULL fromAddress:address]; +} + ++ (BOOL)getHost:(NSString **)hostPtr port:(uint16_t *)portPtr family:(sa_family_t *)afPtr fromAddress:(NSData *)address +{ + if ([address length] >= sizeof(struct sockaddr)) + { + const struct sockaddr *sockaddrX = [address bytes]; + + if (sockaddrX->sa_family == AF_INET) + { + if ([address length] >= sizeof(struct sockaddr_in)) + { + struct sockaddr_in sockaddr4; + memcpy(&sockaddr4, sockaddrX, sizeof(sockaddr4)); + + if (hostPtr) *hostPtr = [self hostFromSockaddr4:&sockaddr4]; + if (portPtr) *portPtr = [self portFromSockaddr4:&sockaddr4]; + if (afPtr) *afPtr = AF_INET; + + return YES; + } + } + else if (sockaddrX->sa_family == AF_INET6) + { + if ([address length] >= sizeof(struct sockaddr_in6)) + { + struct sockaddr_in6 sockaddr6; + memcpy(&sockaddr6, sockaddrX, sizeof(sockaddr6)); + + if (hostPtr) *hostPtr = [self hostFromSockaddr6:&sockaddr6]; + if (portPtr) *portPtr = [self portFromSockaddr6:&sockaddr6]; + if (afPtr) *afPtr = AF_INET6; + + return YES; + } + } + } + + return NO; +} + ++ (NSData *)CRLFData +{ + return [NSData dataWithBytes:"\x0D\x0A" length:2]; +} + ++ (NSData *)CRData +{ + return [NSData dataWithBytes:"\x0D" length:1]; +} + ++ (NSData *)LFData +{ + return [NSData dataWithBytes:"\x0A" length:1]; +} + ++ (NSData *)ZeroData +{ + return [NSData dataWithBytes:"" length:1]; +} + +@end diff --git a/CommandPost Workflow Extension/User Interface/CommandPostViewController.xib b/CommandPost Workflow Extension/User Interface/CommandPostViewController.xib new file mode 100644 index 000000000..418561484 --- /dev/null +++ b/CommandPost Workflow Extension/User Interface/CommandPostViewController.xib @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Hammerspoon Tests/HSTestCase.h b/Hammerspoon Tests/HSTestCase.h index b7163170b..bf04d4bae 100644 --- a/Hammerspoon Tests/HSTestCase.h +++ b/Hammerspoon Tests/HSTestCase.h @@ -11,10 +11,16 @@ #import "MJLua.h" #define RUN_LUA_TEST() XCTAssertTrue([self luaTestFromSelector:_cmd], @"Test failed: %@", NSStringFromSelector(_cmd)); -#define SKIP_IN_TRAVIS() if(self.isTravis) { NSLog(@"Skipping %@ due to Travis", NSStringFromSelector(_cmd)) ; return; } +#define RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(timeout) [self twoPartTestName:_cmd withTimeout:timeout]; + +#define SKIP_IN_TRAVIS() if(self.isTravis) { NSLog(@"Skipping %@ due to Travis", NSStringFromSelector(_cmd)) ; XCTSkip("Test is unreliable in Travis"); } +#define SKIP_IN_XCODE_SERVER() if(self.isXcodeServer) { NSLog(@"Skipping %@ due to Xcode Server", NSStringFromSelector(_cmd)) ; XCTSkip("Test is unreliable in Xcode Server"); } +#define SKIP_IN_GITHUB_ACTIONS() if(self.isGitHubActions) { NSLog(@"Skipping %@ due to GitHub Actions", NSStringFromSelector(_cmd)) ; XCTSkip("Test is unreliable in GitHub Actions"); } @interface HSTestCase : XCTestCase @property (nonatomic) BOOL isTravis; +@property (nonatomic) BOOL isXcodeServer; +@property (nonatomic) BOOL isGitHubActions; /** Sets up the testing environment and loads a Lua file with require() @@ -43,18 +49,24 @@ */ - (BOOL)luaTest:(NSString *)luaCode; +/** +Executes a two-part Lua test with a timeout. + + This is similar to luaTestWithCheckAndTimeOut, but automatically finds the second function by appending `Values` to the first function. + The second function will be called repeatedly until it either returns successfully, or timeout is reached. + */ +- (void)twoPartTestName:(SEL)selector withTimeout:(NSTimeInterval)timeout; + /** Executes a two-part Lua test with a timeout. - The provided setup code is executed immediately, and then the supplied check code will be tested every 0.5s until the test either returns "Success", or the timeout time is reached. + The provided setup code is executed immediately, and then the supplied check code will be tested every 0.5 seconds until it either passes, or `timeout` is reached @param timeOut The amount of time to allow the test to run unsuccessfully, before failing it @param setupCode An NSString containing some Lua code to instantiate the test @param checkCode An NSString containing some Lua code to check if the test has passed - - @return A boolean, true if the test passed, otherwise false */ -- (BOOL)luaTestWithCheckAndTimeOut:(NSTimeInterval)timeOut setupCode:(NSString *)setupCode checkCode:(NSString *)checkCode; +- (void)luaTestWithCheckAndTimeOut:(NSTimeInterval)timeOut setupCode:(NSString *)setupCode checkCode:(NSString *)checkCode; /** Executes a Lua function with the same name as an Objective C selector. This reduces the amount of typing required in the Objective C portions of your tests - if you name your Lua test functions correctly, all you need to do is call [self luaTestFromSelector:_cmd] in each method. This is also neatly abstracted to a #define called RUN_LUA_TEST() @@ -73,4 +85,12 @@ @return A boolean, true if the test run is happening in Travis, false otherwise */ - (BOOL)runningInTravis; + +/** + Determines if the test run is happening in an Xcode Server build system, since we need to skip some tests in that environment + + @return A boolean, true if the test run is happening in Xcode Server, false otherwise + */ +- (BOOL)runningInXcodeServer; + @end diff --git a/Hammerspoon Tests/HSTestCase.m b/Hammerspoon Tests/HSTestCase.m index 6537b6174..92cfc07a1 100644 --- a/Hammerspoon Tests/HSTestCase.m +++ b/Hammerspoon Tests/HSTestCase.m @@ -13,6 +13,8 @@ @implementation HSTestCase - (void)setUpWithRequire:(NSString *)requireName { [super setUp]; self.isTravis = [self runningInTravis]; + self.isXcodeServer = [self runningInXcodeServer]; + self.isGitHubActions = [self runningInGitHubActions]; NSString *result = [self runLua:[NSString stringWithFormat:@"require('%@')", requireName]]; XCTAssertEqualObjects(@"true", result, @"Unable to load %@.lua", requireName); @@ -32,19 +34,49 @@ - (BOOL)luaTest:(NSString *)luaCode { return [result isEqualToString:@"Success"]; } -- (BOOL)luaTestWithCheckAndTimeOut:(NSTimeInterval)timeOut setupCode:(NSString *)setupCode checkCode:(NSString *)checkCode { - NSDate *timeoutDate = [NSDate dateWithTimeIntervalSinceNow:timeOut]; - BOOL result = NO; +- (void)luaTestWithCheckAndTimeOut:(NSTimeInterval)timeOut setupCode:(NSString *)setupCode checkCode:(NSString *)checkCode { + XCTestExpectation *expectation = [self expectationWithDescription:setupCode]; - [self runLua:setupCode]; - - while (result == NO && ([timeoutDate timeIntervalSinceNow] > 0)) { - CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.5, NO); - result = [self luaTest:checkCode]; + NSLog(@"Calling setup code: %@", setupCode); + NSString *result = [self runLua:setupCode]; + NSLog(@"Test returned %@ for: %@", result, setupCode); + if (![result isEqualToString:@"Success"]) { + // Invert the expectation and then fulfill it, to force a failure + expectation.inverted = YES; + [expectation fulfill]; + return; } - return result; + NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.5 repeats:YES block:^(NSTimer *timer) { + NSLog(@"Calling check code: %@", checkCode); + BOOL result = [self luaTest:checkCode]; + if (result) { + [expectation fulfill]; + [timer invalidate]; + } + }]; +/* dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + NSLog(@"Calling check code: %@", checkCode); + BOOL result = [self luaTest:checkCode]; + if (result) { + [expectation fulfill]; + } + });*/ + [self waitForExpectationsWithTimeout:timeOut handler:^(NSError *error) { + if (error) { + NSLog(@"%@ failed", setupCode); + } else { + NSLog(@"%@ succeeded", setupCode); + } + [timer invalidate]; + }]; } + +- (void)twoPartTestName:(SEL)selector withTimeout:(NSTimeInterval)timeout { + NSString *funcName = NSStringFromSelector(selector); + [self luaTestWithCheckAndTimeOut:timeout setupCode:[funcName stringByAppendingString:@"()"] checkCode:[funcName stringByAppendingString:@"Values()"]]; +} + - (BOOL)luaTestFromSelector:(SEL)selector { NSString *funcName = NSStringFromSelector(selector); NSLog(@"Calling Lua function from selector: %@()", funcName); @@ -55,6 +87,14 @@ - (BOOL)runningInTravis { return (getenv("TRAVIS") != NULL); } +- (BOOL)runningInXcodeServer { + return (getenv("XCS") != NULL); +} + +- (BOOL)runningInGitHubActions { + return (getenv("GITHUB_ACTIONS") != NULL); +} + // Tests of the above methods - (void)testrunLua { @@ -66,4 +106,4 @@ - (void)testTestLuaSuccess { [self luaTest:@"return 'Success'"]; } -@end \ No newline at end of file +@end diff --git a/Hammerspoon Tests/HSapplication.m b/Hammerspoon Tests/HSapplication.m index b36222364..0c095aaa1 100644 --- a/Hammerspoon Tests/HSapplication.m +++ b/Hammerspoon Tests/HSapplication.m @@ -8,11 +8,11 @@ #import "HSTestCase.h" -@interface HSapplication : HSTestCase +@interface HSapplicationTests : HSTestCase @end -@implementation HSapplication +@implementation HSapplicationTests - (void)setUp { [super setUpWithRequire:@"test_application"]; @@ -24,6 +24,15 @@ - (void)tearDown { [super tearDown]; } +- (void)testInitWithPidFailures { + RUN_LUA_TEST() +} + +- (void)testInitWithPid { + SKIP_IN_GITHUB_ACTIONS() // Added by @asmagill + RUN_LUA_TEST() +} + - (void)testAttributesFromBundleID { RUN_LUA_TEST() } @@ -36,4 +45,52 @@ - (void)testBasicAttributes { // RUN_LUA_TEST() // } +- (void)testFrontmostApplication { + SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() + RUN_LUA_TEST() +} + +- (void)testRunningApplications { + RUN_LUA_TEST() +} + +- (void)testHiding { + SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() + [self luaTestWithCheckAndTimeOut:5 setupCode:@"testHiding()" checkCode:@"testHidingValues()"]; +} + +- (void)testKilling { + SKIP_IN_TRAVIS() + [self luaTestWithCheckAndTimeOut:5 setupCode:@"testKilling()" checkCode:@"testKillingValues()"]; +} + +- (void)testForceKilling { + SKIP_IN_TRAVIS() + [self luaTestWithCheckAndTimeOut:5 setupCode:@"testForceKilling()" checkCode:@"testForceKillingValues()"]; +} + +- (void)testWindows { + SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() + [self luaTestWithCheckAndTimeOut:5 setupCode:@"testWindows()" checkCode:@"testWindowsValues()"]; +} + +- (void)testMenus { + RUN_LUA_TEST() +} + +- (void)testMenusAsync { + [self luaTestWithCheckAndTimeOut:5 setupCode:@"testMenusAsync()" checkCode:@"testMenusAsyncValues()"]; +} + +- (void)testUTI { + RUN_LUA_TEST() +} + +- (void)testLocalizationFunctions { + RUN_LUA_TEST() +} + @end diff --git a/Hammerspoon Tests/HSaudiodevice.m b/Hammerspoon Tests/HSaudiodevice.m index 7c9648502..4b8b9555a 100644 --- a/Hammerspoon Tests/HSaudiodevice.m +++ b/Hammerspoon Tests/HSaudiodevice.m @@ -27,6 +27,10 @@ - (void)tearDown { // Test functions/constructors +- (void)testGetDefaultEffect { + RUN_LUA_TEST() +} + - (void)testGetDefaultOutput { RUN_LUA_TEST() } @@ -45,46 +49,55 @@ - (void)testGetCurrentInput { - (void)testGetAllDevices { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } - (void)testGetAllOutputDevices { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } - (void)testGetAllInputDevices { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } - (void)testFindDeviceByName { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } - (void)testFindDeviceByUID { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } - (void)testFindInputByName { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } - (void)testFindInputByUID { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } - (void)testFindOutputByName { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } - (void)testFindOutputByUID { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } @@ -93,6 +106,10 @@ - (void)testToString { RUN_LUA_TEST() } +- (void)testSetDefaultEffect { + RUN_LUA_TEST() +} + - (void)testSetDefaultOutput { RUN_LUA_TEST() } @@ -103,11 +120,13 @@ - (void)testSetDefaultInput { - (void)testName { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } - (void)testUID { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } @@ -125,6 +144,10 @@ - (void)testMute { RUN_LUA_TEST() } +- (void)testThru { + RUN_LUA_TEST() +} + - (void)testVolume { SKIP_IN_TRAVIS() RUN_LUA_TEST() @@ -154,6 +177,7 @@ - (void)testWatcher { - (void)testWatcherCallback { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() NSDate *timeoutDate = [NSDate dateWithTimeIntervalSinceNow:5.0]; BOOL result = NO; @@ -169,47 +193,56 @@ - (void)testWatcherCallback { - (void)testInputSupportsDataSources { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } - (void)testOutputSupportsDataSources { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } - (void)testCurrentInputDataSource { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } - (void)testCurrentOutputDataSource { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } - (void)testAllInputDataSources { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } - (void)testAllOutputDataSources { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } // hs.audiodevice.datasource methods - (void)testDataSourceToString { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } - (void)testDataSourceName { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } - (void)testDataSourceSetDefault { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } @end diff --git a/Hammerspoon Tests/HSbrightness.m b/Hammerspoon Tests/HSbrightness.m index 4cfe4b3bc..d18bed94d 100644 --- a/Hammerspoon Tests/HSbrightness.m +++ b/Hammerspoon Tests/HSbrightness.m @@ -26,11 +26,14 @@ - (void)tearDown { - (void)testGet { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } - (void)testSet { SKIP_IN_TRAVIS() + SKIP_IN_XCODE_SERVER() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } diff --git a/Hammerspoon Tests/HScoresetup.m b/Hammerspoon Tests/HScoresetup.m index 81f1fc337..ce07aa74c 100644 --- a/Hammerspoon Tests/HScoresetup.m +++ b/Hammerspoon Tests/HScoresetup.m @@ -52,8 +52,8 @@ - (void)testShutdownCallback { {"verifyShutdown", verifyShutdown}, {NULL, NULL} }; - LuaSkin *skin = [LuaSkin shared]; - [skin registerLibrary:shutdownLib metaFunctions:nil]; + LuaSkin *skin = [LuaSkin sharedWithState:NULL]; + [skin registerLibrary:"shutdownLib" functions:shutdownLib metaFunctions:nil]; lua_setglobal(skin.L, "shutdownLib"); RUN_LUA_TEST() @@ -110,4 +110,4 @@ - (void)testMenuIcon { } // FIXME: Quite a few things here are untested, like opening About/Console/Prefs windows, because I'm not yet sure how to test them -@end \ No newline at end of file +@end diff --git a/Hammerspoon Tests/HSdistributednotifications.m b/Hammerspoon Tests/HSdistributednotifications.m index 436c0f596..d05c33ffb 100644 --- a/Hammerspoon Tests/HSdistributednotifications.m +++ b/Hammerspoon Tests/HSdistributednotifications.m @@ -25,7 +25,7 @@ - (void)tearDown { } - (void)testdistributednotifications { - XCTAssertTrue([self luaTestWithCheckAndTimeOut:5 setupCode:@"testDistributedNotifications()" checkCode:@"testDistNotValueCheck()"], @"hs.distributednotifications test failed"); + [self luaTestWithCheckAndTimeOut:5 setupCode:@"testDistributedNotifications()" checkCode:@"testDistNotValueCheck()"]; } -@end \ No newline at end of file +@end diff --git a/Hammerspoon Tests/HSfs.m b/Hammerspoon Tests/HSfs.m index 11e9fa0b1..5cc3d7acf 100644 --- a/Hammerspoon Tests/HSfs.m +++ b/Hammerspoon Tests/HSfs.m @@ -72,7 +72,8 @@ - (void)testLock { - (void)testVolumes { SKIP_IN_TRAVIS() - XCTAssertTrue([self luaTestWithCheckAndTimeOut:10 setupCode:@"testVolumes()" checkCode:@"testVolumesValues()"], @"testVolumes test failed"); + SKIP_IN_GITHUB_ACTIONS() + [self luaTestWithCheckAndTimeOut:10 setupCode:@"testVolumes()" checkCode:@"testVolumesValues()"]; } @end diff --git a/Hammerspoon Tests/HShotkey.m b/Hammerspoon Tests/HShotkey.m new file mode 100644 index 000000000..516d54554 --- /dev/null +++ b/Hammerspoon Tests/HShotkey.m @@ -0,0 +1,54 @@ +// +// HShotkey.m +// Hammerspoon Tests +// +// Created by Chris Jones on 06/05/2021. +// Copyright © 2021 Hammerspoon. All rights reserved. +// + +#import "HSTestCase.h" + +@interface HShotkey : HSTestCase + +@end + +@implementation HShotkey + +- (void)setUp { + [super setUpWithRequire:@"test_hotkey"]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +- (void)testAssignable { + RUN_LUA_TEST() +} + +- (void)testGetHotkeys { + RUN_LUA_TEST() +} + +- (void)testGetSystemAssigned { + SKIP_IN_GITHUB_ACTIONS() + RUN_LUA_TEST() +} + +- (void)testBasicHotkey { + SKIP_IN_GITHUB_ACTIONS() + RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(2) +} + +- (void)testRepeatingHotkey { + SKIP_IN_GITHUB_ACTIONS() + RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(5) +} + +- (void)testHotkeyStates { + SKIP_IN_GITHUB_ACTIONS() + RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(5) +} +@end diff --git a/Hammerspoon Tests/HShttp.m b/Hammerspoon Tests/HShttp.m new file mode 100644 index 000000000..53a33766c --- /dev/null +++ b/Hammerspoon Tests/HShttp.m @@ -0,0 +1,53 @@ +// +// HShttp.m +// Hammerspoon +// +// Created by Alex Chen on 08/21/2022. + +#import "HSTestCase.h" + +@interface HThttp : HSTestCase + +@end + +@implementation HThttp + +- (void)setUp { + [super setUpWithRequire:@"test_http"]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +// Http tests + +- (void)testHttpDoAsyncRequestWithCachePolicyParam { + RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(5) +} + +- (void)testHttpDoAsyncRequestWithoutEnableRedirectAndCachePolicyParam { + RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(5) +} + +// There's no Lua counterpart for this yet +//- (void)testHttpDoAsyncRequestWithRedirectParamButNoCachePolicyParam { +// RUN_LUA_TEST() +//} + +// There's no Lua counterpart for this yet +//- (void)testHttpDoAsyncRequestWithNoEnableRedirectParam { +// RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(5) +//} + +- (void)testHttpDoAsyncRequestWithRedirection { + RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(5) +} + +- (void)testHttpDoAsyncRequestWithoutRedirection { + RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(5) +} + +@end diff --git a/Hammerspoon Tests/HSimage.m b/Hammerspoon Tests/HSimage.m new file mode 100644 index 000000000..08b261445 --- /dev/null +++ b/Hammerspoon Tests/HSimage.m @@ -0,0 +1,23 @@ +#import "HSTestCase.h" + +@interface HSimage : HSTestCase + +@end + +@implementation HSimage + +- (void)setUp { + [super setUpWithRequire:@"test_image"]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +- (void)testGetExifFromPath { + RUN_LUA_TEST() +} + +@end diff --git a/Hammerspoon Tests/HSinspect.m b/Hammerspoon Tests/HSinspect.m new file mode 100644 index 000000000..40cf2b9ed --- /dev/null +++ b/Hammerspoon Tests/HSinspect.m @@ -0,0 +1,41 @@ +// +// HSinspect.m +// Hammerspoon +// +// Created by David Peterson on 18-Oct-2018. +// Copyright © 2016 Hammerspoon. All rights reserved. +// + +#import "HSTestCase.h" + +@interface HSinspect : HSTestCase + +@end + +@implementation HSinspect + +- (void)setUp { + [super setUpWithRequire:@"test_inspect"]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +- (void)testSimpleInspect { + RUN_LUA_TEST() +} + +/* - cmsj disabled this test because it doesn't work: + 2018-12-27 11:20:52.584907+0100 Hammerspoon[23984:1758686] Test returned: ...s/Hammerspoon Tests.xctest/Contents/Resources/lsunit.lua:27: Assertion failure: expected: '{a = "b"}', actual: '{ + a = nil + }' + +- (void)testInspectAlwaysNewTableKeyValue { + RUN_LUA_TEST() +} + */ + +@end diff --git a/Hammerspoon Tests/HSjsonTests.m b/Hammerspoon Tests/HSjsonTests.m new file mode 100644 index 000000000..cad45fb89 --- /dev/null +++ b/Hammerspoon Tests/HSjsonTests.m @@ -0,0 +1,39 @@ +// +// HSjsonTests.m +// Hammerspoon Tests +// +// Created by Chris Jones on 15/02/2021. +// Copyright © 2021 Hammerspoon. All rights reserved. +// + +#import "HSTestCase.h" + +@interface HSjsonTests : HSTestCase + +@end + +@implementation HSjsonTests + +- (void)setUp { + [super setUpWithRequire:@"test_json"]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +- (void)testEncodeDecode { + RUN_LUA_TEST() +} + +- (void)testEncodeDecodeFailures { + XCTAssertFalse([self luaTestFromSelector:_cmd], @"Test failed: %@", NSStringFromSelector(_cmd)); +} + +- (void)testReadWrite { + RUN_LUA_TEST() +} + +@end diff --git a/Hammerspoon Tests/HSmath.m b/Hammerspoon Tests/HSmath.m new file mode 100644 index 000000000..e2ca58125 --- /dev/null +++ b/Hammerspoon Tests/HSmath.m @@ -0,0 +1,37 @@ +// +// HSmath.m +// Hammerspoon Tests +// +// Created by Chris Jones on 23/12/2019. +// Copyright © 2019 Hammerspoon. All rights reserved. +// + +#import "HSTestCase.h" + +@interface HSmath : HSTestCase + +@end + +@implementation HSmath + +- (void)setUp { + [super setUpWithRequire:@"test_math"]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +// FIXME: These tests don't really test anything other than the functions exist and don't throw errors + +- (void)testRandomFloat { + RUN_LUA_TEST() +} + +- (void)testRandomFromRange { + RUN_LUA_TEST() +} + +@end diff --git a/Hammerspoon Tests/HSmouse.m b/Hammerspoon Tests/HSmouse.m new file mode 100644 index 000000000..d305e4ee0 --- /dev/null +++ b/Hammerspoon Tests/HSmouse.m @@ -0,0 +1,50 @@ +// +// HSmath.m +// Hammerspoon Tests +// +// Created by Chris Jones on 23/12/2019. +// Copyright © 2019 Hammerspoon. All rights reserved. +// + +#import "HSTestCase.h" + +@interface HSmouseTests : HSTestCase + +@end + +@implementation HSmouseTests + +- (void)setUp { + [super setUpWithRequire:@"test_mouse"]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +// FIXME: These tests don't really test anything other than the functions exist and don't throw errors + +- (void)testMouseCount { + SKIP_IN_GITHUB_ACTIONS() + RUN_LUA_TEST() +} + +- (void)testMouseNames { + SKIP_IN_GITHUB_ACTIONS() + RUN_LUA_TEST() +} + +- (void)testMouseAbsolutePosition { + RUN_LUA_TEST() +} + +- (void)testScrollDirection { + RUN_LUA_TEST() +} + +- (void)testMouseTrackingSpeed { + RUN_LUA_TEST() +} +@end diff --git a/Hammerspoon Tests/HSrequire_all.m b/Hammerspoon Tests/HSrequire_all.m index 8e37ae1c6..41748e8a0 100644 --- a/Hammerspoon Tests/HSrequire_all.m +++ b/Hammerspoon Tests/HSrequire_all.m @@ -28,8 +28,12 @@ - (void)tearDown { - (void)testRequireAll { // FIXME: this is hacky, we should be getting a table back so we can assert every extension, etc. NSString *res = [self runLua:@"return testrequires()"]; - NSLog(@"%@", res); - XCTAssertEqualObjects(res, @"", @"one or more require statements failed"); + NSArray *errors = [res componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"💩"]]; + + // If Hammerspoon is already running, hs.ipc will fail to load, so let's filter that error out if it exists. + NSArray *filteredErrors = [errors filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"NOT (SELF contains 'failed to create new local port') AND NOT (SELF == '')"]]; + + XCTAssertEqual(0, filteredErrors.count, @"Some modules failed to load: %@", filteredErrors); } diff --git a/Hammerspoon Tests/HSscreen.m b/Hammerspoon Tests/HSscreen.m index 6bd35d8fc..89cceeff5 100644 --- a/Hammerspoon Tests/HSscreen.m +++ b/Hammerspoon Tests/HSscreen.m @@ -55,6 +55,11 @@ - (void)testCurrentMode { } - (void)testSetMode { + SKIP_IN_GITHUB_ACTIONS() + RUN_LUA_TEST() +} + +- (void)testSetOrigin { RUN_LUA_TEST() } @@ -71,7 +76,7 @@ - (void)testBrightness { } - (void)testGamma { - // FIXME: This should really be an async test which checks that the setGamme() happened. Right now we are just blindly assuming it happens. + // FIXME: This should really be an async test which checks that the setGamma() happened. Right now we are just blindly assuming it happens. RUN_LUA_TEST() } @@ -110,4 +115,4 @@ - (void)testToUnitRect { // FIXME: Untested: toEast/toWest/toSouth/toNorth -@end \ No newline at end of file +@end diff --git a/Hammerspoon Tests/HSserial.m b/Hammerspoon Tests/HSserial.m new file mode 100644 index 000000000..fda48b8dc --- /dev/null +++ b/Hammerspoon Tests/HSserial.m @@ -0,0 +1,49 @@ +// +// hs.serial Tests +// + +#import "HSTestCase.h" + +@interface HSserial : HSTestCase + +@end + +@implementation HSserial + +- (void)setUp { + [super setUpWithRequire:@"test_serial"]; +} + +- (void)tearDown { + [super tearDown]; +} + +- (void)testAvailablePortNames { + RUN_LUA_TEST() +} + +- (void)testAvailablePortPaths { + RUN_LUA_TEST() +} + +- (void)testNewFromName { + SKIP_IN_GITHUB_ACTIONS() + RUN_LUA_TEST() +} + +- (void)testNewFromPath { + SKIP_IN_GITHUB_ACTIONS() + RUN_LUA_TEST() +} + +- (void)testOpenAndClose { + SKIP_IN_GITHUB_ACTIONS() + RUN_LUA_TEST() +} + +- (void)testAttributes { + SKIP_IN_GITHUB_ACTIONS() + RUN_LUA_TEST() +} + +@end diff --git a/Hammerspoon Tests/HSsocket.m b/Hammerspoon Tests/HSsocket.m index 747a4f13a..4b186a669 100644 --- a/Hammerspoon Tests/HSsocket.m +++ b/Hammerspoon Tests/HSsocket.m @@ -4,9 +4,7 @@ // // Created by Michael Bujol on 02/12/2016. -#import "HSTestcase.h" - -#define RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(timeout) XCTAssertTrue([self twoPartTestName:_cmd withTimeout:timeout], @"Test failed: %@", NSStringFromSelector(_cmd)); +#import "HSTestCase.h" @interface HSsocket : HSTestCase @@ -24,11 +22,6 @@ - (void)tearDown { [super tearDown]; } -- (BOOL)twoPartTestName:(SEL)selector withTimeout:(NSTimeInterval)timeout { - NSString *funcName = NSStringFromSelector(selector); - return [self luaTestWithCheckAndTimeOut:timeout setupCode:[funcName stringByAppendingString:@"()"] checkCode:[funcName stringByAppendingString:@"Values()"]]; -} - // TCP socket tests - (void)testTcpSocketInstanceCreation { RUN_LUA_TEST() diff --git a/Hammerspoon Tests/HStask.m b/Hammerspoon Tests/HStask.m new file mode 100644 index 000000000..b576397d5 --- /dev/null +++ b/Hammerspoon Tests/HStask.m @@ -0,0 +1,60 @@ +// +// HStask.m +// Hammerspoon Tests +// +// Created by Chris Jones on 02/03/2018. +// Copyright © 2018 Hammerspoon. All rights reserved. +// + +#import "HSTestCase.h" + +@interface HStask : HSTestCase + +@end + +@implementation HStask + +- (void)setUp { + [super setUpWithRequire:@"test_task"]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +- (void)testNewTask { + RUN_LUA_TEST() +} + +- (void)testSimpleTask { + [self luaTestWithCheckAndTimeOut:5 setupCode:@"testSimpleTask()" checkCode:@"testSimpleTaskValueCheck()"]; +} + +- (void)testSimpleTaskFail { + [self luaTestWithCheckAndTimeOut:5 setupCode:@"testSimpleTaskFail()" checkCode:@"testSimpleTaskFailValueCheck()"]; +} + +- (void)testStreamingTask { + SKIP_IN_TRAVIS() + [self luaTestWithCheckAndTimeOut:10 setupCode:@"testStreamingTask()" checkCode:@"testStreamingTaskValueCheck()"]; +} + +- (void)testTaskLifecycle { + RUN_LUA_TEST() +} + +- (void)testTaskEnvironment { + RUN_LUA_TEST() +} + +- (void)testTaskBlock { + RUN_LUA_TEST() +} + +- (void)testTaskWorkingDirectory { + SKIP_IN_TRAVIS() + RUN_LUA_TEST() +} +@end diff --git a/Hammerspoon Tests/HStimer.m b/Hammerspoon Tests/HStimer.m index 7c2aa3d6b..4ffe1574d 100644 --- a/Hammerspoon Tests/HStimer.m +++ b/Hammerspoon Tests/HStimer.m @@ -59,37 +59,38 @@ - (void)testWeeks { } - (void)testDoAfter { - XCTAssertTrue([self luaTestWithCheckAndTimeOut:5 setupCode:@"testDoAfterStart()" checkCode:@"testTimerValueCheck()"], @"hs.timer.doAfter test failed"); + [self luaTestWithCheckAndTimeOut:5 setupCode:@"testDoAfterStart()" checkCode:@"testTimerValueCheck()"]; } - (void)testDoAt { - XCTAssertTrue([self luaTestWithCheckAndTimeOut:5 setupCode:@"testDoAtStart()" checkCode:@"testTimerValueCheck()"], @"hs.timer.doAt test failed"); + [self luaTestWithCheckAndTimeOut:5 setupCode:@"testDoAtStart()" checkCode:@"testTimerValueCheck()"]; } - (void)testDoEvery { - XCTAssertTrue([self luaTestWithCheckAndTimeOut:5 setupCode:@"testDoEveryStart()" checkCode:@"testTimerValueCheck()"], @"hs.timer.doEvery test failed"); + [self luaTestWithCheckAndTimeOut:5 setupCode:@"testDoEveryStart()" checkCode:@"testTimerValueCheck()"]; } - (void)testDoUntil { - XCTAssertTrue([self luaTestWithCheckAndTimeOut:5 setupCode:@"testDoUntilStart()" checkCode:@"testTimerValueCheck()"], @"hs.timer.doUntil test failed"); + [self luaTestWithCheckAndTimeOut:5 setupCode:@"testDoUntilStart()" checkCode:@"testTimerValueCheck()"]; } - (void)testDoWhile { - XCTAssertTrue([self luaTestWithCheckAndTimeOut:5 setupCode:@"testDoWhileStart()" checkCode:@"testTimerValueCheck()"], @"hs.timer.doWhile test failed"); + [self luaTestWithCheckAndTimeOut:5 setupCode:@"testDoWhileStart()" checkCode:@"testTimerValueCheck()"]; } - (void)testWaitUntil { - XCTAssertTrue([self luaTestWithCheckAndTimeOut:5 setupCode:@"testWaitUntilStart()" checkCode:@"testTimerValueCheck()"], @"hs.timer.waitUntil test failed"); + [self luaTestWithCheckAndTimeOut:5 setupCode:@"testWaitUntilStart()" checkCode:@"testTimerValueCheck()"]; } - (void)testWaitWhile { - XCTAssertTrue([self luaTestWithCheckAndTimeOut:5 setupCode:@"testWaitWhileStart()" checkCode:@"testTimerValueCheck()"], @"hs.timer.waitWhile test failed"); + [self luaTestWithCheckAndTimeOut:5 setupCode:@"testWaitWhileStart()" checkCode:@"testTimerValueCheck()"]; } +/* This test isn't possible with the current XCTestCase Expectations API - there's no way to set an expectation of failure - (void)testNonRunning { - XCTAssertFalse([self luaTestWithCheckAndTimeOut:5 setupCode:@"testNeverStart()" checkCode:@"testTimerValueCheck()"], - @"hs.timer non-running test failed"); + [self luaTestWithCheckAndTimeOut:5 setupCode:@"testNeverStart()" checkCode:@"testTimerValueCheck()"]; } + */ - (void)testNew { RUN_LUA_TEST() @@ -108,7 +109,7 @@ - (void)testTriggers { } - (void)testImmediateFire { - XCTAssertTrue([self luaTestWithCheckAndTimeOut:5 setupCode:@"testImmediateFireStart()" checkCode:@"testTimerValueCheck()"], @"hs.timer:fire test failed"); + [self luaTestWithCheckAndTimeOut:5 setupCode:@"testImmediateFireStart()" checkCode:@"testTimerValueCheck()"]; } @end diff --git a/Hammerspoon Tests/HSuielement.m b/Hammerspoon Tests/HSuielement.m index c16f9b583..2e58b9cd7 100644 --- a/Hammerspoon Tests/HSuielement.m +++ b/Hammerspoon Tests/HSuielement.m @@ -8,11 +8,11 @@ #import "HSTestCase.h" -@interface HSuielement : HSTestCase +@interface HSuielementTests : HSTestCase @end -@implementation HSuielement +@implementation HSuielementTests - (void)setUp { [super setUpWithRequire:@"test_uielement"]; @@ -24,11 +24,24 @@ - (void)tearDown { [super tearDown]; } -- (void)testWatcher { +- (void)testWindowWatcher { SKIP_IN_TRAVIS() - XCTAssertTrue([self luaTestWithCheckAndTimeOut:4 setupCode:@"testWatcher()" checkCode:@"testWatcherValues()"], @"testWatcher test failed"); + SKIP_IN_GITHUB_ACTIONS() + RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(5) } +- (void)testApplicationWatcher { + SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() + RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(5) +} + +// Disabled for now, until we can figure out a test that actually works +//- (void)testUIelementWatcher { +// SKIP_IN_TRAVIS() +// RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(5) +//} + - (void)testHammerspoonElements { SKIP_IN_TRAVIS() RUN_LUA_TEST() @@ -36,6 +49,7 @@ - (void)testHammerspoonElements { - (void)testSelectedText { SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() RUN_LUA_TEST() } diff --git a/Hammerspoon Tests/HSwebsocket.m b/Hammerspoon Tests/HSwebsocket.m new file mode 100644 index 000000000..ce5a8195e --- /dev/null +++ b/Hammerspoon Tests/HSwebsocket.m @@ -0,0 +1,50 @@ +// +// hs.websocket Tests +// + +#import "HSTestCase.h" + +@interface HSwebsocket : HSTestCase + +@end + +@implementation HSwebsocket + +- (void)setUp { + [super setUpWithRequire:@"test_websocket"]; + [self runLua:@"startEchoServer()"]; +} + +- (void)tearDown { + [self runLua:@"stopEchoServer()"]; + [super tearDown]; +} + +- (void)testNew { + RUN_LUA_TEST() +} + +- (void)testEchoData { + RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(8) +} + +- (void)testEchoText { + RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(8) +} + +- (void)testOpenStatus { + RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(5) +} + +- (void)testClosedStatus { + RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(5) +} + +- (void)testClosingStatus { + RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(5) +} + +- (void)testLegacy { + RUN_TWO_PART_LUA_TEST_WITH_TIMEOUT(8) +} +@end diff --git a/Hammerspoon Tests/HSwindow.m b/Hammerspoon Tests/HSwindow.m new file mode 100644 index 000000000..99838be6a --- /dev/null +++ b/Hammerspoon Tests/HSwindow.m @@ -0,0 +1,112 @@ +// +// HSwindow.m +// Hammerspoon Tests +// +// Created by Chris Jones on 15/01/2018. +// Copyright © 2018 Hammerspoon. All rights reserved. +// + +#import "HSTestCase.h" + +@interface HSwindowTests : HSTestCase + +@end + +@implementation HSwindowTests + +- (void)setUp { + [super setUpWithRequire:@"test_window"]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [self runLua:@"hs.closeConsole()"]; + [super tearDown]; +} + +- (void)testAllWindows { + RUN_LUA_TEST() +} + +- (void)testDesktop { + SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() + RUN_LUA_TEST() +} + +- (void)testOrderedWindows { + SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() + RUN_LUA_TEST() +} + +- (void)testFocusedWindow { + RUN_LUA_TEST() +} + +- (void)testSnapshots { + SKIP_IN_GITHUB_ACTIONS() + SKIP_IN_TRAVIS() // Added by @latenitefilms + RUN_LUA_TEST() +} + +- (void)testTitle { + RUN_LUA_TEST() +} + +- (void)testRoles { + SKIP_IN_GITHUB_ACTIONS() + RUN_LUA_TEST() +} + +- (void)testTopLeft { + RUN_LUA_TEST() +} + +- (void)testSize { + SKIP_IN_TRAVIS() // Added by @latenitefilms + SKIP_IN_GITHUB_ACTIONS() + RUN_LUA_TEST() +} + +- (void)testMinimize { + SKIP_IN_GITHUB_ACTIONS() + RUN_LUA_TEST() +} + +- (void)testPID { + RUN_LUA_TEST() +} + +- (void)testApplication { + RUN_LUA_TEST() +} + +- (void)testTabs { + SKIP_IN_TRAVIS() + SKIP_IN_GITHUB_ACTIONS() + RUN_LUA_TEST() +} + +- (void)testClose { + SKIP_IN_GITHUB_ACTIONS() + RUN_LUA_TEST() +} + +- (void)testFullscreen { + SKIP_IN_GITHUB_ACTIONS() + RUN_LUA_TEST() +} + +- (void)testFullscreenOne { + SKIP_IN_GITHUB_ACTIONS() + SKIP_IN_TRAVIS() + [self luaTestWithCheckAndTimeOut:5 setupCode:@"testFullscreenOneSetup()" checkCode:@"testFullscreenOneResult()"]; +} + +- (void)testFullscreenTwo { + SKIP_IN_TRAVIS() + [self luaTestWithCheckAndTimeOut:5 setupCode:@"testFullscreenTwoSetup()" checkCode:@"testFullscreenTwoResult()"]; +} +@end diff --git a/Hammerspoon Tests/testinit.lua b/Hammerspoon Tests/testinit.lua index 53c6a6602..a67dd5c64 100644 --- a/Hammerspoon Tests/testinit.lua +++ b/Hammerspoon Tests/testinit.lua @@ -18,7 +18,7 @@ function testrequires() table.insert(failed, failreason) end end - return table.concat(failed, " / ") + return table.concat(failed, "💩") end print("-- Hammerspoon Tests testinit.lua loaded") diff --git a/Hammerspoon.xcodeproj/project.pbxproj b/Hammerspoon.xcodeproj/project.pbxproj index ae523382f..a15e5ee08 100644 --- a/Hammerspoon.xcodeproj/project.pbxproj +++ b/Hammerspoon.xcodeproj/project.pbxproj @@ -3,17 +3,95 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ - 22613FEC1F297E0D00E05E11 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 22613FF51F2A127E00E05E11 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 22613FE41F297B9B00E05E11 /* internal.m */; }; - 22E4D7FD1FA7488900C8CF5C /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 22E4D8031FA748AC00C8CF5C /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 22E4D7F71FA7485A00C8CF5C /* internal.m */; }; + 220B882A27F8F954006C0B2B /* test_image.lua in Resources */ = {isa = PBXBuildFile; fileRef = 220B882927F8F954006C0B2B /* test_image.lua */; }; + 220B882C27F8F9A3006C0B2B /* HSimage.m in Sources */ = {isa = PBXBuildFile; fileRef = 220B882B27F8F9A3006C0B2B /* HSimage.m */; }; + 220E0B1A29B07EFA003B0BBD /* HSStreamDeckDevicePedal.h in Headers */ = {isa = PBXBuildFile; fileRef = 220E0B1829B07EFA003B0BBD /* HSStreamDeckDevicePedal.h */; }; + 220E0B1B29B07EFA003B0BBD /* HSStreamDeckDevicePedal.m in Sources */ = {isa = PBXBuildFile; fileRef = 220E0B1929B07EFA003B0BBD /* HSStreamDeckDevicePedal.m */; }; + 223A9693211F0EFF00596A79 /* cpCache.icns in Resources */ = {isa = PBXBuildFile; fileRef = 223A9691211F0EFE00596A79 /* cpCache.icns */; }; + 2245184B281ADF8400997BB0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2245184A281ADF8400997BB0 /* Assets.xcassets */; }; + 2245184D281ADF8400997BB0 /* CommandPostViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2245184C281ADF8400997BB0 /* CommandPostViewController.xib */; }; + 22451851281ADF8400997BB0 /* CommandPostViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 22451850281ADF8400997BB0 /* CommandPostViewController.m */; }; + 22451856281ADF8400997BB0 /* CommandPost.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 22451848281ADF8400997BB0 /* CommandPost.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 2248D33E28460E4F00A379E3 /* HSRazerTartarusProDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 2248D33C28460E4F00A379E3 /* HSRazerTartarusProDevice.h */; }; + 2248D33F28460E4F00A379E3 /* HSRazerTartarusProDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 2248D33D28460E4F00A379E3 /* HSRazerTartarusProDevice.m */; }; + 2248D34228476C1300A379E3 /* HSRazerTartarusDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 2248D34028476C1300A379E3 /* HSRazerTartarusDevice.m */; }; + 2248D34328476C1300A379E3 /* HSRazerTartarusDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 2248D34128476C1300A379E3 /* HSRazerTartarusDevice.h */; }; + 224B922E27F6B846003F628E /* HSBlackmagicDeviceKeyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 224B922C27F6B846003F628E /* HSBlackmagicDeviceKeyboard.h */; }; + 224B922F27F6B846003F628E /* HSBlackmagicDeviceKeyboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 224B922D27F6B846003F628E /* HSBlackmagicDeviceKeyboard.m */; }; + 224B923327F6D326003F628E /* HSBlackmagicDeviceSpeedEditor.m in Sources */ = {isa = PBXBuildFile; fileRef = 224B923127F6D326003F628E /* HSBlackmagicDeviceSpeedEditor.m */; }; + 224B923527F6F5C3003F628E /* HSBlackmagicDeviceSpeedEditor.h in Headers */ = {isa = PBXBuildFile; fileRef = 224B923427F6F5C3003F628E /* HSBlackmagicDeviceSpeedEditor.h */; }; + 224BA32A23D1ECA900487FDB /* libwebsocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 224BA32523D1E63A00487FDB /* libwebsocket.m */; }; + 22613FF51F2A127E00E05E11 /* libdialog.m in Sources */ = {isa = PBXBuildFile; fileRef = 22613FE41F297B9B00E05E11 /* libdialog.m */; }; + 22615F33281E3301003ADBC6 /* WorkflowExtension.icns in Resources */ = {isa = PBXBuildFile; fileRef = 22615F32281E3301003ADBC6 /* WorkflowExtension.icns */; }; + 22627C1E2B3E3A1A0029A2F5 /* GCDAsyncSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 22627C1D2B3E3A1A0029A2F5 /* GCDAsyncSocket.m */; }; + 22652B39251C38AC000FF14D /* TouchEvents.c in Sources */ = {isa = PBXBuildFile; fileRef = 22652B37251C38AB000FF14D /* TouchEvents.c */; }; + 22652B3A251C38AC000FF14D /* TouchEvents.h in Headers */ = {isa = PBXBuildFile; fileRef = 22652B38251C38AB000FF14D /* TouchEvents.h */; }; + 22652B3D251C3914000FF14D /* IOHIDEventData.h in Headers */ = {isa = PBXBuildFile; fileRef = 22652B3B251C3913000FF14D /* IOHIDEventData.h */; }; + 22652B3E251C3914000FF14D /* IOHIDEventTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 22652B3C251C3914000FF14D /* IOHIDEventTypes.h */; }; + 22654EA327D43CB8004F8214 /* HSRazerDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 2213843127A105DD0085CA24 /* HSRazerDevice.m */; }; + 22654EA427D43CB8004F8214 /* HSRazerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 2213842D27A105DD0085CA24 /* HSRazerManager.m */; }; + 22654EA527D43CB8004F8214 /* HSRazerTartarusV2Device.m in Sources */ = {isa = PBXBuildFile; fileRef = 2213842C27A105DD0085CA24 /* HSRazerTartarusV2Device.m */; }; + 22654EA627D43CB8004F8214 /* librazer.m in Sources */ = {isa = PBXBuildFile; fileRef = 2213842B27A105DD0085CA24 /* librazer.m */; }; + 22654EA727D43CCE004F8214 /* HSRazerDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 2213843027A105DD0085CA24 /* HSRazerDevice.h */; }; + 22654EA827D43CCE004F8214 /* HSRazerManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 2213843227A105DD0085CA24 /* HSRazerManager.h */; }; + 22654EA927D43CCE004F8214 /* HSRazerTartarusV2Device.h in Headers */ = {isa = PBXBuildFile; fileRef = 2213842E27A105DD0085CA24 /* HSRazerTartarusV2Device.h */; }; + 22654EAA27D43CCE004F8214 /* razer.h in Headers */ = {isa = PBXBuildFile; fileRef = 2213842F27A105DD0085CA24 /* razer.h */; }; + 22654EAD27D43D1F004F8214 /* razer.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 2213842A27A105DD0085CA24 /* razer.lua */; }; + 226BD80D281CE86200294634 /* CocoaAsyncSocket in Resources */ = {isa = PBXBuildFile; fileRef = 226BD80C281CE86200294634 /* CocoaAsyncSocket */; }; + 226F95F827917D3B003DF60F /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 226F960727917D63003DF60F /* HSBlackmagicManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 226F960027917D63003DF60F /* HSBlackmagicManager.m */; }; + 226F960827917D63003DF60F /* libblackmagic.m in Sources */ = {isa = PBXBuildFile; fileRef = 226F960127917D63003DF60F /* libblackmagic.m */; }; + 226F960927917D63003DF60F /* HSBlackmagicManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 226F960227917D63003DF60F /* HSBlackmagicManager.h */; }; + 226F960A27917D63003DF60F /* HSBlackmagicDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 226F960327917D63003DF60F /* HSBlackmagicDevice.h */; }; + 226F960B27917D63003DF60F /* blackmagic.h in Headers */ = {isa = PBXBuildFile; fileRef = 226F960427917D63003DF60F /* blackmagic.h */; }; + 226F960C27917D63003DF60F /* HSBlackmagicDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 226F960627917D63003DF60F /* HSBlackmagicDevice.m */; }; + 226F960F27917DDA003DF60F /* libblackmagic.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 226F95FE27917D3B003DF60F /* libblackmagic.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 226F961027917E06003DF60F /* blackmagic.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 226F960527917D63003DF60F /* blackmagic.lua */; }; + 22738935248606F0003EBC68 /* HSwebsocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 22738934248606F0003EBC68 /* HSwebsocket.m */; }; + 2273893624860C0E003EBC68 /* test_websocket.lua in Resources */ = {isa = PBXBuildFile; fileRef = 22738933248606A9003EBC68 /* test_websocket.lua */; }; + 227478232787F92E00DE6894 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 2274782A2787F94100DE6894 /* libosc.m in Sources */ = {isa = PBXBuildFile; fileRef = 2274781B2787F8F800DE6894 /* libosc.m */; }; + 2274782E2787FA1500DE6894 /* libosc.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 227478292787F92E00DE6894 /* libosc.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 2274782F2787FA2800DE6894 /* osc.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 2274781C2787F8F800DE6894 /* osc.lua */; }; + 227C36C226200D4D00224F53 /* cpPlugin.icns in Resources */ = {isa = PBXBuildFile; fileRef = 227C36C126200D4C00224F53 /* cpPlugin.icns */; }; + 227C36D126200DBE00224F53 /* cpTourBox.icns in Resources */ = {isa = PBXBuildFile; fileRef = 227C36C326200DBB00224F53 /* cpTourBox.icns */; }; + 227C36D226200DBE00224F53 /* cpTouchBar.icns in Resources */ = {isa = PBXBuildFile; fileRef = 227C36C426200DBB00224F53 /* cpTouchBar.icns */; }; + 227C36D326200DBE00224F53 /* cpSnippets.icns in Resources */ = {isa = PBXBuildFile; fileRef = 227C36C526200DBB00224F53 /* cpSnippets.icns */; }; + 227C36D426200DBE00224F53 /* cpHUD.icns in Resources */ = {isa = PBXBuildFile; fileRef = 227C36C626200DBB00224F53 /* cpHUD.icns */; }; + 227C36D526200DBE00224F53 /* cpTangent.icns in Resources */ = {isa = PBXBuildFile; fileRef = 227C36C726200DBC00224F53 /* cpTangent.icns */; }; + 227C36D626200DBE00224F53 /* cpLoupedeck.icns in Resources */ = {isa = PBXBuildFile; fileRef = 227C36C826200DBC00224F53 /* cpLoupedeck.icns */; }; + 227C36D726200DBE00224F53 /* cpLoupedeckPlus.icns in Resources */ = {isa = PBXBuildFile; fileRef = 227C36C926200DBC00224F53 /* cpLoupedeckPlus.icns */; }; + 227C36D826200DBE00224F53 /* cpLoupedeckCT.icns in Resources */ = {isa = PBXBuildFile; fileRef = 227C36CA26200DBC00224F53 /* cpLoupedeckCT.icns */; }; + 227C36D926200DBE00224F53 /* cpShortcuts.icns in Resources */ = {isa = PBXBuildFile; fileRef = 227C36CB26200DBD00224F53 /* cpShortcuts.icns */; }; + 227C36DA26200DBE00224F53 /* cpPasteboard.icns in Resources */ = {isa = PBXBuildFile; fileRef = 227C36CC26200DBD00224F53 /* cpPasteboard.icns */; }; + 227C36DB26200DBE00224F53 /* cpMIDI.icns in Resources */ = {isa = PBXBuildFile; fileRef = 227C36CD26200DBD00224F53 /* cpMIDI.icns */; }; + 227C36DC26200DBE00224F53 /* cpLoupedeckLive.icns in Resources */ = {isa = PBXBuildFile; fileRef = 227C36CE26200DBD00224F53 /* cpLoupedeckLive.icns */; }; + 227C36DD26200DBE00224F53 /* cpMonogram.icns in Resources */ = {isa = PBXBuildFile; fileRef = 227C36CF26200DBE00224F53 /* cpMonogram.icns */; }; + 227C36DE26200DBE00224F53 /* cpStreamDeck.icns in Resources */ = {isa = PBXBuildFile; fileRef = 227C36D026200DBE00224F53 /* cpStreamDeck.icns */; }; + 2290EB2028011DF100CEA572 /* HSRazerOrbweaverDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 2290EB1E28011DF100CEA572 /* HSRazerOrbweaverDevice.m */; }; + 2290EB2128011DF100CEA572 /* HSRazerOrbweaverDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 2290EB1F28011DF100CEA572 /* HSRazerOrbweaverDevice.h */; }; + 22A6626025FC080200AA329E /* test_serial.lua in Resources */ = {isa = PBXBuildFile; fileRef = 22A6625F25FC07F700AA329E /* test_serial.lua */; }; + 22A6626225FC087000AA329E /* HSserial.m in Sources */ = {isa = PBXBuildFile; fileRef = 22A6626125FC087000AA329E /* HSserial.m */; }; + 22DC4FA8299E140100065BE1 /* HSStreamDeckDevicePlus.m in Sources */ = {isa = PBXBuildFile; fileRef = 22DC4FA6299E140100065BE1 /* HSStreamDeckDevicePlus.m */; }; + 22DC4FA9299E140100065BE1 /* HSStreamDeckDevicePlus.h in Headers */ = {isa = PBXBuildFile; fileRef = 22DC4FA7299E140100065BE1 /* HSStreamDeckDevicePlus.h */; }; + 22DF5D2823B9A9EA00C41AE6 /* libpasteboard_watcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 22DF5D1A23B99C4D00C41AE6 /* libpasteboard_watcher.m */; }; + 22E4D8031FA748AC00C8CF5C /* libmidi.m in Sources */ = {isa = PBXBuildFile; fileRef = 22E4D7F71FA7485A00C8CF5C /* libmidi.m */; }; + 22E59E0F2852D6F00062292D /* HSRazerNostromoDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 22E59E0D2852D6EF0062292D /* HSRazerNostromoDevice.h */; }; + 22E59E102852D6F00062292D /* HSRazerNostromoDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 22E59E0E2852D6EF0062292D /* HSRazerNostromoDevice.m */; }; + 22E59E132852FD270062292D /* HSRazerOrbweaverChromaDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 22E59E112852FD270062292D /* HSRazerOrbweaverChromaDevice.m */; }; + 22E59E142852FD270062292D /* HSRazerOrbweaverChromaDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 22E59E122852FD270062292D /* HSRazerOrbweaverChromaDevice.h */; }; + 22EEC62424926E6E00BAE4DA /* libserial.m in Sources */ = {isa = PBXBuildFile; fileRef = 22EEC61724926E2100BAE4DA /* libserial.m */; }; + 22F223EA28AEFB6D00FF081E /* HSRazerTartarusChromaDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 22F223E828AEFB6D00FF081E /* HSRazerTartarusChromaDevice.h */; }; + 22F223EB28AEFB6D00FF081E /* HSRazerTartarusChromaDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 22F223E928AEFB6D00FF081E /* HSRazerTartarusChromaDevice.m */; }; + 22F8F6502F1CE7E40035EC91 /* CommandPost.icon in Resources */ = {isa = PBXBuildFile; fileRef = 22F8F64F2F1CE7E40035EC91 /* CommandPost.icon */; }; + 22FA061227A160410039C37A /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 22FA062427A1609E0039C37A /* librazer.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 22FA061B27A160410039C37A /* librazer.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 394FD223913AE68B92126D37 /* libPods-Hammerspoon.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5BC78AF8FE9DA0BD317A7528 /* libPods-Hammerspoon.a */; }; - 4C3D55B51C7F0A880023B633 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4C3D55BC1C7F0AA90023B633 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C3D55AA1C7F05D00023B633 /* internal.m */; }; + 4C3D55BC1C7F0AA90023B633 /* libosascript.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C3D55AA1C7F05D00023B633 /* libosascript.m */; }; 4C3D55BF1C7F17150023B633 /* NSAppleEventDescriptor+Parsing.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C3D55AE1C7F061D0023B633 /* NSAppleEventDescriptor+Parsing.h */; }; 4C3D55C01C7F171E0023B633 /* NSAppleEventDescriptor+Parsing.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C3D55AF1C7F061D0023B633 /* NSAppleEventDescriptor+Parsing.m */; }; 4C403D641CBE5B9F00EE20ED /* HSapplication.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C403D631CBE5B9F00EE20ED /* HSapplication.m */; }; @@ -26,13 +104,11 @@ 4CB349F11C7F74E5006F0DE0 /* test_osascript.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4CB349F01C7F74E5006F0DE0 /* test_osascript.lua */; }; 4CB349F31C7F74EE006F0DE0 /* test_applescript.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4CB349F21C7F74EE006F0DE0 /* test_applescript.lua */; }; 4CBF1C681C91154700B861CE /* libedit.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 4CBF1C671C91154700B861CE /* libedit.tbd */; }; - 4CD203AC1C6D76E20089706D /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4CD203B21C6D77750089706D /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD203A21C6D75950089706D /* internal.m */; }; + 4CD203B21C6D77750089706D /* libsocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD203A21C6D75950089706D /* libsocket.m */; }; 4CD64AA91C6F15F400EB6E39 /* HSsocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD64AA81C6F15F400EB6E39 /* HSsocket.m */; }; 4CD64AAB1C6F168700EB6E39 /* test_socket.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4CD64AAA1C6F168700EB6E39 /* test_socket.lua */; }; 4CD96BD61C73ABD2009FF648 /* (null) in Frameworks */ = {isa = PBXBuildFile; }; - 4CD96BD71C73ABD2009FF648 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4CD96BDE1C73AC1C009FF648 /* udp.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD96BDD1C73AC1C009FF648 /* udp.m */; }; + 4CD96BDE1C73AC1C009FF648 /* libsocket_udp.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD96BDD1C73AC1C009FF648 /* libsocket_udp.m */; }; 4CE6390F1C76C7F500BB7CD2 /* socket.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CE6390E1C76C7F500BB7CD2 /* socket.h */; }; 4CE639101C76C7F500BB7CD2 /* socket.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CE6390E1C76C7F500BB7CD2 /* socket.h */; }; 4CE639141C772DC700BB7CD2 /* test_udpsocket.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4CE639131C772DC700BB7CD2 /* test_udpsocket.lua */; }; @@ -41,20 +117,20 @@ 4F0676081C32C0B30088C57C /* HSChooserCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F0676061C32C0B30088C57C /* HSChooserCell.m */; }; 4F0F08091DC0DAAA00082B73 /* HSChooserRootView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F0F08071DC0DAAA00082B73 /* HSChooserRootView.h */; }; 4F0F080A1DC0DAAA00082B73 /* HSChooserRootView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F0F08081DC0DAAA00082B73 /* HSChooserRootView.m */; }; - 4F11989F1FF0412600D279D8 /* switcher.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4F11989E1FF0412600D279D8 /* switcher.lua */; }; 4F20B52C1C1F1C5B00F52437 /* Hammerspoon_UITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F20B52B1C1F1C5B00F52437 /* Hammerspoon_UITests.m */; }; 4F20B5341C1F225300F52437 /* init.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4F20B5331C1F225300F52437 /* init.lua */; }; - 4F29C2381C29E0A300B8A69D /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F29C23E1C29E0E700B8A69D /* volume.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F29C2311C29D8E400B8A69D /* volume.m */; }; - 4F2DF3E51F6046F300742D08 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F2DF3EB1F60471400742D08 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F2DF3DE1F6046AD00742D08 /* internal.m */; }; + 4F29C23E1C29E0E700B8A69D /* libfs_volume.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F29C2311C29D8E400B8A69D /* libfs_volume.m */; }; + 4F2C0C7321BB4A04008F32C1 /* HSinspect.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F2C0C7221BB4A03008F32C1 /* HSinspect.m */; }; + 4F2DF3EB1F60471400742D08 /* libstreamdeck.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F2DF3DE1F6046AD00742D08 /* libstreamdeck.m */; }; 4F2DF3F01F605A4900742D08 /* HSStreamDeckManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F2DF3EE1F605A4900742D08 /* HSStreamDeckManager.h */; }; 4F2DF3F11F605A4900742D08 /* HSStreamDeckManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F2DF3EF1F605A4900742D08 /* HSStreamDeckManager.m */; }; 4F2DF3F41F605A9B00742D08 /* HSStreamDeckDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F2DF3F21F605A9B00742D08 /* HSStreamDeckDevice.h */; }; 4F2DF3F51F605A9B00742D08 /* HSStreamDeckDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F2DF3F31F605A9B00742D08 /* HSStreamDeckDevice.m */; }; 4F2DF3F81F6170BE00742D08 /* NSImage+BMP.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F2DF3F61F6170BE00742D08 /* NSImage+BMP.h */; }; 4F2DF3F91F6170BE00742D08 /* NSImage+BMP.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F2DF3F71F6170BE00742D08 /* NSImage+BMP.m */; }; - 4F3978841E89AE7200F30F05 /* Spoon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 4F3978831E89AE7200F30F05 /* Spoon.icns */; }; + 4F3042FF21D4DEE300769310 /* test_inspect.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4F2C0C7121BB49E0008F32C1 /* test_inspect.lua */; }; + 4F30430221D5673A00769310 /* EDSunriseSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F30430021D5673A00769310 /* EDSunriseSet.h */; }; + 4F30430321D5673A00769310 /* EDSunriseSet.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F30430121D5673A00769310 /* EDSunriseSet.m */; }; 4F3D9D031C3302CB0082E864 /* HSChooser.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F3D9D011C3302CB0082E864 /* HSChooser.h */; }; 4F3D9D041C3302CB0082E864 /* HSChooser.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F3D9D021C3302CB0082E864 /* HSChooser.m */; }; 4F3D9D071C3314570082E864 /* HSChooserWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F3D9D051C3314570082E864 /* HSChooserWindow.h */; }; @@ -63,115 +139,215 @@ 4F3D9D0C1C34773E0082E864 /* HSChooserTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F3D9D0A1C34773E0082E864 /* HSChooserTableView.m */; }; 4F40EC401CCD0FE3006342D7 /* HSdistributednotifications.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F40EC3F1CCD0FE3006342D7 /* HSdistributednotifications.m */; }; 4F40EC441CCD126F006342D7 /* test_distributednotifications.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4F40EC431CCD126F006342D7 /* test_distributednotifications.lua */; }; - 4F4CB38C1B737953000EA9B6 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F4CB3951B737A5B000EA9B6 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F4CB3941B737A5B000EA9B6 /* internal.m */; }; - 4F4CB3A11B7385C5000EA9B6 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F4CB3AA1B7385FB000EA9B6 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F4CB3A91B7385FB000EA9B6 /* internal.m */; }; - 4F4CB3B21B738769000EA9B6 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F4CB3BD1B7387AA000EA9B6 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F4CB3BC1B7387AA000EA9B6 /* internal.m */; }; - 4F4CB3C71B738F1E000EA9B6 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F4CB3D31B7391D3000EA9B6 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F4CB3D11B7391D3000EA9B6 /* internal.m */; }; + 4F4CB3951B737A5B000EA9B6 /* libcrash.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F4CB3941B737A5B000EA9B6 /* libcrash.m */; }; + 4F4CB3AA1B7385FB000EA9B6 /* libdockicon.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F4CB3A91B7385FB000EA9B6 /* libdockicon.m */; }; + 4F4CB3D31B7391D3000EA9B6 /* libfs.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F4CB3D11B7391D3000EA9B6 /* libfs.m */; }; 4F4CB3D41B7391D3000EA9B6 /* lfs.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F4CB3D21B7391D3000EA9B6 /* lfs.h */; }; - 4F4CB3EE1B73A3A1000EA9B6 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F4CB3F71B73A4EC000EA9B6 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F4CB3F61B73A4EC000EA9B6 /* internal.m */; }; - 4F4CB4001B73A746000EA9B6 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; + 4F4CB3F71B73A4EC000EA9B6 /* libhash.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F4CB3F61B73A4EC000EA9B6 /* libhash.m */; }; 4F4CB40A1B73A784000EA9B6 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F4CB4091B73A784000EA9B6 /* internal.m */; }; - 4F4CB4121B73AC1D000EA9B6 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F4CB41B1B73AC48000EA9B6 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F4CB41A1B73AC48000EA9B6 /* internal.m */; }; - 4F4CB4231B73AD0B000EA9B6 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F4CB42E1B73AD47000EA9B6 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F4CB42D1B73AD47000EA9B6 /* internal.m */; }; - 4F4CB4371B73AF7E000EA9B6 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F4CB4441B73AFD2000EA9B6 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F4CB4431B73AFD2000EA9B6 /* internal.m */; }; - 4F4CB44B1B73B09C000EA9B6 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F4CB4561B73B0D5000EA9B6 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F4CB4551B73B0D5000EA9B6 /* internal.m */; }; - 4F5134591C2F315C00EFD6D4 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F51345F1C2F317800EFD6D4 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F5134511C2EE08F00EFD6D4 /* internal.m */; }; + 4F4CB41B1B73AC48000EA9B6 /* libhost.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F4CB41A1B73AC48000EA9B6 /* libhost.m */; }; + 4F4CB42E1B73AD47000EA9B6 /* libhotkey.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F4CB42D1B73AD47000EA9B6 /* libhotkey.m */; }; + 4F4CB4441B73AFD2000EA9B6 /* libhttp.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F4CB4431B73AFD2000EA9B6 /* libhttp.m */; }; + 4F4CB4561B73B0D5000EA9B6 /* libimage.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F4CB4551B73B0D5000EA9B6 /* libimage.m */; }; + 4F4F6DAA25DB1BB6000187FA /* HSjsonTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F4F6DA925DB1BB6000187FA /* HSjsonTests.m */; }; + 4F4F6EBF25DB1C7C000187FA /* test_json.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4F4F6EBE25DB1C7C000187FA /* test_json.lua */; }; + 4F51345F1C2F317800EFD6D4 /* libchooser.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F5134511C2EE08F00EFD6D4 /* libchooser.m */; }; 4F5134641C30819000EFD6D4 /* chooser.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F5134631C30819000EFD6D4 /* chooser.h */; }; + 4F5560A1279F6A0300B91FD8 /* HSStreamDeckDeviceMk2.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F55609F279F6A0300B91FD8 /* HSStreamDeckDeviceMk2.h */; }; + 4F5560A2279F6A0300B91FD8 /* HSStreamDeckDeviceMk2.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F5560A0279F6A0300B91FD8 /* HSStreamDeckDeviceMk2.m */; }; 4F5B6E6B1E9E86BB003FC580 /* CommandPost.sdef in Resources */ = {isa = PBXBuildFile; fileRef = 4F5B6E6A1E9E86BB003FC580 /* CommandPost.sdef */; }; 4F5B6E6E1E9E87CE003FC580 /* HSAppleScript.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F5B6E6D1E9E87CE003FC580 /* HSAppleScript.m */; }; - 4F6B3EA31B73D6D300B2A4DE /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F6B3EAE1B73D79100B2A4DE /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3EAD1B73D79100B2A4DE /* internal.m */; }; - 4F6B3EB61B73DC4500B2A4DE /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F6B3EBF1B73DC8400B2A4DE /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3EBE1B73DC8400B2A4DE /* internal.m */; }; - 4F6B3ECD1B73E23800B2A4DE /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F6B3EDA1B73E29300B2A4DE /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3ED91B73E29300B2A4DE /* internal.m */; }; - 4F6B3EE21B73E5AC00B2A4DE /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F6B3EEE1B73E65800B2A4DE /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3EED1B73E65800B2A4DE /* internal.m */; }; - 4F6B3EF61B73E7C200B2A4DE /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F6B3EFF1B73E7F000B2A4DE /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3EFE1B73E7F000B2A4DE /* internal.m */; }; - 4F6B3F071B73E98E00B2A4DE /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F6B3F121B73E9C700B2A4DE /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3F111B73E9C700B2A4DE /* internal.m */; }; - 4F6B3F1C1B73EBB500B2A4DE /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F6B3F271B73EBFD00B2A4DE /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3F261B73EBFD00B2A4DE /* internal.m */; }; - 4F6B3F2D1B73EDD100B2A4DE /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F6B3F391B73EE1C00B2A4DE /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3F381B73EE1C00B2A4DE /* internal.m */; }; - 4F6B3F3F1B73EF4B00B2A4DE /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F6B3F4A1B73EF9A00B2A4DE /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3F491B73EF9A00B2A4DE /* internal.m */; }; - 4F6B3F501B73EFC100B2A4DE /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F6B3F581B73EFE600B2A4DE /* watcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3F571B73EFE600B2A4DE /* watcher.m */; }; - 4F6B3F651B73F0E300B2A4DE /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F6B3F701B73F16700B2A4DE /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3F6F1B73F16700B2A4DE /* internal.m */; }; - 4F6B3F761B73F44500B2A4DE /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F6B3F821B73F49500B2A4DE /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3F811B73F49500B2A4DE /* internal.m */; }; + 4F6653E6238C36F100DEE120 /* HSStreamDeckDeviceOriginal.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F6653E4238C36F100DEE120 /* HSStreamDeckDeviceOriginal.h */; }; + 4F6653E7238C36F100DEE120 /* HSStreamDeckDeviceOriginal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6653E5238C36F100DEE120 /* HSStreamDeckDeviceOriginal.m */; }; + 4F6653EA238C6B6600DEE120 /* HSStreamDeckDeviceMini.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F6653E8238C6B6600DEE120 /* HSStreamDeckDeviceMini.h */; }; + 4F6653EB238C6B6600DEE120 /* HSStreamDeckDeviceMini.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6653E9238C6B6600DEE120 /* HSStreamDeckDeviceMini.m */; }; + 4F6653EE238C7A1200DEE120 /* NSImage+Rotated.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F6653EC238C7A1200DEE120 /* NSImage+Rotated.h */; }; + 4F6653EF238C7A1200DEE120 /* NSImage+Rotated.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6653ED238C7A1200DEE120 /* NSImage+Rotated.m */; }; + 4F6653F2238C7BC600DEE120 /* NSImage+Flipped.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F6653F0238C7BC600DEE120 /* NSImage+Flipped.h */; }; + 4F6653F3238C7BC600DEE120 /* NSImage+Flipped.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6653F1238C7BC600DEE120 /* NSImage+Flipped.m */; }; + 4F6653F62390351100DEE120 /* NSImage+JPEG.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F6653F42390351100DEE120 /* NSImage+JPEG.h */; }; + 4F6653F72390351100DEE120 /* NSImage+JPEG.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6653F52390351100DEE120 /* NSImage+JPEG.m */; }; + 4F68B530227C2DD70076C4F8 /* HSChooserVerticallyCenteringTextFieldCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F68B52E227C2DD70076C4F8 /* HSChooserVerticallyCenteringTextFieldCell.h */; }; + 4F68B531227C2DD70076C4F8 /* HSChooserVerticallyCenteringTextFieldCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F68B52F227C2DD70076C4F8 /* HSChooserVerticallyCenteringTextFieldCell.m */; }; + 4F6B3EAE1B73D79100B2A4DE /* libjson.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3EAD1B73D79100B2A4DE /* libjson.m */; }; + 4F6B3EBF1B73DC8400B2A4DE /* liblocation.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3EBE1B73DC8400B2A4DE /* liblocation.m */; }; + 4F6B3EDA1B73E29300B2A4DE /* libmenubar.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3ED91B73E29300B2A4DE /* libmenubar.m */; }; + 4F6B3EEE1B73E65800B2A4DE /* libmilight.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3EED1B73E65800B2A4DE /* libmilight.m */; }; + 4F6B3EFF1B73E7F000B2A4DE /* libmouse.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3EFE1B73E7F000B2A4DE /* libmouse.m */; }; + 4F6B3F121B73E9C700B2A4DE /* libnotify.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3F111B73E9C700B2A4DE /* libnotify.m */; }; + 4F6B3F271B73EBFD00B2A4DE /* libpasteboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3F261B73EBFD00B2A4DE /* libpasteboard.m */; }; + 4F6B3F391B73EE1C00B2A4DE /* libpathwatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3F381B73EE1C00B2A4DE /* libpathwatcher.m */; }; + 4F6B3F4A1B73EF9A00B2A4DE /* libscreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3F491B73EF9A00B2A4DE /* libscreen.m */; }; + 4F6B3F581B73EFE600B2A4DE /* libscreen_watcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3F571B73EFE600B2A4DE /* libscreen_watcher.m */; }; + 4F6B3F701B73F16700B2A4DE /* libsettings.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3F6F1B73F16700B2A4DE /* libsettings.m */; }; + 4F6B3F821B73F49500B2A4DE /* libsound.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6B3F811B73F49500B2A4DE /* libsound.m */; }; 4F6CE1311C6B93A90016668E /* test_timer.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4F6CE1301C6B93A90016668E /* test_timer.lua */; }; 4F6CE1341C6B93E10016668E /* HStimer.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F6CE1331C6B93E10016668E /* HStimer.m */; }; - 4F70EECE1B726D170025A7B3 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F70EED71B726D3F0025A7B3 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F70EED61B726D3F0025A7B3 /* internal.m */; }; - 4F70EEE41B7273700025A7B3 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F70EEEF1B7273B00025A7B3 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F70EEEE1B7273B00025A7B3 /* internal.m */; }; - 4F76944F1B74C96800536DE4 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F76945A1B74C9CA00536DE4 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F7694591B74C9CA00536DE4 /* internal.m */; }; - 4F85FED31CCA918D00FBBAD7 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F85FED91CCA91AC00FBBAD7 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F85FECC1CCA8A2F00FBBAD7 /* internal.m */; }; - 4F8E84311B90EDBF00C25955 /* statusicon.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4F8E84301B90EDBF00C25955 /* statusicon.pdf */; }; - 4F9618A41E24E60C0048F71D /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F9618AB1E24E62B0048F71D /* lsqlite3.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F96189C1E24E5F70048F71D /* lsqlite3.c */; }; + 4F70EED71B726D3F0025A7B3 /* libaudiodevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F70EED61B726D3F0025A7B3 /* libaudiodevice.m */; }; + 4F70EEEF1B7273B00025A7B3 /* libbase64.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F70EEEE1B7273B00025A7B3 /* libbase64.m */; }; + 4F76945A1B74C9CA00536DE4 /* libkeycodes.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F7694591B74C9CA00536DE4 /* libkeycodes.m */; }; + 4F7BB9D426447C390077A926 /* test_hotkey.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4F7BB9D326447C390077A926 /* test_hotkey.lua */; }; + 4F7BB9D626447C640077A926 /* HShotkey.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F7BB9D526447C640077A926 /* HShotkey.m */; }; + 4F7F3B6D272AF69D00E05732 /* libshortcuts.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F7F3B60272AF57000E05732 /* libshortcuts.m */; }; + 4F7F3B71272B3E2900E05732 /* Intents.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 4F7F3B70272B3E2900E05732 /* Intents.intentdefinition */; }; + 4F7F3B77272B3F3700E05732 /* HSExecuteLuaIntentHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F7F3B76272B3F3700E05732 /* HSExecuteLuaIntentHandler.m */; }; + 4F85FED91CCA91AC00FBBAD7 /* libdistributednotifications.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F85FECC1CCA8A2F00FBBAD7 /* libdistributednotifications.m */; }; + 4F8779D1200CD51200E9DB42 /* HSwindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F8779D0200CD51200E9DB42 /* HSwindow.m */; }; + 4F8779D3200CD63F00E9DB42 /* test_window.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4F8779D2200CD56F00E9DB42 /* test_window.lua */; }; + 4F9618AB1E24E62B0048F71D /* lsqlite3.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F96189C1E24E5F70048F71D /* lsqlite3.c */; settings = {COMPILER_FLAGS = "-Wno-float-equal -Wno-unused-macros"; }; }; 4F9618AF1E24ED650048F71D /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9618AE1E24ED650048F71D /* libsqlite3.tbd */; }; - 4F9797BE1BED0AC800719F3F /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4F9797C41BED0ADC00719F3F /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F9797B61BECD9AD00719F3F /* internal.m */; }; - 4F9F02BB1B3D9591009C32E5 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9F02B91B3D9568009C32E5 /* LuaSkin.framework */; }; + 4F9797C41BED0ADC00719F3F /* libtask.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F9797B61BECD9AD00719F3F /* libtask.m */; }; + 4F9BA8C923DF3CBF006349F2 /* libuielement_watcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F9BA8C823DF3CBE006349F2 /* libuielement_watcher.m */; }; + 4F9BA8D023DF4E58006349F2 /* libapplication.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FBE2CFD1B7261E500407788 /* libapplication.m */; }; + 4F9BA8D723DFAB03006349F2 /* HSuicore.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F9BA8D623DFAB03006349F2 /* HSuicore.m */; }; 4FA125882016739500F02FDF /* HSLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FA125872016739500F02FDF /* HSLogger.m */; }; - 4FBE2CF41B7261A200407788 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FBE2CFE1B7261E500407788 /* application.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FBE2CFB1B7261E500407788 /* application.h */; }; - 4FBE2CFF1B7261E500407788 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FBE2CFD1B7261E500407788 /* internal.m */; }; - 4FBE2D0A1B72631600407788 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FBE2D0C1B72631600407788 /* application.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FBE2CFB1B7261E500407788 /* application.h */; }; - 4FBE2D111B72632800407788 /* watcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FBE2D041B72630200407788 /* watcher.m */; }; + 4FB74B3B2049A9A600B08851 /* HStask.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FB74B3A2049A9A600B08851 /* HStask.m */; }; + 4FB74B3C2049AB8B00B08851 /* test_task.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4FB74B392049A97D00B08851 /* test_task.lua */; }; + 4FB852362735B02400462DD0 /* LuaSkin.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FB852382735B15200462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852392735B23E00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8523A2735B24D00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8523B2735B26800462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8523C2735B27C00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8523D2735B28100462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8523E2735B28700462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8523F2735B28B00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852402735B28F00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852412735B29300462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852422735B29700462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852432735B29B00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852442735B2A000462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852452735B2A400462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852462735B2A800462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852472735B2AC00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852482735B2B000462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852492735B2B500462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8524A2735B2B900462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8524B2735B2BD00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8524C2735B2C100462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8524D2735B2C500462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8524E2735B2C900462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8524F2735B2CD00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852502735B2D100462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852512735B2D500462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852522735B2D900462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852532735B2DD00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852542735B2E100462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852552735B2E500462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852562735B2E900462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852572735B2ED00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852582735B2F100462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852592735B2F500462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8525A2735B2F900462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8525B2735B2FD00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8525C2735B30100462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8525D2735B30400462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8525E2735B30900462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8525F2735B31300462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852602735B31700462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852612735B31B00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852622735B31F00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852632735B32700462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852642735B32C00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852652735B33200462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852662735B33600462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852672735B33A00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852682735B33E00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852692735B34200462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8526A2735B34600462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8526B2735B34B00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8526C2735B34F00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8526D2735B35400462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8526E2735B35800462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8526F2735B35D00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852702735B36100462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852712735B36500462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852722735B36900462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852732735B36E00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852742735B37200462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852752735B37700462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852762735B37C00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852772735B38000462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852782735B38400462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852792735B38900462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8527A2735B38D00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8527B2735B39200462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8527C2735B39900462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8527D2735B39D00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8527E2735B3A100462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8527F2735B3A600462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852802735B3AB00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852812735B3B100462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852822735B3B500462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852832735B3BD00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852842735B3C200462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852852735B3C800462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852862735B3CE00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852872735B3D300462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852882735B3D900462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852892735B3DE00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8528A2735B3E300462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8528B2735B3E900462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8528C2735B3EE00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8528D2735B3F300462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8528E2735B3F700462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB8528F2735B3FC00462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852902735B40500462DD0 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FB852922735B9BC00462DD0 /* libspaces_watcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0AB231B74857D00A82496 /* libspaces_watcher.m */; }; + 4FBE2D111B72632800407788 /* libapplication_watcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FBE2D041B72630200407788 /* libapplication_watcher.m */; }; 4FC09F7C19F99ECE007542A6 /* docs.json in Resources */ = {isa = PBXBuildFile; fileRef = 4FC09F7B19F99ECE007542A6 /* docs.json */; }; - 4FC93CA21BCD872D0041B820 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FC93CA81BCD87440041B820 /* watcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FC93C9B1BCD2D8A0041B820 /* watcher.m */; settings = {COMPILER_FLAGS = "-std=c99"; }; }; + 4FC93CA81BCD87440041B820 /* libaudiodevice_watcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FC93C9B1BCD2D8A0041B820 /* libaudiodevice_watcher.m */; settings = {COMPILER_FLAGS = "-std=c99"; }; }; + 4FCA05A0276767350089A5FC /* window_layout.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FB602EE1DDBB0A900FA751B /* window_layout.lua */; }; + 4FCA05A2276768DE0089A5FC /* init.lua in Copy hsdocs Files */ = {isa = PBXBuildFile; fileRef = 4FCA05912767645A0089A5FC /* init.lua */; }; + 4FCA05A3276768DE0089A5FC /* index.lp in Copy hsdocs Files */ = {isa = PBXBuildFile; fileRef = 4FCA05922767645A0089A5FC /* index.lp */; }; + 4FCA05A4276768DE0089A5FC /* gfm.lp in Copy hsdocs Files */ = {isa = PBXBuildFile; fileRef = 4FCA05932767645A0089A5FC /* gfm.lp */; }; + 4FCA05A5276768DE0089A5FC /* module.lp in Copy hsdocs Files */ = {isa = PBXBuildFile; fileRef = 4FCA05942767645A0089A5FC /* module.lp */; }; + 4FCA05A6276768DE0089A5FC /* index.md in Copy hsdocs Files */ = {isa = PBXBuildFile; fileRef = 4FCA05952767645A0089A5FC /* index.md */; }; + 4FCA05A7276768DE0089A5FC /* form.lp in Copy hsdocs Files */ = {isa = PBXBuildFile; fileRef = 4FCA059A2767645A0089A5FC /* form.lp */; }; + 4FCA05A8276768DE0089A5FC /* common.lp in Copy hsdocs Files */ = {isa = PBXBuildFile; fileRef = 4FCA059B2767645A0089A5FC /* common.lp */; }; + 4FCA05A9276768DE0089A5FC /* sample.lp in Copy hsdocs Files */ = {isa = PBXBuildFile; fileRef = 4FCA059C2767645A0089A5FC /* sample.lp */; }; + 4FCA05AA276768DE0089A5FC /* search.lp in Copy hsdocs Files */ = {isa = PBXBuildFile; fileRef = 4FCA059D2767645A0089A5FC /* search.lp */; }; + 4FCA05AC276769070089A5FC /* templates.md in Copy hsdocs minweb Files */ = {isa = PBXBuildFile; fileRef = 4FCA05972767645A0089A5FC /* templates.md */; }; + 4FCA05AD276769070089A5FC /* index.md in Copy hsdocs minweb Files */ = {isa = PBXBuildFile; fileRef = 4FCA05982767645A0089A5FC /* index.md */; }; + 4FCA05AE276769070089A5FC /* functions.md in Copy hsdocs minweb Files */ = {isa = PBXBuildFile; fileRef = 4FCA05992767645A0089A5FC /* functions.md */; }; + 4FCA05B127678B100089A5FC /* autolink.c in Sources */ = {isa = PBXBuildFile; fileRef = D64964601CCB32AE0074540B /* autolink.c */; }; + 4FCA05B227678B100089A5FC /* buffer.c in Sources */ = {isa = PBXBuildFile; fileRef = D64964621CCB32AE0074540B /* buffer.c */; }; + 4FCA05B327678B100089A5FC /* houdini_href_e.c in Sources */ = {isa = PBXBuildFile; fileRef = D64964641CCB32AE0074540B /* houdini_href_e.c */; }; + 4FCA05B427678B100089A5FC /* houdini_html_e.c in Sources */ = {isa = PBXBuildFile; fileRef = D64964651CCB32AE0074540B /* houdini_html_e.c */; }; + 4FCA05B627678B100089A5FC /* html.c in Sources */ = {isa = PBXBuildFile; fileRef = D64964681CCB32AE0074540B /* html.c */; }; + 4FCA05B727678B100089A5FC /* markdown.c in Sources */ = {isa = PBXBuildFile; fileRef = D649646A1CCB32AE0074540B /* markdown.c */; }; + 4FCA05B827678B100089A5FC /* markdown.m in Sources */ = {isa = PBXBuildFile; fileRef = D649646C1CCB32AE0074540B /* markdown.m */; }; + 4FCA05B927678B100089A5FC /* plaintext.c in Sources */ = {isa = PBXBuildFile; fileRef = D649646D1CCB32AE0074540B /* plaintext.c */; }; + 4FCA05BA27678B100089A5FC /* stack.c in Sources */ = {isa = PBXBuildFile; fileRef = D649646F1CCB32AE0074540B /* stack.c */; }; + 4FCA05BC27678B100089A5FC /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FCA05BE27678B100089A5FC /* autolink.h in Headers */ = {isa = PBXBuildFile; fileRef = D64964611CCB32AE0074540B /* autolink.h */; }; + 4FCA05BF27678B100089A5FC /* buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = D64964631CCB32AE0074540B /* buffer.h */; }; + 4FCA05C027678B100089A5FC /* houdini.h in Headers */ = {isa = PBXBuildFile; fileRef = D64964661CCB32AE0074540B /* houdini.h */; }; + 4FCA05C127678B100089A5FC /* html_blocks.h in Headers */ = {isa = PBXBuildFile; fileRef = D64964671CCB32AE0074540B /* html_blocks.h */; }; + 4FCA05C227678B100089A5FC /* html.h in Headers */ = {isa = PBXBuildFile; fileRef = D64964691CCB32AE0074540B /* html.h */; }; + 4FCA05C327678B100089A5FC /* markdown.h in Headers */ = {isa = PBXBuildFile; fileRef = D649646B1CCB32AE0074540B /* markdown.h */; }; + 4FCA05C427678B100089A5FC /* plaintext.h in Headers */ = {isa = PBXBuildFile; fileRef = D649646E1CCB32AE0074540B /* plaintext.h */; }; + 4FCA05C527678B100089A5FC /* stack.h in Headers */ = {isa = PBXBuildFile; fileRef = D64964701CCB32AE0074540B /* stack.h */; }; + 4FCA05CD27678B410089A5FC /* libmarkdown.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FCA05CA27678B100089A5FC /* libmarkdown.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FCBAFD323B0F7F1007BA1D0 /* libmath.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FCBAFD223B0F7F1007BA1D0 /* libmath.m */; }; + 4FCBAFD723B0FB95007BA1D0 /* HSmath.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FCBAFD623B0FB95007BA1D0 /* HSmath.m */; }; + 4FCBAFD923B1152F007BA1D0 /* test_math.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4FCBAFD823B0FC04007BA1D0 /* test_math.lua */; }; 4FCC52CE1E1527EF007F93D0 /* HSbrightness.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FCC52CD1E1527EF007F93D0 /* HSbrightness.m */; }; 4FCC52CF1E1528D4007F93D0 /* test_brightness.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4FCC52CB1E1526A6007F93D0 /* test_brightness.lua */; }; - 4FD0AB181B7484D700A82496 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FD0AB241B74857D00A82496 /* watcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0AB231B74857D00A82496 /* watcher.m */; }; - 4FD0AB2F1B74867600A82496 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FD0AB3A1B7486B100A82496 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0AB391B7486B100A82496 /* internal.m */; }; - 4FD0AB411B749C8E00A82496 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FD0AB4D1B749CDD00A82496 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0AB4B1B749CDD00A82496 /* internal.m */; }; - 4FD0AB4E1B749CDD00A82496 /* uielement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FD0AB4C1B749CDD00A82496 /* uielement.h */; }; - 4FD0AB561B749D7A00A82496 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FD0AB611B749DB300A82496 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0AB601B749DB300A82496 /* internal.m */; }; - 4FD0AB691B74A67500A82496 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FD0AB731B74A68900A82496 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FD0AB801B74A6E600A82496 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0AB7F1B74A6E600A82496 /* internal.m */; }; - 4FD0AB861B74A73300A82496 /* watcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0AB851B74A73300A82496 /* watcher.m */; }; - 4FD0AB911B74AE1900A82496 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FD0AB9B1B74AE2800A82496 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FD0ABA81B74AE6A00A82496 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0ABA71B74AE6A00A82496 /* internal.m */; }; - 4FD0ABAB1B74AE8000A82496 /* watcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0ABAA1B74AE8000A82496 /* watcher.m */; }; - 4FD0ABB61B74AF4E00A82496 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FD0ABC01B74AF9900A82496 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0ABBE1B74AF9900A82496 /* internal.m */; }; - 4FD0ABC11B74AF9900A82496 /* window.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FD0ABBF1B74AF9900A82496 /* window.h */; }; - 4FD0ABD21B74B2C500A82496 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FD0ABDC1B74B2FA00A82496 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FD0ABE51B74B33500A82496 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0ABE41B74B33500A82496 /* internal.m */; }; + 4FD0AB3A1B7486B100A82496 /* libtimer.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0AB391B7486B100A82496 /* libtimer.m */; }; + 4FD0AB4D1B749CDD00A82496 /* libuielement.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0AB4B1B749CDD00A82496 /* libuielement.m */; }; + 4FD0AB611B749DB300A82496 /* liburlevent.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0AB601B749DB300A82496 /* liburlevent.m */; }; + 4FD0AB801B74A6E600A82496 /* libusb.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0AB7F1B74A6E600A82496 /* libusb.m */; }; + 4FD0AB861B74A73300A82496 /* libusb_watcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0AB851B74A73300A82496 /* libusb_watcher.m */; }; + 4FD0ABA81B74AE6A00A82496 /* libwifi.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0ABA71B74AE6A00A82496 /* libwifi.m */; }; + 4FD0ABAB1B74AE8000A82496 /* libwifi_watcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0ABAA1B74AE8000A82496 /* libwifi_watcher.m */; }; + 4FD0ABC01B74AF9900A82496 /* libwindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0ABBE1B74AF9900A82496 /* libwindow.m */; }; + 4FD0ABE51B74B33500A82496 /* libeventtap.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0ABE41B74B33500A82496 /* libeventtap.m */; }; 4FD0ABE71B74B34500A82496 /* eventtap_event.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FD0ABE61B74B34500A82496 /* eventtap_event.h */; }; - 4FD0ABEB1B74B36000A82496 /* event.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0ABE91B74B36000A82496 /* event.m */; }; + 4FD0ABEB1B74B36000A82496 /* libeventtap_event.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0ABE91B74B36000A82496 /* libeventtap_event.m */; }; 4FD0ABEC1B74B36000A82496 /* eventtap_event.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FD0ABEA1B74B36000A82496 /* eventtap_event.h */; }; - 4FD0ABF91B74B9DE00A82496 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FD0AC021B74BA1600A82496 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0AC011B74BA1600A82496 /* internal.m */; }; - 4FD0AC1C1B74C58800A82496 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FD0AC291B74C62200A82496 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0AC241B74C62200A82496 /* internal.m */; }; + 4FD0AC021B74BA1600A82496 /* libipc.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0AC011B74BA1600A82496 /* libipc.m */; }; + 4FD0AC291B74C62200A82496 /* libhttpserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0AC241B74C62200A82496 /* libhttpserver.m */; }; 4FD0AC2A1B74C62200A82496 /* MYAnonymousIdentity.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FD0AC261B74C62200A82496 /* MYAnonymousIdentity.h */; }; 4FD0AC2B1B74C62200A82496 /* MYAnonymousIdentity.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD0AC271B74C62200A82496 /* MYAnonymousIdentity.m */; }; 4FDD8E4A1C6E4FA100085D7A /* test_screen.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4FDD8E491C6E4FA100085D7A /* test_screen.lua */; }; @@ -187,26 +363,228 @@ 4FDD8E8D1C8C8BF200085D7A /* HScoresetup.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FDD8E8C1C8C8BF200085D7A /* HScoresetup.m */; }; 4FDD8E8F1C8DED1C00085D7A /* HSappfinder.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FDD8E8E1C8DED1C00085D7A /* HSappfinder.m */; }; 4FDD8E911C8DEE3700085D7A /* test_appfinder.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4FDD8E901C8DEE3600085D7A /* test_appfinder.lua */; }; - 4FDD9DC71ED30DC9008F14D3 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FDD9DCD1ED30DEA008F14D3 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FDD9DC21ED30DA2008F14D3 /* internal.m */; }; - 4FDE059A1B72984C00E9E8EE /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FDE05A31B72987B00E9E8EE /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FDE05A21B72987B00E9E8EE /* internal.m */; }; - 4FDE05A91B72988C00E9E8EE /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FDE05B11B7298AD00E9E8EE /* watcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FDE05B01B7298AD00E9E8EE /* watcher.m */; }; - 4FDE05C21B72C22500E9E8EE /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FDE05CD1B72C24700E9E8EE /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FDE05CA1B72C24700E9E8EE /* internal.m */; }; - 4FDE05D71B734EA600E9E8EE /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FDE05E01B734ECC00E9E8EE /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FDE05DF1B734ECC00E9E8EE /* internal.m */; }; - 4FDE05EA1B734EE600E9E8EE /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - 4FDE05F21B734F0100E9E8EE /* watcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FDE05F11B734F0100E9E8EE /* watcher.m */; }; + 4FDD9DCD1ED30DEA008F14D3 /* libplist.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FDD9DC21ED30DA2008F14D3 /* libplist.m */; }; + 4FDE05A31B72987B00E9E8EE /* libbattery.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FDE05A21B72987B00E9E8EE /* libbattery.m */; }; + 4FDE05B11B7298AD00E9E8EE /* libbattery_watcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FDE05B01B7298AD00E9E8EE /* libbattery_watcher.m */; }; + 4FDE05CD1B72C24700E9E8EE /* libbrightness.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FDE05CA1B72C24700E9E8EE /* libbrightness.m */; }; + 4FDE05E01B734ECC00E9E8EE /* libcaffeinate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FDE05DF1B734ECC00E9E8EE /* libcaffeinate.m */; }; + 4FDE05F21B734F0100E9E8EE /* libcaffeinate_watcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FDE05F11B734F0100E9E8EE /* libcaffeinate_watcher.m */; }; 4FEE39D91F0A697400935F90 /* HScrash.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FEE39D81F0A697400935F90 /* HScrash.m */; }; 4FEE39DB1F0A69D600935F90 /* test_crash.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4FEE39DA1F0A69D100935F90 /* test_crash.lua */; }; 4FEF4D4F1C5FA01100E3B939 /* HSaudiodevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FEF4D4E1C5FA01000E3B939 /* HSaudiodevice.m */; }; 4FEF4D551C5FBC0F00E3B939 /* test_audiodevice.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4FEF4D531C5FBA9800E3B939 /* test_audiodevice.lua */; }; 4FEF59431B29A352002344A7 /* HSGrowingTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FEF59421B29A352002344A7 /* HSGrowingTextField.m */; }; - 6AE181221D36E90B0097211C /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; + 4FF061102747050A00FB15D6 /* deezer.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FF0610E274704F700FB15D6 /* deezer.lua */; }; + 4FF061152747A25C00FB15D6 /* tangent.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FF061132747A23700FB15D6 /* tangent.lua */; }; + 4FF061162747A25C00FB15D6 /* vox.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FF061142747A24600FB15D6 /* vox.lua */; }; + 4FF0611E274AA7A200FB15D6 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + 4FF06125274AA7BA00FB15D6 /* libcamera.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FF06119274AA62300FB15D6 /* libcamera.m */; }; + 4FF06128274AA7E600FB15D6 /* libcamera.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FF06124274AA7A200FB15D6 /* libcamera.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF06129274AA7F400FB15D6 /* camera.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FF06118274AA61000FB15D6 /* camera.lua */; }; + 4FF7395227344D740007074E /* libapplication.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FBE2CF91B7261A200407788 /* libapplication.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7395327344D740007074E /* libapplicationwatcher.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FBE2D101B72631600407788 /* libapplicationwatcher.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7395427344D740007074E /* libaudiodevice.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F70EED31B726D170025A7B3 /* libaudiodevice.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7395527344D740007074E /* libbase64.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F70EEE91B7273700025A7B3 /* libbase64.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7395627344D740007074E /* libbattery.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FDE059F1B72984C00E9E8EE /* libbattery.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7395727344D740007074E /* libbatterywatcher.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FDE05AE1B72988C00E9E8EE /* libbatterywatcher.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7395827344D740007074E /* libbrightness.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FDE05C71B72C22500E9E8EE /* libbrightness.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7395927344D740007074E /* libcaffeinate.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FDE05DC1B734EA600E9E8EE /* libcaffeinate.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7395A27344D740007074E /* libcaffeinatewatcher.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FDE05EF1B734EE600E9E8EE /* libcaffeinatewatcher.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7395B27344D740007074E /* libcrash.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F4CB3911B737953000EA9B6 /* libcrash.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7395C27344D740007074E /* libdockicon.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F4CB3A61B7385C5000EA9B6 /* libdockicon.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7395D27344D740007074E /* libfs.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F4CB3CC1B738F1E000EA9B6 /* libfs.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7395E27344D740007074E /* libhash.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F4CB3F31B73A3A1000EA9B6 /* libhash.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7395F27344D740007074E /* libhints.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F4CB4051B73A746000EA9B6 /* libhints.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7396027344D740007074E /* libhost.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F4CB4171B73AC1D000EA9B6 /* libhost.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7396127344D740007074E /* libhotkey.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F4CB4281B73AD0B000EA9B6 /* libhotkey.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7396227344D740007074E /* libhttp.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F4CB43C1B73AF7E000EA9B6 /* libhttp.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7396327344D740007074E /* libimage.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F4CB4501B73B09C000EA9B6 /* libimage.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7396427344D740007074E /* libjson.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F6B3EA81B73D6D300B2A4DE /* libjson.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7396527344D740007074E /* liblocation.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F6B3EBB1B73DC4500B2A4DE /* liblocation.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7396627344D740007074E /* libmenubar.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F6B3ED21B73E23800B2A4DE /* libmenubar.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7396727344D740007074E /* libmilight.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F6B3EE71B73E5AC00B2A4DE /* libmilight.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7396827344D740007074E /* libmouse.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F6B3EFB1B73E7C200B2A4DE /* libmouse.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7396927344D740007074E /* libnotify.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F6B3F0C1B73E98E00B2A4DE /* libnotify.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7396A27344D740007074E /* libpasteboard.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F6B3F211B73EBB500B2A4DE /* libpasteboard.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7396B27344D740007074E /* libpathwatcher.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F6B3F321B73EDD100B2A4DE /* libpathwatcher.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7396C27344D740007074E /* libscreen.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F6B3F441B73EF4B00B2A4DE /* libscreen.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7396D27344D740007074E /* libscreenwatcher.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F6B3F551B73EFC100B2A4DE /* libscreenwatcher.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7396E27344D740007074E /* libsettings.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F6B3F6A1B73F0E300B2A4DE /* libsettings.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7396F27344D740007074E /* libsound.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F6B3F7B1B73F44500B2A4DE /* libsound.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7397027344D740007074E /* libspaces_watcher.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FD0AB1D1B7484D700A82496 /* libspaces_watcher.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7397127344D740007074E /* libtimer.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FD0AB341B74867600A82496 /* libtimer.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7397227344D740007074E /* libuielement.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FD0AB461B749C8E00A82496 /* libuielement.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7397327344D740007074E /* liburlevent.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FD0AB5B1B749D7A00A82496 /* liburlevent.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7397427344D740007074E /* libusb.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FD0AB6E1B74A67500A82496 /* libusb.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7397527344D740007074E /* libusbwatcher.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FD0AB781B74A68900A82496 /* libusbwatcher.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7397627344D740007074E /* libwifi.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FD0AB961B74AE1900A82496 /* libwifi.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7397727344D740007074E /* libwifiwatcher.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FD0ABA01B74AE2800A82496 /* libwifiwatcher.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7397827344D740007074E /* libwindow.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FD0ABBB1B74AF4E00A82496 /* libwindow.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7397927344D740007074E /* libeventtap.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FD0ABD71B74B2C500A82496 /* libeventtap.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7397A27344D740007074E /* libeventtapevent.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FD0ABE11B74B2FA00A82496 /* libeventtapevent.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7397B27344D740007074E /* libipc.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FD0ABFE1B74B9DE00A82496 /* libipc.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7397C27344D740007074E /* libhttpserver.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FD0AC211B74C58800A82496 /* libhttpserver.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7397D27344D740007074E /* libkeycodes.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F7694541B74C96800536DE4 /* libkeycodes.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7397E27344D740007074E /* libwebview.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D64125641BA07CEA000FB5F8 /* libwebview.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7397F27344D740007074E /* libwebviewusercontent.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D64B03461BA954780006C468 /* libwebviewusercontent.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7398027344D740007074E /* libaudiodevicewatcher.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FC93CA71BCD872D0041B820 /* libaudiodevicewatcher.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7398127344D740007074E /* libdrawing_color.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D6F310E01BDF0E1700045CCD /* libdrawing_color.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7398227344D740007074E /* libstyledtext.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D6F310EF1BDF110500045CCD /* libstyledtext.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7398327344D740007074E /* libtask.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F9797C31BED0AC800719F3F /* libtask.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7398427344D740007074E /* libconsole.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D6FD568F1C0422B400BAE238 /* libconsole.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7398527344D750007074E /* libspeech.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D6BB4FB91C16959C000DC0A2 /* libspeech.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7398627344D750007074E /* libspeechlistener.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D6BB4FC71C1695EC000DC0A2 /* libspeechlistener.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7398727344D750007074E /* libfsvolume.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F29C23D1C29E0A300B8A69D /* libfsvolume.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7398827344D750007074E /* libchooser.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F51345E1C2F315C00EFD6D4 /* libchooser.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7398927344D750007074E /* libnetworkconfiguration.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D6477C141C5ED5D000F67BBC /* libnetworkconfiguration.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7398A27344D750007074E /* libnetworkreachability.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D6477C2C1C5ED82200F67BBC /* libnetworkreachability.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7398B27344D750007074E /* libnetworkhost.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D6477C3B1C5ED83C00F67BBC /* libnetworkhost.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7398C27344D750007074E /* libosascript.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4C3D55BB1C7F0A880023B633 /* libosascript.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7398D27344D750007074E /* libsocket.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4CD203B11C6D76E20089706D /* libsocket.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7398E27344D750007074E /* libsocketudp.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4CD96BDC1C73ABD2009FF648 /* libsocketudp.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7398F27344D750007074E /* libdoc.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D64964831CCB32C70074540B /* libdoc.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7399027344D750007074E /* libdistributednotifications.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F85FED81CCA918D00FBBAD7 /* libdistributednotifications.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7399127344D750007074E /* libwebviewdatastore.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D6B946521D139C7D00177E0C /* libwebviewdatastore.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7399227344D750007074E /* libwebviewtoolbar.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D6B9465E1D139CC500177E0C /* libwebviewtoolbar.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7399327344D750007074E /* libnoises.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 6AE181271D36E90B0097211C /* libnoises.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7399427344D750007074E /* libsharing.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D61F4A2F1DCFA67900AEE223 /* libsharing.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7399527344D750007074E /* libnetworkping.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D6A318AA1DDD833100D9B328 /* libnetworkping.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7399627344D750007074E /* libspotlight.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D6A212F31DE38F5F00998C0B /* libspotlight.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7399727344D750007074E /* libcanvas.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D68616071E04D5D20058A4F2 /* libcanvas.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7399827344D750007074E /* libcanvasmatrix.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D68616161E04D6630058A4F2 /* libcanvasmatrix.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7399927344D750007074E /* liblsqlite3.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F9618A91E24E60C0048F71D /* liblsqlite3.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7399A27344D750007074E /* libhost_locale.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D68CE6281E9C450E00912154 /* libhost_locale.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7399B27344D750007074E /* libplist.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FDD9DCC1ED30DC9008F14D3 /* libplist.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7399C27344D750007074E /* libdialog.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 22613FF11F297E0D00E05E11 /* libdialog.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7399D27344D750007074E /* libfsxattr.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D6E164DC1F4C262300B85D8A /* libfsxattr.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7399E27344D750007074E /* libstreamdeck.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F2DF3EA1F6046F300742D08 /* libstreamdeck.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF7399F27344D750007074E /* libmidi.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 22E4D8021FA7488900C8CF5C /* libmidi.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF739A027344D750007074E /* libhid.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = B8524F31201A88CD00844F3D /* libhid.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF739A127344D750007074E /* libbonjour.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D62F9EBB2320B82100FAE188 /* libbonjour.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF739A227344D750007074E /* libbonjourservice.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D62F9EC72320B86300FAE188 /* libbonjourservice.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF739A327344D750007074E /* libmath.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FCBAFCD23B0D941007BA1D0 /* libmath.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF739A427344D750007074E /* libwebsocket.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 224BA33223D1ECA900487FDB /* libwebsocket.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF739A527344D750007074E /* libpasteboardwatcher.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 22DF5D2723B9A9D300C41AE6 /* libpasteboardwatcher.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF739A627344D750007074E /* libuielementwatcher.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F9BA8C723DF3C6B006349F2 /* libuielementwatcher.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF739A727344D750007074E /* libserial.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 22EEC62324926E5100BAE4DA /* libserial.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF739A827344D750007074E /* libaxuielement.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D633A9E9247B9BF2005C88E2 /* libaxuielement.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF739A927344D750007074E /* libshortcuts.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4F7F3B6C272AF68100E05732 /* libshortcuts.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF739B2273481EB0007074E /* _coresetup.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F6689E01C2852B500E48AF1 /* _coresetup.lua */; }; + 4FF739B327348B2C0007074E /* crash.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F4CB3931B737A5B000EA9B6 /* crash.lua */; }; + 4FF739B5273498BA0007074E /* alert.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F64D8BD1B724C4B00FC4C65 /* alert.lua */; }; + 4FF739B6273498BA0007074E /* appfinder.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FDE05F81B7356A400E9E8EE /* appfinder.lua */; }; + 4FF739B7273498BA0007074E /* applescript.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FBE2CE41B72543C00407788 /* applescript.lua */; }; + 4FF739B8273498BA0007074E /* application.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FBE2CFC1B7261E500407788 /* application.lua */; }; + 4FF739B9273498BA0007074E /* audiodevice.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F70EED51B726D3F0025A7B3 /* audiodevice.lua */; }; + 4FF739BA273498BA0007074E /* axuielement.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D687FC3A247B9317005FA3A5 /* axuielement.lua */; }; + 4FF739BB273498BA0007074E /* base64.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F70EEED1B7273B00025A7B3 /* base64.lua */; }; + 4FF739BC273498BA0007074E /* battery.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FDE05A11B72987B00E9E8EE /* battery.lua */; }; + 4FF739BD273498BA0007074E /* bonjour.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D62F9EAB2320B81500FAE188 /* bonjour.lua */; }; + 4FF739BE273498BA0007074E /* brightness.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FDE05C91B72C24700E9E8EE /* brightness.lua */; }; + 4FF739BF273498BA0007074E /* caffeinate.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FDE05DE1B734ECC00E9E8EE /* caffeinate.lua */; }; + 4FF739C0273498BA0007074E /* chooser.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F5134501C2EE08F00EFD6D4 /* chooser.lua */; }; + 4FF739C1273498BA0007074E /* console.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D6FD56811C04228800BAE238 /* console.lua */; }; + 4FF739C2273498BA0007074E /* dialog.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 22613FE51F297B9B00E05E11 /* dialog.lua */; }; + 4FF739C3273498BA0007074E /* distributednotifications.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F85FECB1CCA8A2F00FBBAD7 /* distributednotifications.lua */; }; + 4FF739C4273498BA0007074E /* dockicon.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F4CB3A81B7385FB000EA9B6 /* dockicon.lua */; }; + 4FF739C5273498BA0007074E /* eventtap.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FD0ABE31B74B33500A82496 /* eventtap.lua */; }; + 4FF739C6273498BA0007074E /* expose.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FEABA561BC7ABF8005E2CFB /* expose.lua */; }; + 4FF739C7273498BA0007074E /* fnutils.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F4CB3C11B7388C0000EA9B6 /* fnutils.lua */; }; + 4FF739C8273498BA0007074E /* fs.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F4CB3D01B7391D3000EA9B6 /* fs.lua */; }; + 4FF739C9273498BA0007074E /* geometry.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F4CB3E41B739A0F000EA9B6 /* geometry.lua */; }; + 4FF739CA273498BA0007074E /* grid.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F4CB3E81B739ABD000EA9B6 /* grid.lua */; }; + 4FF739CB273498BA0007074E /* hash.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F4CB3F51B73A4EC000EA9B6 /* hash.lua */; }; + 4FF739CC273498BA0007074E /* hid.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = B8524F24201A875600844F3D /* hid.lua */; }; + 4FF739CD273498BA0007074E /* hints.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F4CB4081B73A784000EA9B6 /* hints.lua */; }; + 4FF739CE273498BA0007074E /* hotkey.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F4CB42C1B73AD47000EA9B6 /* hotkey.lua */; }; + 4FF739CF273498BA0007074E /* http.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F4CB4421B73AFD2000EA9B6 /* http.lua */; }; + 4FF739D0273498BA0007074E /* image.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F4CB4541B73B0D5000EA9B6 /* image.lua */; }; + 4FF739D1273498BA0007074E /* inspect.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F6B3E9B1B73D60000B2A4DE /* inspect.lua */; }; + 4FF739D2273498BA0007074E /* ipc.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FD0AC001B74BA1600A82496 /* ipc.lua */; }; + 4FF739D3273498BA0007074E /* itunes.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F6B3E9D1B73D6A500B2A4DE /* itunes.lua */; }; + 4FF739D4273498BA0007074E /* javascript.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D64208941BE3CDEB00673724 /* javascript.lua */; }; + 4FF739D5273498BA0007074E /* json.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F6B3EAC1B73D79100B2A4DE /* json.lua */; }; + 4FF739D6273498BA0007074E /* keycodes.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F7694581B74C9CA00536DE4 /* keycodes.lua */; }; + 4FF739D7273498BA0007074E /* layout.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F6B3EB01B73DBEA00B2A4DE /* layout.lua */; }; + 4FF739D8273498BA0007074E /* logger.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F6B3EC71B73E15E00B2A4DE /* logger.lua */; }; + 4FF739D9273498BA0007074E /* math.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FCBAFD423B0F805007BA1D0 /* math.lua */; }; + 4FF739DA273498BA0007074E /* menubar.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F6B3ED81B73E29300B2A4DE /* menubar.lua */; }; + 4FF739DB273498BA0007074E /* messages.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F6B3EDC1B73E56600B2A4DE /* messages.lua */; }; + 4FF739DC273498BA0007074E /* midi.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 22E4D7F81FA7485A00C8CF5C /* midi.lua */; }; + 4FF739DD273498BA0007074E /* milight.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F6B3EEC1B73E65800B2A4DE /* milight.lua */; }; + 4FF739DE273498BA0007074E /* mjomatic.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F6B3EF01B73E78900B2A4DE /* mjomatic.lua */; }; + 4FF739DF273498BA0007074E /* mouse.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F6B3EFD1B73E7F000B2A4DE /* mouse.lua */; }; + 4FF739E0273498BA0007074E /* network.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D6477C001C5ED5A600F67BBC /* network.lua */; }; + 4FF739E1273498BA0007074E /* network_configuration.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D6477BFC1C5ED5A600F67BBC /* network_configuration.lua */; }; + 4FF739E2273498BA0007074E /* network_host.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D6477BFE1C5ED5A600F67BBC /* network_host.lua */; }; + 4FF739E3273498BA0007074E /* network_reachability.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D6477C011C5ED5A600F67BBC /* network_reachability.lua */; }; + 4FF739E4273498BA0007074E /* network_ping.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D6A3189A1DDD830A00D9B328 /* network_ping.lua */; }; + 4FF739E5273498BA0007074E /* noises.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 6AE181181D36E8E50097211C /* noises.lua */; }; + 4FF739E6273498BA0007074E /* notify.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F6B3F101B73E9C700B2A4DE /* notify.lua */; }; + 4FF739E7273498BA0007074E /* osascript.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4C3D55A91C7F05D00023B633 /* osascript.lua */; }; + 4FF739E8273498BA0007074E /* pasteboard.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F6B3F251B73EBFD00B2A4DE /* pasteboard.lua */; }; + 4FF739E9273498BA0007074E /* pathwatcher.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F6B3F371B73EE1C00B2A4DE /* pathwatcher.lua */; }; + 4FF739EA273498BA0007074E /* plist.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FDD9DC11ED30DA2008F14D3 /* plist.lua */; }; + 4FF739EB273498BA0007074E /* redshift.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F6689E31C288BAA00E48AF1 /* redshift.lua */; }; + 4FF739EC273498BA0007074E /* screen.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F6B3F481B73EF9A00B2A4DE /* screen.lua */; }; + 4FF739ED273498BA0007074E /* settings.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F6B3F6E1B73F16700B2A4DE /* settings.lua */; }; + 4FF739EE273498BA0007074E /* serial.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 22EEC61824926E2100BAE4DA /* serial.lua */; }; + 4FF739EF273498BA0007074E /* sharing.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D61F4A301DCFA6C600AEE223 /* sharing.lua */; }; + 4FF739F0273498BA0007074E /* shortcuts.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F7F3B61272AF65F00E05732 /* shortcuts.lua */; }; + 4FF739F1273498BA0007074E /* socket.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4CD203A11C6D75950089706D /* socket.lua */; }; + 4FF739F2273498BA0007074E /* sound.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F6B3F801B73F49500B2A4DE /* sound.lua */; }; + 4FF739F3273498BA0007074E /* spaces.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FD0AB211B74856600A82496 /* spaces.lua */; }; + 4FF739F4273498BA0007074E /* speech.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D6BB4FA71C169539000DC0A2 /* speech.lua */; }; + 4FF739F5273498BA0007074E /* spoons.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FEA61501F06546200D71839 /* spoons.lua */; }; + 4FF739F6273498BA0007074E /* spotify.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F6B3F861B73F86E00B2A4DE /* spotify.lua */; }; + 4FF739F7273498BA0007074E /* spotlight.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D6A212E61DE38F3B00998C0B /* spotlight.lua */; }; + 4FF739F8273498BA0007074E /* sqlite3.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F9618991E24E5F70048F71D /* sqlite3.lua */; }; + 4FF739F9273498BA0007074E /* streamdeck.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F2DF3DD1F6046AD00742D08 /* streamdeck.lua */; }; + 4FF739FA273498BA0007074E /* styledtext.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D6F310D01BDF0E0000045CCD /* styledtext.lua */; }; + 4FF739FB273498BA0007074E /* tabs.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FD0AB291B74863000A82496 /* tabs.lua */; }; + 4FF739FC273498BA0007074E /* task.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F9797B51BECD9AD00719F3F /* task.lua */; }; + 4FF739FD273498BA0007074E /* timer.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FD0AB381B7486B100A82496 /* timer.lua */; }; + 4FF739FE273498BA0007074E /* uielement.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FD0AB4A1B749CDD00A82496 /* uielement.lua */; }; + 4FF739FF273498BA0007074E /* urlevent.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FD0AB5F1B749DB300A82496 /* urlevent.lua */; }; + 4FF73A00273498BA0007074E /* usb.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FD0AB7E1B74A6E600A82496 /* usb.lua */; }; + 4FF73A01273498BA0007074E /* utf8.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FD0AB8B1B74AC2300A82496 /* utf8.lua */; }; + 4FF73A02273498BA0007074E /* watchable.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D684BBFB1DFB72BD00B4D0B8 /* watchable.lua */; }; + 4FF73A03273498BA0007074E /* websocket.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 224BA33423D1EE6F00487FDB /* websocket.lua */; }; + 4FF73A04273498BA0007074E /* webview.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D64125581BA07CDE000FB5F8 /* webview.lua */; }; + 4FF73A05273498BA0007074E /* webview_toolbar.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D63FBD921D1CFB4E005255DD /* webview_toolbar.lua */; }; + 4FF73A06273498BA0007074E /* wifi.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FD0ABA61B74AE6A00A82496 /* wifi.lua */; }; + 4FF73A07273498BA0007074E /* window.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FD0ABBD1B74AF9900A82496 /* window.lua */; }; + 4FF73A08273498BA0007074E /* window_filter.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FD0ABC81B74B0EC00A82496 /* window_filter.lua */; }; + 4FF73A0A273498BA0007074E /* window_switcher.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F11989E1FF0412600D279D8 /* window_switcher.lua */; }; + 4FF73A0E27349AE60007074E /* canvas.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D68615F51E04D5990058A4F2 /* canvas.lua */; }; + 4FF73A0F27349AE60007074E /* canvas_matrix.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D68615F81E04D5990058A4F2 /* canvas_matrix.lua */; }; + 4FF73A1027349AE60007074E /* drawing.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F4CB3BB1B7387AA000EA9B6 /* drawing.lua */; }; + 4FF73A1127349AE60007074E /* drawing_canvasWrapper.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D6E071681E04D9FC00C1046A /* drawing_canvasWrapper.lua */; }; + 4FF73A1227349AE60007074E /* drawing_color.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D6F310CC1BDF0DCC00045CCD /* drawing_color.lua */; }; + 4FF73A1327349AE60007074E /* host.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F4CB4191B73AC48000EA9B6 /* host.lua */; }; + 4FF73A1427349AE60007074E /* host_locale.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D68CE61B1E9C44E200912154 /* host_locale.lua */; }; + 4FF73A1527349AE60007074E /* location.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4F6B3EBD1B73DC8400B2A4DE /* location.lua */; }; + 4FF73A1627349AE60007074E /* location_geocoder.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D66B763A1DD6FD1400CA12E6 /* location_geocoder.lua */; }; + 4FF73A17273539EE0007074E /* doc.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FD0ABCA1B74B1C500A82496 /* doc.lua */; }; + 4FF73A18273539EE0007074E /* doc_builder.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D67F1B3C1EA9D65E00FEB411 /* doc_builder.lua */; }; + 4FF73A1A273539EE0007074E /* httpserver.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FD0AC231B74C62200A82496 /* httpserver.lua */; }; + 4FF73A1B273539EE0007074E /* httpserver_hsminweb.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D6B772991CCB544B00908A59 /* httpserver_hsminweb.lua */; }; + 4FF73A1C273539EE0007074E /* cgilua_compatibility_functions.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = D6B772981CCB544B00908A59 /* cgilua_compatibility_functions.lua */; }; + 4FF73A1D2735439B0007074E /* cmdpost in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = 4FD0AC091B74BACD00A82496 /* cmdpost */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 4FF73A1F273544AD0007074E /* cmdpost.man in Copy hs manpage */ = {isa = PBXBuildFile; fileRef = 4FD0AC121B74BB2300A82496 /* cmdpost.man */; }; + 4FF73A2027358DDA0007074E /* HSChooserWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4F0676041C32AED90088C57C /* HSChooserWindow.xib */; }; + 4FF73A23273594730007074E /* lua.json in Resources */ = {isa = PBXBuildFile; fileRef = 4FF73A212735944D0007074E /* lua.json */; }; + 4FF73A252735954D0007074E /* timeout3 in Resources */ = {isa = PBXBuildFile; fileRef = 4FF73A24273595340007074E /* timeout3 */; }; + 4FF73A2B27359C2C0007074E /* window_highlight.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FF73A2A27359C0E0007074E /* window_highlight.lua */; }; + 4FF73A2C27359C2C0007074E /* window_tiling.lua in Copy Extension Lua files */ = {isa = PBXBuildFile; fileRef = 4FF73A2727359BD20007074E /* window_tiling.lua */; }; + 4FFB20FC23C5E01300811E77 /* HSStreamDeckDeviceXL.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFB20FA23C5E01300811E77 /* HSStreamDeckDeviceXL.h */; }; + 4FFB20FD23C5E01300811E77 /* HSStreamDeckDeviceXL.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FFB20FB23C5E01300811E77 /* HSStreamDeckDeviceXL.m */; }; + 4FFB210023CD14A500811E77 /* HSStreamDeckDeviceOriginalV2.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFB20FE23CD14A400811E77 /* HSStreamDeckDeviceOriginalV2.h */; }; + 4FFB210123CD14A500811E77 /* HSStreamDeckDeviceOriginalV2.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FFB20FF23CD14A400811E77 /* HSStreamDeckDeviceOriginalV2.m */; }; + 4FFF9FB525D89B3B00D2997C /* HSmouse.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FFF9FB425D89B3B00D2997C /* HSmouse.m */; }; + 4FFFA01225D89BAF00D2997C /* test_mouse.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4FFFA01125D89BAF00D2997C /* test_mouse.lua */; }; 6AE181281D36E9260097211C /* detectors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6AE181161D36E8E50097211C /* detectors.cpp */; }; - 6AE1812A1D36E9260097211C /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AE181191D36E8E50097211C /* internal.m */; }; + 6AE1812A1D36E9260097211C /* libnoises.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AE181191D36E8E50097211C /* libnoises.m */; }; 6AE1812C1D36E9600097211C /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6AE1812B1D36E9600097211C /* Accelerate.framework */; }; 6AE1812E1D36E96A0097211C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6AE1812D1D36E96A0097211C /* CoreAudio.framework */; }; 6AE181321D39C8F10097211C /* HSnoises.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AE181311D39C8F10097211C /* HSnoises.m */; }; @@ -217,11 +595,9 @@ 942E71A619B1112F001BA156 /* MJPreferencesWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 942E71A419B1112F001BA156 /* MJPreferencesWindowController.m */; }; 942E71AA19B11176001BA156 /* MJAccessibilityUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 942E71A919B11176001BA156 /* MJAccessibilityUtils.m */; }; 943BF0F219A4B43E0017F79D /* MJUserNotificationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 943BF0F119A4B43E0017F79D /* MJUserNotificationManager.m */; }; - 943BF0F319A4BC730017F79D /* Images.xcassets in Sources */ = {isa = PBXBuildFile; fileRef = 944A2D3F1989737E00D8DC90 /* Images.xcassets */; }; 944A2D391989735300D8DC90 /* MJAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 944A2D341989735300D8DC90 /* MJAppDelegate.m */; }; 944A2D3A1989735300D8DC90 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 944A2D351989735300D8DC90 /* MainMenu.xib */; }; 944A2D431989737E00D8DC90 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 944A2D3D1989737E00D8DC90 /* Credits.rtf */; }; - 944A2D451989737E00D8DC90 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 944A2D3F1989737E00D8DC90 /* Images.xcassets */; }; 944A2DA91989760400D8DC90 /* MJConsoleWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 944A2DA81989760400D8DC90 /* MJConsoleWindowController.m */; }; 945B65AC198D2DDB002D2E30 /* MJLua.m in Sources */ = {isa = PBXBuildFile; fileRef = 945B65AB198D2DDB002D2E30 /* MJLua.m */; }; 945B65B2198D31FC002D2E30 /* setup.lua in Resources */ = {isa = PBXBuildFile; fileRef = 945B65B1198D31FC002D2E30 /* setup.lua */; }; @@ -230,31 +606,24 @@ 949CDBFE1990747B00906CCE /* PreferencesWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 949CDBFD1990747B00906CCE /* PreferencesWindow.xib */; }; 949CDC001990759B00906CCE /* ConsoleWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 949CDBFF1990759B00906CCE /* ConsoleWindow.xib */; }; 94A1E5481993AC5C003AEB26 /* MJFileUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 94A1E5471993AC5C003AEB26 /* MJFileUtils.m */; }; - B8524F2C201A88CD00844F3D /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - B8524F32201A896000844F3D /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = B8524F25201A875600844F3D /* internal.m */; }; + B8524F32201A896000844F3D /* libhid.m in Sources */ = {isa = PBXBuildFile; fileRef = B8524F25201A875600844F3D /* libhid.m */; }; + CE139CB028B24B6500743C90 /* HShttp.m in Sources */ = {isa = PBXBuildFile; fileRef = CE139CAF28B24B6500743C90 /* HShttp.m */; }; + CE139CB128B24DAC00743C90 /* http.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4F4CB4421B73AFD2000EA9B6 /* http.lua */; }; + CE139CB328B2539500743C90 /* test_http.lua in Resources */ = {isa = PBXBuildFile; fileRef = CE139CB228B2539500743C90 /* test_http.lua */; }; D02F95291A00221C00E28BB2 /* HSrequire_all.m in Sources */ = {isa = PBXBuildFile; fileRef = D02F95281A00221C00E28BB2 /* HSrequire_all.m */; }; D077B5BF1A001B5300369B30 /* variables.m in Sources */ = {isa = PBXBuildFile; fileRef = D077B5BE1A001B5300369B30 /* variables.m */; }; - D61F4A2A1DCFA67900AEE223 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - D61F4A341DCFA6DB00AEE223 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = D61F4A311DCFA6C600AEE223 /* internal.m */; }; - D63FBD951D1CFB77005255DD /* toolbar_internal.m in Sources */ = {isa = PBXBuildFile; fileRef = D63FBD911D1CFB4E005255DD /* toolbar_internal.m */; }; - D641255F1BA07CEA000FB5F8 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - D64125661BA07D20000FB5F8 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = D64125591BA07CDE000FB5F8 /* internal.m */; }; - D6477C0F1C5ED5D000F67BBC /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - D6477C151C5ED61500F67BBC /* configurationinternal.m in Sources */ = {isa = PBXBuildFile; fileRef = D6477BFD1C5ED5A600F67BBC /* configurationinternal.m */; }; - D6477C221C5ED82200F67BBC /* reachabilityinternal.m in Sources */ = {isa = PBXBuildFile; fileRef = D6477C021C5ED5A600F67BBC /* reachabilityinternal.m */; }; - D6477C271C5ED82200F67BBC /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - D6477C301C5ED83C00F67BBC /* hostinternal.m in Sources */ = {isa = PBXBuildFile; fileRef = D6477BFF1C5ED5A600F67BBC /* hostinternal.m */; }; - D6477C361C5ED83C00F67BBC /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - D649647E1CCB32C70074540B /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - D64964841CCB33120074540B /* autolink.c in Sources */ = {isa = PBXBuildFile; fileRef = D64964601CCB32AE0074540B /* autolink.c */; }; - D64964851CCB33120074540B /* buffer.c in Sources */ = {isa = PBXBuildFile; fileRef = D64964621CCB32AE0074540B /* buffer.c */; }; - D64964861CCB33120074540B /* houdini_href_e.c in Sources */ = {isa = PBXBuildFile; fileRef = D64964641CCB32AE0074540B /* houdini_href_e.c */; }; - D64964871CCB33120074540B /* houdini_html_e.c in Sources */ = {isa = PBXBuildFile; fileRef = D64964651CCB32AE0074540B /* houdini_html_e.c */; }; - D64964881CCB33120074540B /* html.c in Sources */ = {isa = PBXBuildFile; fileRef = D64964681CCB32AE0074540B /* html.c */; }; - D64964891CCB33120074540B /* markdown.c in Sources */ = {isa = PBXBuildFile; fileRef = D649646A1CCB32AE0074540B /* markdown.c */; }; - D649648A1CCB33120074540B /* markdown.m in Sources */ = {isa = PBXBuildFile; fileRef = D649646C1CCB32AE0074540B /* markdown.m */; }; - D649648B1CCB33120074540B /* plaintext.c in Sources */ = {isa = PBXBuildFile; fileRef = D649646D1CCB32AE0074540B /* plaintext.c */; }; - D649648C1CCB33120074540B /* stack.c in Sources */ = {isa = PBXBuildFile; fileRef = D649646F1CCB32AE0074540B /* stack.c */; }; + D61F4A341DCFA6DB00AEE223 /* libsharing.m in Sources */ = {isa = PBXBuildFile; fileRef = D61F4A311DCFA6C600AEE223 /* libsharing.m */; }; + D62F9EBC2320B83B00FAE188 /* libbonjoir.m in Sources */ = {isa = PBXBuildFile; fileRef = D62F9EAD2320B81500FAE188 /* libbonjoir.m */; }; + D62F9EC82320B88600FAE188 /* libbonjour_service.m in Sources */ = {isa = PBXBuildFile; fileRef = D62F9EAC2320B81500FAE188 /* libbonjour_service.m */; }; + D633A9EA247B9C1A005C88E2 /* common.m in Sources */ = {isa = PBXBuildFile; fileRef = D687FC3C247B9317005FA3A5 /* common.m */; }; + D633A9EB247B9C1A005C88E2 /* libaxuielement.m in Sources */ = {isa = PBXBuildFile; fileRef = D687FC39247B9317005FA3A5 /* libaxuielement.m */; }; + D633A9EC247B9C1A005C88E2 /* observer.m in Sources */ = {isa = PBXBuildFile; fileRef = D687FC3B247B9317005FA3A5 /* observer.m */; }; + D633A9ED247B9C2C005C88E2 /* common.h in Headers */ = {isa = PBXBuildFile; fileRef = D687FC38247B9316005FA3A5 /* common.h */; }; + D63FBD951D1CFB77005255DD /* libwebview_toolbar.m in Sources */ = {isa = PBXBuildFile; fileRef = D63FBD911D1CFB4E005255DD /* libwebview_toolbar.m */; }; + D64125661BA07D20000FB5F8 /* libwebview.m in Sources */ = {isa = PBXBuildFile; fileRef = D64125591BA07CDE000FB5F8 /* libwebview.m */; }; + D6477C151C5ED61500F67BBC /* libnetwork_configuration.m in Sources */ = {isa = PBXBuildFile; fileRef = D6477BFD1C5ED5A600F67BBC /* libnetwork_configuration.m */; }; + D6477C221C5ED82200F67BBC /* libnetwork_reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = D6477C021C5ED5A600F67BBC /* libnetwork_reachability.m */; }; + D6477C301C5ED83C00F67BBC /* libnetwork_host.m in Sources */ = {isa = PBXBuildFile; fileRef = D6477BFF1C5ED5A600F67BBC /* libnetwork_host.m */; }; D649648D1CCB33510074540B /* autolink.h in Headers */ = {isa = PBXBuildFile; fileRef = D64964611CCB32AE0074540B /* autolink.h */; }; D649648E1CCB33510074540B /* buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = D64964631CCB32AE0074540B /* buffer.h */; }; D649648F1CCB33510074540B /* houdini.h in Headers */ = {isa = PBXBuildFile; fileRef = D64964661CCB32AE0074540B /* houdini.h */; }; @@ -264,51 +633,61 @@ D64964931CCB33510074540B /* plaintext.h in Headers */ = {isa = PBXBuildFile; fileRef = D649646E1CCB32AE0074540B /* plaintext.h */; }; D64964941CCB33510074540B /* stack.h in Headers */ = {isa = PBXBuildFile; fileRef = D64964701CCB32AE0074540B /* stack.h */; }; D64B03371BA954290006C468 /* webview.h in Headers */ = {isa = PBXBuildFile; fileRef = D64B03361BA9541E0006C468 /* webview.h */; }; - D64B03401BA954780006C468 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; D64B03421BA954780006C468 /* webview.h in Headers */ = {isa = PBXBuildFile; fileRef = D64B03361BA9541E0006C468 /* webview.h */; }; - D64B03471BA954A20006C468 /* usercontent.m in Sources */ = {isa = PBXBuildFile; fileRef = D64B03381BA954660006C468 /* usercontent.m */; }; - D68616021E04D5D20058A4F2 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; + D64B03471BA954A20006C468 /* libwebview_usercontent.m in Sources */ = {isa = PBXBuildFile; fileRef = D64B03381BA954660006C468 /* libwebview_usercontent.m */; }; + D659EC7429F8468F00A7D103 /* docs.css in Copy hsdocs Files */ = {isa = PBXBuildFile; fileRef = D659EC7329F8468F00A7D103 /* docs.css */; }; D68616081E04D60A0058A4F2 /* imageAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = D68615F41E04D5990058A4F2 /* imageAdditions.m */; }; - D68616091E04D60A0058A4F2 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = D68615F61E04D5990058A4F2 /* internal.m */; }; + D68616091E04D60A0058A4F2 /* libcanvas.m in Sources */ = {isa = PBXBuildFile; fileRef = D68615F61E04D5990058A4F2 /* libcanvas.m */; }; D686160A1E04D61C0058A4F2 /* Canvas.h in Headers */ = {isa = PBXBuildFile; fileRef = D68615F31E04D5990058A4F2 /* Canvas.h */; }; - D68616101E04D6630058A4F2 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - D68616171E04D6BA0058A4F2 /* matrix_internal.m in Sources */ = {isa = PBXBuildFile; fileRef = D68615F71E04D5990058A4F2 /* matrix_internal.m */; }; - D68CE6231E9C450E00912154 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - D68CE6291E9C457400912154 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = D68CE61C1E9C44E200912154 /* internal.m */; }; + D68616171E04D6BA0058A4F2 /* libcanvas_matrix.m in Sources */ = {isa = PBXBuildFile; fileRef = D68615F71E04D5990058A4F2 /* libcanvas_matrix.m */; }; + D68CE6291E9C457400912154 /* libhost_locale.m in Sources */ = {isa = PBXBuildFile; fileRef = D68CE61C1E9C44E200912154 /* libhost_locale.m */; }; D6943FE01EDBF1F50057BB26 /* cmdpost.m in Sources */ = {isa = PBXBuildFile; fileRef = D6943FDE1EDBF1DE0057BB26 /* cmdpost.m */; }; D6943FE31EDBF2510057BB26 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D6943FE11EDBF2510057BB26 /* CoreFoundation.framework */; }; D6943FE41EDBF2510057BB26 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D6943FE21EDBF2510057BB26 /* Foundation.framework */; }; - D6A212EE1DE38F5F00998C0B /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - D6A212F41DE38F8200998C0B /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = D6A212E71DE38F3B00998C0B /* internal.m */; }; - D6A318A51DDD833100D9B328 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - D6A318AB1DDD836800D9B328 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = D6A3189B1DDD830A00D9B328 /* internal.m */; }; + D6A212F41DE38F8200998C0B /* libspotlight.m in Sources */ = {isa = PBXBuildFile; fileRef = D6A212E71DE38F3B00998C0B /* libspotlight.m */; }; + D6A318AB1DDD836800D9B328 /* libnetwork_ping.m in Sources */ = {isa = PBXBuildFile; fileRef = D6A3189B1DDD830A00D9B328 /* libnetwork_ping.m */; }; D6A318AC1DDD836800D9B328 /* SimplePing.m in Sources */ = {isa = PBXBuildFile; fileRef = D6A3189D1DDD830A00D9B328 /* SimplePing.m */; }; D6A318AD1DDD837400D9B328 /* SimplePing.h in Headers */ = {isa = PBXBuildFile; fileRef = D6A3189C1DDD830A00D9B328 /* SimplePing.h */; }; - D6B9464C1D139C7D00177E0C /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; + D6A6C1122A05F3500018FC9B /* byte_order.h in Headers */ = {isa = PBXBuildFile; fileRef = D6A6C10D2A05F3500018FC9B /* byte_order.h */; }; + D6A6C1132A05F3500018FC9B /* sha3.m in Sources */ = {isa = PBXBuildFile; fileRef = D6A6C10E2A05F3500018FC9B /* sha3.m */; }; + D6A6C1142A05F3500018FC9B /* sha3.h in Headers */ = {isa = PBXBuildFile; fileRef = D6A6C10F2A05F3500018FC9B /* sha3.h */; }; + D6A6C1152A05F3500018FC9B /* algorithms.m in Sources */ = {isa = PBXBuildFile; fileRef = D6A6C1102A05F3500018FC9B /* algorithms.m */; }; + D6A6C1162A05F3500018FC9B /* algorithms.h in Headers */ = {isa = PBXBuildFile; fileRef = D6A6C1112A05F3500018FC9B /* algorithms.h */; }; D6B9464E1D139C7D00177E0C /* webview.h in Headers */ = {isa = PBXBuildFile; fileRef = D64B03361BA9541E0006C468 /* webview.h */; }; - D6B946531D139CB800177E0C /* datastore.m in Sources */ = {isa = PBXBuildFile; fileRef = D6B946431D139C4900177E0C /* datastore.m */; }; - D6B946581D139CC500177E0C /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; + D6B946531D139CB800177E0C /* libwebview_datastore.m in Sources */ = {isa = PBXBuildFile; fileRef = D6B946431D139C4900177E0C /* libwebview_datastore.m */; }; D6B9465A1D139CC500177E0C /* webview.h in Headers */ = {isa = PBXBuildFile; fileRef = D64B03361BA9541E0006C468 /* webview.h */; }; - D6BB4FB41C16959C000DC0A2 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - D6BB4FBA1C1695BF000DC0A2 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = D6BB4FA81C169539000DC0A2 /* internal.m */; }; - D6BB4FC21C1695EC000DC0A2 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - D6BB4FC81C169605000DC0A2 /* listener.m in Sources */ = {isa = PBXBuildFile; fileRef = D6BB4FA91C169539000DC0A2 /* listener.m */; }; - D6E164D71F4C262300B85D8A /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - D6E164DD1F4C264D00B85D8A /* xattr.m in Sources */ = {isa = PBXBuildFile; fileRef = D6E164D11F4C25FD00B85D8A /* xattr.m */; }; - D6F310DB1BDF0E1700045CCD /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - D6F310E11BDF0E5F00045CCD /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = D6F310CD1BDF0DCC00045CCD /* internal.m */; }; - D6F310E31BDF108E00045CCD /* drawing.h in Headers */ = {isa = PBXBuildFile; fileRef = D6F310E21BDF107D00045CCD /* drawing.h */; }; - D6F310E41BDF109900045CCD /* drawing.h in Headers */ = {isa = PBXBuildFile; fileRef = D6F310E21BDF107D00045CCD /* drawing.h */; }; - D6F310EA1BDF110500045CCD /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - D6F310F01BDF113900045CCD /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = D6F310D11BDF0E0000045CCD /* internal.m */; }; - D6FD568A1C0422B400BAE238 /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */; }; - D6FD56901C0422DE00BAE238 /* internal.m in Sources */ = {isa = PBXBuildFile; fileRef = D6FD56821C04228800BAE238 /* internal.m */; }; - E2491A2E1E98CAD80005A439 /* cpPlugin.icns in Resources */ = {isa = PBXBuildFile; fileRef = E2491A2D1E98CAD80005A439 /* cpPlugin.icns */; }; + D6BACEAA23178ECA00110E1E /* libdoc.m in Sources */ = {isa = PBXBuildFile; fileRef = D6BACEA923178EC900110E1E /* libdoc.m */; }; + D6BB4FBA1C1695BF000DC0A2 /* libspeech.m in Sources */ = {isa = PBXBuildFile; fileRef = D6BB4FA81C169539000DC0A2 /* libspeech.m */; }; + D6BB4FC81C169605000DC0A2 /* libspeech_listener.m in Sources */ = {isa = PBXBuildFile; fileRef = D6BB4FA91C169539000DC0A2 /* libspeech_listener.m */; }; + D6C32CC927DDD47F001AA22E /* LuaSkin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB852342735B02400462DD0 /* LuaSkin.framework */; }; + D6C32CD227DDD68E001AA22E /* libspaces.m in Sources */ = {isa = PBXBuildFile; fileRef = D6C32CD027DDD68E001AA22E /* libspaces.m */; }; + D6C32CD327DDD68E001AA22E /* private.h in Headers */ = {isa = PBXBuildFile; fileRef = D6C32CD127DDD68E001AA22E /* private.h */; }; + D6C32CD627DDD811001AA22E /* libspaces.dylib in Copy Extension Dylibs */ = {isa = PBXBuildFile; fileRef = D6C32CCF27DDD47F001AA22E /* libspaces.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + D6E164DD1F4C264D00B85D8A /* libfs_xattr.m in Sources */ = {isa = PBXBuildFile; fileRef = D6E164D11F4C25FD00B85D8A /* libfs_xattr.m */; }; + D6EE7C7F249B488C0053FB3A /* ExternalReferences.h in Headers */ = {isa = PBXBuildFile; fileRef = D6EE7C7D249B488B0053FB3A /* ExternalReferences.h */; }; + D6EE7C80249B488C0053FB3A /* axtextmarker.m in Sources */ = {isa = PBXBuildFile; fileRef = D6EE7C7E249B488B0053FB3A /* axtextmarker.m */; }; + D6F310E11BDF0E5F00045CCD /* libdrawing_color.m in Sources */ = {isa = PBXBuildFile; fileRef = D6F310CD1BDF0DCC00045CCD /* libdrawing_color.m */; }; + D6F310F01BDF113900045CCD /* libstyledtext.m in Sources */ = {isa = PBXBuildFile; fileRef = D6F310D11BDF0E0000045CCD /* libstyledtext.m */; }; + D6FD56901C0422DE00BAE238 /* libconsole.m in Sources */ = {isa = PBXBuildFile; fileRef = D6FD56821C04228800BAE238 /* libconsole.m */; }; + DAED28EC20B95E8F004602CB /* led.m in Sources */ = {isa = PBXBuildFile; fileRef = DAED28EB20B95E8E004602CB /* led.m */; }; E29DDE461E85524F00313995 /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = E29DDE451E85524F00313995 /* dsa_pub.pem */; }; - E2E2B1FE1E8546FE009AEAD6 /* PFMoveApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = E2E2B1FD1E8546FE009AEAD6 /* PFMoveApplication.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 22451854281ADF8400997BB0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9445CA0319083251002568BB /* Project object */; + proxyType = 1; + remoteGlobalIDString = 22451847281ADF8400997BB0; + remoteInfo = CommandPost; + }; + 224BA33523D1EFB300487FDB /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9445CA0319083251002568BB /* Project object */; + proxyType = 1; + remoteGlobalIDString = 224BA32723D1ECA900487FDB; + remoteInfo = websocket; + }; 22613FF31F297E7F00E05E11 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9445CA0319083251002568BB /* Project object */; @@ -316,6 +695,34 @@ remoteGlobalIDString = 22613FE81F297E0D00E05E11; remoteInfo = dialog; }; + 22654EAB27D43CF8004F8214 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9445CA0319083251002568BB /* Project object */; + proxyType = 1; + remoteGlobalIDString = 22FA060C27A160410039C37A; + remoteInfo = razer; + }; + 226F960D27917DCB003DF60F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9445CA0319083251002568BB /* Project object */; + proxyType = 1; + remoteGlobalIDString = 226F95F427917D3B003DF60F; + remoteInfo = speededitor; + }; + 2274782C2787F9DD00DE6894 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9445CA0319083251002568BB /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2274781F2787F92E00DE6894; + remoteInfo = osc; + }; + 22DF5D2A23B9AA8C00C41AE6 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9445CA0319083251002568BB /* Project object */; + proxyType = 1; + remoteGlobalIDString = 22DF5D1C23B9A9D300C41AE6; + remoteInfo = pasteboardwatcher; + }; 22E4D8041FA748E500C8CF5C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9445CA0319083251002568BB /* Project object */; @@ -323,6 +730,13 @@ remoteGlobalIDString = 22E4D7F91FA7488900C8CF5C; remoteInfo = midi; }; + 22EEC62524926EAF00BAE4DA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9445CA0319083251002568BB /* Project object */; + proxyType = 1; + remoteGlobalIDString = 22EEC61924926E5100BAE4DA; + remoteInfo = serial; + }; 4C1CA6B01C6D9D5E00379CCE /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9445CA0319083251002568BB /* Project object */; @@ -372,13 +786,6 @@ remoteGlobalIDString = 4F4CB39C1B7385C5000EA9B6; remoteInfo = dockicon; }; - 4F4CB3B81B738785000EA9B6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9445CA0319083251002568BB /* Project object */; - proxyType = 1; - remoteGlobalIDString = 4F4CB3AD1B738769000EA9B6; - remoteInfo = drawing; - }; 4F4CB3CD1B738FBC000EA9B6 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9445CA0319083251002568BB /* Project object */; @@ -540,6 +947,13 @@ remoteGlobalIDString = 4F76944A1B74C96800536DE4; remoteInfo = keycodes; }; + 4F7F3B6E272AF7E100E05732 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9445CA0319083251002568BB /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4F7F3B62272AF68100E05732; + remoteInfo = shortcuts; + }; 4F85FEDA1CCAB22400FBBAD7 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9445CA0319083251002568BB /* Project object */; @@ -561,6 +975,13 @@ remoteGlobalIDString = 4F9797B91BED0AC800719F3F; remoteInfo = task; }; + 4F9BA8CA23DF3CCE006349F2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9445CA0319083251002568BB /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4F9BA8BC23DF3C6B006349F2; + remoteInfo = uielementwatcher; + }; 4FBE2D011B72624A00407788 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9445CA0319083251002568BB /* Project object */; @@ -582,6 +1003,20 @@ remoteGlobalIDString = 4FC93C9D1BCD872D0041B820; remoteInfo = audiodevicewatcher; }; + 4FCA05CB27678B330089A5FC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9445CA0319083251002568BB /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4FCA05AF27678B100089A5FC; + remoteInfo = markdown; + }; + 4FCBAFCF23B0D98F007BA1D0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9445CA0319083251002568BB /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4FCBAFC323B0D941007BA1D0; + remoteInfo = math; + }; 4FCC42A61F6B800900485268 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9445CA0319083251002568BB /* Project object */; @@ -729,6 +1164,13 @@ remoteGlobalIDString = 4FDE05E31B734EE600E9E8EE; remoteInfo = caffeinatewatcher; }; + 4FF06126274AA7D900FB15D6 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9445CA0319083251002568BB /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4FF0611A274AA7A200FB15D6; + remoteInfo = camera; + }; 6AE1812F1D36E9A30097211C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9445CA0319083251002568BB /* Project object */; @@ -757,6 +1199,27 @@ remoteGlobalIDString = D61F4A261DCFA67900AEE223; remoteInfo = sharing; }; + D62F9EC92320B90200FAE188 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9445CA0319083251002568BB /* Project object */; + proxyType = 1; + remoteGlobalIDString = D62F9EB12320B82100FAE188; + remoteInfo = bonjour; + }; + D62F9ECB2320B90200FAE188 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9445CA0319083251002568BB /* Project object */; + proxyType = 1; + remoteGlobalIDString = D62F9EBD2320B86300FAE188; + remoteInfo = bonjourservice; + }; + D633A9EE247B9C57005C88E2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9445CA0319083251002568BB /* Project object */; + proxyType = 1; + remoteGlobalIDString = D633A9DF247B9BF2005C88E2; + remoteInfo = axuielement; + }; D64125671BA07D35000FB5F8 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9445CA0319083251002568BB /* Project object */; @@ -883,6 +1346,13 @@ remoteGlobalIDString = D6BB4FBB1C1695EC000DC0A2; remoteInfo = speechlistener; }; + D6C32CD427DDD78F001AA22E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9445CA0319083251002568BB /* Project object */; + proxyType = 1; + remoteGlobalIDString = D6C32CC527DDD47F001AA22E; + remoteInfo = spaces; + }; D6FD56911C04230200BAE238 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9445CA0319083251002568BB /* Project object */; @@ -893,6 +1363,61 @@ /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ + 22451857281ADF8400997BB0 /* Embed App Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + 22451856281ADF8400997BB0 /* CommandPost.appex in Embed App Extensions */, + ); + name = "Embed App Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; + 4FB852372735B02400462DD0 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 4FB852362735B02400462DD0 /* LuaSkin.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + 4FCA05A12767689C0089A5FC /* Copy hsdocs Files */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = extensions/hs/hsdocs; + dstSubfolderSpec = 7; + files = ( + D659EC7429F8468F00A7D103 /* docs.css in Copy hsdocs Files */, + 4FCA05A2276768DE0089A5FC /* init.lua in Copy hsdocs Files */, + 4FCA05A3276768DE0089A5FC /* index.lp in Copy hsdocs Files */, + 4FCA05A4276768DE0089A5FC /* gfm.lp in Copy hsdocs Files */, + 4FCA05A5276768DE0089A5FC /* module.lp in Copy hsdocs Files */, + 4FCA05A6276768DE0089A5FC /* index.md in Copy hsdocs Files */, + 4FCA05A7276768DE0089A5FC /* form.lp in Copy hsdocs Files */, + 4FCA05A8276768DE0089A5FC /* common.lp in Copy hsdocs Files */, + 4FCA05A9276768DE0089A5FC /* sample.lp in Copy hsdocs Files */, + 4FCA05AA276768DE0089A5FC /* search.lp in Copy hsdocs Files */, + ); + name = "Copy hsdocs Files"; + runOnlyForDeploymentPostprocessing = 0; + }; + 4FCA05AB276768EC0089A5FC /* Copy hsdocs minweb Files */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = extensions/hs/hsdocs/hsminweb; + dstSubfolderSpec = 7; + files = ( + 4FCA05AC276769070089A5FC /* templates.md in Copy hsdocs minweb Files */, + 4FCA05AD276769070089A5FC /* index.md in Copy hsdocs minweb Files */, + 4FCA05AE276769070089A5FC /* functions.md in Copy hsdocs minweb Files */, + ); + name = "Copy hsdocs minweb Files"; + runOnlyForDeploymentPostprocessing = 0; + }; 4FD0AC071B74BACD00A82496 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -902,18 +1427,343 @@ ); runOnlyForDeploymentPostprocessing = 1; }; + 4FF7395127344D370007074E /* Copy Extension Dylibs */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = hs; + dstSubfolderSpec = 10; + files = ( + 2274782E2787FA1500DE6894 /* libosc.dylib in Copy Extension Dylibs */, + 22FA062427A1609E0039C37A /* librazer.dylib in Copy Extension Dylibs */, + 226F960F27917DDA003DF60F /* libblackmagic.dylib in Copy Extension Dylibs */, + D6C32CD627DDD811001AA22E /* libspaces.dylib in Copy Extension Dylibs */, + 4FCA05CD27678B410089A5FC /* libmarkdown.dylib in Copy Extension Dylibs */, + 4FF06128274AA7E600FB15D6 /* libcamera.dylib in Copy Extension Dylibs */, + 4FF73A1D2735439B0007074E /* cmdpost in Copy Extension Dylibs */, + 4FF7395227344D740007074E /* libapplication.dylib in Copy Extension Dylibs */, + 4FF7395327344D740007074E /* libapplicationwatcher.dylib in Copy Extension Dylibs */, + 4FF7395427344D740007074E /* libaudiodevice.dylib in Copy Extension Dylibs */, + 4FF7395527344D740007074E /* libbase64.dylib in Copy Extension Dylibs */, + 4FF7395627344D740007074E /* libbattery.dylib in Copy Extension Dylibs */, + 4FF7395727344D740007074E /* libbatterywatcher.dylib in Copy Extension Dylibs */, + 4FF7395827344D740007074E /* libbrightness.dylib in Copy Extension Dylibs */, + 4FF7395927344D740007074E /* libcaffeinate.dylib in Copy Extension Dylibs */, + 4FF7395A27344D740007074E /* libcaffeinatewatcher.dylib in Copy Extension Dylibs */, + 4FF7395B27344D740007074E /* libcrash.dylib in Copy Extension Dylibs */, + 4FF7395C27344D740007074E /* libdockicon.dylib in Copy Extension Dylibs */, + 4FF7395D27344D740007074E /* libfs.dylib in Copy Extension Dylibs */, + 4FF7395E27344D740007074E /* libhash.dylib in Copy Extension Dylibs */, + 4FF7395F27344D740007074E /* libhints.dylib in Copy Extension Dylibs */, + 4FF7396027344D740007074E /* libhost.dylib in Copy Extension Dylibs */, + 4FF7396127344D740007074E /* libhotkey.dylib in Copy Extension Dylibs */, + 4FF7396227344D740007074E /* libhttp.dylib in Copy Extension Dylibs */, + 4FF7396327344D740007074E /* libimage.dylib in Copy Extension Dylibs */, + 4FF7396427344D740007074E /* libjson.dylib in Copy Extension Dylibs */, + 4FF7396527344D740007074E /* liblocation.dylib in Copy Extension Dylibs */, + 4FF7396627344D740007074E /* libmenubar.dylib in Copy Extension Dylibs */, + 4FF7396727344D740007074E /* libmilight.dylib in Copy Extension Dylibs */, + 4FF7396827344D740007074E /* libmouse.dylib in Copy Extension Dylibs */, + 4FF7396927344D740007074E /* libnotify.dylib in Copy Extension Dylibs */, + 4FF7396A27344D740007074E /* libpasteboard.dylib in Copy Extension Dylibs */, + 4FF7396B27344D740007074E /* libpathwatcher.dylib in Copy Extension Dylibs */, + 4FF7396C27344D740007074E /* libscreen.dylib in Copy Extension Dylibs */, + 4FF7396D27344D740007074E /* libscreenwatcher.dylib in Copy Extension Dylibs */, + 4FF7396E27344D740007074E /* libsettings.dylib in Copy Extension Dylibs */, + 4FF7396F27344D740007074E /* libsound.dylib in Copy Extension Dylibs */, + 4FF7397027344D740007074E /* libspaces_watcher.dylib in Copy Extension Dylibs */, + 4FF7397127344D740007074E /* libtimer.dylib in Copy Extension Dylibs */, + 4FF7397227344D740007074E /* libuielement.dylib in Copy Extension Dylibs */, + 4FF7397327344D740007074E /* liburlevent.dylib in Copy Extension Dylibs */, + 4FF7397427344D740007074E /* libusb.dylib in Copy Extension Dylibs */, + 4FF7397527344D740007074E /* libusbwatcher.dylib in Copy Extension Dylibs */, + 4FF7397627344D740007074E /* libwifi.dylib in Copy Extension Dylibs */, + 4FF7397727344D740007074E /* libwifiwatcher.dylib in Copy Extension Dylibs */, + 4FF7397827344D740007074E /* libwindow.dylib in Copy Extension Dylibs */, + 4FF7397927344D740007074E /* libeventtap.dylib in Copy Extension Dylibs */, + 4FF7397A27344D740007074E /* libeventtapevent.dylib in Copy Extension Dylibs */, + 4FF7397B27344D740007074E /* libipc.dylib in Copy Extension Dylibs */, + 4FF7397C27344D740007074E /* libhttpserver.dylib in Copy Extension Dylibs */, + 4FF7397D27344D740007074E /* libkeycodes.dylib in Copy Extension Dylibs */, + 4FF7397E27344D740007074E /* libwebview.dylib in Copy Extension Dylibs */, + 4FF7397F27344D740007074E /* libwebviewusercontent.dylib in Copy Extension Dylibs */, + 4FF7398027344D740007074E /* libaudiodevicewatcher.dylib in Copy Extension Dylibs */, + 4FF7398127344D740007074E /* libdrawing_color.dylib in Copy Extension Dylibs */, + 4FF7398227344D740007074E /* libstyledtext.dylib in Copy Extension Dylibs */, + 4FF7398327344D740007074E /* libtask.dylib in Copy Extension Dylibs */, + 4FF7398427344D740007074E /* libconsole.dylib in Copy Extension Dylibs */, + 4FF7398527344D750007074E /* libspeech.dylib in Copy Extension Dylibs */, + 4FF7398627344D750007074E /* libspeechlistener.dylib in Copy Extension Dylibs */, + 4FF7398727344D750007074E /* libfsvolume.dylib in Copy Extension Dylibs */, + 4FF7398827344D750007074E /* libchooser.dylib in Copy Extension Dylibs */, + 4FF7398927344D750007074E /* libnetworkconfiguration.dylib in Copy Extension Dylibs */, + 4FF7398A27344D750007074E /* libnetworkreachability.dylib in Copy Extension Dylibs */, + 4FF7398B27344D750007074E /* libnetworkhost.dylib in Copy Extension Dylibs */, + 4FF7398C27344D750007074E /* libosascript.dylib in Copy Extension Dylibs */, + 4FF7398D27344D750007074E /* libsocket.dylib in Copy Extension Dylibs */, + 4FF7398E27344D750007074E /* libsocketudp.dylib in Copy Extension Dylibs */, + 4FF7398F27344D750007074E /* libdoc.dylib in Copy Extension Dylibs */, + 4FF7399027344D750007074E /* libdistributednotifications.dylib in Copy Extension Dylibs */, + 4FF7399127344D750007074E /* libwebviewdatastore.dylib in Copy Extension Dylibs */, + 4FF7399227344D750007074E /* libwebviewtoolbar.dylib in Copy Extension Dylibs */, + 4FF7399327344D750007074E /* libnoises.dylib in Copy Extension Dylibs */, + 4FF7399427344D750007074E /* libsharing.dylib in Copy Extension Dylibs */, + 4FF7399527344D750007074E /* libnetworkping.dylib in Copy Extension Dylibs */, + 4FF7399627344D750007074E /* libspotlight.dylib in Copy Extension Dylibs */, + 4FF7399727344D750007074E /* libcanvas.dylib in Copy Extension Dylibs */, + 4FF7399827344D750007074E /* libcanvasmatrix.dylib in Copy Extension Dylibs */, + 4FF7399927344D750007074E /* liblsqlite3.dylib in Copy Extension Dylibs */, + 4FF7399A27344D750007074E /* libhost_locale.dylib in Copy Extension Dylibs */, + 4FF7399B27344D750007074E /* libplist.dylib in Copy Extension Dylibs */, + 4FF7399C27344D750007074E /* libdialog.dylib in Copy Extension Dylibs */, + 4FF7399D27344D750007074E /* libfsxattr.dylib in Copy Extension Dylibs */, + 4FF7399E27344D750007074E /* libstreamdeck.dylib in Copy Extension Dylibs */, + 4FF7399F27344D750007074E /* libmidi.dylib in Copy Extension Dylibs */, + 4FF739A027344D750007074E /* libhid.dylib in Copy Extension Dylibs */, + 4FF739A127344D750007074E /* libbonjour.dylib in Copy Extension Dylibs */, + 4FF739A227344D750007074E /* libbonjourservice.dylib in Copy Extension Dylibs */, + 4FF739A327344D750007074E /* libmath.dylib in Copy Extension Dylibs */, + 4FF739A427344D750007074E /* libwebsocket.dylib in Copy Extension Dylibs */, + 4FF739A527344D750007074E /* libpasteboardwatcher.dylib in Copy Extension Dylibs */, + 4FF739A627344D750007074E /* libuielementwatcher.dylib in Copy Extension Dylibs */, + 4FF739A727344D750007074E /* libserial.dylib in Copy Extension Dylibs */, + 4FF739A827344D750007074E /* libaxuielement.dylib in Copy Extension Dylibs */, + 4FF739A927344D750007074E /* libshortcuts.dylib in Copy Extension Dylibs */, + ); + name = "Copy Extension Dylibs"; + runOnlyForDeploymentPostprocessing = 0; + }; + 4FF739B1273481C90007074E /* Copy Extension Lua files */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = extensions/hs; + dstSubfolderSpec = 7; + files = ( + 22654EAD27D43D1F004F8214 /* razer.lua in Copy Extension Lua files */, + 2274782F2787FA2800DE6894 /* osc.lua in Copy Extension Lua files */, + 226F961027917E06003DF60F /* blackmagic.lua in Copy Extension Lua files */, + 4FCA05A0276767350089A5FC /* window_layout.lua in Copy Extension Lua files */, + 4FF06129274AA7F400FB15D6 /* camera.lua in Copy Extension Lua files */, + 4FF061152747A25C00FB15D6 /* tangent.lua in Copy Extension Lua files */, + 4FF061162747A25C00FB15D6 /* vox.lua in Copy Extension Lua files */, + 4FF061102747050A00FB15D6 /* deezer.lua in Copy Extension Lua files */, + 4FF73A2B27359C2C0007074E /* window_highlight.lua in Copy Extension Lua files */, + 4FF73A2C27359C2C0007074E /* window_tiling.lua in Copy Extension Lua files */, + 4FF73A17273539EE0007074E /* doc.lua in Copy Extension Lua files */, + 4FF73A18273539EE0007074E /* doc_builder.lua in Copy Extension Lua files */, + 4FF73A1A273539EE0007074E /* httpserver.lua in Copy Extension Lua files */, + 4FF73A1B273539EE0007074E /* httpserver_hsminweb.lua in Copy Extension Lua files */, + 4FF73A1C273539EE0007074E /* cgilua_compatibility_functions.lua in Copy Extension Lua files */, + 4FF73A0E27349AE60007074E /* canvas.lua in Copy Extension Lua files */, + 4FF73A0F27349AE60007074E /* canvas_matrix.lua in Copy Extension Lua files */, + 4FF73A1027349AE60007074E /* drawing.lua in Copy Extension Lua files */, + 4FF73A1127349AE60007074E /* drawing_canvasWrapper.lua in Copy Extension Lua files */, + 4FF73A1227349AE60007074E /* drawing_color.lua in Copy Extension Lua files */, + 4FF73A1327349AE60007074E /* host.lua in Copy Extension Lua files */, + 4FF73A1427349AE60007074E /* host_locale.lua in Copy Extension Lua files */, + 4FF73A1527349AE60007074E /* location.lua in Copy Extension Lua files */, + 4FF73A1627349AE60007074E /* location_geocoder.lua in Copy Extension Lua files */, + 4FF739B5273498BA0007074E /* alert.lua in Copy Extension Lua files */, + 4FF739B6273498BA0007074E /* appfinder.lua in Copy Extension Lua files */, + 4FF739B7273498BA0007074E /* applescript.lua in Copy Extension Lua files */, + 4FF739B8273498BA0007074E /* application.lua in Copy Extension Lua files */, + 4FF739B9273498BA0007074E /* audiodevice.lua in Copy Extension Lua files */, + 4FF739BA273498BA0007074E /* axuielement.lua in Copy Extension Lua files */, + 4FF739BB273498BA0007074E /* base64.lua in Copy Extension Lua files */, + 4FF739BC273498BA0007074E /* battery.lua in Copy Extension Lua files */, + 4FF739BD273498BA0007074E /* bonjour.lua in Copy Extension Lua files */, + 4FF739BE273498BA0007074E /* brightness.lua in Copy Extension Lua files */, + 4FF739BF273498BA0007074E /* caffeinate.lua in Copy Extension Lua files */, + 4FF739C0273498BA0007074E /* chooser.lua in Copy Extension Lua files */, + 4FF739C1273498BA0007074E /* console.lua in Copy Extension Lua files */, + 4FF739C2273498BA0007074E /* dialog.lua in Copy Extension Lua files */, + 4FF739C3273498BA0007074E /* distributednotifications.lua in Copy Extension Lua files */, + 4FF739C4273498BA0007074E /* dockicon.lua in Copy Extension Lua files */, + 4FF739C5273498BA0007074E /* eventtap.lua in Copy Extension Lua files */, + 4FF739C6273498BA0007074E /* expose.lua in Copy Extension Lua files */, + 4FF739C7273498BA0007074E /* fnutils.lua in Copy Extension Lua files */, + 4FF739C8273498BA0007074E /* fs.lua in Copy Extension Lua files */, + 4FF739C9273498BA0007074E /* geometry.lua in Copy Extension Lua files */, + 4FF739CA273498BA0007074E /* grid.lua in Copy Extension Lua files */, + 4FF739CB273498BA0007074E /* hash.lua in Copy Extension Lua files */, + 4FF739CC273498BA0007074E /* hid.lua in Copy Extension Lua files */, + 4FF739CD273498BA0007074E /* hints.lua in Copy Extension Lua files */, + 4FF739CE273498BA0007074E /* hotkey.lua in Copy Extension Lua files */, + 4FF739CF273498BA0007074E /* http.lua in Copy Extension Lua files */, + 4FF739D0273498BA0007074E /* image.lua in Copy Extension Lua files */, + 4FF739D1273498BA0007074E /* inspect.lua in Copy Extension Lua files */, + 4FF739D2273498BA0007074E /* ipc.lua in Copy Extension Lua files */, + 4FF739D3273498BA0007074E /* itunes.lua in Copy Extension Lua files */, + 4FF739D4273498BA0007074E /* javascript.lua in Copy Extension Lua files */, + 4FF739D5273498BA0007074E /* json.lua in Copy Extension Lua files */, + 4FF739D6273498BA0007074E /* keycodes.lua in Copy Extension Lua files */, + 4FF739D7273498BA0007074E /* layout.lua in Copy Extension Lua files */, + 4FF739D8273498BA0007074E /* logger.lua in Copy Extension Lua files */, + 4FF739D9273498BA0007074E /* math.lua in Copy Extension Lua files */, + 4FF739DA273498BA0007074E /* menubar.lua in Copy Extension Lua files */, + 4FF739DB273498BA0007074E /* messages.lua in Copy Extension Lua files */, + 4FF739DC273498BA0007074E /* midi.lua in Copy Extension Lua files */, + 4FF739DD273498BA0007074E /* milight.lua in Copy Extension Lua files */, + 4FF739DE273498BA0007074E /* mjomatic.lua in Copy Extension Lua files */, + 4FF739DF273498BA0007074E /* mouse.lua in Copy Extension Lua files */, + 4FF739E0273498BA0007074E /* network.lua in Copy Extension Lua files */, + 4FF739E1273498BA0007074E /* network_configuration.lua in Copy Extension Lua files */, + 4FF739E2273498BA0007074E /* network_host.lua in Copy Extension Lua files */, + 4FF739E3273498BA0007074E /* network_reachability.lua in Copy Extension Lua files */, + 4FF739E4273498BA0007074E /* network_ping.lua in Copy Extension Lua files */, + 4FF739E5273498BA0007074E /* noises.lua in Copy Extension Lua files */, + 4FF739E6273498BA0007074E /* notify.lua in Copy Extension Lua files */, + 4FF739E7273498BA0007074E /* osascript.lua in Copy Extension Lua files */, + 4FF739E8273498BA0007074E /* pasteboard.lua in Copy Extension Lua files */, + 4FF739E9273498BA0007074E /* pathwatcher.lua in Copy Extension Lua files */, + 4FF739EA273498BA0007074E /* plist.lua in Copy Extension Lua files */, + 4FF739EB273498BA0007074E /* redshift.lua in Copy Extension Lua files */, + 4FF739EC273498BA0007074E /* screen.lua in Copy Extension Lua files */, + 4FF739ED273498BA0007074E /* settings.lua in Copy Extension Lua files */, + 4FF739EE273498BA0007074E /* serial.lua in Copy Extension Lua files */, + 4FF739EF273498BA0007074E /* sharing.lua in Copy Extension Lua files */, + 4FF739F0273498BA0007074E /* shortcuts.lua in Copy Extension Lua files */, + 4FF739F1273498BA0007074E /* socket.lua in Copy Extension Lua files */, + 4FF739F2273498BA0007074E /* sound.lua in Copy Extension Lua files */, + 4FF739F3273498BA0007074E /* spaces.lua in Copy Extension Lua files */, + 4FF739F4273498BA0007074E /* speech.lua in Copy Extension Lua files */, + 4FF739F5273498BA0007074E /* spoons.lua in Copy Extension Lua files */, + 4FF739F6273498BA0007074E /* spotify.lua in Copy Extension Lua files */, + 4FF739F7273498BA0007074E /* spotlight.lua in Copy Extension Lua files */, + 4FF739F8273498BA0007074E /* sqlite3.lua in Copy Extension Lua files */, + 4FF739F9273498BA0007074E /* streamdeck.lua in Copy Extension Lua files */, + 4FF739FA273498BA0007074E /* styledtext.lua in Copy Extension Lua files */, + 4FF739FB273498BA0007074E /* tabs.lua in Copy Extension Lua files */, + 4FF739FC273498BA0007074E /* task.lua in Copy Extension Lua files */, + 4FF739FD273498BA0007074E /* timer.lua in Copy Extension Lua files */, + 4FF739FE273498BA0007074E /* uielement.lua in Copy Extension Lua files */, + 4FF739FF273498BA0007074E /* urlevent.lua in Copy Extension Lua files */, + 4FF73A00273498BA0007074E /* usb.lua in Copy Extension Lua files */, + 4FF73A01273498BA0007074E /* utf8.lua in Copy Extension Lua files */, + 4FF73A02273498BA0007074E /* watchable.lua in Copy Extension Lua files */, + 4FF73A03273498BA0007074E /* websocket.lua in Copy Extension Lua files */, + 4FF73A04273498BA0007074E /* webview.lua in Copy Extension Lua files */, + 4FF73A05273498BA0007074E /* webview_toolbar.lua in Copy Extension Lua files */, + 4FF73A06273498BA0007074E /* wifi.lua in Copy Extension Lua files */, + 4FF73A07273498BA0007074E /* window.lua in Copy Extension Lua files */, + 4FF73A08273498BA0007074E /* window_filter.lua in Copy Extension Lua files */, + 4FF73A0A273498BA0007074E /* window_switcher.lua in Copy Extension Lua files */, + 4FF739B327348B2C0007074E /* crash.lua in Copy Extension Lua files */, + 4FF739B2273481EB0007074E /* _coresetup.lua in Copy Extension Lua files */, + ); + name = "Copy Extension Lua files"; + runOnlyForDeploymentPostprocessing = 0; + }; + 4FF73A1E2735449D0007074E /* Copy hs manpage */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = man; + dstSubfolderSpec = 7; + files = ( + 4FF73A1F273544AD0007074E /* cmdpost.man in Copy hs manpage */, + ); + name = "Copy hs manpage"; + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 22613FE41F297B9B00E05E11 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/dialog/internal.m; sourceTree = ""; }; - 22613FE51F297B9B00E05E11 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/dialog/init.lua; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.lua; }; + 220B882927F8F954006C0B2B /* test_image.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = test_image.lua; path = extensions/image/test_image.lua; sourceTree = ""; }; + 220B882B27F8F9A3006C0B2B /* HSimage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HSimage.m; sourceTree = ""; }; + 220E0B1829B07EFA003B0BBD /* HSStreamDeckDevicePedal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSStreamDeckDevicePedal.h; path = extensions/streamdeck/HSStreamDeckDevicePedal.h; sourceTree = ""; }; + 220E0B1929B07EFA003B0BBD /* HSStreamDeckDevicePedal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSStreamDeckDevicePedal.m; path = extensions/streamdeck/HSStreamDeckDevicePedal.m; sourceTree = ""; }; + 2213842A27A105DD0085CA24 /* razer.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = razer.lua; path = extensions/razer/razer.lua; sourceTree = ""; }; + 2213842B27A105DD0085CA24 /* librazer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = librazer.m; path = extensions/razer/librazer.m; sourceTree = ""; }; + 2213842C27A105DD0085CA24 /* HSRazerTartarusV2Device.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSRazerTartarusV2Device.m; path = extensions/razer/HSRazerTartarusV2Device.m; sourceTree = ""; }; + 2213842D27A105DD0085CA24 /* HSRazerManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSRazerManager.m; path = extensions/razer/HSRazerManager.m; sourceTree = ""; }; + 2213842E27A105DD0085CA24 /* HSRazerTartarusV2Device.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSRazerTartarusV2Device.h; path = extensions/razer/HSRazerTartarusV2Device.h; sourceTree = ""; }; + 2213842F27A105DD0085CA24 /* razer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = razer.h; path = extensions/razer/razer.h; sourceTree = ""; }; + 2213843027A105DD0085CA24 /* HSRazerDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSRazerDevice.h; path = extensions/razer/HSRazerDevice.h; sourceTree = ""; }; + 2213843127A105DD0085CA24 /* HSRazerDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSRazerDevice.m; path = extensions/razer/HSRazerDevice.m; sourceTree = ""; }; + 2213843227A105DD0085CA24 /* HSRazerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSRazerManager.h; path = extensions/razer/HSRazerManager.h; sourceTree = ""; }; + 221BCFD32787FFF1000EABD4 /* libF53OSC.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libF53OSC.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 223A9691211F0EFE00596A79 /* cpCache.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = cpCache.icns; sourceTree = ""; }; + 22451848281ADF8400997BB0 /* CommandPost.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = CommandPost.appex; sourceTree = BUILT_PRODUCTS_DIR; }; + 2245184A281ADF8400997BB0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 2245184C281ADF8400997BB0 /* CommandPostViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CommandPostViewController.xib; sourceTree = ""; }; + 2245184E281ADF8400997BB0 /* CommandPost-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CommandPost-Bridging-Header.h"; sourceTree = ""; }; + 2245184F281ADF8400997BB0 /* CommandPostViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CommandPostViewController.h; sourceTree = ""; }; + 22451850281ADF8400997BB0 /* CommandPostViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CommandPostViewController.m; sourceTree = ""; }; + 22451852281ADF8400997BB0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 22451853281ADF8400997BB0 /* CommandPost.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = CommandPost.entitlements; sourceTree = ""; }; + 2248D33C28460E4F00A379E3 /* HSRazerTartarusProDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSRazerTartarusProDevice.h; path = extensions/razer/HSRazerTartarusProDevice.h; sourceTree = ""; }; + 2248D33D28460E4F00A379E3 /* HSRazerTartarusProDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSRazerTartarusProDevice.m; path = extensions/razer/HSRazerTartarusProDevice.m; sourceTree = ""; }; + 2248D34028476C1300A379E3 /* HSRazerTartarusDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSRazerTartarusDevice.m; path = extensions/razer/HSRazerTartarusDevice.m; sourceTree = ""; }; + 2248D34128476C1300A379E3 /* HSRazerTartarusDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSRazerTartarusDevice.h; path = extensions/razer/HSRazerTartarusDevice.h; sourceTree = ""; }; + 224B922C27F6B846003F628E /* HSBlackmagicDeviceKeyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSBlackmagicDeviceKeyboard.h; path = extensions/blackmagic/HSBlackmagicDeviceKeyboard.h; sourceTree = ""; }; + 224B922D27F6B846003F628E /* HSBlackmagicDeviceKeyboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSBlackmagicDeviceKeyboard.m; path = extensions/blackmagic/HSBlackmagicDeviceKeyboard.m; sourceTree = ""; }; + 224B923127F6D326003F628E /* HSBlackmagicDeviceSpeedEditor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSBlackmagicDeviceSpeedEditor.m; path = extensions/blackmagic/HSBlackmagicDeviceSpeedEditor.m; sourceTree = ""; }; + 224B923427F6F5C3003F628E /* HSBlackmagicDeviceSpeedEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSBlackmagicDeviceSpeedEditor.h; path = extensions/blackmagic/HSBlackmagicDeviceSpeedEditor.h; sourceTree = ""; }; + 224BA32523D1E63A00487FDB /* libwebsocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libwebsocket.m; path = extensions/websocket/libwebsocket.m; sourceTree = ""; }; + 224BA33223D1ECA900487FDB /* libwebsocket.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libwebsocket.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 224BA33423D1EE6F00487FDB /* websocket.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = websocket.lua; path = extensions/websocket/websocket.lua; sourceTree = ""; }; + 22613FE41F297B9B00E05E11 /* libdialog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libdialog.m; path = extensions/dialog/libdialog.m; sourceTree = ""; }; + 22613FE51F297B9B00E05E11 /* dialog.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = dialog.lua; path = extensions/dialog/dialog.lua; sourceTree = ""; }; 22613FF11F297E0D00E05E11 /* libdialog.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libdialog.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 22E4D7F71FA7485A00C8CF5C /* internal.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/midi/internal.m; sourceTree = SOURCE_ROOT; }; - 22E4D7F81FA7485A00C8CF5C /* init.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = init.lua; path = extensions/midi/init.lua; sourceTree = SOURCE_ROOT; }; + 22615F32281E3301003ADBC6 /* WorkflowExtension.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = WorkflowExtension.icns; sourceTree = ""; }; + 22627C1D2B3E3A1A0029A2F5 /* GCDAsyncSocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GCDAsyncSocket.m; sourceTree = ""; }; + 22652B37251C38AB000FF14D /* TouchEvents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = TouchEvents.c; path = extensions/eventtap/TouchEvents.c; sourceTree = ""; }; + 22652B38251C38AB000FF14D /* TouchEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TouchEvents.h; path = extensions/eventtap/TouchEvents.h; sourceTree = ""; }; + 22652B3B251C3913000FF14D /* IOHIDEventData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IOHIDEventData.h; path = extensions/eventtap/IOHIDEventData.h; sourceTree = ""; }; + 22652B3C251C3914000FF14D /* IOHIDEventTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IOHIDEventTypes.h; path = extensions/eventtap/IOHIDEventTypes.h; sourceTree = ""; }; + 226BD80C281CE86200294634 /* CocoaAsyncSocket */ = {isa = PBXFileReference; lastKnownFileType = folder; path = CocoaAsyncSocket; sourceTree = ""; }; + 226F95FE27917D3B003DF60F /* libblackmagic.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libblackmagic.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 226F960027917D63003DF60F /* HSBlackmagicManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSBlackmagicManager.m; path = extensions/blackmagic/HSBlackmagicManager.m; sourceTree = ""; }; + 226F960127917D63003DF60F /* libblackmagic.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libblackmagic.m; path = extensions/blackmagic/libblackmagic.m; sourceTree = ""; }; + 226F960227917D63003DF60F /* HSBlackmagicManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSBlackmagicManager.h; path = extensions/blackmagic/HSBlackmagicManager.h; sourceTree = ""; }; + 226F960327917D63003DF60F /* HSBlackmagicDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSBlackmagicDevice.h; path = extensions/blackmagic/HSBlackmagicDevice.h; sourceTree = ""; }; + 226F960427917D63003DF60F /* blackmagic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = blackmagic.h; path = extensions/blackmagic/blackmagic.h; sourceTree = ""; }; + 226F960527917D63003DF60F /* blackmagic.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = blackmagic.lua; path = extensions/blackmagic/blackmagic.lua; sourceTree = ""; }; + 226F960627917D63003DF60F /* HSBlackmagicDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSBlackmagicDevice.m; path = extensions/blackmagic/HSBlackmagicDevice.m; sourceTree = ""; }; + 22738933248606A9003EBC68 /* test_websocket.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = test_websocket.lua; path = extensions/websocket/test_websocket.lua; sourceTree = ""; }; + 22738934248606F0003EBC68 /* HSwebsocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HSwebsocket.m; sourceTree = ""; }; + 2274781B2787F8F800DE6894 /* libosc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libosc.m; path = extensions/osc/libosc.m; sourceTree = ""; }; + 2274781C2787F8F800DE6894 /* osc.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = osc.lua; path = extensions/osc/osc.lua; sourceTree = ""; }; + 227478292787F92E00DE6894 /* libosc.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libosc.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 227C36C126200D4C00224F53 /* cpPlugin.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = cpPlugin.icns; sourceTree = ""; }; + 227C36C326200DBB00224F53 /* cpTourBox.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = cpTourBox.icns; sourceTree = ""; }; + 227C36C426200DBB00224F53 /* cpTouchBar.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = cpTouchBar.icns; sourceTree = ""; }; + 227C36C526200DBB00224F53 /* cpSnippets.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = cpSnippets.icns; sourceTree = ""; }; + 227C36C626200DBB00224F53 /* cpHUD.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = cpHUD.icns; sourceTree = ""; }; + 227C36C726200DBC00224F53 /* cpTangent.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = cpTangent.icns; sourceTree = ""; }; + 227C36C826200DBC00224F53 /* cpLoupedeck.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = cpLoupedeck.icns; sourceTree = ""; }; + 227C36C926200DBC00224F53 /* cpLoupedeckPlus.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = cpLoupedeckPlus.icns; sourceTree = ""; }; + 227C36CA26200DBC00224F53 /* cpLoupedeckCT.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = cpLoupedeckCT.icns; sourceTree = ""; }; + 227C36CB26200DBD00224F53 /* cpShortcuts.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = cpShortcuts.icns; sourceTree = ""; }; + 227C36CC26200DBD00224F53 /* cpPasteboard.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = cpPasteboard.icns; sourceTree = ""; }; + 227C36CD26200DBD00224F53 /* cpMIDI.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = cpMIDI.icns; sourceTree = ""; }; + 227C36CE26200DBD00224F53 /* cpLoupedeckLive.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = cpLoupedeckLive.icns; sourceTree = ""; }; + 227C36CF26200DBE00224F53 /* cpMonogram.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = cpMonogram.icns; sourceTree = ""; }; + 227C36D026200DBE00224F53 /* cpStreamDeck.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = cpStreamDeck.icns; sourceTree = ""; }; + 2290EB1E28011DF100CEA572 /* HSRazerOrbweaverDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSRazerOrbweaverDevice.m; path = extensions/razer/HSRazerOrbweaverDevice.m; sourceTree = ""; }; + 2290EB1F28011DF100CEA572 /* HSRazerOrbweaverDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSRazerOrbweaverDevice.h; path = extensions/razer/HSRazerOrbweaverDevice.h; sourceTree = ""; }; + 22A6625F25FC07F700AA329E /* test_serial.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = test_serial.lua; path = extensions/serial/test_serial.lua; sourceTree = ""; }; + 22A6626125FC087000AA329E /* HSserial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HSserial.m; sourceTree = ""; }; + 22DC4FA6299E140100065BE1 /* HSStreamDeckDevicePlus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSStreamDeckDevicePlus.m; path = extensions/streamdeck/HSStreamDeckDevicePlus.m; sourceTree = ""; }; + 22DC4FA7299E140100065BE1 /* HSStreamDeckDevicePlus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSStreamDeckDevicePlus.h; path = extensions/streamdeck/HSStreamDeckDevicePlus.h; sourceTree = ""; }; + 22DF5D1A23B99C4D00C41AE6 /* libpasteboard_watcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libpasteboard_watcher.m; path = extensions/pasteboard/libpasteboard_watcher.m; sourceTree = ""; }; + 22DF5D2723B9A9D300C41AE6 /* libpasteboardwatcher.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libpasteboardwatcher.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 22E4D7F71FA7485A00C8CF5C /* libmidi.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = libmidi.m; path = extensions/midi/libmidi.m; sourceTree = SOURCE_ROOT; }; + 22E4D7F81FA7485A00C8CF5C /* midi.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = midi.lua; path = extensions/midi/midi.lua; sourceTree = SOURCE_ROOT; }; 22E4D8021FA7488900C8CF5C /* libmidi.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libmidi.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; 22E4D8071FA74BDA00C8CF5C /* libMIKMIDI.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libMIKMIDI.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 4C3D55A91C7F05D00023B633 /* init.lua */ = {isa = PBXFileReference; lastKnownFileType = text; path = init.lua; sourceTree = ""; }; - 4C3D55AA1C7F05D00023B633 /* internal.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = internal.m; sourceTree = ""; }; + 22E59E0D2852D6EF0062292D /* HSRazerNostromoDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSRazerNostromoDevice.h; path = extensions/razer/HSRazerNostromoDevice.h; sourceTree = ""; }; + 22E59E0E2852D6EF0062292D /* HSRazerNostromoDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSRazerNostromoDevice.m; path = extensions/razer/HSRazerNostromoDevice.m; sourceTree = ""; }; + 22E59E112852FD270062292D /* HSRazerOrbweaverChromaDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSRazerOrbweaverChromaDevice.m; path = extensions/razer/HSRazerOrbweaverChromaDevice.m; sourceTree = ""; }; + 22E59E122852FD270062292D /* HSRazerOrbweaverChromaDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSRazerOrbweaverChromaDevice.h; path = extensions/razer/HSRazerOrbweaverChromaDevice.h; sourceTree = ""; }; + 22EEC61724926E2100BAE4DA /* libserial.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = libserial.m; path = extensions/serial/libserial.m; sourceTree = ""; }; + 22EEC61824926E2100BAE4DA /* serial.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = serial.lua; path = extensions/serial/serial.lua; sourceTree = ""; }; + 22EEC62324926E5100BAE4DA /* libserial.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libserial.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 22F223E828AEFB6D00FF081E /* HSRazerTartarusChromaDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSRazerTartarusChromaDevice.h; path = extensions/razer/HSRazerTartarusChromaDevice.h; sourceTree = ""; }; + 22F223E928AEFB6D00FF081E /* HSRazerTartarusChromaDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSRazerTartarusChromaDevice.m; path = extensions/razer/HSRazerTartarusChromaDevice.m; sourceTree = ""; }; + 22F8F64F2F1CE7E40035EC91 /* CommandPost.icon */ = {isa = PBXFileReference; lastKnownFileType = folder.iconcomposer.icon; path = CommandPost.icon; sourceTree = ""; }; + 22FA061B27A160410039C37A /* librazer.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = librazer.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 4C3D55A91C7F05D00023B633 /* osascript.lua */ = {isa = PBXFileReference; lastKnownFileType = text; path = osascript.lua; sourceTree = ""; }; + 4C3D55AA1C7F05D00023B633 /* libosascript.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = libosascript.m; sourceTree = ""; }; 4C3D55AD1C7F05D00023B633 /* test_javascript.lua */ = {isa = PBXFileReference; lastKnownFileType = text; path = test_javascript.lua; sourceTree = ""; }; 4C3D55AE1C7F061D0023B633 /* NSAppleEventDescriptor+Parsing.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSAppleEventDescriptor+Parsing.h"; sourceTree = ""; }; 4C3D55AF1C7F061D0023B633 /* NSAppleEventDescriptor+Parsing.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSAppleEventDescriptor+Parsing.m"; sourceTree = ""; }; @@ -927,30 +1777,36 @@ 4CB349F01C7F74E5006F0DE0 /* test_osascript.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = test_osascript.lua; sourceTree = ""; }; 4CB349F21C7F74EE006F0DE0 /* test_applescript.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = test_applescript.lua; sourceTree = ""; }; 4CBF1C671C91154700B861CE /* libedit.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libedit.tbd; path = usr/lib/libedit.tbd; sourceTree = SDKROOT; }; - 4CD203A11C6D75950089706D /* init.lua */ = {isa = PBXFileReference; lastKnownFileType = text; path = init.lua; sourceTree = ""; }; - 4CD203A21C6D75950089706D /* internal.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = internal.m; sourceTree = ""; }; + 4CD203A11C6D75950089706D /* socket.lua */ = {isa = PBXFileReference; lastKnownFileType = text; path = socket.lua; sourceTree = ""; }; + 4CD203A21C6D75950089706D /* libsocket.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = libsocket.m; sourceTree = ""; }; 4CD203B11C6D76E20089706D /* libsocket.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libsocket.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; 4CD64AA81C6F15F400EB6E39 /* HSsocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HSsocket.m; sourceTree = ""; }; 4CD64AAA1C6F168700EB6E39 /* test_socket.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = test_socket.lua; sourceTree = ""; }; 4CD96BDC1C73ABD2009FF648 /* libsocketudp.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libsocketudp.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4CD96BDD1C73AC1C009FF648 /* udp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = udp.m; path = extensions/socket/udp.m; sourceTree = ""; }; + 4CD96BDD1C73AC1C009FF648 /* libsocket_udp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = libsocket_udp.m; sourceTree = ""; }; 4CE6390E1C76C7F500BB7CD2 /* socket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = socket.h; sourceTree = ""; }; - 4CE639131C772DC700BB7CD2 /* test_udpsocket.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = test_udpsocket.lua; path = extensions/socket/test_udpsocket.lua; sourceTree = ""; }; + 4CE639131C772DC700BB7CD2 /* test_udpsocket.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = test_udpsocket.lua; sourceTree = ""; }; 4CEDEE1B1C640D11005CBF97 /* HSosascript.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HSosascript.m; sourceTree = ""; }; 4F0676041C32AED90088C57C /* HSChooserWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = HSChooserWindow.xib; path = extensions/chooser/HSChooserWindow.xib; sourceTree = ""; }; 4F0676051C32C0B30088C57C /* HSChooserCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSChooserCell.h; path = extensions/chooser/HSChooserCell.h; sourceTree = ""; }; 4F0676061C32C0B30088C57C /* HSChooserCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSChooserCell.m; path = extensions/chooser/HSChooserCell.m; sourceTree = ""; }; + 4F081E7922D69D5600AB87C1 /* Hammerspoon.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Hammerspoon.entitlements; sourceTree = ""; }; + 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Extensions-Base.xcconfig"; sourceTree = ""; }; + 4F0C1C78272F4F28002CA157 /* Project-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Project-Release.xcconfig"; sourceTree = ""; }; + 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Extensions-Ideal.xcconfig"; sourceTree = ""; }; 4F0F08071DC0DAAA00082B73 /* HSChooserRootView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSChooserRootView.h; path = extensions/chooser/HSChooserRootView.h; sourceTree = ""; }; 4F0F08081DC0DAAA00082B73 /* HSChooserRootView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSChooserRootView.m; path = extensions/chooser/HSChooserRootView.m; sourceTree = ""; }; - 4F11989E1FF0412600D279D8 /* switcher.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = switcher.lua; path = extensions/window/switcher.lua; sourceTree = ""; }; + 4F11989E1FF0412600D279D8 /* window_switcher.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = window_switcher.lua; path = extensions/window/window_switcher.lua; sourceTree = ""; }; 4F20B5291C1F1C5B00F52437 /* Hammerspoon UI Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Hammerspoon UI Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 4F20B52B1C1F1C5B00F52437 /* Hammerspoon_UITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Hammerspoon_UITests.m; sourceTree = ""; }; 4F20B52D1C1F1C5B00F52437 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 4F20B5331C1F225300F52437 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = init.lua; sourceTree = ""; }; - 4F29C2311C29D8E400B8A69D /* volume.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = volume.m; path = extensions/fs/volume.m; sourceTree = ""; }; + 4F29C2311C29D8E400B8A69D /* libfs_volume.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libfs_volume.m; path = extensions/fs/libfs_volume.m; sourceTree = ""; }; 4F29C23D1C29E0A300B8A69D /* libfsvolume.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libfsvolume.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F2DF3DD1F6046AD00742D08 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/streamdeck/init.lua; sourceTree = ""; }; - 4F2DF3DE1F6046AD00742D08 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/streamdeck/internal.m; sourceTree = ""; }; + 4F2C0C7121BB49E0008F32C1 /* test_inspect.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = test_inspect.lua; path = extensions/inspect/test_inspect.lua; sourceTree = ""; }; + 4F2C0C7221BB4A03008F32C1 /* HSinspect.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HSinspect.m; sourceTree = ""; }; + 4F2DF3DD1F6046AD00742D08 /* streamdeck.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = streamdeck.lua; path = extensions/streamdeck/streamdeck.lua; sourceTree = ""; }; + 4F2DF3DE1F6046AD00742D08 /* libstreamdeck.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libstreamdeck.m; path = extensions/streamdeck/libstreamdeck.m; sourceTree = ""; }; 4F2DF3EA1F6046F300742D08 /* libstreamdeck.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libstreamdeck.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; 4F2DF3EE1F605A4900742D08 /* HSStreamDeckManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSStreamDeckManager.h; path = extensions/streamdeck/HSStreamDeckManager.h; sourceTree = ""; }; 4F2DF3EF1F605A4900742D08 /* HSStreamDeckManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSStreamDeckManager.m; path = extensions/streamdeck/HSStreamDeckManager.m; sourceTree = ""; }; @@ -959,7 +1815,8 @@ 4F2DF3F61F6170BE00742D08 /* NSImage+BMP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSImage+BMP.h"; path = "extensions/streamdeck/NSImage+BMP.h"; sourceTree = ""; }; 4F2DF3F71F6170BE00742D08 /* NSImage+BMP.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSImage+BMP.m"; path = "extensions/streamdeck/NSImage+BMP.m"; sourceTree = ""; }; 4F2DF3FA1F61AE6700742D08 /* streamdeck.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = streamdeck.h; path = extensions/streamdeck/streamdeck.h; sourceTree = ""; }; - 4F3978831E89AE7200F30F05 /* Spoon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Spoon.icns; sourceTree = ""; }; + 4F30430021D5673A00769310 /* EDSunriseSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EDSunriseSet.h; path = extensions/location/EDSunriseSet.h; sourceTree = ""; }; + 4F30430121D5673A00769310 /* EDSunriseSet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EDSunriseSet.m; path = extensions/location/EDSunriseSet.m; sourceTree = ""; }; 4F3D9D011C3302CB0082E864 /* HSChooser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSChooser.h; path = extensions/chooser/HSChooser.h; sourceTree = ""; }; 4F3D9D021C3302CB0082E864 /* HSChooser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSChooser.m; path = extensions/chooser/HSChooser.m; sourceTree = ""; }; 4F3D9D051C3314570082E864 /* HSChooserWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSChooserWindow.h; path = extensions/chooser/HSChooserWindow.h; sourceTree = ""; }; @@ -969,185 +1826,233 @@ 4F40EC3F1CCD0FE3006342D7 /* HSdistributednotifications.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HSdistributednotifications.m; sourceTree = ""; }; 4F40EC431CCD126F006342D7 /* test_distributednotifications.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = test_distributednotifications.lua; path = extensions/distributednotifications/test_distributednotifications.lua; sourceTree = ""; }; 4F4CB3911B737953000EA9B6 /* libcrash.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libcrash.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F4CB3931B737A5B000EA9B6 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/crash/init.lua; sourceTree = ""; }; - 4F4CB3941B737A5B000EA9B6 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/crash/internal.m; sourceTree = ""; }; + 4F4CB3931B737A5B000EA9B6 /* crash.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = crash.lua; path = extensions/crash/crash.lua; sourceTree = ""; }; + 4F4CB3941B737A5B000EA9B6 /* libcrash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libcrash.m; path = extensions/crash/libcrash.m; sourceTree = ""; }; 4F4CB3A61B7385C5000EA9B6 /* libdockicon.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libdockicon.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F4CB3A81B7385FB000EA9B6 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/dockicon/init.lua; sourceTree = ""; }; - 4F4CB3A91B7385FB000EA9B6 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/dockicon/internal.m; sourceTree = ""; }; - 4F4CB3B71B738769000EA9B6 /* libdrawing.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libdrawing.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F4CB3BB1B7387AA000EA9B6 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/drawing/init.lua; sourceTree = ""; }; - 4F4CB3BC1B7387AA000EA9B6 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/drawing/internal.m; sourceTree = ""; }; - 4F4CB3C11B7388C0000EA9B6 /* init.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = init.lua; path = extensions/fnutils/init.lua; sourceTree = ""; }; + 4F4CB3A81B7385FB000EA9B6 /* dockicon.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = dockicon.lua; path = extensions/dockicon/dockicon.lua; sourceTree = ""; }; + 4F4CB3A91B7385FB000EA9B6 /* libdockicon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libdockicon.m; path = extensions/dockicon/libdockicon.m; sourceTree = ""; }; + 4F4CB3BB1B7387AA000EA9B6 /* drawing.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = drawing.lua; path = extensions/drawing/drawing.lua; sourceTree = ""; }; + 4F4CB3C11B7388C0000EA9B6 /* fnutils.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = fnutils.lua; path = extensions/fnutils/fnutils.lua; sourceTree = ""; }; 4F4CB3CC1B738F1E000EA9B6 /* libfs.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libfs.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F4CB3D01B7391D3000EA9B6 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/fs/init.lua; sourceTree = ""; }; - 4F4CB3D11B7391D3000EA9B6 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/fs/internal.m; sourceTree = ""; }; + 4F4CB3D01B7391D3000EA9B6 /* fs.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = fs.lua; path = extensions/fs/fs.lua; sourceTree = ""; }; + 4F4CB3D11B7391D3000EA9B6 /* libfs.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libfs.m; path = extensions/fs/libfs.m; sourceTree = ""; }; 4F4CB3D21B7391D3000EA9B6 /* lfs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lfs.h; path = extensions/fs/lfs.h; sourceTree = ""; }; - 4F4CB3E41B739A0F000EA9B6 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/geometry/init.lua; sourceTree = ""; }; - 4F4CB3E81B739ABD000EA9B6 /* init.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = init.lua; path = extensions/grid/init.lua; sourceTree = ""; }; + 4F4CB3E41B739A0F000EA9B6 /* geometry.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = geometry.lua; path = extensions/geometry/geometry.lua; sourceTree = ""; }; + 4F4CB3E81B739ABD000EA9B6 /* grid.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = grid.lua; path = extensions/grid/grid.lua; sourceTree = ""; }; 4F4CB3F31B73A3A1000EA9B6 /* libhash.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libhash.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F4CB3F51B73A4EC000EA9B6 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/hash/init.lua; sourceTree = ""; }; - 4F4CB3F61B73A4EC000EA9B6 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/hash/internal.m; sourceTree = ""; }; + 4F4CB3F51B73A4EC000EA9B6 /* hash.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = hash.lua; path = extensions/hash/hash.lua; sourceTree = ""; }; + 4F4CB3F61B73A4EC000EA9B6 /* libhash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libhash.m; path = extensions/hash/libhash.m; sourceTree = ""; }; 4F4CB4051B73A746000EA9B6 /* libhints.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libhints.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F4CB4081B73A784000EA9B6 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/hints/init.lua; sourceTree = ""; }; + 4F4CB4081B73A784000EA9B6 /* hints.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = hints.lua; path = extensions/hints/hints.lua; sourceTree = ""; }; 4F4CB4091B73A784000EA9B6 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/hints/internal.m; sourceTree = ""; }; 4F4CB4171B73AC1D000EA9B6 /* libhost.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libhost.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F4CB4191B73AC48000EA9B6 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/host/init.lua; sourceTree = ""; }; - 4F4CB41A1B73AC48000EA9B6 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/host/internal.m; sourceTree = ""; }; + 4F4CB4191B73AC48000EA9B6 /* host.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = host.lua; path = extensions/host/host.lua; sourceTree = ""; }; + 4F4CB41A1B73AC48000EA9B6 /* libhost.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libhost.m; path = extensions/host/libhost.m; sourceTree = ""; }; 4F4CB4281B73AD0B000EA9B6 /* libhotkey.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libhotkey.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F4CB42C1B73AD47000EA9B6 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/hotkey/init.lua; sourceTree = ""; }; - 4F4CB42D1B73AD47000EA9B6 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/hotkey/internal.m; sourceTree = ""; }; + 4F4CB42C1B73AD47000EA9B6 /* hotkey.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = hotkey.lua; path = extensions/hotkey/hotkey.lua; sourceTree = ""; }; + 4F4CB42D1B73AD47000EA9B6 /* libhotkey.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libhotkey.m; path = extensions/hotkey/libhotkey.m; sourceTree = ""; }; 4F4CB43C1B73AF7E000EA9B6 /* libhttp.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libhttp.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F4CB4421B73AFD2000EA9B6 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/http/init.lua; sourceTree = ""; }; - 4F4CB4431B73AFD2000EA9B6 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/http/internal.m; sourceTree = ""; }; + 4F4CB4421B73AFD2000EA9B6 /* http.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = http.lua; path = extensions/http/http.lua; sourceTree = ""; }; + 4F4CB4431B73AFD2000EA9B6 /* libhttp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libhttp.m; path = extensions/http/libhttp.m; sourceTree = ""; }; 4F4CB4501B73B09C000EA9B6 /* libimage.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libimage.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F4CB4541B73B0D5000EA9B6 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/image/init.lua; sourceTree = ""; }; - 4F4CB4551B73B0D5000EA9B6 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/image/internal.m; sourceTree = ""; }; + 4F4CB4541B73B0D5000EA9B6 /* image.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = image.lua; path = extensions/image/image.lua; sourceTree = ""; }; + 4F4CB4551B73B0D5000EA9B6 /* libimage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libimage.m; path = extensions/image/libimage.m; sourceTree = ""; }; + 4F4F6DA925DB1BB6000187FA /* HSjsonTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HSjsonTests.m; sourceTree = ""; }; + 4F4F6EBE25DB1C7C000187FA /* test_json.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = test_json.lua; path = extensions/json/test_json.lua; sourceTree = ""; }; 4F5050311B97A7B9009E2B14 /* MJAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MJAppDelegate.h; sourceTree = ""; }; - 4F5134501C2EE08F00EFD6D4 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/chooser/init.lua; sourceTree = ""; }; - 4F5134511C2EE08F00EFD6D4 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/chooser/internal.m; sourceTree = ""; }; + 4F5134501C2EE08F00EFD6D4 /* chooser.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = chooser.lua; path = extensions/chooser/chooser.lua; sourceTree = ""; }; + 4F5134511C2EE08F00EFD6D4 /* libchooser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libchooser.m; path = extensions/chooser/libchooser.m; sourceTree = ""; }; 4F51345E1C2F315C00EFD6D4 /* libchooser.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libchooser.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; 4F5134631C30819000EFD6D4 /* chooser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = chooser.h; path = extensions/chooser/chooser.h; sourceTree = ""; }; + 4F55609F279F6A0300B91FD8 /* HSStreamDeckDeviceMk2.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = HSStreamDeckDeviceMk2.h; path = extensions/streamdeck/HSStreamDeckDeviceMk2.h; sourceTree = ""; }; + 4F5560A0279F6A0300B91FD8 /* HSStreamDeckDeviceMk2.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = HSStreamDeckDeviceMk2.m; path = extensions/streamdeck/HSStreamDeckDeviceMk2.m; sourceTree = ""; }; 4F5B6E6A1E9E86BB003FC580 /* CommandPost.sdef */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = CommandPost.sdef; sourceTree = ""; }; 4F5B6E6C1E9E87CE003FC580 /* HSAppleScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HSAppleScript.h; sourceTree = ""; }; 4F5B6E6D1E9E87CE003FC580 /* HSAppleScript.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HSAppleScript.m; sourceTree = ""; }; - 4F64D8BD1B724C4B00FC4C65 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/alert/init.lua; sourceTree = ""; }; - 4F6689E01C2852B500E48AF1 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/_coresetup/init.lua; sourceTree = ""; }; - 4F6689E31C288BAA00E48AF1 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/redshift/init.lua; sourceTree = ""; }; - 4F6B3E9B1B73D60000B2A4DE /* init.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = init.lua; path = extensions/inspect/init.lua; sourceTree = ""; }; - 4F6B3E9D1B73D6A500B2A4DE /* init.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = init.lua; path = extensions/itunes/init.lua; sourceTree = ""; }; + 4F64D8BD1B724C4B00FC4C65 /* alert.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = alert.lua; path = extensions/alert/alert.lua; sourceTree = ""; }; + 4F6653E4238C36F100DEE120 /* HSStreamDeckDeviceOriginal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = HSStreamDeckDeviceOriginal.h; path = extensions/streamdeck/HSStreamDeckDeviceOriginal.h; sourceTree = ""; }; + 4F6653E5238C36F100DEE120 /* HSStreamDeckDeviceOriginal.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = HSStreamDeckDeviceOriginal.m; path = extensions/streamdeck/HSStreamDeckDeviceOriginal.m; sourceTree = ""; }; + 4F6653E8238C6B6600DEE120 /* HSStreamDeckDeviceMini.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = HSStreamDeckDeviceMini.h; path = extensions/streamdeck/HSStreamDeckDeviceMini.h; sourceTree = ""; }; + 4F6653E9238C6B6600DEE120 /* HSStreamDeckDeviceMini.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = HSStreamDeckDeviceMini.m; path = extensions/streamdeck/HSStreamDeckDeviceMini.m; sourceTree = ""; }; + 4F6653EC238C7A1200DEE120 /* NSImage+Rotated.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "NSImage+Rotated.h"; path = "extensions/streamdeck/NSImage+Rotated.h"; sourceTree = ""; }; + 4F6653ED238C7A1200DEE120 /* NSImage+Rotated.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = "NSImage+Rotated.m"; path = "extensions/streamdeck/NSImage+Rotated.m"; sourceTree = ""; }; + 4F6653F0238C7BC600DEE120 /* NSImage+Flipped.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "NSImage+Flipped.h"; path = "extensions/streamdeck/NSImage+Flipped.h"; sourceTree = ""; }; + 4F6653F1238C7BC600DEE120 /* NSImage+Flipped.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = "NSImage+Flipped.m"; path = "extensions/streamdeck/NSImage+Flipped.m"; sourceTree = ""; }; + 4F6653F42390351100DEE120 /* NSImage+JPEG.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "NSImage+JPEG.h"; path = "extensions/streamdeck/NSImage+JPEG.h"; sourceTree = ""; }; + 4F6653F52390351100DEE120 /* NSImage+JPEG.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = "NSImage+JPEG.m"; path = "extensions/streamdeck/NSImage+JPEG.m"; sourceTree = ""; }; + 4F6689E01C2852B500E48AF1 /* _coresetup.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = _coresetup.lua; path = extensions/_coresetup/_coresetup.lua; sourceTree = ""; }; + 4F6689E31C288BAA00E48AF1 /* redshift.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = redshift.lua; path = extensions/redshift/redshift.lua; sourceTree = ""; }; + 4F68B52E227C2DD70076C4F8 /* HSChooserVerticallyCenteringTextFieldCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = HSChooserVerticallyCenteringTextFieldCell.h; path = extensions/chooser/HSChooserVerticallyCenteringTextFieldCell.h; sourceTree = ""; }; + 4F68B52F227C2DD70076C4F8 /* HSChooserVerticallyCenteringTextFieldCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = HSChooserVerticallyCenteringTextFieldCell.m; path = extensions/chooser/HSChooserVerticallyCenteringTextFieldCell.m; sourceTree = ""; }; + 4F6B3E9B1B73D60000B2A4DE /* inspect.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = inspect.lua; path = extensions/inspect/inspect.lua; sourceTree = ""; }; + 4F6B3E9D1B73D6A500B2A4DE /* itunes.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = itunes.lua; path = extensions/itunes/itunes.lua; sourceTree = ""; }; 4F6B3EA81B73D6D300B2A4DE /* libjson.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libjson.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F6B3EAC1B73D79100B2A4DE /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/json/init.lua; sourceTree = ""; }; - 4F6B3EAD1B73D79100B2A4DE /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/json/internal.m; sourceTree = ""; }; - 4F6B3EB01B73DBEA00B2A4DE /* init.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = init.lua; path = extensions/layout/init.lua; sourceTree = ""; }; + 4F6B3EAC1B73D79100B2A4DE /* json.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = json.lua; path = extensions/json/json.lua; sourceTree = ""; }; + 4F6B3EAD1B73D79100B2A4DE /* libjson.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libjson.m; path = extensions/json/libjson.m; sourceTree = ""; }; + 4F6B3EB01B73DBEA00B2A4DE /* layout.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = layout.lua; path = extensions/layout/layout.lua; sourceTree = ""; }; 4F6B3EBB1B73DC4500B2A4DE /* liblocation.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = liblocation.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F6B3EBD1B73DC8400B2A4DE /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/location/init.lua; sourceTree = ""; }; - 4F6B3EBE1B73DC8400B2A4DE /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/location/internal.m; sourceTree = ""; }; - 4F6B3EC71B73E15E00B2A4DE /* init.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = init.lua; path = extensions/logger/init.lua; sourceTree = ""; }; + 4F6B3EBD1B73DC8400B2A4DE /* location.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = location.lua; path = extensions/location/location.lua; sourceTree = ""; }; + 4F6B3EBE1B73DC8400B2A4DE /* liblocation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = liblocation.m; path = extensions/location/liblocation.m; sourceTree = ""; }; + 4F6B3EC71B73E15E00B2A4DE /* logger.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = logger.lua; path = extensions/logger/logger.lua; sourceTree = ""; }; 4F6B3ED21B73E23800B2A4DE /* libmenubar.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libmenubar.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F6B3ED81B73E29300B2A4DE /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/menubar/init.lua; sourceTree = ""; }; - 4F6B3ED91B73E29300B2A4DE /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/menubar/internal.m; sourceTree = ""; }; - 4F6B3EDC1B73E56600B2A4DE /* init.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = init.lua; path = extensions/messages/init.lua; sourceTree = ""; }; + 4F6B3ED81B73E29300B2A4DE /* menubar.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = menubar.lua; path = extensions/menubar/menubar.lua; sourceTree = ""; }; + 4F6B3ED91B73E29300B2A4DE /* libmenubar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libmenubar.m; path = extensions/menubar/libmenubar.m; sourceTree = ""; }; + 4F6B3EDC1B73E56600B2A4DE /* messages.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = messages.lua; path = extensions/messages/messages.lua; sourceTree = ""; }; 4F6B3EE71B73E5AC00B2A4DE /* libmilight.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libmilight.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F6B3EEC1B73E65800B2A4DE /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/milight/init.lua; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.lua; }; - 4F6B3EED1B73E65800B2A4DE /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/milight/internal.m; sourceTree = ""; }; - 4F6B3EF01B73E78900B2A4DE /* init.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = init.lua; path = extensions/mjomatic/init.lua; sourceTree = ""; }; + 4F6B3EEC1B73E65800B2A4DE /* milight.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = milight.lua; path = extensions/milight/milight.lua; sourceTree = ""; }; + 4F6B3EED1B73E65800B2A4DE /* libmilight.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libmilight.m; path = extensions/milight/libmilight.m; sourceTree = ""; }; + 4F6B3EF01B73E78900B2A4DE /* mjomatic.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = mjomatic.lua; path = extensions/mjomatic/mjomatic.lua; sourceTree = ""; }; 4F6B3EFB1B73E7C200B2A4DE /* libmouse.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libmouse.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F6B3EFD1B73E7F000B2A4DE /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/mouse/init.lua; sourceTree = ""; }; - 4F6B3EFE1B73E7F000B2A4DE /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/mouse/internal.m; sourceTree = ""; }; + 4F6B3EFD1B73E7F000B2A4DE /* mouse.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = mouse.lua; path = extensions/mouse/mouse.lua; sourceTree = ""; }; + 4F6B3EFE1B73E7F000B2A4DE /* libmouse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libmouse.m; path = extensions/mouse/libmouse.m; sourceTree = ""; }; 4F6B3F0C1B73E98E00B2A4DE /* libnotify.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libnotify.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F6B3F101B73E9C700B2A4DE /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/notify/init.lua; sourceTree = ""; }; - 4F6B3F111B73E9C700B2A4DE /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/notify/internal.m; sourceTree = ""; }; + 4F6B3F101B73E9C700B2A4DE /* notify.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = notify.lua; path = extensions/notify/notify.lua; sourceTree = ""; }; + 4F6B3F111B73E9C700B2A4DE /* libnotify.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libnotify.m; path = extensions/notify/libnotify.m; sourceTree = ""; }; 4F6B3F211B73EBB500B2A4DE /* libpasteboard.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libpasteboard.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F6B3F251B73EBFD00B2A4DE /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/pasteboard/init.lua; sourceTree = ""; }; - 4F6B3F261B73EBFD00B2A4DE /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/pasteboard/internal.m; sourceTree = ""; }; + 4F6B3F251B73EBFD00B2A4DE /* pasteboard.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = pasteboard.lua; path = extensions/pasteboard/pasteboard.lua; sourceTree = ""; }; + 4F6B3F261B73EBFD00B2A4DE /* libpasteboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libpasteboard.m; path = extensions/pasteboard/libpasteboard.m; sourceTree = ""; }; 4F6B3F321B73EDD100B2A4DE /* libpathwatcher.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libpathwatcher.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F6B3F371B73EE1C00B2A4DE /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/pathwatcher/init.lua; sourceTree = ""; }; - 4F6B3F381B73EE1C00B2A4DE /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/pathwatcher/internal.m; sourceTree = ""; }; + 4F6B3F371B73EE1C00B2A4DE /* pathwatcher.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = pathwatcher.lua; path = extensions/pathwatcher/pathwatcher.lua; sourceTree = ""; }; + 4F6B3F381B73EE1C00B2A4DE /* libpathwatcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libpathwatcher.m; path = extensions/pathwatcher/libpathwatcher.m; sourceTree = ""; }; 4F6B3F441B73EF4B00B2A4DE /* libscreen.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libscreen.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F6B3F481B73EF9A00B2A4DE /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/screen/init.lua; sourceTree = ""; }; - 4F6B3F491B73EF9A00B2A4DE /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/screen/internal.m; sourceTree = ""; }; + 4F6B3F481B73EF9A00B2A4DE /* screen.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = screen.lua; path = extensions/screen/screen.lua; sourceTree = ""; }; + 4F6B3F491B73EF9A00B2A4DE /* libscreen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libscreen.m; path = extensions/screen/libscreen.m; sourceTree = ""; }; 4F6B3F551B73EFC100B2A4DE /* libscreenwatcher.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libscreenwatcher.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F6B3F571B73EFE600B2A4DE /* watcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = watcher.m; path = extensions/screen/watcher.m; sourceTree = ""; }; + 4F6B3F571B73EFE600B2A4DE /* libscreen_watcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libscreen_watcher.m; path = extensions/screen/libscreen_watcher.m; sourceTree = ""; }; 4F6B3F6A1B73F0E300B2A4DE /* libsettings.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libsettings.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F6B3F6E1B73F16700B2A4DE /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/settings/init.lua; sourceTree = ""; }; - 4F6B3F6F1B73F16700B2A4DE /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/settings/internal.m; sourceTree = ""; }; + 4F6B3F6E1B73F16700B2A4DE /* settings.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = settings.lua; path = extensions/settings/settings.lua; sourceTree = ""; }; + 4F6B3F6F1B73F16700B2A4DE /* libsettings.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libsettings.m; path = extensions/settings/libsettings.m; sourceTree = ""; }; 4F6B3F7B1B73F44500B2A4DE /* libsound.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libsound.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F6B3F801B73F49500B2A4DE /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/sound/init.lua; sourceTree = ""; }; - 4F6B3F811B73F49500B2A4DE /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/sound/internal.m; sourceTree = ""; }; - 4F6B3F861B73F86E00B2A4DE /* init.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = init.lua; path = extensions/spotify/init.lua; sourceTree = ""; }; + 4F6B3F801B73F49500B2A4DE /* sound.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = sound.lua; path = extensions/sound/sound.lua; sourceTree = ""; }; + 4F6B3F811B73F49500B2A4DE /* libsound.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libsound.m; path = extensions/sound/libsound.m; sourceTree = ""; }; + 4F6B3F861B73F86E00B2A4DE /* spotify.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = spotify.lua; path = extensions/spotify/spotify.lua; sourceTree = ""; }; 4F6CE1301C6B93A90016668E /* test_timer.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = test_timer.lua; path = extensions/timer/test_timer.lua; sourceTree = ""; }; 4F6CE1331C6B93E10016668E /* HStimer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HStimer.m; sourceTree = ""; }; + 4F6D9E3623075C05006CC3E4 /* Hammerspoon-dev.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Hammerspoon-dev.entitlements"; sourceTree = ""; }; 4F70EED31B726D170025A7B3 /* libaudiodevice.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libaudiodevice.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F70EED51B726D3F0025A7B3 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/audiodevice/init.lua; sourceTree = ""; }; - 4F70EED61B726D3F0025A7B3 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/audiodevice/internal.m; sourceTree = ""; }; + 4F70EED51B726D3F0025A7B3 /* audiodevice.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = audiodevice.lua; path = extensions/audiodevice/audiodevice.lua; sourceTree = ""; }; + 4F70EED61B726D3F0025A7B3 /* libaudiodevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libaudiodevice.m; path = extensions/audiodevice/libaudiodevice.m; sourceTree = ""; }; 4F70EEE91B7273700025A7B3 /* libbase64.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libbase64.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F70EEED1B7273B00025A7B3 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/base64/init.lua; sourceTree = ""; }; - 4F70EEEE1B7273B00025A7B3 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/base64/internal.m; sourceTree = ""; }; - 4F766E571C48F79C007B9D24 /* copy_extensions_to_bundle.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = copy_extensions_to_bundle.sh; path = scripts/copy_extensions_to_bundle.sh; sourceTree = ""; }; - 4F766E581C48F79C007B9D24 /* librelease.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = librelease.sh; path = scripts/librelease.sh; sourceTree = ""; }; - 4F766E591C48F79C007B9D24 /* release.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = release.sh; path = scripts/release.sh; sourceTree = ""; }; + 4F70EEED1B7273B00025A7B3 /* base64.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = base64.lua; path = extensions/base64/base64.lua; sourceTree = ""; }; + 4F70EEEE1B7273B00025A7B3 /* libbase64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libbase64.m; path = extensions/base64/libbase64.m; sourceTree = ""; }; 4F7694541B74C96800536DE4 /* libkeycodes.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libkeycodes.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F7694581B74C9CA00536DE4 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/keycodes/init.lua; sourceTree = ""; }; - 4F7694591B74C9CA00536DE4 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/keycodes/internal.m; sourceTree = ""; }; - 4F85FECB1CCA8A2F00FBBAD7 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/distributednotifications/init.lua; sourceTree = ""; }; - 4F85FECC1CCA8A2F00FBBAD7 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/distributednotifications/internal.m; sourceTree = ""; }; + 4F7694581B74C9CA00536DE4 /* keycodes.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = keycodes.lua; path = extensions/keycodes/keycodes.lua; sourceTree = ""; }; + 4F7694591B74C9CA00536DE4 /* libkeycodes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libkeycodes.m; path = extensions/keycodes/libkeycodes.m; sourceTree = ""; }; + 4F7BB9D326447C390077A926 /* test_hotkey.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = test_hotkey.lua; path = extensions/hotkey/test_hotkey.lua; sourceTree = ""; }; + 4F7BB9D526447C640077A926 /* HShotkey.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HShotkey.m; sourceTree = ""; }; + 4F7F3B5F272AF40E00E05732 /* ShortcutsEvents.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ShortcutsEvents.h; sourceTree = ""; }; + 4F7F3B60272AF57000E05732 /* libshortcuts.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = libshortcuts.m; sourceTree = ""; }; + 4F7F3B61272AF65F00E05732 /* shortcuts.lua */ = {isa = PBXFileReference; lastKnownFileType = text; path = shortcuts.lua; sourceTree = ""; }; + 4F7F3B6C272AF68100E05732 /* libshortcuts.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libshortcuts.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 4F7F3B70272B3E2900E05732 /* Intents.intentdefinition */ = {isa = PBXFileReference; lastKnownFileType = file.intentdefinition; path = Intents.intentdefinition; sourceTree = ""; }; + 4F7F3B75272B3F3700E05732 /* HSExecuteLuaIntentHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HSExecuteLuaIntentHandler.h; sourceTree = ""; }; + 4F7F3B76272B3F3700E05732 /* HSExecuteLuaIntentHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HSExecuteLuaIntentHandler.m; sourceTree = ""; }; + 4F7F3B7A272DE83500E05732 /* Hammerspoon-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Hammerspoon-Debug.xcconfig"; sourceTree = ""; }; + 4F7F3B7B272DE98800E05732 /* Hammerspoon-Profile.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Hammerspoon-Profile.xcconfig"; sourceTree = ""; }; + 4F7F3B7C272DE99200E05732 /* Hammerspoon-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Hammerspoon-Release.xcconfig"; sourceTree = ""; }; + 4F7F3B7D272DE9F800E05732 /* Project-Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Project-Base.xcconfig"; sourceTree = ""; }; + 4F7F3B7E272E009C00E05732 /* Hammerspoon-Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Hammerspoon-Base.xcconfig"; sourceTree = ""; }; + 4F85FECB1CCA8A2F00FBBAD7 /* distributednotifications.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = distributednotifications.lua; path = extensions/distributednotifications/distributednotifications.lua; sourceTree = ""; }; + 4F85FECC1CCA8A2F00FBBAD7 /* libdistributednotifications.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libdistributednotifications.m; path = extensions/distributednotifications/libdistributednotifications.m; sourceTree = ""; }; 4F85FED81CCA918D00FBBAD7 /* libdistributednotifications.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libdistributednotifications.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F8E84301B90EDBF00C25955 /* statusicon.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = statusicon.pdf; sourceTree = ""; }; - 4F9618991E24E5F70048F71D /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/sqlite3/init.lua; sourceTree = ""; }; + 4F8779D0200CD51200E9DB42 /* HSwindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HSwindow.m; sourceTree = ""; }; + 4F8779D2200CD56F00E9DB42 /* test_window.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = test_window.lua; path = extensions/window/test_window.lua; sourceTree = ""; }; + 4F9618991E24E5F70048F71D /* sqlite3.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = sqlite3.lua; path = extensions/sqlite3/sqlite3.lua; sourceTree = ""; }; 4F96189C1E24E5F70048F71D /* lsqlite3.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; name = lsqlite3.c; path = extensions/sqlite3/lsqlite3.c; sourceTree = ""; }; 4F9618A91E24E60C0048F71D /* liblsqlite3.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = liblsqlite3.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; 4F9618AE1E24ED650048F71D /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; }; - 4F9797B51BECD9AD00719F3F /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/task/init.lua; sourceTree = ""; }; - 4F9797B61BECD9AD00719F3F /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/task/internal.m; sourceTree = ""; }; + 4F9797B51BECD9AD00719F3F /* task.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = task.lua; path = extensions/task/task.lua; sourceTree = ""; }; + 4F9797B61BECD9AD00719F3F /* libtask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libtask.m; path = extensions/task/libtask.m; sourceTree = ""; }; 4F9797C31BED0AC800719F3F /* libtask.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libtask.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LuaSkin.framework; path = "../../../Library/Developer/Xcode/DerivedData/Hammerspoon-bcanpjyjcsxqcveiabevaoqikpya/Build/Products/Debug/LuaSkin.framework"; sourceTree = ""; }; - 4F9F02B91B3D9568009C32E5 /* LuaSkin.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LuaSkin.framework; path = build/Hammerspoon/Build/Products/Debug/LuaSkin.framework; sourceTree = ""; }; + 4F9BA8C723DF3C6B006349F2 /* libuielementwatcher.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libuielementwatcher.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 4F9BA8C823DF3CBE006349F2 /* libuielement_watcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libuielement_watcher.m; path = extensions/uielement/libuielement_watcher.m; sourceTree = ""; }; + 4F9BA8D523DFAB03006349F2 /* HSuicore.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HSuicore.h; sourceTree = ""; }; + 4F9BA8D623DFAB03006349F2 /* HSuicore.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HSuicore.m; sourceTree = ""; }; 4FA125872016739500F02FDF /* HSLogger.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HSLogger.m; sourceTree = ""; }; 4FA12589201673E400F02FDF /* HSLogger.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HSLogger.h; sourceTree = ""; }; - 4FB602EE1DDBB0A900FA751B /* layout.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = layout.lua; path = extensions/window/layout.lua; sourceTree = SOURCE_ROOT; }; - 4FBE2CE41B72543C00407788 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/applescript/init.lua; sourceTree = ""; }; + 4FB602EE1DDBB0A900FA751B /* window_layout.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = window_layout.lua; path = extensions/window/window_layout.lua; sourceTree = SOURCE_ROOT; }; + 4FB74B392049A97D00B08851 /* test_task.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = test_task.lua; path = extensions/task/test_task.lua; sourceTree = ""; }; + 4FB74B3A2049A9A600B08851 /* HStask.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HStask.m; sourceTree = ""; }; + 4FB852342735B02400462DD0 /* LuaSkin.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = LuaSkin.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 4FBE2CE41B72543C00407788 /* applescript.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = applescript.lua; path = extensions/applescript/applescript.lua; sourceTree = ""; }; 4FBE2CF91B7261A200407788 /* libapplication.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libapplication.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4FBE2CFB1B7261E500407788 /* application.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = application.h; path = extensions/application/application.h; sourceTree = ""; }; - 4FBE2CFC1B7261E500407788 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/application/init.lua; sourceTree = ""; }; - 4FBE2CFD1B7261E500407788 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/application/internal.m; sourceTree = ""; }; - 4FBE2D041B72630200407788 /* watcher.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = watcher.m; path = extensions/application/watcher.m; sourceTree = ""; }; + 4FBE2CFC1B7261E500407788 /* application.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = application.lua; path = extensions/application/application.lua; sourceTree = ""; }; + 4FBE2CFD1B7261E500407788 /* libapplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libapplication.m; path = extensions/application/libapplication.m; sourceTree = ""; }; + 4FBE2D041B72630200407788 /* libapplication_watcher.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = libapplication_watcher.m; path = extensions/application/libapplication_watcher.m; sourceTree = ""; }; 4FBE2D101B72631600407788 /* libapplicationwatcher.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libapplicationwatcher.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; 4FC09F7B19F99ECE007542A6 /* docs.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; name = docs.json; path = build/docs.json; sourceTree = ""; }; - 4FC93C9B1BCD2D8A0041B820 /* watcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = watcher.m; path = extensions/audiodevice/watcher.m; sourceTree = ""; }; + 4FC93C9B1BCD2D8A0041B820 /* libaudiodevice_watcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libaudiodevice_watcher.m; path = extensions/audiodevice/libaudiodevice_watcher.m; sourceTree = ""; }; 4FC93CA71BCD872D0041B820 /* libaudiodevicewatcher.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libaudiodevicewatcher.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 4FCA05912767645A0089A5FC /* init.lua */ = {isa = PBXFileReference; lastKnownFileType = text; path = init.lua; sourceTree = ""; }; + 4FCA05922767645A0089A5FC /* index.lp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.lex; path = index.lp; sourceTree = ""; }; + 4FCA05932767645A0089A5FC /* gfm.lp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.lex; path = gfm.lp; sourceTree = ""; }; + 4FCA05942767645A0089A5FC /* module.lp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.lex; path = module.lp; sourceTree = ""; }; + 4FCA05952767645A0089A5FC /* index.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = index.md; sourceTree = ""; }; + 4FCA05972767645A0089A5FC /* templates.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = templates.md; sourceTree = ""; }; + 4FCA05982767645A0089A5FC /* index.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = index.md; sourceTree = ""; }; + 4FCA05992767645A0089A5FC /* functions.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = functions.md; sourceTree = ""; }; + 4FCA059A2767645A0089A5FC /* form.lp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.lex; path = form.lp; sourceTree = ""; }; + 4FCA059B2767645A0089A5FC /* common.lp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.lex; path = common.lp; sourceTree = ""; }; + 4FCA059C2767645A0089A5FC /* sample.lp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.lex; path = sample.lp; sourceTree = ""; }; + 4FCA059D2767645A0089A5FC /* search.lp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.lex; path = search.lp; sourceTree = ""; }; + 4FCA05CA27678B100089A5FC /* libmarkdown.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libmarkdown.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 4FCBAFCD23B0D941007BA1D0 /* libmath.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libmath.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 4FCBAFD223B0F7F1007BA1D0 /* libmath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libmath.m; path = extensions/math/libmath.m; sourceTree = ""; }; + 4FCBAFD423B0F805007BA1D0 /* math.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = math.lua; path = extensions/math/math.lua; sourceTree = ""; }; + 4FCBAFD623B0FB95007BA1D0 /* HSmath.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HSmath.m; sourceTree = ""; }; + 4FCBAFD823B0FC04007BA1D0 /* test_math.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = test_math.lua; path = extensions/math/test_math.lua; sourceTree = ""; }; 4FCC52CB1E1526A6007F93D0 /* test_brightness.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = test_brightness.lua; path = extensions/brightness/test_brightness.lua; sourceTree = ""; }; 4FCC52CD1E1527EF007F93D0 /* HSbrightness.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HSbrightness.m; sourceTree = ""; }; - 4FD0AB1D1B7484D700A82496 /* libspaceswatcher.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libspaceswatcher.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4FD0AB211B74856600A82496 /* init.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = init.lua; path = extensions/spaces/init.lua; sourceTree = ""; }; - 4FD0AB231B74857D00A82496 /* watcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = watcher.m; path = extensions/spaces/watcher.m; sourceTree = ""; }; - 4FD0AB291B74863000A82496 /* init.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = init.lua; path = extensions/tabs/init.lua; sourceTree = ""; }; + 4FD0AB1D1B7484D700A82496 /* libspaces_watcher.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libspaces_watcher.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 4FD0AB211B74856600A82496 /* spaces.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = spaces.lua; path = extensions/spaces/spaces.lua; sourceTree = ""; }; + 4FD0AB231B74857D00A82496 /* libspaces_watcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libspaces_watcher.m; path = extensions/spaces/libspaces_watcher.m; sourceTree = ""; }; + 4FD0AB291B74863000A82496 /* tabs.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = tabs.lua; path = extensions/tabs/tabs.lua; sourceTree = ""; }; 4FD0AB341B74867600A82496 /* libtimer.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libtimer.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4FD0AB381B7486B100A82496 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/timer/init.lua; sourceTree = ""; }; - 4FD0AB391B7486B100A82496 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/timer/internal.m; sourceTree = ""; }; + 4FD0AB381B7486B100A82496 /* timer.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = timer.lua; path = extensions/timer/timer.lua; sourceTree = ""; }; + 4FD0AB391B7486B100A82496 /* libtimer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libtimer.m; path = extensions/timer/libtimer.m; sourceTree = ""; }; 4FD0AB461B749C8E00A82496 /* libuielement.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libuielement.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4FD0AB4A1B749CDD00A82496 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/uielement/init.lua; sourceTree = ""; }; - 4FD0AB4B1B749CDD00A82496 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/uielement/internal.m; sourceTree = ""; }; - 4FD0AB4C1B749CDD00A82496 /* uielement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = uielement.h; path = extensions/uielement/uielement.h; sourceTree = ""; }; + 4FD0AB4A1B749CDD00A82496 /* uielement.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = uielement.lua; path = extensions/uielement/uielement.lua; sourceTree = ""; }; + 4FD0AB4B1B749CDD00A82496 /* libuielement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libuielement.m; path = extensions/uielement/libuielement.m; sourceTree = ""; }; 4FD0AB5B1B749D7A00A82496 /* liburlevent.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = liburlevent.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4FD0AB5F1B749DB300A82496 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/urlevent/init.lua; sourceTree = ""; }; - 4FD0AB601B749DB300A82496 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/urlevent/internal.m; sourceTree = ""; }; + 4FD0AB5F1B749DB300A82496 /* urlevent.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = urlevent.lua; path = extensions/urlevent/urlevent.lua; sourceTree = ""; }; + 4FD0AB601B749DB300A82496 /* liburlevent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = liburlevent.m; path = extensions/urlevent/liburlevent.m; sourceTree = ""; }; 4FD0AB6E1B74A67500A82496 /* libusb.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libusb.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; 4FD0AB781B74A68900A82496 /* libusbwatcher.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libusbwatcher.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4FD0AB7E1B74A6E600A82496 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/usb/init.lua; sourceTree = ""; }; - 4FD0AB7F1B74A6E600A82496 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/usb/internal.m; sourceTree = ""; }; - 4FD0AB851B74A73300A82496 /* watcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = watcher.m; path = extensions/usb/watcher.m; sourceTree = ""; }; - 4FD0AB8B1B74AC2300A82496 /* init.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = init.lua; path = extensions/utf8/init.lua; sourceTree = ""; }; + 4FD0AB7E1B74A6E600A82496 /* usb.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = usb.lua; path = extensions/usb/usb.lua; sourceTree = ""; }; + 4FD0AB7F1B74A6E600A82496 /* libusb.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libusb.m; path = extensions/usb/libusb.m; sourceTree = ""; }; + 4FD0AB851B74A73300A82496 /* libusb_watcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libusb_watcher.m; path = extensions/usb/libusb_watcher.m; sourceTree = ""; }; + 4FD0AB8B1B74AC2300A82496 /* utf8.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = utf8.lua; path = extensions/utf8/utf8.lua; sourceTree = ""; }; 4FD0AB961B74AE1900A82496 /* libwifi.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libwifi.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; 4FD0ABA01B74AE2800A82496 /* libwifiwatcher.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libwifiwatcher.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4FD0ABA61B74AE6A00A82496 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/wifi/init.lua; sourceTree = ""; }; - 4FD0ABA71B74AE6A00A82496 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/wifi/internal.m; sourceTree = ""; }; - 4FD0ABAA1B74AE8000A82496 /* watcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = watcher.m; path = extensions/wifi/watcher.m; sourceTree = ""; }; + 4FD0ABA61B74AE6A00A82496 /* wifi.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = wifi.lua; path = extensions/wifi/wifi.lua; sourceTree = ""; }; + 4FD0ABA71B74AE6A00A82496 /* libwifi.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libwifi.m; path = extensions/wifi/libwifi.m; sourceTree = ""; }; + 4FD0ABAA1B74AE8000A82496 /* libwifi_watcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libwifi_watcher.m; path = extensions/wifi/libwifi_watcher.m; sourceTree = ""; }; 4FD0ABBB1B74AF4E00A82496 /* libwindow.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libwindow.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4FD0ABBD1B74AF9900A82496 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/window/init.lua; sourceTree = ""; }; - 4FD0ABBE1B74AF9900A82496 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/window/internal.m; sourceTree = ""; }; - 4FD0ABBF1B74AF9900A82496 /* window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = window.h; path = extensions/window/window.h; sourceTree = ""; }; - 4FD0ABC81B74B0EC00A82496 /* filter.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = filter.lua; path = extensions/window/filter.lua; sourceTree = ""; }; - 4FD0ABCA1B74B1C500A82496 /* init.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = init.lua; path = extensions/doc/init.lua; sourceTree = ""; }; + 4FD0ABBD1B74AF9900A82496 /* window.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = window.lua; path = extensions/window/window.lua; sourceTree = ""; }; + 4FD0ABBE1B74AF9900A82496 /* libwindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libwindow.m; path = extensions/window/libwindow.m; sourceTree = ""; }; + 4FD0ABC81B74B0EC00A82496 /* window_filter.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = window_filter.lua; path = extensions/window/window_filter.lua; sourceTree = ""; }; + 4FD0ABCA1B74B1C500A82496 /* doc.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = doc.lua; path = extensions/doc/doc.lua; sourceTree = ""; }; 4FD0ABCC1B74B1C500A82496 /* makeLuaDocs.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = makeLuaDocs.lua; path = extensions/doc/makeLuaDocs.lua; sourceTree = ""; }; 4FD0ABD71B74B2C500A82496 /* libeventtap.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libeventtap.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; 4FD0ABE11B74B2FA00A82496 /* libeventtapevent.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libeventtapevent.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4FD0ABE31B74B33500A82496 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/eventtap/init.lua; sourceTree = ""; }; - 4FD0ABE41B74B33500A82496 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/eventtap/internal.m; sourceTree = ""; }; + 4FD0ABE31B74B33500A82496 /* eventtap.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = eventtap.lua; path = extensions/eventtap/eventtap.lua; sourceTree = ""; }; + 4FD0ABE41B74B33500A82496 /* libeventtap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libeventtap.m; path = extensions/eventtap/libeventtap.m; sourceTree = ""; }; 4FD0ABE61B74B34500A82496 /* eventtap_event.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = eventtap_event.h; path = extensions/eventtap/eventtap_event.h; sourceTree = ""; }; - 4FD0ABE91B74B36000A82496 /* event.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = event.m; path = extensions/eventtap/event.m; sourceTree = ""; }; + 4FD0ABE91B74B36000A82496 /* libeventtap_event.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libeventtap_event.m; path = extensions/eventtap/libeventtap_event.m; sourceTree = ""; }; 4FD0ABEA1B74B36000A82496 /* eventtap_event.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = eventtap_event.h; path = extensions/eventtap/eventtap_event.h; sourceTree = ""; }; 4FD0ABFE1B74B9DE00A82496 /* libipc.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libipc.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4FD0AC001B74BA1600A82496 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/ipc/init.lua; sourceTree = ""; }; - 4FD0AC011B74BA1600A82496 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/ipc/internal.m; sourceTree = ""; }; - 4FD0AC091B74BACD00A82496 /* hs */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = hs; path = cmdpost; sourceTree = BUILT_PRODUCTS_DIR; }; + 4FD0AC001B74BA1600A82496 /* ipc.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = ipc.lua; path = extensions/ipc/ipc.lua; sourceTree = ""; }; + 4FD0AC011B74BA1600A82496 /* libipc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libipc.m; path = extensions/ipc/libipc.m; sourceTree = ""; }; + 4FD0AC091B74BACD00A82496 /* cmdpost */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = cmdpost; sourceTree = BUILT_PRODUCTS_DIR; }; 4FD0AC121B74BB2300A82496 /* cmdpost.man */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = cmdpost.man; path = extensions/ipc/cli/cmdpost.man; sourceTree = ""; }; 4FD0AC211B74C58800A82496 /* libhttpserver.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libhttpserver.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4FD0AC231B74C62200A82496 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/httpserver/init.lua; sourceTree = ""; }; - 4FD0AC241B74C62200A82496 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/httpserver/internal.m; sourceTree = ""; }; + 4FD0AC231B74C62200A82496 /* httpserver.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = httpserver.lua; path = extensions/httpserver/httpserver.lua; sourceTree = ""; }; + 4FD0AC241B74C62200A82496 /* libhttpserver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libhttpserver.m; path = extensions/httpserver/libhttpserver.m; sourceTree = ""; }; 4FD0AC251B74C62200A82496 /* mkCertTemplate.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = mkCertTemplate.sh; path = extensions/httpserver/mkCertTemplate.sh; sourceTree = ""; }; 4FD0AC261B74C62200A82496 /* MYAnonymousIdentity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MYAnonymousIdentity.h; path = extensions/httpserver/MYAnonymousIdentity.h; sourceTree = ""; }; 4FD0AC271B74C62200A82496 /* MYAnonymousIdentity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MYAnonymousIdentity.m; path = extensions/httpserver/MYAnonymousIdentity.m; sourceTree = ""; }; 4FD0AC281B74C62200A82496 /* openssl.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = openssl.conf; path = extensions/httpserver/openssl.conf; sourceTree = ""; }; + 4FD427CB2621E7F000E8D95F /* update_version_build_numbers.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; name = update_version_build_numbers.sh; path = scripts/update_version_build_numbers.sh; sourceTree = ""; }; 4FDD8E491C6E4FA100085D7A /* test_screen.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = test_screen.lua; path = extensions/screen/test_screen.lua; sourceTree = ""; }; 4FDD8E4B1C6E4FBB00085D7A /* HSscreen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HSscreen.m; sourceTree = ""; }; 4FDD8E4D1C834C8100085D7A /* HSbase64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HSbase64.m; sourceTree = ""; }; @@ -1162,42 +2067,65 @@ 4FDD8E8C1C8C8BF200085D7A /* HScoresetup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HScoresetup.m; sourceTree = ""; }; 4FDD8E8E1C8DED1C00085D7A /* HSappfinder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HSappfinder.m; sourceTree = ""; }; 4FDD8E901C8DEE3600085D7A /* test_appfinder.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = test_appfinder.lua; path = extensions/appfinder/test_appfinder.lua; sourceTree = ""; }; - 4FDD9DC11ED30DA2008F14D3 /* init.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = init.lua; path = extensions/plist/init.lua; sourceTree = ""; }; - 4FDD9DC21ED30DA2008F14D3 /* internal.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/plist/internal.m; sourceTree = ""; }; + 4FDD9DC11ED30DA2008F14D3 /* plist.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = plist.lua; path = extensions/plist/plist.lua; sourceTree = ""; }; + 4FDD9DC21ED30DA2008F14D3 /* libplist.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = libplist.m; path = extensions/plist/libplist.m; sourceTree = ""; }; 4FDD9DCC1ED30DC9008F14D3 /* libplist.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libplist.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; 4FDE059F1B72984C00E9E8EE /* libbattery.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libbattery.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4FDE05A11B72987B00E9E8EE /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/battery/init.lua; sourceTree = ""; }; - 4FDE05A21B72987B00E9E8EE /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/battery/internal.m; sourceTree = ""; }; + 4FDE05A11B72987B00E9E8EE /* battery.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = battery.lua; path = extensions/battery/battery.lua; sourceTree = ""; }; + 4FDE05A21B72987B00E9E8EE /* libbattery.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libbattery.m; path = extensions/battery/libbattery.m; sourceTree = ""; }; 4FDE05AE1B72988C00E9E8EE /* libbatterywatcher.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libbatterywatcher.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4FDE05B01B7298AD00E9E8EE /* watcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = watcher.m; path = extensions/battery/watcher.m; sourceTree = ""; }; + 4FDE05B01B7298AD00E9E8EE /* libbattery_watcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libbattery_watcher.m; path = extensions/battery/libbattery_watcher.m; sourceTree = ""; }; 4FDE05C71B72C22500E9E8EE /* libbrightness.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libbrightness.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4FDE05C91B72C24700E9E8EE /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/brightness/init.lua; sourceTree = ""; }; - 4FDE05CA1B72C24700E9E8EE /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/brightness/internal.m; sourceTree = ""; }; + 4FDE05C91B72C24700E9E8EE /* brightness.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = brightness.lua; path = extensions/brightness/brightness.lua; sourceTree = ""; }; + 4FDE05CA1B72C24700E9E8EE /* libbrightness.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libbrightness.m; path = extensions/brightness/libbrightness.m; sourceTree = ""; }; 4FDE05DC1B734EA600E9E8EE /* libcaffeinate.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libcaffeinate.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4FDE05DE1B734ECC00E9E8EE /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/caffeinate/init.lua; sourceTree = ""; }; - 4FDE05DF1B734ECC00E9E8EE /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/caffeinate/internal.m; sourceTree = ""; }; + 4FDE05DE1B734ECC00E9E8EE /* caffeinate.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = caffeinate.lua; path = extensions/caffeinate/caffeinate.lua; sourceTree = ""; }; + 4FDE05DF1B734ECC00E9E8EE /* libcaffeinate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libcaffeinate.m; path = extensions/caffeinate/libcaffeinate.m; sourceTree = ""; }; 4FDE05EF1B734EE600E9E8EE /* libcaffeinatewatcher.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libcaffeinatewatcher.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 4FDE05F11B734F0100E9E8EE /* watcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = watcher.m; path = extensions/caffeinate/watcher.m; sourceTree = ""; }; - 4FDE05F81B7356A400E9E8EE /* init.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = init.lua; path = extensions/appfinder/init.lua; sourceTree = ""; }; - 4FEA61501F06546200D71839 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/spoons/init.lua; sourceTree = ""; }; - 4FEABA561BC7ABF8005E2CFB /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/expose/init.lua; sourceTree = ""; }; + 4FDE05F11B734F0100E9E8EE /* libcaffeinate_watcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libcaffeinate_watcher.m; path = extensions/caffeinate/libcaffeinate_watcher.m; sourceTree = ""; }; + 4FDE05F81B7356A400E9E8EE /* appfinder.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = appfinder.lua; path = extensions/appfinder/appfinder.lua; sourceTree = ""; }; + 4FE15C1C27D8A5D100D37D27 /* libbuild.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; name = libbuild.sh; path = scripts/libbuild.sh; sourceTree = ""; }; + 4FE15C1D27D8A5D100D37D27 /* build.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; name = build.sh; path = scripts/build.sh; sourceTree = ""; }; + 4FE15C1E27D8A5DD00D37D27 /* build_docs.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; name = build_docs.py; path = scripts/docs/bin/build_docs.py; sourceTree = ""; }; + 4FEA61501F06546200D71839 /* spoons.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = spoons.lua; path = extensions/spoons/spoons.lua; sourceTree = ""; }; + 4FEABA561BC7ABF8005E2CFB /* expose.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = expose.lua; path = extensions/expose/expose.lua; sourceTree = ""; }; 4FEE39D81F0A697400935F90 /* HScrash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HScrash.m; sourceTree = ""; }; 4FEE39DA1F0A69D100935F90 /* test_crash.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = test_crash.lua; path = extensions/crash/test_crash.lua; sourceTree = ""; }; 4FEF4D4E1C5FA01000E3B939 /* HSaudiodevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HSaudiodevice.m; sourceTree = ""; }; 4FEF4D531C5FBA9800E3B939 /* test_audiodevice.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = test_audiodevice.lua; path = extensions/audiodevice/test_audiodevice.lua; sourceTree = ""; }; 4FEF59411B29A352002344A7 /* HSGrowingTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HSGrowingTextField.h; sourceTree = ""; }; 4FEF59421B29A352002344A7 /* HSGrowingTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HSGrowingTextField.m; sourceTree = ""; }; + 4FF0610E274704F700FB15D6 /* deezer.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = deezer.lua; path = extensions/deezer/deezer.lua; sourceTree = ""; }; + 4FF061132747A23700FB15D6 /* tangent.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = tangent.lua; path = extensions/tangent/tangent.lua; sourceTree = ""; }; + 4FF061142747A24600FB15D6 /* vox.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = vox.lua; path = extensions/vox/vox.lua; sourceTree = ""; }; + 4FF06118274AA61000FB15D6 /* camera.lua */ = {isa = PBXFileReference; lastKnownFileType = text; path = camera.lua; sourceTree = ""; }; + 4FF06119274AA62300FB15D6 /* libcamera.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = libcamera.m; sourceTree = ""; }; + 4FF06124274AA7A200FB15D6 /* libcamera.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libcamera.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 4FF73950273448B30007074E /* Archive-Export-Options.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Archive-Export-Options.plist"; sourceTree = ""; }; + 4FF73A212735944D0007074E /* lua.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = lua.json; path = extensions/doc/lua.json; sourceTree = ""; }; + 4FF73A24273595340007074E /* timeout3 */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; name = timeout3; path = extensions/httpserver/timeout3; sourceTree = ""; }; + 4FF73A2727359BD20007074E /* window_tiling.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = window_tiling.lua; path = extensions/window/window_tiling.lua; sourceTree = ""; }; + 4FF73A2A27359C0E0007074E /* window_highlight.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = window_highlight.lua; path = extensions/window/window_highlight.lua; sourceTree = ""; }; + 4FF73AA4273A85820007074E /* hs.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = hs.xcconfig; sourceTree = ""; }; + 4FF73AA5273AAE290007074E /* Hammerspoon-Test.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Hammerspoon-Test.xcconfig"; sourceTree = ""; }; + 4FFB20FA23C5E01300811E77 /* HSStreamDeckDeviceXL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = HSStreamDeckDeviceXL.h; path = extensions/streamdeck/HSStreamDeckDeviceXL.h; sourceTree = ""; }; + 4FFB20FB23C5E01300811E77 /* HSStreamDeckDeviceXL.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = HSStreamDeckDeviceXL.m; path = extensions/streamdeck/HSStreamDeckDeviceXL.m; sourceTree = ""; }; + 4FFB20FE23CD14A400811E77 /* HSStreamDeckDeviceOriginalV2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HSStreamDeckDeviceOriginalV2.h; path = extensions/streamdeck/HSStreamDeckDeviceOriginalV2.h; sourceTree = ""; }; + 4FFB20FF23CD14A400811E77 /* HSStreamDeckDeviceOriginalV2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HSStreamDeckDeviceOriginalV2.m; path = extensions/streamdeck/HSStreamDeckDeviceOriginalV2.m; sourceTree = ""; }; + 4FFF9FB425D89B3B00D2997C /* HSmouse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HSmouse.m; sourceTree = ""; }; + 4FFFA01125D89BAF00D2997C /* test_mouse.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = test_mouse.lua; path = extensions/mouse/test_mouse.lua; sourceTree = ""; }; 5BC78AF8FE9DA0BD317A7528 /* libPods-Hammerspoon.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Hammerspoon.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 6AE181161D36E8E50097211C /* detectors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = detectors.cpp; path = extensions/noises/detectors.cpp; sourceTree = ""; }; 6AE181171D36E8E50097211C /* detectors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = detectors.h; path = extensions/noises/detectors.h; sourceTree = ""; }; - 6AE181181D36E8E50097211C /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/noises/init.lua; sourceTree = ""; }; - 6AE181191D36E8E50097211C /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/noises/internal.m; sourceTree = ""; }; + 6AE181181D36E8E50097211C /* noises.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = noises.lua; path = extensions/noises/noises.lua; sourceTree = ""; }; + 6AE181191D36E8E50097211C /* libnoises.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libnoises.m; path = extensions/noises/libnoises.m; sourceTree = ""; }; 6AE1811A1D36E8E50097211C /* popTemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = popTemplate.h; path = extensions/noises/popTemplate.h; sourceTree = ""; }; 6AE181271D36E90B0097211C /* libnoises.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libnoises.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; 6AE1812B1D36E9600097211C /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; 6AE1812D1D36E96A0097211C /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; 6AE181311D39C8F10097211C /* HSnoises.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HSnoises.m; sourceTree = ""; }; 6AE181331D39C9570097211C /* test_noises.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = test_noises.lua; path = extensions/noises/test_noises.lua; sourceTree = ""; }; + 75E2C8065BA22C7EA133713A /* Pods-Hammerspoon.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Hammerspoon.profile.xcconfig"; path = "Pods/Target Support Files/Pods-Hammerspoon/Pods-Hammerspoon.profile.xcconfig"; sourceTree = ""; }; 867B086413FD65986CB40932 /* Pods-Hammerspoon.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Hammerspoon.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Hammerspoon/Pods-Hammerspoon.debug.xcconfig"; sourceTree = ""; }; 9409202F19A5940600B9964E /* MJVersionUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJVersionUtils.h; sourceTree = ""; }; 9409203019A5940600B9964E /* MJVersionUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJVersionUtils.m; sourceTree = ""; }; @@ -1216,7 +2144,6 @@ 944A2D341989735300D8DC90 /* MJAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJAppDelegate.m; sourceTree = ""; }; 944A2D351989735300D8DC90 /* MainMenu.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainMenu.xib; sourceTree = ""; }; 944A2D3D1989737E00D8DC90 /* Credits.rtf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.rtf; path = Credits.rtf; sourceTree = ""; }; - 944A2D3F1989737E00D8DC90 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 944A2D401989737E00D8DC90 /* CommandPost-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "CommandPost-Info.plist"; sourceTree = ""; }; 944A2D411989737E00D8DC90 /* Hammerspoon-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Hammerspoon-Prefix.pch"; sourceTree = ""; }; 944A2DA81989760400D8DC90 /* MJConsoleWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJConsoleWindowController.m; sourceTree = ""; }; @@ -1232,29 +2159,37 @@ 949CDBFF1990759B00906CCE /* ConsoleWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ConsoleWindow.xib; sourceTree = ""; }; 94A1E5461993AC5C003AEB26 /* MJFileUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJFileUtils.h; sourceTree = ""; }; 94A1E5471993AC5C003AEB26 /* MJFileUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJFileUtils.m; sourceTree = ""; }; - B8524F24201A875600844F3D /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/hid/init.lua; sourceTree = ""; }; - B8524F25201A875600844F3D /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/hid/internal.m; sourceTree = ""; }; + B8524F24201A875600844F3D /* hid.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = hid.lua; path = extensions/hid/hid.lua; sourceTree = ""; }; + B8524F25201A875600844F3D /* libhid.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libhid.m; path = extensions/hid/libhid.m; sourceTree = ""; }; B8524F31201A88CD00844F3D /* libhid.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libhid.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + CE139CAF28B24B6500743C90 /* HShttp.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HShttp.m; sourceTree = ""; }; + CE139CB228B2539500743C90 /* test_http.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = test_http.lua; path = extensions/http/test_http.lua; sourceTree = ""; }; D02F95241A00221C00E28BB2 /* Hammerspoon Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Hammerspoon Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; D02F95271A00221C00E28BB2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; D02F95281A00221C00E28BB2 /* HSrequire_all.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HSrequire_all.m; sourceTree = ""; }; D077B5BE1A001B5300369B30 /* variables.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = variables.m; sourceTree = ""; }; D61F4A2F1DCFA67900AEE223 /* libsharing.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libsharing.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - D61F4A301DCFA6C600AEE223 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/sharing/init.lua; sourceTree = ""; }; - D61F4A311DCFA6C600AEE223 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/sharing/internal.m; sourceTree = ""; }; - D63FBD911D1CFB4E005255DD /* toolbar_internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = toolbar_internal.m; path = extensions/webview/toolbar_internal.m; sourceTree = ""; }; - D63FBD921D1CFB4E005255DD /* toolbar.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = toolbar.lua; path = extensions/webview/toolbar.lua; sourceTree = ""; }; - D64125581BA07CDE000FB5F8 /* init.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = init.lua; path = extensions/webview/init.lua; sourceTree = ""; }; - D64125591BA07CDE000FB5F8 /* internal.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/webview/internal.m; sourceTree = ""; }; + D61F4A301DCFA6C600AEE223 /* sharing.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = sharing.lua; path = extensions/sharing/sharing.lua; sourceTree = ""; }; + D61F4A311DCFA6C600AEE223 /* libsharing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libsharing.m; path = extensions/sharing/libsharing.m; sourceTree = ""; }; + D62F9EAB2320B81500FAE188 /* bonjour.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = bonjour.lua; path = extensions/bonjour/bonjour.lua; sourceTree = ""; }; + D62F9EAC2320B81500FAE188 /* libbonjour_service.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libbonjour_service.m; path = extensions/bonjour/libbonjour_service.m; sourceTree = ""; }; + D62F9EAD2320B81500FAE188 /* libbonjoir.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libbonjoir.m; path = extensions/bonjour/libbonjoir.m; sourceTree = ""; }; + D62F9EBB2320B82100FAE188 /* libbonjour.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libbonjour.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + D62F9EC72320B86300FAE188 /* libbonjourservice.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libbonjourservice.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + D633A9E9247B9BF2005C88E2 /* libaxuielement.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libaxuielement.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + D63FBD911D1CFB4E005255DD /* libwebview_toolbar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libwebview_toolbar.m; path = extensions/webview/libwebview_toolbar.m; sourceTree = ""; }; + D63FBD921D1CFB4E005255DD /* webview_toolbar.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = webview_toolbar.lua; path = extensions/webview/webview_toolbar.lua; sourceTree = ""; }; + D64125581BA07CDE000FB5F8 /* webview.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = webview.lua; path = extensions/webview/webview.lua; sourceTree = ""; }; + D64125591BA07CDE000FB5F8 /* libwebview.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = libwebview.m; path = extensions/webview/libwebview.m; sourceTree = ""; }; D64125641BA07CEA000FB5F8 /* libwebview.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libwebview.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - D64208941BE3CDEB00673724 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/javascript/init.lua; sourceTree = ""; }; - D6477BFC1C5ED5A600F67BBC /* configuration.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = configuration.lua; path = extensions/network/configuration.lua; sourceTree = ""; }; - D6477BFD1C5ED5A600F67BBC /* configurationinternal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = configurationinternal.m; path = extensions/network/configurationinternal.m; sourceTree = ""; }; - D6477BFE1C5ED5A600F67BBC /* host.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = host.lua; path = extensions/network/host.lua; sourceTree = ""; }; - D6477BFF1C5ED5A600F67BBC /* hostinternal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = hostinternal.m; path = extensions/network/hostinternal.m; sourceTree = ""; }; - D6477C001C5ED5A600F67BBC /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/network/init.lua; sourceTree = ""; }; - D6477C011C5ED5A600F67BBC /* reachability.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = reachability.lua; path = extensions/network/reachability.lua; sourceTree = ""; }; - D6477C021C5ED5A600F67BBC /* reachabilityinternal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = reachabilityinternal.m; path = extensions/network/reachabilityinternal.m; sourceTree = ""; }; + D64208941BE3CDEB00673724 /* javascript.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = javascript.lua; path = extensions/javascript/javascript.lua; sourceTree = ""; }; + D6477BFC1C5ED5A600F67BBC /* network_configuration.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = network_configuration.lua; path = extensions/network/network_configuration.lua; sourceTree = ""; }; + D6477BFD1C5ED5A600F67BBC /* libnetwork_configuration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libnetwork_configuration.m; path = extensions/network/libnetwork_configuration.m; sourceTree = ""; }; + D6477BFE1C5ED5A600F67BBC /* network_host.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = network_host.lua; path = extensions/network/network_host.lua; sourceTree = ""; }; + D6477BFF1C5ED5A600F67BBC /* libnetwork_host.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libnetwork_host.m; path = extensions/network/libnetwork_host.m; sourceTree = ""; }; + D6477C001C5ED5A600F67BBC /* network.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = network.lua; path = extensions/network/network.lua; sourceTree = ""; }; + D6477C011C5ED5A600F67BBC /* network_reachability.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = network_reachability.lua; path = extensions/network/network_reachability.lua; sourceTree = ""; }; + D6477C021C5ED5A600F67BBC /* libnetwork_reachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libnetwork_reachability.m; path = extensions/network/libnetwork_reachability.m; sourceTree = ""; }; D6477C141C5ED5D000F67BBC /* libnetworkconfiguration.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libnetworkconfiguration.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; D6477C2C1C5ED82200F67BBC /* libnetworkreachability.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libnetworkreachability.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; D6477C3B1C5ED83C00F67BBC /* libnetworkhost.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libnetworkhost.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1277,70 +2212,122 @@ D64964701CCB32AE0074540B /* stack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stack.h; path = extensions/doc/stack.h; sourceTree = ""; }; D64964831CCB32C70074540B /* libdoc.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libdoc.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; D64B03361BA9541E0006C468 /* webview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = webview.h; path = extensions/webview/webview.h; sourceTree = ""; }; - D64B03381BA954660006C468 /* usercontent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = usercontent.m; path = extensions/webview/usercontent.m; sourceTree = ""; }; + D64B03381BA954660006C468 /* libwebview_usercontent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libwebview_usercontent.m; path = extensions/webview/libwebview_usercontent.m; sourceTree = ""; }; D64B03461BA954780006C468 /* libwebviewusercontent.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libwebviewusercontent.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - D66B763A1DD6FD1400CA12E6 /* geocoder.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = geocoder.lua; path = extensions/location/geocoder.lua; sourceTree = ""; }; - D67F1B3C1EA9D65E00FEB411 /* builder.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = builder.lua; path = extensions/doc/builder.lua; sourceTree = ""; }; - D684BBFB1DFB72BD00B4D0B8 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/watchable/init.lua; sourceTree = ""; }; + D659EC7329F8468F00A7D103 /* docs.css */ = {isa = PBXFileReference; lastKnownFileType = text.css; name = docs.css; path = scripts/docs/templates/docs.css; sourceTree = ""; }; + D66B763A1DD6FD1400CA12E6 /* location_geocoder.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = location_geocoder.lua; path = extensions/location/location_geocoder.lua; sourceTree = ""; }; + D67F1B3C1EA9D65E00FEB411 /* doc_builder.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = doc_builder.lua; path = extensions/doc/doc_builder.lua; sourceTree = ""; }; + D684BBFB1DFB72BD00B4D0B8 /* watchable.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = watchable.lua; path = extensions/watchable/watchable.lua; sourceTree = ""; }; D68615F31E04D5990058A4F2 /* Canvas.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Canvas.h; path = extensions/canvas/Canvas.h; sourceTree = ""; }; D68615F41E04D5990058A4F2 /* imageAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = imageAdditions.m; path = extensions/canvas/imageAdditions.m; sourceTree = ""; }; - D68615F51E04D5990058A4F2 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/canvas/init.lua; sourceTree = ""; }; - D68615F61E04D5990058A4F2 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/canvas/internal.m; sourceTree = ""; }; - D68615F71E04D5990058A4F2 /* matrix_internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = matrix_internal.m; path = extensions/canvas/matrix_internal.m; sourceTree = ""; }; - D68615F81E04D5990058A4F2 /* matrix.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = matrix.lua; path = extensions/canvas/matrix.lua; sourceTree = ""; }; + D68615F51E04D5990058A4F2 /* canvas.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = canvas.lua; path = extensions/canvas/canvas.lua; sourceTree = ""; }; + D68615F61E04D5990058A4F2 /* libcanvas.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libcanvas.m; path = extensions/canvas/libcanvas.m; sourceTree = ""; }; + D68615F71E04D5990058A4F2 /* libcanvas_matrix.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libcanvas_matrix.m; path = extensions/canvas/libcanvas_matrix.m; sourceTree = ""; }; + D68615F81E04D5990058A4F2 /* canvas_matrix.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = canvas_matrix.lua; path = extensions/canvas/canvas_matrix.lua; sourceTree = ""; }; D68616071E04D5D20058A4F2 /* libcanvas.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libcanvas.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; D68616161E04D6630058A4F2 /* libcanvasmatrix.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libcanvasmatrix.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - D68CE61B1E9C44E200912154 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/host/locale/init.lua; sourceTree = ""; }; - D68CE61C1E9C44E200912154 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/host/locale/internal.m; sourceTree = ""; }; + D687FC38247B9316005FA3A5 /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = common.h; path = extensions/axuielement/common.h; sourceTree = SOURCE_ROOT; }; + D687FC39247B9317005FA3A5 /* libaxuielement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libaxuielement.m; path = extensions/axuielement/libaxuielement.m; sourceTree = SOURCE_ROOT; }; + D687FC3A247B9317005FA3A5 /* axuielement.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = axuielement.lua; path = extensions/axuielement/axuielement.lua; sourceTree = SOURCE_ROOT; }; + D687FC3B247B9317005FA3A5 /* observer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = observer.m; path = extensions/axuielement/observer.m; sourceTree = SOURCE_ROOT; }; + D687FC3C247B9317005FA3A5 /* common.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = common.m; path = extensions/axuielement/common.m; sourceTree = SOURCE_ROOT; }; + D68CE61B1E9C44E200912154 /* host_locale.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = host_locale.lua; path = extensions/host/locale/host_locale.lua; sourceTree = ""; }; + D68CE61C1E9C44E200912154 /* libhost_locale.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libhost_locale.m; path = extensions/host/locale/libhost_locale.m; sourceTree = ""; }; D68CE6281E9C450E00912154 /* libhost_locale.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libhost_locale.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; D6943FDE1EDBF1DE0057BB26 /* cmdpost.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = cmdpost.m; path = extensions/ipc/cli/cmdpost.m; sourceTree = ""; }; D6943FE11EDBF2510057BB26 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; D6943FE21EDBF2510057BB26 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - D6A212E61DE38F3B00998C0B /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/spotlight/init.lua; sourceTree = ""; }; - D6A212E71DE38F3B00998C0B /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/spotlight/internal.m; sourceTree = ""; }; + D6A212E61DE38F3B00998C0B /* spotlight.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = spotlight.lua; path = extensions/spotlight/spotlight.lua; sourceTree = ""; }; + D6A212E71DE38F3B00998C0B /* libspotlight.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libspotlight.m; path = extensions/spotlight/libspotlight.m; sourceTree = ""; }; D6A212F31DE38F5F00998C0B /* libspotlight.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libspotlight.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - D6A3189A1DDD830A00D9B328 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/network/ping/init.lua; sourceTree = ""; }; - D6A3189B1DDD830A00D9B328 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/network/ping/internal.m; sourceTree = ""; }; + D6A3189A1DDD830A00D9B328 /* network_ping.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = network_ping.lua; path = extensions/network/ping/network_ping.lua; sourceTree = ""; }; + D6A3189B1DDD830A00D9B328 /* libnetwork_ping.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libnetwork_ping.m; path = extensions/network/ping/libnetwork_ping.m; sourceTree = ""; }; D6A3189C1DDD830A00D9B328 /* SimplePing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SimplePing.h; path = extensions/network/ping/SimplePing.h; sourceTree = ""; }; D6A3189D1DDD830A00D9B328 /* SimplePing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SimplePing.m; path = extensions/network/ping/SimplePing.m; sourceTree = ""; }; D6A318AA1DDD833100D9B328 /* libnetworkping.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libnetworkping.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + D6A6C10D2A05F3500018FC9B /* byte_order.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = byte_order.h; path = extensions/hash/byte_order.h; sourceTree = ""; }; + D6A6C10E2A05F3500018FC9B /* sha3.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = sha3.m; path = extensions/hash/sha3.m; sourceTree = ""; }; + D6A6C10F2A05F3500018FC9B /* sha3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sha3.h; path = extensions/hash/sha3.h; sourceTree = ""; }; + D6A6C1102A05F3500018FC9B /* algorithms.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = algorithms.m; path = extensions/hash/algorithms.m; sourceTree = ""; }; + D6A6C1112A05F3500018FC9B /* algorithms.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = algorithms.h; path = extensions/hash/algorithms.h; sourceTree = ""; }; D6B772981CCB544B00908A59 /* cgilua_compatibility_functions.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = cgilua_compatibility_functions.lua; path = extensions/httpserver/cgilua_compatibility_functions.lua; sourceTree = ""; }; - D6B772991CCB544B00908A59 /* hsminweb.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = hsminweb.lua; path = extensions/httpserver/hsminweb.lua; sourceTree = ""; }; - D6B946431D139C4900177E0C /* datastore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = datastore.m; path = extensions/webview/datastore.m; sourceTree = ""; }; + D6B772991CCB544B00908A59 /* httpserver_hsminweb.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = httpserver_hsminweb.lua; path = extensions/httpserver/httpserver_hsminweb.lua; sourceTree = ""; }; + D6B946431D139C4900177E0C /* libwebview_datastore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libwebview_datastore.m; path = extensions/webview/libwebview_datastore.m; sourceTree = ""; }; D6B946521D139C7D00177E0C /* libwebviewdatastore.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libwebviewdatastore.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; D6B9465E1D139CC500177E0C /* libwebviewtoolbar.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libwebviewtoolbar.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - D6BB4FA71C169539000DC0A2 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/speech/init.lua; sourceTree = ""; }; - D6BB4FA81C169539000DC0A2 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/speech/internal.m; sourceTree = ""; }; - D6BB4FA91C169539000DC0A2 /* listener.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = listener.m; path = extensions/speech/listener.m; sourceTree = ""; }; + D6BACEA923178EC900110E1E /* libdoc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libdoc.m; path = extensions/doc/libdoc.m; sourceTree = ""; }; + D6BB4FA71C169539000DC0A2 /* speech.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = speech.lua; path = extensions/speech/speech.lua; sourceTree = ""; }; + D6BB4FA81C169539000DC0A2 /* libspeech.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libspeech.m; path = extensions/speech/libspeech.m; sourceTree = ""; }; + D6BB4FA91C169539000DC0A2 /* libspeech_listener.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libspeech_listener.m; path = extensions/speech/libspeech_listener.m; sourceTree = ""; }; D6BB4FB91C16959C000DC0A2 /* libspeech.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libspeech.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; D6BB4FC71C1695EC000DC0A2 /* libspeechlistener.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libspeechlistener.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - D6BCFD1E1EA9E23B00F6D731 /* spoonsupport.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = spoonsupport.lua; path = extensions/doc/spoonsupport.lua; sourceTree = ""; }; - D6E071681E04D9FC00C1046A /* canvasWrapper.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = canvasWrapper.lua; path = extensions/drawing/canvasWrapper.lua; sourceTree = ""; }; - D6E164D11F4C25FD00B85D8A /* xattr.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = xattr.m; path = extensions/fs/xattr.m; sourceTree = ""; }; + D6C32CCF27DDD47F001AA22E /* libspaces.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libspaces.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + D6C32CD027DDD68E001AA22E /* libspaces.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libspaces.m; path = extensions/spaces/libspaces.m; sourceTree = ""; }; + D6C32CD127DDD68E001AA22E /* private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = private.h; path = extensions/spaces/private.h; sourceTree = ""; }; + D6E071681E04D9FC00C1046A /* drawing_canvasWrapper.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = drawing_canvasWrapper.lua; path = extensions/drawing/drawing_canvasWrapper.lua; sourceTree = ""; }; + D6E164D11F4C25FD00B85D8A /* libfs_xattr.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libfs_xattr.m; path = extensions/fs/libfs_xattr.m; sourceTree = ""; }; D6E164DC1F4C262300B85D8A /* libfsxattr.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libfsxattr.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - D6F310CC1BDF0DCC00045CCD /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/drawing/color/init.lua; sourceTree = ""; }; - D6F310CD1BDF0DCC00045CCD /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/drawing/color/internal.m; sourceTree = ""; }; - D6F310D01BDF0E0000045CCD /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/styledtext/init.lua; sourceTree = ""; }; - D6F310D11BDF0E0000045CCD /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/styledtext/internal.m; sourceTree = ""; }; + D6EE7C7D249B488B0053FB3A /* ExternalReferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ExternalReferences.h; path = extensions/axuielement/ExternalReferences.h; sourceTree = SOURCE_ROOT; }; + D6EE7C7E249B488B0053FB3A /* axtextmarker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = axtextmarker.m; path = extensions/axuielement/axtextmarker.m; sourceTree = SOURCE_ROOT; }; + D6F310CC1BDF0DCC00045CCD /* drawing_color.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = drawing_color.lua; path = extensions/drawing/color/drawing_color.lua; sourceTree = ""; }; + D6F310CD1BDF0DCC00045CCD /* libdrawing_color.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libdrawing_color.m; path = extensions/drawing/color/libdrawing_color.m; sourceTree = ""; }; + D6F310D01BDF0E0000045CCD /* styledtext.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = styledtext.lua; path = extensions/styledtext/styledtext.lua; sourceTree = ""; }; + D6F310D11BDF0E0000045CCD /* libstyledtext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libstyledtext.m; path = extensions/styledtext/libstyledtext.m; sourceTree = ""; }; D6F310E01BDF0E1700045CCD /* libdrawing_color.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libdrawing_color.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - D6F310E21BDF107D00045CCD /* drawing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = drawing.h; path = extensions/drawing/drawing.h; sourceTree = ""; }; D6F310EF1BDF110500045CCD /* libstyledtext.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libstyledtext.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - D6FD56811C04228800BAE238 /* init.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = init.lua; path = extensions/console/init.lua; sourceTree = ""; }; - D6FD56821C04228800BAE238 /* internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = internal.m; path = extensions/console/internal.m; sourceTree = ""; }; + D6FD56811C04228800BAE238 /* console.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = console.lua; path = extensions/console/console.lua; sourceTree = ""; }; + D6FD56821C04228800BAE238 /* libconsole.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = libconsole.m; path = extensions/console/libconsole.m; sourceTree = ""; }; D6FD568F1C0422B400BAE238 /* libconsole.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libconsole.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + DAED28EB20B95E8E004602CB /* led.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = led.m; path = extensions/hid/led.m; sourceTree = ""; }; DE2547C1592A3EDD90D9815D /* Pods-Hammerspoon.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Hammerspoon.release.xcconfig"; path = "Pods/Target Support Files/Pods-Hammerspoon/Pods-Hammerspoon.release.xcconfig"; sourceTree = ""; }; - E2491A2D1E98CAD80005A439 /* cpPlugin.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = cpPlugin.icns; sourceTree = ""; }; E29DDE451E85524F00313995 /* dsa_pub.pem */ = {isa = PBXFileReference; lastKnownFileType = text; path = dsa_pub.pem; sourceTree = ""; }; - E2E2B1FC1E8546FE009AEAD6 /* PFMoveApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PFMoveApplication.h; sourceTree = ""; }; - E2E2B1FD1E8546FE009AEAD6 /* PFMoveApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PFMoveApplication.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 22451845281ADF8400997BB0 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 224BA32B23D1ECA900487FDB /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4FB852402735B28F00462DD0 /* LuaSkin.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 22613FEB1F297E0D00E05E11 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 22613FEC1F297E0D00E05E11 /* LuaSkin.framework in Frameworks */, + 4FB8527D2735B39D00462DD0 /* LuaSkin.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 226F95F727917D3B003DF60F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 226F95F827917D3B003DF60F /* LuaSkin.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 227478222787F92E00DE6894 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 227478232787F92E00DE6894 /* LuaSkin.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 22DF5D1F23B9A9D300C41AE6 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4FB8525A2735B2F900462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1348,7 +2335,23 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 22E4D7FD1FA7488900C8CF5C /* LuaSkin.framework in Frameworks */, + 4FB852652735B33200462DD0 /* LuaSkin.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 22EEC61C24926E5100BAE4DA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4FB852542735B2E100462DD0 /* LuaSkin.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 22FA061127A160410039C37A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 22FA061227A160410039C37A /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1356,7 +2359,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4C3D55B51C7F0A880023B633 /* LuaSkin.framework in Frameworks */, + 4FB8525C2735B30100462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1364,7 +2367,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4CD203AC1C6D76E20089706D /* LuaSkin.framework in Frameworks */, + 4FB852512735B2D500462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1372,8 +2375,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 4FB852502735B2D100462DD0 /* LuaSkin.framework in Frameworks */, 4CD96BD61C73ABD2009FF648 /* (null) in Frameworks */, - 4CD96BD71C73ABD2009FF648 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1388,7 +2391,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F29C2381C29E0A300B8A69D /* LuaSkin.framework in Frameworks */, + 4FB852762735B37C00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1396,7 +2399,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F2DF3E51F6046F300742D08 /* LuaSkin.framework in Frameworks */, + 4FB852492735B2B500462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1404,7 +2407,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F4CB38C1B737953000EA9B6 /* LuaSkin.framework in Frameworks */, + 4FB8527F2735B3A600462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1412,15 +2415,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F4CB3A11B7385C5000EA9B6 /* LuaSkin.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 4F4CB3B01B738769000EA9B6 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 4F4CB3B21B738769000EA9B6 /* LuaSkin.framework in Frameworks */, + 4FB8527B2735B39200462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1428,7 +2423,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F4CB3C71B738F1E000EA9B6 /* LuaSkin.framework in Frameworks */, + 4FB852772735B38000462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1436,7 +2431,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F4CB3EE1B73A3A1000EA9B6 /* LuaSkin.framework in Frameworks */, + 4FB852742735B37200462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1444,7 +2439,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F4CB4001B73A746000EA9B6 /* LuaSkin.framework in Frameworks */, + 4FB852722735B36900462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1452,7 +2447,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F4CB4121B73AC1D000EA9B6 /* LuaSkin.framework in Frameworks */, + 4FB852712735B36500462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1460,7 +2455,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F4CB4231B73AD0B000EA9B6 /* LuaSkin.framework in Frameworks */, + 4FB8526F2735B35D00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1468,7 +2463,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F4CB4371B73AF7E000EA9B6 /* LuaSkin.framework in Frameworks */, + 4FB8526E2735B35800462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1476,7 +2471,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F4CB44B1B73B09C000EA9B6 /* LuaSkin.framework in Frameworks */, + 4FB8526C2735B34F00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1484,7 +2479,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F5134591C2F315C00EFD6D4 /* LuaSkin.framework in Frameworks */, + 4FB852812735B3B100462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1492,7 +2487,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3EA31B73D6D300B2A4DE /* LuaSkin.framework in Frameworks */, + 4FB8526A2735B34600462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1500,7 +2495,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3EB61B73DC4500B2A4DE /* LuaSkin.framework in Frameworks */, + 4FB852682735B33E00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1508,7 +2503,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3ECD1B73E23800B2A4DE /* LuaSkin.framework in Frameworks */, + 4FB852662735B33600462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1516,7 +2511,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3EE21B73E5AC00B2A4DE /* LuaSkin.framework in Frameworks */, + 4FB852642735B32C00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1524,7 +2519,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3EF61B73E7C200B2A4DE /* LuaSkin.framework in Frameworks */, + 4FB852632735B32700462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1532,7 +2527,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3F071B73E98E00B2A4DE /* LuaSkin.framework in Frameworks */, + 4FB8525D2735B30400462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1540,7 +2535,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3F1C1B73EBB500B2A4DE /* LuaSkin.framework in Frameworks */, + 4FB8525B2735B2FD00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1548,7 +2543,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3F2D1B73EDD100B2A4DE /* LuaSkin.framework in Frameworks */, + 4FB852592735B2F500462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1556,7 +2551,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3F3F1B73EF4B00B2A4DE /* LuaSkin.framework in Frameworks */, + 4FB852572735B2ED00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1564,7 +2559,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3F501B73EFC100B2A4DE /* LuaSkin.framework in Frameworks */, + 4FB852562735B2E900462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1572,7 +2567,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3F651B73F0E300B2A4DE /* LuaSkin.framework in Frameworks */, + 4FB852552735B2E500462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1580,7 +2575,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3F761B73F44500B2A4DE /* LuaSkin.framework in Frameworks */, + 4FB8524F2735B2CD00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1588,7 +2583,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F70EECE1B726D170025A7B3 /* LuaSkin.framework in Frameworks */, + 4FB8528E2735B3F700462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1596,7 +2591,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F70EEE41B7273700025A7B3 /* LuaSkin.framework in Frameworks */, + 4FB8528B2735B3E900462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1604,7 +2599,15 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F76944F1B74C96800536DE4 /* LuaSkin.framework in Frameworks */, + 4FB852692735B34200462DD0 /* LuaSkin.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4F7F3B65272AF68100E05732 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4FB852522735B2D900462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1612,7 +2615,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F85FED31CCA918D00FBBAD7 /* LuaSkin.framework in Frameworks */, + 4FB8527C2735B39900462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1620,8 +2623,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 4FB8524A2735B2B900462DD0 /* LuaSkin.framework in Frameworks */, 4F9618AF1E24ED650048F71D /* libsqlite3.tbd in Frameworks */, - 4F9618A41E24E60C0048F71D /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1629,7 +2632,15 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F9797BE1BED0AC800719F3F /* LuaSkin.framework in Frameworks */, + 4FB852472735B2AC00462DD0 /* LuaSkin.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4F9BA8BF23DF3C6B006349F2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4FB852442735B2A000462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1637,7 +2648,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FBE2CF41B7261A200407788 /* LuaSkin.framework in Frameworks */, + 4FB852902735B40500462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1645,7 +2656,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FBE2D0A1B72631600407788 /* LuaSkin.framework in Frameworks */, + 4FB8528F2735B3FC00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1653,7 +2664,23 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FC93CA21BCD872D0041B820 /* LuaSkin.framework in Frameworks */, + 4FB8528D2735B3F300462DD0 /* LuaSkin.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4FCA05BB27678B100089A5FC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4FCA05BC27678B100089A5FC /* LuaSkin.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4FCBAFC623B0D941007BA1D0 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4FB852672735B33A00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1661,7 +2688,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0AB181B7484D700A82496 /* LuaSkin.framework in Frameworks */, + 4FB8524E2735B2C900462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1669,7 +2696,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0AB2F1B74867600A82496 /* LuaSkin.framework in Frameworks */, + 4FB852462735B2A800462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1677,7 +2704,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0AB411B749C8E00A82496 /* LuaSkin.framework in Frameworks */, + 4FB852452735B2A400462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1685,7 +2712,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0AB561B749D7A00A82496 /* LuaSkin.framework in Frameworks */, + 4FB852432735B29B00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1693,7 +2720,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0AB691B74A67500A82496 /* LuaSkin.framework in Frameworks */, + 4FB852422735B29700462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1701,7 +2728,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0AB731B74A68900A82496 /* LuaSkin.framework in Frameworks */, + 4FB852412735B29300462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1709,7 +2736,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0AB911B74AE1900A82496 /* LuaSkin.framework in Frameworks */, + 4FB852392735B23E00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1717,7 +2744,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0AB9B1B74AE2800A82496 /* LuaSkin.framework in Frameworks */, + 4FB8523B2735B26800462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1725,7 +2752,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0ABB61B74AF4E00A82496 /* LuaSkin.framework in Frameworks */, + 4FB8523A2735B24D00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1733,7 +2760,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0ABD21B74B2C500A82496 /* LuaSkin.framework in Frameworks */, + 4FB852792735B38900462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1741,7 +2768,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0ABDC1B74B2FA00A82496 /* LuaSkin.framework in Frameworks */, + 4FB852782735B38400462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1749,7 +2776,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0ABF91B74B9DE00A82496 /* LuaSkin.framework in Frameworks */, + 4FB8526B2735B34B00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1767,7 +2794,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0AC1C1B74C58800A82496 /* LuaSkin.framework in Frameworks */, + 4FB8526D2735B35400462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1775,7 +2802,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FDD9DC71ED30DC9008F14D3 /* LuaSkin.framework in Frameworks */, + 4FB852582735B2F100462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1783,7 +2810,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FDE059A1B72984C00E9E8EE /* LuaSkin.framework in Frameworks */, + 4FB8528A2735B3E300462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1791,7 +2818,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FDE05A91B72988C00E9E8EE /* LuaSkin.framework in Frameworks */, + 4FB852892735B3DE00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1799,7 +2826,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FDE05C21B72C22500E9E8EE /* LuaSkin.framework in Frameworks */, + 4FB852862735B3CE00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1807,7 +2834,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FDE05D71B734EA600E9E8EE /* LuaSkin.framework in Frameworks */, + 4FB852852735B3C800462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1815,7 +2842,15 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FDE05EA1B734EE600E9E8EE /* LuaSkin.framework in Frameworks */, + 4FB852842735B3C200462DD0 /* LuaSkin.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4FF0611D274AA7A200FB15D6 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4FF0611E274AA7A200FB15D6 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1823,9 +2858,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 4FB8525E2735B30900462DD0 /* LuaSkin.framework in Frameworks */, 6AE1812E1D36E96A0097211C /* CoreAudio.framework in Frameworks */, 6AE1812C1D36E9600097211C /* Accelerate.framework in Frameworks */, - 6AE181221D36E90B0097211C /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1833,7 +2868,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4F9F02BB1B3D9591009C32E5 /* LuaSkin.framework in Frameworks */, + 4FB852382735B15200462DD0 /* LuaSkin.framework in Frameworks */, 394FD223913AE68B92126D37 /* libPods-Hammerspoon.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1842,7 +2877,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - B8524F2C201A88CD00844F3D /* LuaSkin.framework in Frameworks */, + 4FB852732735B36E00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1857,7 +2892,31 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D61F4A2A1DCFA67900AEE223 /* LuaSkin.framework in Frameworks */, + 4FB852532735B2DD00462DD0 /* LuaSkin.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D62F9EB42320B82100FAE188 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4FB852882735B3D900462DD0 /* LuaSkin.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D62F9EC02320B86300FAE188 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4FB852872735B3D300462DD0 /* LuaSkin.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D633A9E2247B9BF2005C88E2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4FB8528C2735B3EE00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1865,7 +2924,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D641255F1BA07CEA000FB5F8 /* LuaSkin.framework in Frameworks */, + 4FB8523F2735B28B00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1873,7 +2932,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D6477C0F1C5ED5D000F67BBC /* LuaSkin.framework in Frameworks */, + 4FB852622735B31F00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1881,7 +2940,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D6477C271C5ED82200F67BBC /* LuaSkin.framework in Frameworks */, + 4FB8525F2735B31300462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1889,7 +2948,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D6477C361C5ED83C00F67BBC /* LuaSkin.framework in Frameworks */, + 4FB852612735B31B00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1897,7 +2956,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D649647E1CCB32C70074540B /* LuaSkin.framework in Frameworks */, + 4FB8527E2735B3A100462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1905,7 +2964,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D64B03401BA954780006C468 /* LuaSkin.framework in Frameworks */, + 4FB8523C2735B27C00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1913,7 +2972,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D68616021E04D5D20058A4F2 /* LuaSkin.framework in Frameworks */, + 4FB852832735B3BD00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1921,7 +2980,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D68616101E04D6630058A4F2 /* LuaSkin.framework in Frameworks */, + 4FB852822735B3B500462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1929,7 +2988,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D68CE6231E9C450E00912154 /* LuaSkin.framework in Frameworks */, + 4FB852702735B36100462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1937,7 +2996,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D6A212EE1DE38F5F00998C0B /* LuaSkin.framework in Frameworks */, + 4FB8524B2735B2BD00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1945,7 +3004,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D6A318A51DDD833100D9B328 /* LuaSkin.framework in Frameworks */, + 4FB852602735B31700462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1953,7 +3012,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D6B9464C1D139C7D00177E0C /* LuaSkin.framework in Frameworks */, + 4FB8523E2735B28700462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1961,7 +3020,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D6B946581D139CC500177E0C /* LuaSkin.framework in Frameworks */, + 4FB8523D2735B28100462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1969,7 +3028,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D6BB4FB41C16959C000DC0A2 /* LuaSkin.framework in Frameworks */, + 4FB8524D2735B2C500462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1977,7 +3036,15 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D6BB4FC21C1695EC000DC0A2 /* LuaSkin.framework in Frameworks */, + 4FB8524C2735B2C100462DD0 /* LuaSkin.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D6C32CC827DDD47F001AA22E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D6C32CC927DDD47F001AA22E /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1985,7 +3052,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D6E164D71F4C262300B85D8A /* LuaSkin.framework in Frameworks */, + 4FB852752735B37700462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1993,7 +3060,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D6F310DB1BDF0E1700045CCD /* LuaSkin.framework in Frameworks */, + 4FB8527A2735B38D00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2001,7 +3068,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D6F310EA1BDF110500045CCD /* LuaSkin.framework in Frameworks */, + 4FB852482735B2B000462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2009,7 +3076,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D6FD568A1C0422B400BAE238 /* LuaSkin.framework in Frameworks */, + 4FB852802735B3AB00462DD0 /* LuaSkin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2021,145 +3088,277 @@ children = ( 867B086413FD65986CB40932 /* Pods-Hammerspoon.debug.xcconfig */, DE2547C1592A3EDD90D9815D /* Pods-Hammerspoon.release.xcconfig */, + 75E2C8065BA22C7EA133713A /* Pods-Hammerspoon.profile.xcconfig */, ); name = Pods; sourceTree = ""; }; - 22613FE31F297B3300E05E11 /* dialog */ = { + 2213841E27A105520085CA24 /* razer */ = { isa = PBXGroup; children = ( - 22613FE41F297B9B00E05E11 /* internal.m */, - 22613FE51F297B9B00E05E11 /* init.lua */, - ); - name = dialog; + 2213842A27A105DD0085CA24 /* razer.lua */, + 2213842F27A105DD0085CA24 /* razer.h */, + 2213842B27A105DD0085CA24 /* librazer.m */, + 2213843027A105DD0085CA24 /* HSRazerDevice.h */, + 2213843127A105DD0085CA24 /* HSRazerDevice.m */, + 2213843227A105DD0085CA24 /* HSRazerManager.h */, + 2213842D27A105DD0085CA24 /* HSRazerManager.m */, + 22E59E0D2852D6EF0062292D /* HSRazerNostromoDevice.h */, + 22E59E0E2852D6EF0062292D /* HSRazerNostromoDevice.m */, + 2290EB1F28011DF100CEA572 /* HSRazerOrbweaverDevice.h */, + 2290EB1E28011DF100CEA572 /* HSRazerOrbweaverDevice.m */, + 22E59E122852FD270062292D /* HSRazerOrbweaverChromaDevice.h */, + 22E59E112852FD270062292D /* HSRazerOrbweaverChromaDevice.m */, + 2248D34128476C1300A379E3 /* HSRazerTartarusDevice.h */, + 2248D34028476C1300A379E3 /* HSRazerTartarusDevice.m */, + 22F223E828AEFB6D00FF081E /* HSRazerTartarusChromaDevice.h */, + 22F223E928AEFB6D00FF081E /* HSRazerTartarusChromaDevice.m */, + 2248D33C28460E4F00A379E3 /* HSRazerTartarusProDevice.h */, + 2248D33D28460E4F00A379E3 /* HSRazerTartarusProDevice.m */, + 2213842E27A105DD0085CA24 /* HSRazerTartarusV2Device.h */, + 2213842C27A105DD0085CA24 /* HSRazerTartarusV2Device.m */, + ); + name = razer; sourceTree = ""; }; - 22E4D7F61FA747FA00C8CF5C /* midi */ = { + 22451849281ADF8400997BB0 /* CommandPost Workflow Extension */ = { isa = PBXGroup; children = ( - 22E4D7F81FA7485A00C8CF5C /* init.lua */, - 22E4D7F71FA7485A00C8CF5C /* internal.m */, - ); - name = midi; + 22615F36281E3858003ADBC6 /* User Interface */, + 22615F34281E3819003ADBC6 /* Assets */, + 22615F35281E3836003ADBC6 /* Extras */, + 22627C1D2B3E3A1A0029A2F5 /* GCDAsyncSocket.m */, + 2245184E281ADF8400997BB0 /* CommandPost-Bridging-Header.h */, + 2245184F281ADF8400997BB0 /* CommandPostViewController.h */, + 22451850281ADF8400997BB0 /* CommandPostViewController.m */, + ); + path = "CommandPost Workflow Extension"; sourceTree = ""; }; - 4C3D55A81C7F05D00023B633 /* osascript */ = { + 224BA33323D1ECF200487FDB /* websocket */ = { isa = PBXGroup; children = ( - 4C3D55A91C7F05D00023B633 /* init.lua */, - 4C3D55AA1C7F05D00023B633 /* internal.m */, - 4C3D55AE1C7F061D0023B633 /* NSAppleEventDescriptor+Parsing.h */, - 4C3D55AF1C7F061D0023B633 /* NSAppleEventDescriptor+Parsing.m */, - 4CB349F01C7F74E5006F0DE0 /* test_osascript.lua */, - 4CB349F21C7F74EE006F0DE0 /* test_applescript.lua */, - 4C3D55AD1C7F05D00023B633 /* test_javascript.lua */, + 224BA33423D1EE6F00487FDB /* websocket.lua */, + 224BA32523D1E63A00487FDB /* libwebsocket.m */, + 22738933248606A9003EBC68 /* test_websocket.lua */, ); - name = osascript; - path = extensions/osascript; + name = websocket; sourceTree = ""; }; - 4CD203A01C6D75950089706D /* socket */ = { + 22613FE31F297B3300E05E11 /* dialog */ = { isa = PBXGroup; children = ( - 4CE6390E1C76C7F500BB7CD2 /* socket.h */, - 4CD203A11C6D75950089706D /* init.lua */, - 4CD203A21C6D75950089706D /* internal.m */, - 4CD64AAA1C6F168700EB6E39 /* test_socket.lua */, + 22613FE51F297B9B00E05E11 /* dialog.lua */, + 22613FE41F297B9B00E05E11 /* libdialog.m */, ); - name = socket; - path = extensions/socket; + name = dialog; sourceTree = ""; }; - 4CD96BDF1C73AC21009FF648 /* socketudp */ = { + 22615F34281E3819003ADBC6 /* Assets */ = { isa = PBXGroup; children = ( - 4CD96BDD1C73AC1C009FF648 /* udp.m */, - 4CE639131C772DC700BB7CD2 /* test_udpsocket.lua */, + 2245184A281ADF8400997BB0 /* Assets.xcassets */, + 22615F32281E3301003ADBC6 /* WorkflowExtension.icns */, ); - name = socketudp; + path = Assets; sourceTree = ""; }; - 4F11989D1FF040F600D279D8 /* windowswitcher */ = { + 22615F35281E3836003ADBC6 /* Extras */ = { isa = PBXGroup; children = ( - 4F11989E1FF0412600D279D8 /* switcher.lua */, + 22451853281ADF8400997BB0 /* CommandPost.entitlements */, + 22451852281ADF8400997BB0 /* Info.plist */, + 226BD80C281CE86200294634 /* CocoaAsyncSocket */, ); - name = windowswitcher; + path = Extras; sourceTree = ""; }; - 4F20B52A1C1F1C5B00F52437 /* Hammerspoon UI Tests */ = { + 22615F36281E3858003ADBC6 /* User Interface */ = { isa = PBXGroup; children = ( - 4F20B52B1C1F1C5B00F52437 /* Hammerspoon_UITests.m */, - 4F20B52D1C1F1C5B00F52437 /* Info.plist */, - 4F20B5331C1F225300F52437 /* init.lua */, + 2245184C281ADF8400997BB0 /* CommandPostViewController.xib */, ); - name = "Hammerspoon UI Tests"; - path = HammerspoonUITests; + path = "User Interface"; sourceTree = ""; }; - 4F2DF3DC1F60468E00742D08 /* streamdeck */ = { + 22652B3F251C391E000FF14D /* gestures */ = { isa = PBXGroup; children = ( - 4F2DF3DD1F6046AD00742D08 /* init.lua */, - 4F2DF3DE1F6046AD00742D08 /* internal.m */, - 4F2DF3EE1F605A4900742D08 /* HSStreamDeckManager.h */, - 4F2DF3EF1F605A4900742D08 /* HSStreamDeckManager.m */, - 4F2DF3F21F605A9B00742D08 /* HSStreamDeckDevice.h */, - 4F2DF3F31F605A9B00742D08 /* HSStreamDeckDevice.m */, - 4F2DF3F61F6170BE00742D08 /* NSImage+BMP.h */, - 4F2DF3F71F6170BE00742D08 /* NSImage+BMP.m */, - 4F2DF3FA1F61AE6700742D08 /* streamdeck.h */, + 22652B3B251C3913000FF14D /* IOHIDEventData.h */, + 22652B3C251C3914000FF14D /* IOHIDEventTypes.h */, + 22652B37251C38AB000FF14D /* TouchEvents.c */, + 22652B38251C38AB000FF14D /* TouchEvents.h */, ); - name = streamdeck; + name = gestures; sourceTree = ""; }; - 4F4CB3921B7379D3000EA9B6 /* crash */ = { + 226F95FF27917D4B003DF60F /* blackmagic */ = { isa = PBXGroup; children = ( - 4F4CB3931B737A5B000EA9B6 /* init.lua */, - 4F4CB3941B737A5B000EA9B6 /* internal.m */, - 4FEE39DA1F0A69D100935F90 /* test_crash.lua */, - ); - name = crash; + 224B923427F6F5C3003F628E /* HSBlackmagicDeviceSpeedEditor.h */, + 224B923127F6D326003F628E /* HSBlackmagicDeviceSpeedEditor.m */, + 224B922C27F6B846003F628E /* HSBlackmagicDeviceKeyboard.h */, + 224B922D27F6B846003F628E /* HSBlackmagicDeviceKeyboard.m */, + 226F960327917D63003DF60F /* HSBlackmagicDevice.h */, + 226F960627917D63003DF60F /* HSBlackmagicDevice.m */, + 226F960227917D63003DF60F /* HSBlackmagicManager.h */, + 226F960027917D63003DF60F /* HSBlackmagicManager.m */, + 226F960527917D63003DF60F /* blackmagic.lua */, + 226F960127917D63003DF60F /* libblackmagic.m */, + 226F960427917D63003DF60F /* blackmagic.h */, + ); + name = blackmagic; sourceTree = ""; }; - 4F4CB3A71B7385E3000EA9B6 /* dockicon */ = { + 2274781A2787F8CE00DE6894 /* osc */ = { isa = PBXGroup; children = ( - 4F4CB3A81B7385FB000EA9B6 /* init.lua */, - 4F4CB3A91B7385FB000EA9B6 /* internal.m */, + 2274781B2787F8F800DE6894 /* libosc.m */, + 2274781C2787F8F800DE6894 /* osc.lua */, ); - name = dockicon; + name = osc; sourceTree = ""; }; - 4F4CB3BA1B73879B000EA9B6 /* drawing */ = { + 22E4D7F61FA747FA00C8CF5C /* midi */ = { isa = PBXGroup; children = ( - D6E071681E04D9FC00C1046A /* canvasWrapper.lua */, - D6F310E21BDF107D00045CCD /* drawing.h */, - D6F310CA1BDF0D9600045CCD /* color */, - 4F4CB3BB1B7387AA000EA9B6 /* init.lua */, - 4F4CB3BC1B7387AA000EA9B6 /* internal.m */, + 22E4D7F81FA7485A00C8CF5C /* midi.lua */, + 22E4D7F71FA7485A00C8CF5C /* libmidi.m */, ); - name = drawing; + name = midi; sourceTree = ""; }; - 4F4CB3C01B7388AE000EA9B6 /* fnutils */ = { + 22EEC61624926DEA00BAE4DA /* serial */ = { isa = PBXGroup; children = ( - 4F4CB3C11B7388C0000EA9B6 /* init.lua */, + 22EEC61824926E2100BAE4DA /* serial.lua */, + 22EEC61724926E2100BAE4DA /* libserial.m */, + 22A6625F25FC07F700AA329E /* test_serial.lua */, ); - name = fnutils; + name = serial; sourceTree = ""; }; - 4F4CB3CF1B7391C3000EA9B6 /* fs */ = { + 4C3D55A81C7F05D00023B633 /* osascript */ = { isa = PBXGroup; children = ( - D6E164D11F4C25FD00B85D8A /* xattr.m */, - 4F29C2311C29D8E400B8A69D /* volume.m */, - 4F4CB3D01B7391D3000EA9B6 /* init.lua */, - 4F4CB3D11B7391D3000EA9B6 /* internal.m */, + 4C3D55A91C7F05D00023B633 /* osascript.lua */, + 4C3D55AA1C7F05D00023B633 /* libosascript.m */, + 4C3D55AE1C7F061D0023B633 /* NSAppleEventDescriptor+Parsing.h */, + 4C3D55AF1C7F061D0023B633 /* NSAppleEventDescriptor+Parsing.m */, + 4CB349F01C7F74E5006F0DE0 /* test_osascript.lua */, + 4CB349F21C7F74EE006F0DE0 /* test_applescript.lua */, + 4C3D55AD1C7F05D00023B633 /* test_javascript.lua */, + ); + name = osascript; + path = extensions/osascript; + sourceTree = ""; + }; + 4CD203A01C6D75950089706D /* socket */ = { + isa = PBXGroup; + children = ( + 4CD203A11C6D75950089706D /* socket.lua */, + 4CD203A21C6D75950089706D /* libsocket.m */, + 4CD96BDD1C73AC1C009FF648 /* libsocket_udp.m */, + 4CE6390E1C76C7F500BB7CD2 /* socket.h */, + 4CD64AAA1C6F168700EB6E39 /* test_socket.lua */, + 4CE639131C772DC700BB7CD2 /* test_udpsocket.lua */, + ); + name = socket; + path = extensions/socket; + sourceTree = ""; + }; + 4F20B52A1C1F1C5B00F52437 /* Hammerspoon UI Tests */ = { + isa = PBXGroup; + children = ( + 4F20B52B1C1F1C5B00F52437 /* Hammerspoon_UITests.m */, + 4F20B52D1C1F1C5B00F52437 /* Info.plist */, + 4F20B5331C1F225300F52437 /* init.lua */, + ); + name = "Hammerspoon UI Tests"; + path = HammerspoonUITests; + sourceTree = ""; + }; + 4F2DF3DC1F60468E00742D08 /* streamdeck */ = { + isa = PBXGroup; + children = ( + 4F2DF3DD1F6046AD00742D08 /* streamdeck.lua */, + 4F2DF3FA1F61AE6700742D08 /* streamdeck.h */, + 4F2DF3DE1F6046AD00742D08 /* libstreamdeck.m */, + 4F2DF3F21F605A9B00742D08 /* HSStreamDeckDevice.h */, + 4F2DF3F31F605A9B00742D08 /* HSStreamDeckDevice.m */, + 22DC4FA7299E140100065BE1 /* HSStreamDeckDevicePlus.h */, + 22DC4FA6299E140100065BE1 /* HSStreamDeckDevicePlus.m */, + 4F6653E8238C6B6600DEE120 /* HSStreamDeckDeviceMini.h */, + 4F6653E9238C6B6600DEE120 /* HSStreamDeckDeviceMini.m */, + 4F6653E4238C36F100DEE120 /* HSStreamDeckDeviceOriginal.h */, + 4F6653E5238C36F100DEE120 /* HSStreamDeckDeviceOriginal.m */, + 4FFB20FE23CD14A400811E77 /* HSStreamDeckDeviceOriginalV2.h */, + 4FFB20FF23CD14A400811E77 /* HSStreamDeckDeviceOriginalV2.m */, + 4FFB20FA23C5E01300811E77 /* HSStreamDeckDeviceXL.h */, + 4FFB20FB23C5E01300811E77 /* HSStreamDeckDeviceXL.m */, + 4F55609F279F6A0300B91FD8 /* HSStreamDeckDeviceMk2.h */, + 4F5560A0279F6A0300B91FD8 /* HSStreamDeckDeviceMk2.m */, + 220E0B1829B07EFA003B0BBD /* HSStreamDeckDevicePedal.h */, + 220E0B1929B07EFA003B0BBD /* HSStreamDeckDevicePedal.m */, + 4F2DF3EE1F605A4900742D08 /* HSStreamDeckManager.h */, + 4F2DF3EF1F605A4900742D08 /* HSStreamDeckManager.m */, + 4F2DF3F61F6170BE00742D08 /* NSImage+BMP.h */, + 4F2DF3F71F6170BE00742D08 /* NSImage+BMP.m */, + 4F6653F0238C7BC600DEE120 /* NSImage+Flipped.h */, + 4F6653F1238C7BC600DEE120 /* NSImage+Flipped.m */, + 4F6653F42390351100DEE120 /* NSImage+JPEG.h */, + 4F6653F52390351100DEE120 /* NSImage+JPEG.m */, + 4F6653EC238C7A1200DEE120 /* NSImage+Rotated.h */, + 4F6653ED238C7A1200DEE120 /* NSImage+Rotated.m */, + ); + name = streamdeck; + sourceTree = ""; + }; + 4F4CB3921B7379D3000EA9B6 /* crash */ = { + isa = PBXGroup; + children = ( + 4F4CB3931B737A5B000EA9B6 /* crash.lua */, + 4F4CB3941B737A5B000EA9B6 /* libcrash.m */, + 4FEE39DA1F0A69D100935F90 /* test_crash.lua */, + ); + name = crash; + sourceTree = ""; + }; + 4F4CB3A71B7385E3000EA9B6 /* dockicon */ = { + isa = PBXGroup; + children = ( + 4F4CB3A81B7385FB000EA9B6 /* dockicon.lua */, + 4F4CB3A91B7385FB000EA9B6 /* libdockicon.m */, + ); + name = dockicon; + sourceTree = ""; + }; + 4F4CB3BA1B73879B000EA9B6 /* drawing */ = { + isa = PBXGroup; + children = ( + 4F4CB3BB1B7387AA000EA9B6 /* drawing.lua */, + D6E071681E04D9FC00C1046A /* drawing_canvasWrapper.lua */, + D6F310CC1BDF0DCC00045CCD /* drawing_color.lua */, + D6F310CD1BDF0DCC00045CCD /* libdrawing_color.m */, + ); + name = drawing; + sourceTree = ""; + }; + 4F4CB3C01B7388AE000EA9B6 /* fnutils */ = { + isa = PBXGroup; + children = ( + 4F4CB3C11B7388C0000EA9B6 /* fnutils.lua */, + ); + name = fnutils; + sourceTree = ""; + }; + 4F4CB3CF1B7391C3000EA9B6 /* fs */ = { + isa = PBXGroup; + children = ( + 4F4CB3D01B7391D3000EA9B6 /* fs.lua */, + 4F4CB3D11B7391D3000EA9B6 /* libfs.m */, + D6E164D11F4C25FD00B85D8A /* libfs_xattr.m */, + 4F29C2311C29D8E400B8A69D /* libfs_volume.m */, 4F4CB3D21B7391D3000EA9B6 /* lfs.h */, 4C5BA6B61C85EB0400E68CA9 /* test_fs.lua */, ); @@ -2169,7 +3368,7 @@ 4F4CB3E31B739A00000EA9B6 /* geometry */ = { isa = PBXGroup; children = ( - 4F4CB3E41B739A0F000EA9B6 /* init.lua */, + 4F4CB3E41B739A0F000EA9B6 /* geometry.lua */, ); name = geometry; sourceTree = ""; @@ -2177,7 +3376,7 @@ 4F4CB3E71B739AB4000EA9B6 /* grid */ = { isa = PBXGroup; children = ( - 4F4CB3E81B739ABD000EA9B6 /* init.lua */, + 4F4CB3E81B739ABD000EA9B6 /* grid.lua */, ); name = grid; sourceTree = ""; @@ -2185,8 +3384,13 @@ 4F4CB3F41B73A3D9000EA9B6 /* hash */ = { isa = PBXGroup; children = ( - 4F4CB3F51B73A4EC000EA9B6 /* init.lua */, - 4F4CB3F61B73A4EC000EA9B6 /* internal.m */, + D6A6C1112A05F3500018FC9B /* algorithms.h */, + D6A6C1102A05F3500018FC9B /* algorithms.m */, + D6A6C10D2A05F3500018FC9B /* byte_order.h */, + D6A6C10F2A05F3500018FC9B /* sha3.h */, + D6A6C10E2A05F3500018FC9B /* sha3.m */, + 4F4CB3F51B73A4EC000EA9B6 /* hash.lua */, + 4F4CB3F61B73A4EC000EA9B6 /* libhash.m */, ); name = hash; sourceTree = ""; @@ -2194,7 +3398,7 @@ 4F4CB4071B73A776000EA9B6 /* hints */ = { isa = PBXGroup; children = ( - 4F4CB4081B73A784000EA9B6 /* init.lua */, + 4F4CB4081B73A784000EA9B6 /* hints.lua */, 4F4CB4091B73A784000EA9B6 /* internal.m */, ); name = hints; @@ -2203,9 +3407,10 @@ 4F4CB4181B73AC35000EA9B6 /* host */ = { isa = PBXGroup; children = ( - D68CE61A1E9C44C600912154 /* locale */, - 4F4CB4191B73AC48000EA9B6 /* init.lua */, - 4F4CB41A1B73AC48000EA9B6 /* internal.m */, + 4F4CB4191B73AC48000EA9B6 /* host.lua */, + D68CE61B1E9C44E200912154 /* host_locale.lua */, + 4F4CB41A1B73AC48000EA9B6 /* libhost.m */, + D68CE61C1E9C44E200912154 /* libhost_locale.m */, ); name = host; sourceTree = ""; @@ -2213,8 +3418,9 @@ 4F4CB42B1B73AD36000EA9B6 /* hotkey */ = { isa = PBXGroup; children = ( - 4F4CB42C1B73AD47000EA9B6 /* init.lua */, - 4F4CB42D1B73AD47000EA9B6 /* internal.m */, + 4F4CB42C1B73AD47000EA9B6 /* hotkey.lua */, + 4F4CB42D1B73AD47000EA9B6 /* libhotkey.m */, + 4F7BB9D326447C390077A926 /* test_hotkey.lua */, ); name = hotkey; sourceTree = ""; @@ -2222,8 +3428,9 @@ 4F4CB4411B73AFC1000EA9B6 /* http */ = { isa = PBXGroup; children = ( - 4F4CB4421B73AFD2000EA9B6 /* init.lua */, - 4F4CB4431B73AFD2000EA9B6 /* internal.m */, + CE139CB228B2539500743C90 /* test_http.lua */, + 4F4CB4421B73AFD2000EA9B6 /* http.lua */, + 4F4CB4431B73AFD2000EA9B6 /* libhttp.m */, ); name = http; sourceTree = ""; @@ -2231,8 +3438,9 @@ 4F4CB4531B73B0C4000EA9B6 /* image */ = { isa = PBXGroup; children = ( - 4F4CB4541B73B0D5000EA9B6 /* init.lua */, - 4F4CB4551B73B0D5000EA9B6 /* internal.m */, + 220B882927F8F954006C0B2B /* test_image.lua */, + 4F4CB4541B73B0D5000EA9B6 /* image.lua */, + 4F4CB4551B73B0D5000EA9B6 /* libimage.m */, ); name = image; sourceTree = ""; @@ -2240,8 +3448,8 @@ 4F51344F1C2EE07700EFD6D4 /* chooser */ = { isa = PBXGroup; children = ( - 4F5134501C2EE08F00EFD6D4 /* init.lua */, - 4F5134511C2EE08F00EFD6D4 /* internal.m */, + 4F5134501C2EE08F00EFD6D4 /* chooser.lua */, + 4F5134511C2EE08F00EFD6D4 /* libchooser.m */, 4F5134631C30819000EFD6D4 /* chooser.h */, 4F0676041C32AED90088C57C /* HSChooserWindow.xib */, 4F0676051C32C0B30088C57C /* HSChooserCell.h */, @@ -2254,6 +3462,8 @@ 4F3D9D0A1C34773E0082E864 /* HSChooserTableView.m */, 4F0F08071DC0DAAA00082B73 /* HSChooserRootView.h */, 4F0F08081DC0DAAA00082B73 /* HSChooserRootView.m */, + 4F68B52E227C2DD70076C4F8 /* HSChooserVerticallyCenteringTextFieldCell.h */, + 4F68B52F227C2DD70076C4F8 /* HSChooserVerticallyCenteringTextFieldCell.m */, ); name = chooser; sourceTree = ""; @@ -2261,7 +3471,7 @@ 4F64D8BC1B724C3A00FC4C65 /* alert */ = { isa = PBXGroup; children = ( - 4F64D8BD1B724C4B00FC4C65 /* init.lua */, + 4F64D8BD1B724C4B00FC4C65 /* alert.lua */, 4FDD8E531C83616100085D7A /* test_alert.lua */, ); name = alert; @@ -2270,7 +3480,7 @@ 4F6689DF1C2852A100E48AF1 /* _coresetup */ = { isa = PBXGroup; children = ( - 4F6689E01C2852B500E48AF1 /* init.lua */, + 4F6689E01C2852B500E48AF1 /* _coresetup.lua */, 4FDD8E8A1C8C8BD200085D7A /* test_coresetup.lua */, ); name = _coresetup; @@ -2279,7 +3489,7 @@ 4F6689E21C288B8900E48AF1 /* redshift */ = { isa = PBXGroup; children = ( - 4F6689E31C288BAA00E48AF1 /* init.lua */, + 4F6689E31C288BAA00E48AF1 /* redshift.lua */, ); name = redshift; sourceTree = ""; @@ -2287,7 +3497,8 @@ 4F6B3E9A1B73D5F300B2A4DE /* inspect */ = { isa = PBXGroup; children = ( - 4F6B3E9B1B73D60000B2A4DE /* init.lua */, + 4F6B3E9B1B73D60000B2A4DE /* inspect.lua */, + 4F2C0C7121BB49E0008F32C1 /* test_inspect.lua */, ); name = inspect; sourceTree = ""; @@ -2295,7 +3506,7 @@ 4F6B3E9C1B73D69800B2A4DE /* itunes */ = { isa = PBXGroup; children = ( - 4F6B3E9D1B73D6A500B2A4DE /* init.lua */, + 4F6B3E9D1B73D6A500B2A4DE /* itunes.lua */, ); name = itunes; sourceTree = ""; @@ -2303,8 +3514,9 @@ 4F6B3EAB1B73D76800B2A4DE /* json */ = { isa = PBXGroup; children = ( - 4F6B3EAC1B73D79100B2A4DE /* init.lua */, - 4F6B3EAD1B73D79100B2A4DE /* internal.m */, + 4F6B3EAC1B73D79100B2A4DE /* json.lua */, + 4F6B3EAD1B73D79100B2A4DE /* libjson.m */, + 4F4F6EBE25DB1C7C000187FA /* test_json.lua */, ); name = json; sourceTree = ""; @@ -2312,7 +3524,7 @@ 4F6B3EAF1B73DBDB00B2A4DE /* layout */ = { isa = PBXGroup; children = ( - 4F6B3EB01B73DBEA00B2A4DE /* init.lua */, + 4F6B3EB01B73DBEA00B2A4DE /* layout.lua */, ); name = layout; sourceTree = ""; @@ -2320,9 +3532,11 @@ 4F6B3EBC1B73DC7000B2A4DE /* location */ = { isa = PBXGroup; children = ( - D66B763A1DD6FD1400CA12E6 /* geocoder.lua */, - 4F6B3EBD1B73DC8400B2A4DE /* init.lua */, - 4F6B3EBE1B73DC8400B2A4DE /* internal.m */, + 4F6B3EBD1B73DC8400B2A4DE /* location.lua */, + D66B763A1DD6FD1400CA12E6 /* location_geocoder.lua */, + 4F6B3EBE1B73DC8400B2A4DE /* liblocation.m */, + 4F30430021D5673A00769310 /* EDSunriseSet.h */, + 4F30430121D5673A00769310 /* EDSunriseSet.m */, ); name = location; sourceTree = ""; @@ -2330,7 +3544,7 @@ 4F6B3EC61B73E14200B2A4DE /* logger */ = { isa = PBXGroup; children = ( - 4F6B3EC71B73E15E00B2A4DE /* init.lua */, + 4F6B3EC71B73E15E00B2A4DE /* logger.lua */, ); name = logger; sourceTree = ""; @@ -2338,8 +3552,8 @@ 4F6B3ED71B73E27D00B2A4DE /* menubar */ = { isa = PBXGroup; children = ( - 4F6B3ED81B73E29300B2A4DE /* init.lua */, - 4F6B3ED91B73E29300B2A4DE /* internal.m */, + 4F6B3ED81B73E29300B2A4DE /* menubar.lua */, + 4F6B3ED91B73E29300B2A4DE /* libmenubar.m */, ); name = menubar; sourceTree = ""; @@ -2347,7 +3561,7 @@ 4F6B3EDB1B73E55300B2A4DE /* messages */ = { isa = PBXGroup; children = ( - 4F6B3EDC1B73E56600B2A4DE /* init.lua */, + 4F6B3EDC1B73E56600B2A4DE /* messages.lua */, ); name = messages; sourceTree = ""; @@ -2355,8 +3569,8 @@ 4F6B3EEB1B73E64A00B2A4DE /* milight */ = { isa = PBXGroup; children = ( - 4F6B3EEC1B73E65800B2A4DE /* init.lua */, - 4F6B3EED1B73E65800B2A4DE /* internal.m */, + 4F6B3EEC1B73E65800B2A4DE /* milight.lua */, + 4F6B3EED1B73E65800B2A4DE /* libmilight.m */, ); name = milight; sourceTree = ""; @@ -2364,7 +3578,7 @@ 4F6B3EEF1B73E77D00B2A4DE /* mjomatic */ = { isa = PBXGroup; children = ( - 4F6B3EF01B73E78900B2A4DE /* init.lua */, + 4F6B3EF01B73E78900B2A4DE /* mjomatic.lua */, ); name = mjomatic; sourceTree = ""; @@ -2372,8 +3586,9 @@ 4F6B3EFC1B73E7E200B2A4DE /* mouse */ = { isa = PBXGroup; children = ( - 4F6B3EFD1B73E7F000B2A4DE /* init.lua */, - 4F6B3EFE1B73E7F000B2A4DE /* internal.m */, + 4F6B3EFD1B73E7F000B2A4DE /* mouse.lua */, + 4F6B3EFE1B73E7F000B2A4DE /* libmouse.m */, + 4FFFA01125D89BAF00D2997C /* test_mouse.lua */, ); name = mouse; sourceTree = ""; @@ -2381,8 +3596,8 @@ 4F6B3F0F1B73E9BA00B2A4DE /* notify */ = { isa = PBXGroup; children = ( - 4F6B3F101B73E9C700B2A4DE /* init.lua */, - 4F6B3F111B73E9C700B2A4DE /* internal.m */, + 4F6B3F101B73E9C700B2A4DE /* notify.lua */, + 4F6B3F111B73E9C700B2A4DE /* libnotify.m */, ); name = notify; sourceTree = ""; @@ -2390,8 +3605,9 @@ 4F6B3F241B73EBF000B2A4DE /* pasteboard */ = { isa = PBXGroup; children = ( - 4F6B3F251B73EBFD00B2A4DE /* init.lua */, - 4F6B3F261B73EBFD00B2A4DE /* internal.m */, + 4F6B3F251B73EBFD00B2A4DE /* pasteboard.lua */, + 4F6B3F261B73EBFD00B2A4DE /* libpasteboard.m */, + 22DF5D1A23B99C4D00C41AE6 /* libpasteboard_watcher.m */, ); name = pasteboard; sourceTree = ""; @@ -2399,8 +3615,8 @@ 4F6B3F361B73EE0E00B2A4DE /* pathwatcher */ = { isa = PBXGroup; children = ( - 4F6B3F371B73EE1C00B2A4DE /* init.lua */, - 4F6B3F381B73EE1C00B2A4DE /* internal.m */, + 4F6B3F371B73EE1C00B2A4DE /* pathwatcher.lua */, + 4F6B3F381B73EE1C00B2A4DE /* libpathwatcher.m */, ); name = pathwatcher; sourceTree = ""; @@ -2408,26 +3624,19 @@ 4F6B3F471B73EF8A00B2A4DE /* screen */ = { isa = PBXGroup; children = ( - 4F6B3F481B73EF9A00B2A4DE /* init.lua */, - 4F6B3F491B73EF9A00B2A4DE /* internal.m */, + 4F6B3F481B73EF9A00B2A4DE /* screen.lua */, + 4F6B3F491B73EF9A00B2A4DE /* libscreen.m */, + 4F6B3F571B73EFE600B2A4DE /* libscreen_watcher.m */, 4FDD8E491C6E4FA100085D7A /* test_screen.lua */, ); name = screen; sourceTree = ""; }; - 4F6B3F561B73EFD700B2A4DE /* screenwatcher */ = { - isa = PBXGroup; - children = ( - 4F6B3F571B73EFE600B2A4DE /* watcher.m */, - ); - name = screenwatcher; - sourceTree = ""; - }; 4F6B3F6D1B73F15A00B2A4DE /* settings */ = { isa = PBXGroup; children = ( - 4F6B3F6E1B73F16700B2A4DE /* init.lua */, - 4F6B3F6F1B73F16700B2A4DE /* internal.m */, + 4F6B3F6E1B73F16700B2A4DE /* settings.lua */, + 4F6B3F6F1B73F16700B2A4DE /* libsettings.m */, ); name = settings; sourceTree = ""; @@ -2435,8 +3644,8 @@ 4F6B3F7F1B73F48500B2A4DE /* sound */ = { isa = PBXGroup; children = ( - 4F6B3F801B73F49500B2A4DE /* init.lua */, - 4F6B3F811B73F49500B2A4DE /* internal.m */, + 4F6B3F801B73F49500B2A4DE /* sound.lua */, + 4F6B3F811B73F49500B2A4DE /* libsound.m */, ); name = sound; sourceTree = ""; @@ -2444,7 +3653,7 @@ 4F6B3F851B73F86200B2A4DE /* spotify */ = { isa = PBXGroup; children = ( - 4F6B3F861B73F86E00B2A4DE /* init.lua */, + 4F6B3F861B73F86E00B2A4DE /* spotify.lua */, ); name = spotify; sourceTree = ""; @@ -2452,8 +3661,9 @@ 4F70EED41B726D2E0025A7B3 /* audiodevice */ = { isa = PBXGroup; children = ( - 4F70EED51B726D3F0025A7B3 /* init.lua */, - 4F70EED61B726D3F0025A7B3 /* internal.m */, + 4F70EED51B726D3F0025A7B3 /* audiodevice.lua */, + 4F70EED61B726D3F0025A7B3 /* libaudiodevice.m */, + 4FC93C9B1BCD2D8A0041B820 /* libaudiodevice_watcher.m */, 4FEF4D531C5FBA9800E3B939 /* test_audiodevice.lua */, ); name = audiodevice; @@ -2462,9 +3672,9 @@ 4F70EEEC1B72739D0025A7B3 /* base64 */ = { isa = PBXGroup; children = ( + 4F70EEED1B7273B00025A7B3 /* base64.lua */, + 4F70EEEE1B7273B00025A7B3 /* libbase64.m */, 4FDD8E4F1C834C9400085D7A /* test_base64.lua */, - 4F70EEED1B7273B00025A7B3 /* init.lua */, - 4F70EEEE1B7273B00025A7B3 /* internal.m */, ); name = base64; sourceTree = ""; @@ -2472,9 +3682,10 @@ 4F766E561C48F789007B9D24 /* scripts */ = { isa = PBXGroup; children = ( - 4F766E571C48F79C007B9D24 /* copy_extensions_to_bundle.sh */, - 4F766E581C48F79C007B9D24 /* librelease.sh */, - 4F766E591C48F79C007B9D24 /* release.sh */, + 4FE15C1E27D8A5DD00D37D27 /* build_docs.py */, + 4FE15C1D27D8A5D100D37D27 /* build.sh */, + 4FE15C1C27D8A5D100D37D27 /* libbuild.sh */, + 4FD427CB2621E7F000E8D95F /* update_version_build_numbers.sh */, ); name = scripts; sourceTree = ""; @@ -2482,18 +3693,47 @@ 4F7694571B74C9B400536DE4 /* keycodes */ = { isa = PBXGroup; children = ( - 4F7694581B74C9CA00536DE4 /* init.lua */, - 4F7694591B74C9CA00536DE4 /* internal.m */, + 4F7694581B74C9CA00536DE4 /* keycodes.lua */, + 4F7694591B74C9CA00536DE4 /* libkeycodes.m */, ); name = keycodes; sourceTree = ""; }; + 4F7F3B5E272AF40E00E05732 /* shortcuts */ = { + isa = PBXGroup; + children = ( + 4F7F3B61272AF65F00E05732 /* shortcuts.lua */, + 4F7F3B60272AF57000E05732 /* libshortcuts.m */, + 4F7F3B5F272AF40E00E05732 /* ShortcutsEvents.h */, + ); + name = shortcuts; + path = extensions/shortcuts; + sourceTree = ""; + }; + 4F7F3B79272DE7D000E05732 /* Build Configs */ = { + isa = PBXGroup; + children = ( + 4FF73950273448B30007074E /* Archive-Export-Options.plist */, + 4F7F3B7D272DE9F800E05732 /* Project-Base.xcconfig */, + 4F0C1C78272F4F28002CA157 /* Project-Release.xcconfig */, + 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */, + 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */, + 4F7F3B7E272E009C00E05732 /* Hammerspoon-Base.xcconfig */, + 4F7F3B7A272DE83500E05732 /* Hammerspoon-Debug.xcconfig */, + 4F7F3B7B272DE98800E05732 /* Hammerspoon-Profile.xcconfig */, + 4F7F3B7C272DE99200E05732 /* Hammerspoon-Release.xcconfig */, + 4FF73AA5273AAE290007074E /* Hammerspoon-Test.xcconfig */, + 4FF73AA4273A85820007074E /* hs.xcconfig */, + ); + path = "Build Configs"; + sourceTree = ""; + }; 4F85FECA1CCA8A1400FBBAD7 /* distributednotifications */ = { isa = PBXGroup; children = ( + 4F85FECB1CCA8A2F00FBBAD7 /* distributednotifications.lua */, + 4F85FECC1CCA8A2F00FBBAD7 /* libdistributednotifications.m */, 4F40EC431CCD126F006342D7 /* test_distributednotifications.lua */, - 4F85FECB1CCA8A2F00FBBAD7 /* init.lua */, - 4F85FECC1CCA8A2F00FBBAD7 /* internal.m */, ); name = distributednotifications; sourceTree = ""; @@ -2501,7 +3741,7 @@ 4F9618981E24E5B40048F71D /* sqlite3 */ = { isa = PBXGroup; children = ( - 4F9618991E24E5F70048F71D /* init.lua */, + 4F9618991E24E5F70048F71D /* sqlite3.lua */, 4F96189C1E24E5F70048F71D /* lsqlite3.c */, ); name = sqlite3; @@ -2510,8 +3750,9 @@ 4F9797B41BECD98C00719F3F /* task */ = { isa = PBXGroup; children = ( - 4F9797B51BECD9AD00719F3F /* init.lua */, - 4F9797B61BECD9AD00719F3F /* internal.m */, + 4F9797B51BECD9AD00719F3F /* task.lua */, + 4F9797B61BECD9AD00719F3F /* libtask.m */, + 4FB74B392049A97D00B08851 /* test_task.lua */, ); name = task; sourceTree = ""; @@ -2519,25 +3760,25 @@ 4F98506D1B722C4100F7E909 /* extensions */ = { isa = PBXGroup; children = ( - B8524F23201A874600844F3D /* hid */, 4F6689DF1C2852A100E48AF1 /* _coresetup */, 4F64D8BC1B724C3A00FC4C65 /* alert */, 4FDE05F71B73568E00E9E8EE /* appfinder */, 4FBE2CE31B72542600407788 /* applescript */, 4FBE2CFA1B7261C100407788 /* application */, - 4FBE2D031B7262DE00407788 /* applicationwatcher */, 4F70EED41B726D2E0025A7B3 /* audiodevice */, - 4FC93C9A1BCD2D750041B820 /* audiodevicewatcher */, + D687FC37247B92EE005FA3A5 /* axuielement */, 4F70EEEC1B72739D0025A7B3 /* base64 */, 4FDE05A01B72986200E9E8EE /* battery */, - 4FDE05AF1B72989B00E9E8EE /* batterywatcher */, + 226F95FF27917D4B003DF60F /* blackmagic */, + D62F9EAA2320B7F600FAE188 /* bonjour */, 4FDE05C81B72C23400E9E8EE /* brightness */, 4FDE05DD1B734EB400E9E8EE /* caffeinate */, - 4FDE05F01B734EF300E9E8EE /* caffeinatewatcher */, + 4FF06117274AA5EB00FB15D6 /* camera */, D68615F21E04D5370058A4F2 /* canvas */, 4F51344F1C2EE07700EFD6D4 /* chooser */, D6FD56801C04226C00BAE238 /* console */, 4F4CB3921B7379D3000EA9B6 /* crash */, + 4FF0610D274704B900FB15D6 /* deezer */, 22613FE31F297B3300E05E11 /* dialog */, 4F85FECA1CCA8A1400FBBAD7 /* distributednotifications */, 4FD0ABC91B74B1B000A82496 /* doc */, @@ -2551,6 +3792,7 @@ 4F4CB3E31B739A00000EA9B6 /* geometry */, 4F4CB3E71B739AB4000EA9B6 /* grid */, 4F4CB3F41B73A3D9000EA9B6 /* hash */, + B8524F23201A874600844F3D /* hid */, 4F4CB4071B73A776000EA9B6 /* hints */, 4F4CB4181B73AC35000EA9B6 /* host */, 4F4CB42B1B73AD36000EA9B6 /* hotkey */, @@ -2566,6 +3808,7 @@ 4F6B3EAF1B73DBDB00B2A4DE /* layout */, 4F6B3EBC1B73DC7000B2A4DE /* location */, 4F6B3EC61B73E14200B2A4DE /* logger */, + 4FCBAFBF23B0D343007BA1D0 /* math */, 4F6B3ED71B73E27D00B2A4DE /* menubar */, 4F6B3EDB1B73E55300B2A4DE /* messages */, 22E4D7F61FA747FA00C8CF5C /* midi */, @@ -2576,21 +3819,21 @@ 6AE181151D36E8BE0097211C /* noises */, 4F6B3F0F1B73E9BA00B2A4DE /* notify */, 4C3D55A81C7F05D00023B633 /* osascript */, + 2274781A2787F8CE00DE6894 /* osc */, 4F6B3F241B73EBF000B2A4DE /* pasteboard */, 4F6B3F361B73EE0E00B2A4DE /* pathwatcher */, 4FDD9DC01ED30D89008F14D3 /* plist */, + 2213841E27A105520085CA24 /* razer */, 4F6689E21C288B8900E48AF1 /* redshift */, 4F6B3F471B73EF8A00B2A4DE /* screen */, - 4F6B3F561B73EFD700B2A4DE /* screenwatcher */, 4F6B3F6D1B73F15A00B2A4DE /* settings */, + 22EEC61624926DEA00BAE4DA /* serial */, D61F4A251DCFA63800AEE223 /* sharing */, + 4F7F3B5E272AF40E00E05732 /* shortcuts */, 4CD203A01C6D75950089706D /* socket */, - 4CD96BDF1C73AC21009FF648 /* socketudp */, 4F6B3F7F1B73F48500B2A4DE /* sound */, 4FD0AB201B74855700A82496 /* spaces */, - 4FD0AB221B74856B00A82496 /* spaceswatcher */, D6BB4FA61C169500000DC0A2 /* speech */, - D6BB4FAD1C169565000DC0A2 /* speechlistener */, 4FEA614F1F06544500D71839 /* spoons */, 4F6B3F851B73F86200B2A4DE /* spotify */, D6A212E51DE38F1400998C0B /* spotlight */, @@ -2598,41 +3841,27 @@ 4F2DF3DC1F60468E00742D08 /* streamdeck */, D6F310CB1BDF0DA300045CCD /* styledtext */, 4FD0AB281B74862600A82496 /* tabs */, + 4FF061122747A21A00FB15D6 /* tangent */, 4F9797B41BECD98C00719F3F /* task */, 4FD0AB371B7486A300A82496 /* timer */, 4FD0AB491B749CCD00A82496 /* uielement */, 4FD0AB5E1B749DA300A82496 /* urlevent */, 4FD0AB7D1B74A6D700A82496 /* usb */, - 4FD0AB841B74A72200A82496 /* usbwatcher */, 4FD0AB8A1B74AC1800A82496 /* utf8 */, + 4FF061112747A20900FB15D6 /* vox */, D684BBFA1DFB728500B4D0B8 /* watchable */, + 224BA33323D1ECF200487FDB /* websocket */, D64125571BA07CA9000FB5F8 /* webview */, - D63FBD8F1D1CFB0A005255DD /* webviewdatastore */, - D63FBD901D1CFB1E005255DD /* webviewtoolbar */, - D64B03351BA953E60006C468 /* webviewusercontent */, 4FD0ABA51B74AE5A00A82496 /* wifi */, - 4FD0ABA91B74AE7200A82496 /* wifiwatcher */, 4FD0ABBC1B74AF8B00A82496 /* window */, - 4FD0ABC71B74B0E200A82496 /* windowfilter */, - 4FB602ED1DDBB08300FA751B /* windowlayout */, - 4F11989D1FF040F600D279D8 /* windowswitcher */, ); name = extensions; sourceTree = ""; }; - 4FB602ED1DDBB08300FA751B /* windowlayout */ = { - isa = PBXGroup; - children = ( - 4FB602EE1DDBB0A900FA751B /* layout.lua */, - ); - name = windowlayout; - path = Hammerspoon; - sourceTree = ""; - }; 4FBE2CE31B72542600407788 /* applescript */ = { isa = PBXGroup; children = ( - 4FBE2CE41B72543C00407788 /* init.lua */, + 4FBE2CE41B72543C00407788 /* applescript.lua */, ); name = applescript; sourceTree = ""; @@ -2640,50 +3869,67 @@ 4FBE2CFA1B7261C100407788 /* application */ = { isa = PBXGroup; children = ( - 4FBE2CFB1B7261E500407788 /* application.h */, - 4FBE2CFC1B7261E500407788 /* init.lua */, - 4FBE2CFD1B7261E500407788 /* internal.m */, + 4FBE2CFC1B7261E500407788 /* application.lua */, + 4FBE2CFD1B7261E500407788 /* libapplication.m */, + 4FBE2D041B72630200407788 /* libapplication_watcher.m */, 4C403D651CBE627200EE20ED /* test_application.lua */, ); name = application; sourceTree = ""; }; - 4FBE2D031B7262DE00407788 /* applicationwatcher */ = { + 4FCA05902767645A0089A5FC /* hsdocs */ = { isa = PBXGroup; children = ( - 4FBE2D041B72630200407788 /* watcher.m */, - ); - name = applicationwatcher; + 4FCA05912767645A0089A5FC /* init.lua */, + 4FCA05922767645A0089A5FC /* index.lp */, + 4FCA05932767645A0089A5FC /* gfm.lp */, + 4FCA05942767645A0089A5FC /* module.lp */, + 4FCA05952767645A0089A5FC /* index.md */, + 4FCA05962767645A0089A5FC /* hsminweb */, + 4FCA059A2767645A0089A5FC /* form.lp */, + 4FCA059B2767645A0089A5FC /* common.lp */, + 4FCA059C2767645A0089A5FC /* sample.lp */, + 4FCA059D2767645A0089A5FC /* search.lp */, + ); + name = hsdocs; + path = extensions/doc/hsdocs; sourceTree = ""; }; - 4FC93C9A1BCD2D750041B820 /* audiodevicewatcher */ = { + 4FCA05962767645A0089A5FC /* hsminweb */ = { isa = PBXGroup; children = ( - 4FC93C9B1BCD2D8A0041B820 /* watcher.m */, + 4FCA05972767645A0089A5FC /* templates.md */, + 4FCA05982767645A0089A5FC /* index.md */, + 4FCA05992767645A0089A5FC /* functions.md */, ); - name = audiodevicewatcher; + path = hsminweb; sourceTree = ""; }; - 4FD0AB201B74855700A82496 /* spaces */ = { + 4FCBAFBF23B0D343007BA1D0 /* math */ = { isa = PBXGroup; children = ( - 4FD0AB211B74856600A82496 /* init.lua */, + 4FCBAFD423B0F805007BA1D0 /* math.lua */, + 4FCBAFD223B0F7F1007BA1D0 /* libmath.m */, + 4FCBAFD823B0FC04007BA1D0 /* test_math.lua */, ); - name = spaces; + name = math; sourceTree = ""; }; - 4FD0AB221B74856B00A82496 /* spaceswatcher */ = { + 4FD0AB201B74855700A82496 /* spaces */ = { isa = PBXGroup; children = ( - 4FD0AB231B74857D00A82496 /* watcher.m */, + D6C32CD027DDD68E001AA22E /* libspaces.m */, + D6C32CD127DDD68E001AA22E /* private.h */, + 4FD0AB211B74856600A82496 /* spaces.lua */, + 4FD0AB231B74857D00A82496 /* libspaces_watcher.m */, ); - name = spaceswatcher; + name = spaces; sourceTree = ""; }; 4FD0AB281B74862600A82496 /* tabs */ = { isa = PBXGroup; children = ( - 4FD0AB291B74863000A82496 /* init.lua */, + 4FD0AB291B74863000A82496 /* tabs.lua */, ); name = tabs; sourceTree = ""; @@ -2691,8 +3937,8 @@ 4FD0AB371B7486A300A82496 /* timer */ = { isa = PBXGroup; children = ( - 4FD0AB381B7486B100A82496 /* init.lua */, - 4FD0AB391B7486B100A82496 /* internal.m */, + 4FD0AB381B7486B100A82496 /* timer.lua */, + 4FD0AB391B7486B100A82496 /* libtimer.m */, 4F6CE1301C6B93A90016668E /* test_timer.lua */, ); name = timer; @@ -2701,9 +3947,9 @@ 4FD0AB491B749CCD00A82496 /* uielement */ = { isa = PBXGroup; children = ( - 4FD0AB4A1B749CDD00A82496 /* init.lua */, - 4FD0AB4B1B749CDD00A82496 /* internal.m */, - 4FD0AB4C1B749CDD00A82496 /* uielement.h */, + 4FD0AB4A1B749CDD00A82496 /* uielement.lua */, + 4FD0AB4B1B749CDD00A82496 /* libuielement.m */, + 4F9BA8C823DF3CBE006349F2 /* libuielement_watcher.m */, 4C8F8CB41CC38BC500F72CE5 /* test_uielement.lua */, ); name = uielement; @@ -2712,8 +3958,8 @@ 4FD0AB5E1B749DA300A82496 /* urlevent */ = { isa = PBXGroup; children = ( - 4FD0AB5F1B749DB300A82496 /* init.lua */, - 4FD0AB601B749DB300A82496 /* internal.m */, + 4FD0AB5F1B749DB300A82496 /* urlevent.lua */, + 4FD0AB601B749DB300A82496 /* liburlevent.m */, ); name = urlevent; sourceTree = ""; @@ -2721,24 +3967,17 @@ 4FD0AB7D1B74A6D700A82496 /* usb */ = { isa = PBXGroup; children = ( - 4FD0AB7E1B74A6E600A82496 /* init.lua */, - 4FD0AB7F1B74A6E600A82496 /* internal.m */, + 4FD0AB7E1B74A6E600A82496 /* usb.lua */, + 4FD0AB7F1B74A6E600A82496 /* libusb.m */, + 4FD0AB851B74A73300A82496 /* libusb_watcher.m */, ); name = usb; sourceTree = ""; }; - 4FD0AB841B74A72200A82496 /* usbwatcher */ = { - isa = PBXGroup; - children = ( - 4FD0AB851B74A73300A82496 /* watcher.m */, - ); - name = usbwatcher; - sourceTree = ""; - }; 4FD0AB8A1B74AC1800A82496 /* utf8 */ = { isa = PBXGroup; children = ( - 4FD0AB8B1B74AC2300A82496 /* init.lua */, + 4FD0AB8B1B74AC2300A82496 /* utf8.lua */, ); name = utf8; sourceTree = ""; @@ -2746,43 +3985,35 @@ 4FD0ABA51B74AE5A00A82496 /* wifi */ = { isa = PBXGroup; children = ( - 4FD0ABA61B74AE6A00A82496 /* init.lua */, - 4FD0ABA71B74AE6A00A82496 /* internal.m */, + 4FD0ABA61B74AE6A00A82496 /* wifi.lua */, + 4FD0ABA71B74AE6A00A82496 /* libwifi.m */, + 4FD0ABAA1B74AE8000A82496 /* libwifi_watcher.m */, ); name = wifi; sourceTree = ""; }; - 4FD0ABA91B74AE7200A82496 /* wifiwatcher */ = { - isa = PBXGroup; - children = ( - 4FD0ABAA1B74AE8000A82496 /* watcher.m */, - ); - name = wifiwatcher; - sourceTree = ""; - }; 4FD0ABBC1B74AF8B00A82496 /* window */ = { isa = PBXGroup; children = ( - 4FD0ABBD1B74AF9900A82496 /* init.lua */, - 4FD0ABBE1B74AF9900A82496 /* internal.m */, - 4FD0ABBF1B74AF9900A82496 /* window.h */, + 4FD0ABBD1B74AF9900A82496 /* window.lua */, + 4FD0ABC81B74B0EC00A82496 /* window_filter.lua */, + 4FF73A2A27359C0E0007074E /* window_highlight.lua */, + 4FB602EE1DDBB0A900FA751B /* window_layout.lua */, + 4F11989E1FF0412600D279D8 /* window_switcher.lua */, + 4FF73A2727359BD20007074E /* window_tiling.lua */, + 4FD0ABBE1B74AF9900A82496 /* libwindow.m */, + 4F8779D2200CD56F00E9DB42 /* test_window.lua */, ); name = window; sourceTree = ""; }; - 4FD0ABC71B74B0E200A82496 /* windowfilter */ = { - isa = PBXGroup; - children = ( - 4FD0ABC81B74B0EC00A82496 /* filter.lua */, - ); - name = windowfilter; - sourceTree = ""; - }; 4FD0ABC91B74B1B000A82496 /* doc */ = { isa = PBXGroup; children = ( - D6BCFD1E1EA9E23B00F6D731 /* spoonsupport.lua */, - D67F1B3C1EA9D65E00FEB411 /* builder.lua */, + 4FCA05902767645A0089A5FC /* hsdocs */, + 4FD0ABCA1B74B1C500A82496 /* doc.lua */, + D6BACEA923178EC900110E1E /* libdoc.m */, + D67F1B3C1EA9D65E00FEB411 /* doc_builder.lua */, D64964601CCB32AE0074540B /* autolink.c */, D64964611CCB32AE0074540B /* autolink.h */, D64964621CCB32AE0074540B /* buffer.c */, @@ -2800,8 +4031,8 @@ D649646E1CCB32AE0074540B /* plaintext.h */, D649646F1CCB32AE0074540B /* stack.c */, D64964701CCB32AE0074540B /* stack.h */, - 4FD0ABCA1B74B1C500A82496 /* init.lua */, 4FD0ABCC1B74B1C500A82496 /* makeLuaDocs.lua */, + 4FF73A212735944D0007074E /* lua.json */, ); name = doc; sourceTree = ""; @@ -2809,8 +4040,8 @@ 4FD0ABE21B74B32700A82496 /* eventtap */ = { isa = PBXGroup; children = ( - 4FD0ABE31B74B33500A82496 /* init.lua */, - 4FD0ABE41B74B33500A82496 /* internal.m */, + 4FD0ABE31B74B33500A82496 /* eventtap.lua */, + 4FD0ABE41B74B33500A82496 /* libeventtap.m */, 4FD0ABE61B74B34500A82496 /* eventtap_event.h */, ); name = eventtap; @@ -2819,7 +4050,8 @@ 4FD0ABE81B74B34E00A82496 /* eventtapevent */ = { isa = PBXGroup; children = ( - 4FD0ABE91B74B36000A82496 /* event.m */, + 22652B3F251C391E000FF14D /* gestures */, + 4FD0ABE91B74B36000A82496 /* libeventtap_event.m */, 4FD0ABEA1B74B36000A82496 /* eventtap_event.h */, ); name = eventtapevent; @@ -2829,8 +4061,8 @@ isa = PBXGroup; children = ( 4FD0AC101B74BB0600A82496 /* hs */, - 4FD0AC001B74BA1600A82496 /* init.lua */, - 4FD0AC011B74BA1600A82496 /* internal.m */, + 4FD0AC001B74BA1600A82496 /* ipc.lua */, + 4FD0AC011B74BA1600A82496 /* libipc.m */, ); name = ipc; sourceTree = ""; @@ -2847,10 +4079,11 @@ 4FD0AC221B74C60100A82496 /* httpserver */ = { isa = PBXGroup; children = ( + 4FF73A24273595340007074E /* timeout3 */, + 4FD0AC231B74C62200A82496 /* httpserver.lua */, + D6B772991CCB544B00908A59 /* httpserver_hsminweb.lua */, D6B772981CCB544B00908A59 /* cgilua_compatibility_functions.lua */, - D6B772991CCB544B00908A59 /* hsminweb.lua */, - 4FD0AC231B74C62200A82496 /* init.lua */, - 4FD0AC241B74C62200A82496 /* internal.m */, + 4FD0AC241B74C62200A82496 /* libhttpserver.m */, 4FD0AC251B74C62200A82496 /* mkCertTemplate.sh */, 4FD0AC261B74C62200A82496 /* MYAnonymousIdentity.h */, 4FD0AC271B74C62200A82496 /* MYAnonymousIdentity.m */, @@ -2862,8 +4095,8 @@ 4FDD9DC01ED30D89008F14D3 /* plist */ = { isa = PBXGroup; children = ( - 4FDD9DC11ED30DA2008F14D3 /* init.lua */, - 4FDD9DC21ED30DA2008F14D3 /* internal.m */, + 4FDD9DC11ED30DA2008F14D3 /* plist.lua */, + 4FDD9DC21ED30DA2008F14D3 /* libplist.m */, ); name = plist; sourceTree = ""; @@ -2871,25 +4104,18 @@ 4FDE05A01B72986200E9E8EE /* battery */ = { isa = PBXGroup; children = ( - 4FDE05A11B72987B00E9E8EE /* init.lua */, - 4FDE05A21B72987B00E9E8EE /* internal.m */, + 4FDE05A11B72987B00E9E8EE /* battery.lua */, + 4FDE05A21B72987B00E9E8EE /* libbattery.m */, + 4FDE05B01B7298AD00E9E8EE /* libbattery_watcher.m */, ); name = battery; sourceTree = ""; }; - 4FDE05AF1B72989B00E9E8EE /* batterywatcher */ = { - isa = PBXGroup; - children = ( - 4FDE05B01B7298AD00E9E8EE /* watcher.m */, - ); - name = batterywatcher; - sourceTree = ""; - }; 4FDE05C81B72C23400E9E8EE /* brightness */ = { isa = PBXGroup; children = ( - 4FDE05C91B72C24700E9E8EE /* init.lua */, - 4FDE05CA1B72C24700E9E8EE /* internal.m */, + 4FDE05C91B72C24700E9E8EE /* brightness.lua */, + 4FDE05CA1B72C24700E9E8EE /* libbrightness.m */, 4FCC52CB1E1526A6007F93D0 /* test_brightness.lua */, ); name = brightness; @@ -2898,24 +4124,17 @@ 4FDE05DD1B734EB400E9E8EE /* caffeinate */ = { isa = PBXGroup; children = ( - 4FDE05DE1B734ECC00E9E8EE /* init.lua */, - 4FDE05DF1B734ECC00E9E8EE /* internal.m */, + 4FDE05DE1B734ECC00E9E8EE /* caffeinate.lua */, + 4FDE05DF1B734ECC00E9E8EE /* libcaffeinate.m */, + 4FDE05F11B734F0100E9E8EE /* libcaffeinate_watcher.m */, ); name = caffeinate; sourceTree = ""; }; - 4FDE05F01B734EF300E9E8EE /* caffeinatewatcher */ = { - isa = PBXGroup; - children = ( - 4FDE05F11B734F0100E9E8EE /* watcher.m */, - ); - name = caffeinatewatcher; - sourceTree = ""; - }; 4FDE05F71B73568E00E9E8EE /* appfinder */ = { isa = PBXGroup; children = ( - 4FDE05F81B7356A400E9E8EE /* init.lua */, + 4FDE05F81B7356A400E9E8EE /* appfinder.lua */, 4FDD8E901C8DEE3600085D7A /* test_appfinder.lua */, ); name = appfinder; @@ -2924,7 +4143,7 @@ 4FEA614F1F06544500D71839 /* spoons */ = { isa = PBXGroup; children = ( - 4FEA61501F06546200D71839 /* init.lua */, + 4FEA61501F06546200D71839 /* spoons.lua */, ); name = spoons; sourceTree = ""; @@ -2932,19 +4151,53 @@ 4FEABA551BC7ABDE005E2CFB /* expose */ = { isa = PBXGroup; children = ( - 4FEABA561BC7ABF8005E2CFB /* init.lua */, + 4FEABA561BC7ABF8005E2CFB /* expose.lua */, ); name = expose; sourceTree = ""; }; + 4FF0610D274704B900FB15D6 /* deezer */ = { + isa = PBXGroup; + children = ( + 4FF0610E274704F700FB15D6 /* deezer.lua */, + ); + name = deezer; + sourceTree = ""; + }; + 4FF061112747A20900FB15D6 /* vox */ = { + isa = PBXGroup; + children = ( + 4FF061142747A24600FB15D6 /* vox.lua */, + ); + name = vox; + sourceTree = ""; + }; + 4FF061122747A21A00FB15D6 /* tangent */ = { + isa = PBXGroup; + children = ( + 4FF061132747A23700FB15D6 /* tangent.lua */, + ); + name = tangent; + sourceTree = ""; + }; + 4FF06117274AA5EB00FB15D6 /* camera */ = { + isa = PBXGroup; + children = ( + 4FF06118274AA61000FB15D6 /* camera.lua */, + 4FF06119274AA62300FB15D6 /* libcamera.m */, + ); + name = camera; + path = extensions/camera; + sourceTree = ""; + }; 6AE181151D36E8BE0097211C /* noises */ = { isa = PBXGroup; children = ( + 6AE181181D36E8E50097211C /* noises.lua */, + 6AE181191D36E8E50097211C /* libnoises.m */, 6AE181331D39C9570097211C /* test_noises.lua */, 6AE181161D36E8E50097211C /* detectors.cpp */, 6AE181171D36E8E50097211C /* detectors.h */, - 6AE181181D36E8E50097211C /* init.lua */, - 6AE181191D36E8E50097211C /* internal.m */, 6AE1811A1D36E8E50097211C /* popTemplate.h */, ); name = noises; @@ -2975,12 +4228,14 @@ 9445CA0219083251002568BB = { isa = PBXGroup; children = ( + D659EC7329F8468F00A7D103 /* docs.css */, 4FC09F7B19F99ECE007542A6 /* docs.json */, 9445CA1419083251002568BB /* Hammerspoon */, 4F98506D1B722C4100F7E909 /* extensions */, 4F766E561C48F789007B9D24 /* scripts */, D02F95251A00221C00E28BB2 /* Hammerspoon Tests */, 4F20B52A1C1F1C5B00F52437 /* Hammerspoon UI Tests */, + 22451849281ADF8400997BB0 /* CommandPost Workflow Extension */, 9445CA0D19083251002568BB /* Frameworks */, 9445CA0C19083251002568BB /* Products */, 0024EE4F07CEC6C274F32AB6 /* Pods */, @@ -3003,7 +4258,6 @@ 4FDE05EF1B734EE600E9E8EE /* libcaffeinatewatcher.dylib */, 4F4CB3911B737953000EA9B6 /* libcrash.dylib */, 4F4CB3A61B7385C5000EA9B6 /* libdockicon.dylib */, - 4F4CB3B71B738769000EA9B6 /* libdrawing.dylib */, 4F4CB3CC1B738F1E000EA9B6 /* libfs.dylib */, 4F4CB3F31B73A3A1000EA9B6 /* libhash.dylib */, 4F4CB4051B73A746000EA9B6 /* libhints.dylib */, @@ -3023,7 +4277,7 @@ 4F6B3F551B73EFC100B2A4DE /* libscreenwatcher.dylib */, 4F6B3F6A1B73F0E300B2A4DE /* libsettings.dylib */, 4F6B3F7B1B73F44500B2A4DE /* libsound.dylib */, - 4FD0AB1D1B7484D700A82496 /* libspaceswatcher.dylib */, + 4FD0AB1D1B7484D700A82496 /* libspaces_watcher.dylib */, 4FD0AB341B74867600A82496 /* libtimer.dylib */, 4FD0AB461B749C8E00A82496 /* libuielement.dylib */, 4FD0AB5B1B749D7A00A82496 /* liburlevent.dylib */, @@ -3035,7 +4289,7 @@ 4FD0ABD71B74B2C500A82496 /* libeventtap.dylib */, 4FD0ABE11B74B2FA00A82496 /* libeventtapevent.dylib */, 4FD0ABFE1B74B9DE00A82496 /* libipc.dylib */, - 4FD0AC091B74BACD00A82496 /* hs */, + 4FD0AC091B74BACD00A82496 /* cmdpost */, 4FD0AC211B74C58800A82496 /* libhttpserver.dylib */, 4F7694541B74C96800536DE4 /* libkeycodes.dylib */, D64125641BA07CEA000FB5F8 /* libwebview.dylib */, @@ -3074,6 +4328,22 @@ 4F2DF3EA1F6046F300742D08 /* libstreamdeck.dylib */, 22E4D8021FA7488900C8CF5C /* libmidi.dylib */, B8524F31201A88CD00844F3D /* libhid.dylib */, + D62F9EBB2320B82100FAE188 /* libbonjour.dylib */, + D62F9EC72320B86300FAE188 /* libbonjourservice.dylib */, + 4FCBAFCD23B0D941007BA1D0 /* libmath.dylib */, + 224BA33223D1ECA900487FDB /* libwebsocket.dylib */, + 22DF5D2723B9A9D300C41AE6 /* libpasteboardwatcher.dylib */, + 4F9BA8C723DF3C6B006349F2 /* libuielementwatcher.dylib */, + 22EEC62324926E5100BAE4DA /* libserial.dylib */, + D633A9E9247B9BF2005C88E2 /* libaxuielement.dylib */, + 4F7F3B6C272AF68100E05732 /* libshortcuts.dylib */, + 4FF06124274AA7A200FB15D6 /* libcamera.dylib */, + 4FCA05CA27678B100089A5FC /* libmarkdown.dylib */, + 227478292787F92E00DE6894 /* libosc.dylib */, + 226F95FE27917D3B003DF60F /* libblackmagic.dylib */, + 22FA061B27A160410039C37A /* librazer.dylib */, + D6C32CCF27DDD47F001AA22E /* libspaces.dylib */, + 22451848281ADF8400997BB0 /* CommandPost.appex */, ); name = Products; sourceTree = ""; @@ -3081,6 +4351,8 @@ 9445CA0D19083251002568BB /* Frameworks */ = { isa = PBXGroup; children = ( + 221BCFD32787FFF1000EABD4 /* libF53OSC.a */, + 4FB852342735B02400462DD0 /* LuaSkin.framework */, 22E4D8071FA74BDA00C8CF5C /* libMIKMIDI.a */, D6943FE11EDBF2510057BB26 /* CoreFoundation.framework */, D6943FE21EDBF2510057BB26 /* Foundation.framework */, @@ -3088,8 +4360,6 @@ 6AE1812D1D36E96A0097211C /* CoreAudio.framework */, 6AE1812B1D36E9600097211C /* Accelerate.framework */, 4CBF1C671C91154700B861CE /* libedit.tbd */, - 4F9850E81B722CBF00F7E909 /* LuaSkin.framework */, - 4F9F02B91B3D9568009C32E5 /* LuaSkin.framework */, 5BC78AF8FE9DA0BD317A7528 /* libPods-Hammerspoon.a */, ); name = Frameworks; @@ -3098,6 +4368,9 @@ 9445CA1419083251002568BB /* Hammerspoon */ = { isa = PBXGroup; children = ( + 4F7F3B79272DE7D000E05732 /* Build Configs */, + 4F081E7922D69D5600AB87C1 /* Hammerspoon.entitlements */, + 4F6D9E3623075C05006CC3E4 /* Hammerspoon-dev.entitlements */, 944A2D49198973A400D8DC90 /* Main */, 944A2D481989739B00D8DC90 /* Extras */, ); @@ -3107,15 +4380,29 @@ 944A2D481989739B00D8DC90 /* Extras */ = { isa = PBXGroup; children = ( - E2491A2D1E98CAD80005A439 /* cpPlugin.icns */, + 22F8F64F2F1CE7E40035EC91 /* CommandPost.icon */, + 227C36C626200DBB00224F53 /* cpHUD.icns */, + 227C36C826200DBC00224F53 /* cpLoupedeck.icns */, + 227C36CA26200DBC00224F53 /* cpLoupedeckCT.icns */, + 227C36CE26200DBD00224F53 /* cpLoupedeckLive.icns */, + 227C36C926200DBC00224F53 /* cpLoupedeckPlus.icns */, + 227C36CD26200DBD00224F53 /* cpMIDI.icns */, + 227C36CF26200DBE00224F53 /* cpMonogram.icns */, + 227C36CC26200DBD00224F53 /* cpPasteboard.icns */, + 227C36CB26200DBD00224F53 /* cpShortcuts.icns */, + 227C36C526200DBB00224F53 /* cpSnippets.icns */, + 227C36D026200DBE00224F53 /* cpStreamDeck.icns */, + 227C36C726200DBC00224F53 /* cpTangent.icns */, + 227C36C426200DBB00224F53 /* cpTouchBar.icns */, + 227C36C326200DBB00224F53 /* cpTourBox.icns */, + 227C36C126200D4C00224F53 /* cpPlugin.icns */, + 223A9691211F0EFE00596A79 /* cpCache.icns */, E29DDE451E85524F00313995 /* dsa_pub.pem */, - 4F3978831E89AE7200F30F05 /* Spoon.icns */, - 4F8E84301B90EDBF00C25955 /* statusicon.pdf */, 944A2D3D1989737E00D8DC90 /* Credits.rtf */, - 944A2D3F1989737E00D8DC90 /* Images.xcassets */, 944A2D401989737E00D8DC90 /* CommandPost-Info.plist */, 944A2D411989737E00D8DC90 /* Hammerspoon-Prefix.pch */, 4F5B6E6A1E9E86BB003FC580 /* CommandPost.sdef */, + 4F7F3B70272B3E2900E05732 /* Intents.intentdefinition */, ); name = Extras; sourceTree = ""; @@ -3133,6 +4420,10 @@ 4FA12589201673E400F02FDF /* HSLogger.h */, 4FA125872016739500F02FDF /* HSLogger.m */, 945B65B1198D31FC002D2E30 /* setup.lua */, + 4F9BA8D523DFAB03006349F2 /* HSuicore.h */, + 4F9BA8D623DFAB03006349F2 /* HSuicore.m */, + 4F7F3B75272B3F3700E05732 /* HSExecuteLuaIntentHandler.h */, + 4F7F3B76272B3F3700E05732 /* HSExecuteLuaIntentHandler.m */, 942E71AB19B11288001BA156 /* Preferences Window */, 942050C219907AF700FC4839 /* Console Window */, 945B65B0198D304F002D2E30 /* Auxiliary */, @@ -3143,7 +4434,6 @@ 945B65B0198D304F002D2E30 /* Auxiliary */ = { isa = PBXGroup; children = ( - E2E2B1FB1E8545F9009AEAD6 /* LetsMove */, 9422ACBB19B6163800F06A90 /* MJConfigUtils.h */, 9422ACBC19B6163800F06A90 /* MJConfigUtils.m */, 94A1E5461993AC5C003AEB26 /* MJFileUtils.h */, @@ -3169,8 +4459,9 @@ B8524F23201A874600844F3D /* hid */ = { isa = PBXGroup; children = ( - B8524F24201A875600844F3D /* init.lua */, - B8524F25201A875600844F3D /* internal.m */, + B8524F24201A875600844F3D /* hid.lua */, + B8524F25201A875600844F3D /* libhid.m */, + DAED28EB20B95E8E004602CB /* led.m */, ); name = hid; sourceTree = ""; @@ -3178,28 +4469,39 @@ D02F95251A00221C00E28BB2 /* Hammerspoon Tests */ = { isa = PBXGroup; children = ( + 220B882B27F8F9A3006C0B2B /* HSimage.m */, 4FDD8E511C83612C00085D7A /* HSalert.m */, - 4FEE39D81F0A697400935F90 /* HScrash.m */, - 6AE181311D39C8F10097211C /* HSnoises.m */, 4FDD8E8E1C8DED1C00085D7A /* HSappfinder.m */, 4C403D631CBE5B9F00EE20ED /* HSapplication.m */, 4FEF4D4E1C5FA01000E3B939 /* HSaudiodevice.m */, 4FDD8E4D1C834C8100085D7A /* HSbase64.m */, 4FCC52CD1E1527EF007F93D0 /* HSbrightness.m */, 4FDD8E8C1C8C8BF200085D7A /* HScoresetup.m */, + 4FEE39D81F0A697400935F90 /* HScrash.m */, 4F40EC3F1CCD0FE3006342D7 /* HSdistributednotifications.m */, 4C5BA6B41C85EAEB00E68CA9 /* HSfs.m */, + 4F7BB9D526447C640077A926 /* HShotkey.m */, + 4F2C0C7221BB4A03008F32C1 /* HSinspect.m */, + 4F4F6DA925DB1BB6000187FA /* HSjsonTests.m */, + 4FCBAFD623B0FB95007BA1D0 /* HSmath.m */, + 4FFF9FB425D89B3B00D2997C /* HSmouse.m */, + 6AE181311D39C8F10097211C /* HSnoises.m */, 4CEDEE1B1C640D11005CBF97 /* HSosascript.m */, D02F95281A00221C00E28BB2 /* HSrequire_all.m */, 4FDD8E4B1C6E4FBB00085D7A /* HSscreen.m */, + 22A6626125FC087000AA329E /* HSserial.m */, 4CD64AA81C6F15F400EB6E39 /* HSsocket.m */, - 4C8F8CB21CC38B7E00F72CE5 /* HSuielement.m */, + 4FB74B3A2049A9A600B08851 /* HStask.m */, 4FDD8E871C8AE3ED00085D7A /* HSTestCase.h */, 4FDD8E881C8AE3ED00085D7A /* HSTestCase.m */, 4F6CE1331C6B93E10016668E /* HStimer.m */, + 4C8F8CB21CC38B7E00F72CE5 /* HSuielement.m */, + 22738934248606F0003EBC68 /* HSwebsocket.m */, + 4F8779D0200CD51200E9DB42 /* HSwindow.m */, 4FDD8E7B1C85A05700085D7A /* lsunit.lua */, - 4FDD8E7D1C85A06800085D7A /* testinit.lua */, D02F95261A00221C00E28BB2 /* Supporting Files */, + 4FDD8E7D1C85A06800085D7A /* testinit.lua */, + CE139CAF28B24B6500743C90 /* HShttp.m */, ); path = "Hammerspoon Tests"; sourceTree = ""; @@ -3215,35 +4517,32 @@ D61F4A251DCFA63800AEE223 /* sharing */ = { isa = PBXGroup; children = ( - D61F4A301DCFA6C600AEE223 /* init.lua */, - D61F4A311DCFA6C600AEE223 /* internal.m */, + D61F4A301DCFA6C600AEE223 /* sharing.lua */, + D61F4A311DCFA6C600AEE223 /* libsharing.m */, ); name = sharing; sourceTree = ""; }; - D63FBD8F1D1CFB0A005255DD /* webviewdatastore */ = { - isa = PBXGroup; - children = ( - D6B946431D139C4900177E0C /* datastore.m */, - ); - name = webviewdatastore; - sourceTree = ""; - }; - D63FBD901D1CFB1E005255DD /* webviewtoolbar */ = { + D62F9EAA2320B7F600FAE188 /* bonjour */ = { isa = PBXGroup; children = ( - D63FBD911D1CFB4E005255DD /* toolbar_internal.m */, - D63FBD921D1CFB4E005255DD /* toolbar.lua */, + D62F9EAB2320B81500FAE188 /* bonjour.lua */, + D62F9EAD2320B81500FAE188 /* libbonjoir.m */, + D62F9EAC2320B81500FAE188 /* libbonjour_service.m */, ); - name = webviewtoolbar; + name = bonjour; sourceTree = ""; }; D64125571BA07CA9000FB5F8 /* webview */ = { isa = PBXGroup; children = ( + D64125581BA07CDE000FB5F8 /* webview.lua */, + D63FBD921D1CFB4E005255DD /* webview_toolbar.lua */, + D64125591BA07CDE000FB5F8 /* libwebview.m */, + D6B946431D139C4900177E0C /* libwebview_datastore.m */, + D63FBD911D1CFB4E005255DD /* libwebview_toolbar.m */, + D64B03381BA954660006C468 /* libwebview_usercontent.m */, D64B03361BA9541E0006C468 /* webview.h */, - D64125581BA07CDE000FB5F8 /* init.lua */, - D64125591BA07CDE000FB5F8 /* internal.m */, ); name = webview; sourceTree = ""; @@ -3251,7 +4550,7 @@ D64208931BE3CDC200673724 /* javascript */ = { isa = PBXGroup; children = ( - D64208941BE3CDEB00673724 /* init.lua */, + D64208941BE3CDEB00673724 /* javascript.lua */, ); name = javascript; sourceTree = ""; @@ -3259,30 +4558,23 @@ D6477BFB1C5ED57400F67BBC /* network */ = { isa = PBXGroup; children = ( + D6477C001C5ED5A600F67BBC /* network.lua */, + D6477BFC1C5ED5A600F67BBC /* network_configuration.lua */, + D6477BFE1C5ED5A600F67BBC /* network_host.lua */, + D6477C011C5ED5A600F67BBC /* network_reachability.lua */, + D6A3189A1DDD830A00D9B328 /* network_ping.lua */, D6A318991DDD82E100D9B328 /* ping */, - D6477BFC1C5ED5A600F67BBC /* configuration.lua */, - D6477BFD1C5ED5A600F67BBC /* configurationinternal.m */, - D6477BFE1C5ED5A600F67BBC /* host.lua */, - D6477BFF1C5ED5A600F67BBC /* hostinternal.m */, - D6477C001C5ED5A600F67BBC /* init.lua */, - D6477C011C5ED5A600F67BBC /* reachability.lua */, - D6477C021C5ED5A600F67BBC /* reachabilityinternal.m */, + D6477BFD1C5ED5A600F67BBC /* libnetwork_configuration.m */, + D6477BFF1C5ED5A600F67BBC /* libnetwork_host.m */, + D6477C021C5ED5A600F67BBC /* libnetwork_reachability.m */, ); name = network; sourceTree = ""; }; - D64B03351BA953E60006C468 /* webviewusercontent */ = { - isa = PBXGroup; - children = ( - D64B03381BA954660006C468 /* usercontent.m */, - ); - name = webviewusercontent; - sourceTree = ""; - }; D684BBFA1DFB728500B4D0B8 /* watchable */ = { isa = PBXGroup; children = ( - D684BBFB1DFB72BD00B4D0B8 /* init.lua */, + D684BBFB1DFB72BD00B4D0B8 /* watchable.lua */, ); name = watchable; sourceTree = ""; @@ -3290,30 +4582,36 @@ D68615F21E04D5370058A4F2 /* canvas */ = { isa = PBXGroup; children = ( + D68615F51E04D5990058A4F2 /* canvas.lua */, + D68615F81E04D5990058A4F2 /* canvas_matrix.lua */, + D68615F61E04D5990058A4F2 /* libcanvas.m */, + D68615F71E04D5990058A4F2 /* libcanvas_matrix.m */, D68615F31E04D5990058A4F2 /* Canvas.h */, D68615F41E04D5990058A4F2 /* imageAdditions.m */, - D68615F51E04D5990058A4F2 /* init.lua */, - D68615F61E04D5990058A4F2 /* internal.m */, - D68615F71E04D5990058A4F2 /* matrix_internal.m */, - D68615F81E04D5990058A4F2 /* matrix.lua */, ); name = canvas; sourceTree = ""; }; - D68CE61A1E9C44C600912154 /* locale */ = { + D687FC37247B92EE005FA3A5 /* axuielement */ = { isa = PBXGroup; children = ( - D68CE61B1E9C44E200912154 /* init.lua */, - D68CE61C1E9C44E200912154 /* internal.m */, - ); - name = locale; + D687FC3A247B9317005FA3A5 /* axuielement.lua */, + D687FC39247B9317005FA3A5 /* libaxuielement.m */, + D687FC3B247B9317005FA3A5 /* observer.m */, + D6EE7C7E249B488B0053FB3A /* axtextmarker.m */, + D6EE7C7D249B488B0053FB3A /* ExternalReferences.h */, + D687FC38247B9316005FA3A5 /* common.h */, + D687FC3C247B9317005FA3A5 /* common.m */, + ); + name = axuielement; + path = extensions/axuielement; sourceTree = ""; }; D6A212E51DE38F1400998C0B /* spotlight */ = { isa = PBXGroup; children = ( - D6A212E61DE38F3B00998C0B /* init.lua */, - D6A212E71DE38F3B00998C0B /* internal.m */, + D6A212E61DE38F3B00998C0B /* spotlight.lua */, + D6A212E71DE38F3B00998C0B /* libspotlight.m */, ); name = spotlight; sourceTree = ""; @@ -3321,8 +4619,7 @@ D6A318991DDD82E100D9B328 /* ping */ = { isa = PBXGroup; children = ( - D6A3189A1DDD830A00D9B328 /* init.lua */, - D6A3189B1DDD830A00D9B328 /* internal.m */, + D6A3189B1DDD830A00D9B328 /* libnetwork_ping.m */, D6A3189C1DDD830A00D9B328 /* SimplePing.h */, D6A3189D1DDD830A00D9B328 /* SimplePing.m */, ); @@ -3332,34 +4629,18 @@ D6BB4FA61C169500000DC0A2 /* speech */ = { isa = PBXGroup; children = ( - D6BB4FA71C169539000DC0A2 /* init.lua */, - D6BB4FA81C169539000DC0A2 /* internal.m */, + D6BB4FA71C169539000DC0A2 /* speech.lua */, + D6BB4FA81C169539000DC0A2 /* libspeech.m */, + D6BB4FA91C169539000DC0A2 /* libspeech_listener.m */, ); name = speech; sourceTree = ""; }; - D6BB4FAD1C169565000DC0A2 /* speechlistener */ = { - isa = PBXGroup; - children = ( - D6BB4FA91C169539000DC0A2 /* listener.m */, - ); - name = speechlistener; - sourceTree = ""; - }; - D6F310CA1BDF0D9600045CCD /* color */ = { - isa = PBXGroup; - children = ( - D6F310CC1BDF0DCC00045CCD /* init.lua */, - D6F310CD1BDF0DCC00045CCD /* internal.m */, - ); - name = color; - sourceTree = ""; - }; D6F310CB1BDF0DA300045CCD /* styledtext */ = { isa = PBXGroup; children = ( - D6F310D01BDF0E0000045CCD /* init.lua */, - D6F310D11BDF0E0000045CCD /* internal.m */, + D6F310D01BDF0E0000045CCD /* styledtext.lua */, + D6F310D11BDF0E0000045CCD /* libstyledtext.m */, ); name = styledtext; sourceTree = ""; @@ -3367,25 +4648,22 @@ D6FD56801C04226C00BAE238 /* console */ = { isa = PBXGroup; children = ( - D6FD56811C04228800BAE238 /* init.lua */, - D6FD56821C04228800BAE238 /* internal.m */, + D6FD56811C04228800BAE238 /* console.lua */, + D6FD56821C04228800BAE238 /* libconsole.m */, ); name = console; sourceTree = ""; }; - E2E2B1FB1E8545F9009AEAD6 /* LetsMove */ = { - isa = PBXGroup; - children = ( - E2E2B1FC1E8546FE009AEAD6 /* PFMoveApplication.h */, - E2E2B1FD1E8546FE009AEAD6 /* PFMoveApplication.m */, - ); - name = LetsMove; - path = ..; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ + 224BA32D23D1ECA900487FDB /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 22613FED1F297E0D00E05E11 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -3393,6 +4671,32 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 226F95F927917D3B003DF60F /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 224B923527F6F5C3003F628E /* HSBlackmagicDeviceSpeedEditor.h in Headers */, + 226F960B27917D63003DF60F /* blackmagic.h in Headers */, + 224B922E27F6B846003F628E /* HSBlackmagicDeviceKeyboard.h in Headers */, + 226F960A27917D63003DF60F /* HSBlackmagicDevice.h in Headers */, + 226F960927917D63003DF60F /* HSBlackmagicManager.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 227478242787F92E00DE6894 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 22DF5D2123B9A9D300C41AE6 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 22E4D7FE1FA7488900C8CF5C /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -3400,6 +4704,30 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 22EEC61E24926E5100BAE4DA /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 22FA061327A160410039C37A /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 22654EA727D43CCE004F8214 /* HSRazerDevice.h in Headers */, + 22654EA827D43CCE004F8214 /* HSRazerManager.h in Headers */, + 2290EB2128011DF100CEA572 /* HSRazerOrbweaverDevice.h in Headers */, + 22E59E142852FD270062292D /* HSRazerOrbweaverChromaDevice.h in Headers */, + 2248D34328476C1300A379E3 /* HSRazerTartarusDevice.h in Headers */, + 22654EA927D43CCE004F8214 /* HSRazerTartarusV2Device.h in Headers */, + 22F223EA28AEFB6D00FF081E /* HSRazerTartarusChromaDevice.h in Headers */, + 22E59E0F2852D6F00062292D /* HSRazerNostromoDevice.h in Headers */, + 2248D33E28460E4F00A379E3 /* HSRazerTartarusProDevice.h in Headers */, + 22654EAA27D43CCE004F8214 /* razer.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 4C3D55B71C7F0A880023B633 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -3436,8 +4764,18 @@ buildActionMask = 2147483647; files = ( 4F2DF3F41F605A9B00742D08 /* HSStreamDeckDevice.h in Headers */, + 4F6653F62390351100DEE120 /* NSImage+JPEG.h in Headers */, + 4F6653E6238C36F100DEE120 /* HSStreamDeckDeviceOriginal.h in Headers */, + 4F5560A1279F6A0300B91FD8 /* HSStreamDeckDeviceMk2.h in Headers */, + 22DC4FA9299E140100065BE1 /* HSStreamDeckDevicePlus.h in Headers */, 4F2DF3F81F6170BE00742D08 /* NSImage+BMP.h in Headers */, 4F2DF3F01F605A4900742D08 /* HSStreamDeckManager.h in Headers */, + 4FFB210023CD14A500811E77 /* HSStreamDeckDeviceOriginalV2.h in Headers */, + 4F6653F2238C7BC600DEE120 /* NSImage+Flipped.h in Headers */, + 4FFB20FC23C5E01300811E77 /* HSStreamDeckDeviceXL.h in Headers */, + 220E0B1A29B07EFA003B0BBD /* HSStreamDeckDevicePedal.h in Headers */, + 4F6653EA238C6B6600DEE120 /* HSStreamDeckDeviceMini.h in Headers */, + 4F6653EE238C7A1200DEE120 /* NSImage+Rotated.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3455,14 +4793,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 4F4CB3B31B738769000EA9B6 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - D6F310E31BDF108E00045CCD /* drawing.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 4F4CB3C81B738F1E000EA9B6 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -3475,6 +4805,9 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + D6A6C1162A05F3500018FC9B /* algorithms.h in Headers */, + D6A6C1122A05F3500018FC9B /* byte_order.h in Headers */, + D6A6C1142A05F3500018FC9B /* sha3.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3522,6 +4855,7 @@ 4F5134641C30819000EFD6D4 /* chooser.h in Headers */, 4F0676071C32C0B30088C57C /* HSChooserCell.h in Headers */, 4F0F08091DC0DAAA00082B73 /* HSChooserRootView.h in Headers */, + 4F68B530227C2DD70076C4F8 /* HSChooserVerticallyCenteringTextFieldCell.h in Headers */, 4F3D9D031C3302CB0082E864 /* HSChooser.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -3537,6 +4871,7 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + 4F30430221D5673A00769310 /* EDSunriseSet.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3631,6 +4966,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 4F7F3B67272AF68100E05732 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 4F85FED41CCA918D00FBBAD7 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -3652,59 +4994,85 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 4FBE2CF51B7261A200407788 /* Headers */ = { + 4F9BA8C123DF3C6B006349F2 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 4FBE2CFE1B7261E500407788 /* application.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; - 4FBE2D0B1B72631600407788 /* Headers */ = { + 4FBE2CF51B7261A200407788 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 4FBE2D0C1B72631600407788 /* application.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; - 4FC93CA31BCD872D0041B820 /* Headers */ = { + 4FBE2D0B1B72631600407788 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 4FD0AB191B7484D700A82496 /* Headers */ = { + 4FC93CA31BCD872D0041B820 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 4FD0AB301B74867600A82496 /* Headers */ = { + 4FCA05BD27678B100089A5FC /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + 4FCA05BE27678B100089A5FC /* autolink.h in Headers */, + 4FCA05BF27678B100089A5FC /* buffer.h in Headers */, + 4FCA05C027678B100089A5FC /* houdini.h in Headers */, + 4FCA05C127678B100089A5FC /* html_blocks.h in Headers */, + 4FCA05C227678B100089A5FC /* html.h in Headers */, + 4FCA05C327678B100089A5FC /* markdown.h in Headers */, + 4FCA05C427678B100089A5FC /* plaintext.h in Headers */, + 4FCA05C527678B100089A5FC /* stack.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; - 4FD0AB421B749C8E00A82496 /* Headers */ = { + 4FCBAFC823B0D941007BA1D0 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0AB4E1B749CDD00A82496 /* uielement.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; - 4FD0AB571B749D7A00A82496 /* Headers */ = { + 4FD0AB191B7484D700A82496 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 4FD0AB6A1B74A67500A82496 /* Headers */ = { + 4FD0AB301B74867600A82496 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4FD0AB421B749C8E00A82496 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4FD0AB571B749D7A00A82496 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4FD0AB6A1B74A67500A82496 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( @@ -3736,7 +5104,6 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0ABC11B74AF9900A82496 /* window.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3752,7 +5119,10 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + 22652B3D251C3914000FF14D /* IOHIDEventData.h in Headers */, 4FD0ABEC1B74B36000A82496 /* eventtap_event.h in Headers */, + 22652B3A251C38AC000FF14D /* TouchEvents.h in Headers */, + 22652B3E251C3914000FF14D /* IOHIDEventTypes.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3813,6 +5183,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 4FF0611F274AA7A200FB15D6 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 6AE181231D36E90B0097211C /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -3834,6 +5211,29 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D62F9EB62320B82100FAE188 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D62F9EC22320B86300FAE188 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D633A9E4247B9BF2005C88E2 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D633A9ED247B9C2C005C88E2 /* common.h in Headers */, + D6EE7C7F249B488C0053FB3A /* ExternalReferences.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; D64125601BA07CEA000FB5F8 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -3953,6 +5353,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D6C32CCA27DDD47F001AA22E /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D6C32CD327DDD68E001AA22E /* private.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; D6E164D81F4C262300B85D8A /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -3964,7 +5372,6 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - D6F310E41BDF109900045CCD /* drawing.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3985,6 +5392,40 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ + 22451847281ADF8400997BB0 /* CommandPost */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2245185B281ADF8400997BB0 /* Build configuration list for PBXNativeTarget "CommandPost" */; + buildPhases = ( + 22451844281ADF8400997BB0 /* Sources */, + 22451845281ADF8400997BB0 /* Frameworks */, + 22451846281ADF8400997BB0 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = CommandPost; + productName = CommandPost; + productReference = 22451848281ADF8400997BB0 /* CommandPost.appex */; + productType = "com.apple.product-type.app-extension"; + }; + 224BA32723D1ECA900487FDB /* websocket */ = { + isa = PBXNativeTarget; + buildConfigurationList = 224BA32E23D1ECA900487FDB /* Build configuration list for PBXNativeTarget "websocket" */; + buildPhases = ( + 224BA32823D1ECA900487FDB /* Sources */, + 224BA32B23D1ECA900487FDB /* Frameworks */, + 224BA32D23D1ECA900487FDB /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = websocket; + productName = alert; + productReference = 224BA33223D1ECA900487FDB /* libwebsocket.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; 22613FE81F297E0D00E05E11 /* dialog */ = { isa = PBXNativeTarget; buildConfigurationList = 22613FEE1F297E0D00E05E11 /* Build configuration list for PBXNativeTarget "dialog" */; @@ -4002,6 +5443,57 @@ productReference = 22613FF11F297E0D00E05E11 /* libdialog.dylib */; productType = "com.apple.product-type.library.dynamic"; }; + 226F95F427917D3B003DF60F /* blackmagic */ = { + isa = PBXNativeTarget; + buildConfigurationList = 226F95FA27917D3B003DF60F /* Build configuration list for PBXNativeTarget "blackmagic" */; + buildPhases = ( + 226F95F527917D3B003DF60F /* Sources */, + 226F95F727917D3B003DF60F /* Frameworks */, + 226F95F927917D3B003DF60F /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = blackmagic; + productName = alert; + productReference = 226F95FE27917D3B003DF60F /* libblackmagic.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; + 2274781F2787F92E00DE6894 /* osc */ = { + isa = PBXNativeTarget; + buildConfigurationList = 227478252787F92E00DE6894 /* Build configuration list for PBXNativeTarget "osc" */; + buildPhases = ( + 227478202787F92E00DE6894 /* Sources */, + 227478222787F92E00DE6894 /* Frameworks */, + 227478242787F92E00DE6894 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = osc; + productName = alert; + productReference = 227478292787F92E00DE6894 /* libosc.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; + 22DF5D1C23B9A9D300C41AE6 /* pasteboardwatcher */ = { + isa = PBXNativeTarget; + buildConfigurationList = 22DF5D2323B9A9D300C41AE6 /* Build configuration list for PBXNativeTarget "pasteboardwatcher" */; + buildPhases = ( + 22DF5D1D23B9A9D300C41AE6 /* Sources */, + 22DF5D1F23B9A9D300C41AE6 /* Frameworks */, + 22DF5D2123B9A9D300C41AE6 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = pasteboardwatcher; + productName = alert; + productReference = 22DF5D2723B9A9D300C41AE6 /* libpasteboardwatcher.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; 22E4D7F91FA7488900C8CF5C /* midi */ = { isa = PBXNativeTarget; buildConfigurationList = 22E4D7FF1FA7488900C8CF5C /* Build configuration list for PBXNativeTarget "midi" */; @@ -4019,6 +5511,40 @@ productReference = 22E4D8021FA7488900C8CF5C /* libmidi.dylib */; productType = "com.apple.product-type.library.dynamic"; }; + 22EEC61924926E5100BAE4DA /* serial */ = { + isa = PBXNativeTarget; + buildConfigurationList = 22EEC61F24926E5100BAE4DA /* Build configuration list for PBXNativeTarget "serial" */; + buildPhases = ( + 22EEC61A24926E5100BAE4DA /* Sources */, + 22EEC61C24926E5100BAE4DA /* Frameworks */, + 22EEC61E24926E5100BAE4DA /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = serial; + productName = alert; + productReference = 22EEC62324926E5100BAE4DA /* libserial.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; + 22FA060C27A160410039C37A /* razer */ = { + isa = PBXNativeTarget; + buildConfigurationList = 22FA061727A160410039C37A /* Build configuration list for PBXNativeTarget "razer" */; + buildPhases = ( + 22FA060D27A160410039C37A /* Sources */, + 22FA061127A160410039C37A /* Frameworks */, + 22FA061327A160410039C37A /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = razer; + productName = alert; + productReference = 22FA061B27A160410039C37A /* librazer.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; 4C3D55B01C7F0A880023B633 /* osascript */ = { isa = PBXNativeTarget; buildConfigurationList = 4C3D55B81C7F0A880023B633 /* Build configuration list for PBXNativeTarget "osascript" */; @@ -4156,23 +5682,6 @@ productReference = 4F4CB3A61B7385C5000EA9B6 /* libdockicon.dylib */; productType = "com.apple.product-type.library.dynamic"; }; - 4F4CB3AD1B738769000EA9B6 /* drawing */ = { - isa = PBXNativeTarget; - buildConfigurationList = 4F4CB3B41B738769000EA9B6 /* Build configuration list for PBXNativeTarget "drawing" */; - buildPhases = ( - 4F4CB3AE1B738769000EA9B6 /* Sources */, - 4F4CB3B01B738769000EA9B6 /* Frameworks */, - 4F4CB3B31B738769000EA9B6 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = drawing; - productName = alert; - productReference = 4F4CB3B71B738769000EA9B6 /* libdrawing.dylib */; - productType = "com.apple.product-type.library.dynamic"; - }; 4F4CB3C21B738F1E000EA9B6 /* fs */ = { isa = PBXNativeTarget; buildConfigurationList = 4F4CB3C91B738F1E000EA9B6 /* Build configuration list for PBXNativeTarget "fs" */; @@ -4564,6 +6073,23 @@ productReference = 4F7694541B74C96800536DE4 /* libkeycodes.dylib */; productType = "com.apple.product-type.library.dynamic"; }; + 4F7F3B62272AF68100E05732 /* shortcuts */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4F7F3B68272AF68100E05732 /* Build configuration list for PBXNativeTarget "shortcuts" */; + buildPhases = ( + 4F7F3B63272AF68100E05732 /* Sources */, + 4F7F3B65272AF68100E05732 /* Frameworks */, + 4F7F3B67272AF68100E05732 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = shortcuts; + productName = alert; + productReference = 4F7F3B6C272AF68100E05732 /* libshortcuts.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; 4F85FECF1CCA918D00FBBAD7 /* distributednotifications */ = { isa = PBXNativeTarget; buildConfigurationList = 4F85FED51CCA918D00FBBAD7 /* Build configuration list for PBXNativeTarget "distributednotifications" */; @@ -4615,6 +6141,23 @@ productReference = 4F9797C31BED0AC800719F3F /* libtask.dylib */; productType = "com.apple.product-type.library.dynamic"; }; + 4F9BA8BC23DF3C6B006349F2 /* uielementwatcher */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4F9BA8C323DF3C6B006349F2 /* Build configuration list for PBXNativeTarget "uielementwatcher" */; + buildPhases = ( + 4F9BA8BD23DF3C6B006349F2 /* Sources */, + 4F9BA8BF23DF3C6B006349F2 /* Frameworks */, + 4F9BA8C123DF3C6B006349F2 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = uielementwatcher; + productName = alert; + productReference = 4F9BA8C723DF3C6B006349F2 /* libuielementwatcher.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; 4FBE2CEF1B7261A200407788 /* application */ = { isa = PBXNativeTarget; buildConfigurationList = 4FBE2CF61B7261A200407788 /* Build configuration list for PBXNativeTarget "application" */; @@ -4666,9 +6209,43 @@ productReference = 4FC93CA71BCD872D0041B820 /* libaudiodevicewatcher.dylib */; productType = "com.apple.product-type.library.dynamic"; }; - 4FD0AB141B7484D700A82496 /* spaceswatcher */ = { + 4FCA05AF27678B100089A5FC /* markdown */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4FCA05C627678B100089A5FC /* Build configuration list for PBXNativeTarget "markdown" */; + buildPhases = ( + 4FCA05B027678B100089A5FC /* Sources */, + 4FCA05BB27678B100089A5FC /* Frameworks */, + 4FCA05BD27678B100089A5FC /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = markdown; + productName = alert; + productReference = 4FCA05CA27678B100089A5FC /* libmarkdown.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; + 4FCBAFC323B0D941007BA1D0 /* math */ = { isa = PBXNativeTarget; - buildConfigurationList = 4FD0AB1A1B7484D700A82496 /* Build configuration list for PBXNativeTarget "spaceswatcher" */; + buildConfigurationList = 4FCBAFC923B0D941007BA1D0 /* Build configuration list for PBXNativeTarget "math" */; + buildPhases = ( + 4FCBAFC423B0D941007BA1D0 /* Sources */, + 4FCBAFC623B0D941007BA1D0 /* Frameworks */, + 4FCBAFC823B0D941007BA1D0 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = math; + productName = alert; + productReference = 4FCBAFCD23B0D941007BA1D0 /* libmath.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; + 4FD0AB141B7484D700A82496 /* spaces_watcher */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4FD0AB1A1B7484D700A82496 /* Build configuration list for PBXNativeTarget "spaces_watcher" */; buildPhases = ( 4FD0AB151B7484D700A82496 /* Sources */, 4FD0AB161B7484D700A82496 /* Frameworks */, @@ -4678,9 +6255,9 @@ ); dependencies = ( ); - name = spaceswatcher; + name = spaces_watcher; productName = alert; - productReference = 4FD0AB1D1B7484D700A82496 /* libspaceswatcher.dylib */; + productReference = 4FD0AB1D1B7484D700A82496 /* libspaces_watcher.dylib */; productType = "com.apple.product-type.library.dynamic"; }; 4FD0AB2A1B74867600A82496 /* timer */ = { @@ -4884,7 +6461,7 @@ ); name = cmdpost; productName = hs; - productReference = 4FD0AC091B74BACD00A82496 /* hs */; + productReference = 4FD0AC091B74BACD00A82496 /* cmdpost */; productType = "com.apple.product-type.tool"; }; 4FD0AC171B74C58800A82496 /* httpserver */ = { @@ -5007,6 +6584,23 @@ productReference = 4FDE05EF1B734EE600E9E8EE /* libcaffeinatewatcher.dylib */; productType = "com.apple.product-type.library.dynamic"; }; + 4FF0611A274AA7A200FB15D6 /* camera */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4FF06120274AA7A200FB15D6 /* Build configuration list for PBXNativeTarget "camera" */; + buildPhases = ( + 4FF0611B274AA7A200FB15D6 /* Sources */, + 4FF0611D274AA7A200FB15D6 /* Frameworks */, + 4FF0611F274AA7A200FB15D6 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = camera; + productName = alert; + productReference = 4FF06124274AA7A200FB15D6 /* libcamera.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; 6AE1811E1D36E90B0097211C /* noises */ = { isa = PBXNativeTarget; buildConfigurationList = 6AE181241D36E90B0097211C /* Build configuration list for PBXNativeTarget "noises" */; @@ -5029,26 +6623,46 @@ buildConfigurationList = 9445CA3C19083251002568BB /* Build configuration list for PBXNativeTarget "Hammerspoon" */; buildPhases = ( CDFA91F1078130B13A38C135 /* [CP] Check Pods Manifest.lock */, - 4F251E7F1A49D5BE00AB6103 /* Prepare defines header file */, + 4F251E7F1A49D5BE00AB6103 /* Prepare secret header file */, 4FC09F7A19F99E48007542A6 /* Compile docs.json */, 9445CA0719083251002568BB /* Sources */, 9445CA0819083251002568BB /* Frameworks */, - 4FA81F271B3F2A52000B5537 /* Copy LuaSkin.framework to build/bundle */, - 4FBE2D161B7268DF00407788 /* Copy extensions to bundle */, + 4FB852372735B02400462DD0 /* Embed Frameworks */, + 4FF7395127344D370007074E /* Copy Extension Dylibs */, + 4FF739B1273481C90007074E /* Copy Extension Lua files */, 9445CA0919083251002568BB /* Resources */, E2887C971E4B5BD200468A07 /* Copy CommandPost Files */, E849AEC367EA9502A25B9A7C /* [CP] Embed Pods Frameworks */, - 87D84F4E858960C510223FC4 /* [CP] Copy Pods Resources */, - 4F1CF8D91A47F583001C8AE7 /* Upload binary to Crashlytics */, - 4F7DB3571A5C513F00C22B03 /* Sign app/frameworks */, - 4F6689E61C288FF800E48AF1 /* Assert no stray init.lua's in app bundle */, + 22451857281ADF8400997BB0 /* Embed App Extensions */, + 4F6D9E3523074BC6006CC3E4 /* Update version/build numbers */, + 4FF73A1E2735449D0007074E /* Copy hs manpage */, + 4FCA05A12767689C0089A5FC /* Copy hsdocs Files */, + 4FCA05AB276768EC0089A5FC /* Copy hsdocs minweb Files */, + 32AE478F5CB502BD4652FB25 /* [CP] Copy Pods Resources */, ); buildRules = ( ); dependencies = ( + 22613FF41F297E7F00E05E11 /* PBXTargetDependency */, + 22654EAC27D43CF8004F8214 /* PBXTargetDependency */, + 2274782D2787F9DD00DE6894 /* PBXTargetDependency */, + 226F960E27917DCB003DF60F /* PBXTargetDependency */, + 224BA33623D1EFB300487FDB /* PBXTargetDependency */, + 22EEC62624926EAF00BAE4DA /* PBXTargetDependency */, + D6C32CD527DDD78F001AA22E /* PBXTargetDependency */, + 4FCA05CC27678B330089A5FC /* PBXTargetDependency */, + 4FF06127274AA7D900FB15D6 /* PBXTargetDependency */, + 4F7F3B6F272AF7E100E05732 /* PBXTargetDependency */, + 224BA33623D1EFB300487FDB /* PBXTargetDependency */, + 22EEC62624926EAF00BAE4DA /* PBXTargetDependency */, + D633A9EF247B9C57005C88E2 /* PBXTargetDependency */, + 22DF5D2B23B9AA8C00C41AE6 /* PBXTargetDependency */, + 4F9BA8CB23DF3CCE006349F2 /* PBXTargetDependency */, + 4FCBAFD023B0D98F007BA1D0 /* PBXTargetDependency */, + D62F9ECA2320B90200FAE188 /* PBXTargetDependency */, + D62F9ECC2320B90200FAE188 /* PBXTargetDependency */, 22E4D8051FA748E500C8CF5C /* PBXTargetDependency */, 4FCC42A71F6B800900485268 /* PBXTargetDependency */, - 22613FF41F297E7F00E05E11 /* PBXTargetDependency */, D64C85C81F4C272A004DFA1F /* PBXTargetDependency */, D68CE62B1E9C45A800912154 /* PBXTargetDependency */, 4F9618AD1E24E63D0048F71D /* PBXTargetDependency */, @@ -5112,7 +6726,6 @@ 4FD0ABF11B74B3CE00A82496 /* PBXTargetDependency */, 4FD0ABF31B74B3CE00A82496 /* PBXTargetDependency */, D675906D1BDF12DA00EE9F75 /* PBXTargetDependency */, - 4F4CB3B91B738785000EA9B6 /* PBXTargetDependency */, 4F4CB3AC1B7386B5000EA9B6 /* PBXTargetDependency */, 4F4CB3981B737A7C000EA9B6 /* PBXTargetDependency */, D6FD56921C04230200BAE238 /* PBXTargetDependency */, @@ -5127,6 +6740,7 @@ 4F70EEDE1B726D730025A7B3 /* PBXTargetDependency */, 4FBE2D181B72699100407788 /* PBXTargetDependency */, 4FBE2D021B72624A00407788 /* PBXTargetDependency */, + 22451855281ADF8400997BB0 /* PBXTargetDependency */, ); name = Hammerspoon; productName = Hammerspoon; @@ -5185,6 +6799,57 @@ productReference = D61F4A2F1DCFA67900AEE223 /* libsharing.dylib */; productType = "com.apple.product-type.library.dynamic"; }; + D62F9EB12320B82100FAE188 /* bonjour */ = { + isa = PBXNativeTarget; + buildConfigurationList = D62F9EB72320B82100FAE188 /* Build configuration list for PBXNativeTarget "bonjour" */; + buildPhases = ( + D62F9EB22320B82100FAE188 /* Sources */, + D62F9EB42320B82100FAE188 /* Frameworks */, + D62F9EB62320B82100FAE188 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = bonjour; + productName = alert; + productReference = D62F9EBB2320B82100FAE188 /* libbonjour.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; + D62F9EBD2320B86300FAE188 /* bonjourservice */ = { + isa = PBXNativeTarget; + buildConfigurationList = D62F9EC32320B86300FAE188 /* Build configuration list for PBXNativeTarget "bonjourservice" */; + buildPhases = ( + D62F9EBE2320B86300FAE188 /* Sources */, + D62F9EC02320B86300FAE188 /* Frameworks */, + D62F9EC22320B86300FAE188 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = bonjourservice; + productName = alert; + productReference = D62F9EC72320B86300FAE188 /* libbonjourservice.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; + D633A9DF247B9BF2005C88E2 /* axuielement */ = { + isa = PBXNativeTarget; + buildConfigurationList = D633A9E5247B9BF2005C88E2 /* Build configuration list for PBXNativeTarget "axuielement" */; + buildPhases = ( + D633A9E0247B9BF2005C88E2 /* Sources */, + D633A9E2247B9BF2005C88E2 /* Frameworks */, + D633A9E4247B9BF2005C88E2 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = axuielement; + productName = alert; + productReference = D633A9E9247B9BF2005C88E2 /* libaxuielement.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; D641255A1BA07CEA000FB5F8 /* webview */ = { isa = PBXNativeTarget; buildConfigurationList = D64125611BA07CEA000FB5F8 /* Build configuration list for PBXNativeTarget "webview" */; @@ -5440,6 +7105,23 @@ productReference = D6BB4FC71C1695EC000DC0A2 /* libspeechlistener.dylib */; productType = "com.apple.product-type.library.dynamic"; }; + D6C32CC527DDD47F001AA22E /* spaces */ = { + isa = PBXNativeTarget; + buildConfigurationList = D6C32CCB27DDD47F001AA22E /* Build configuration list for PBXNativeTarget "spaces" */; + buildPhases = ( + D6C32CC627DDD47F001AA22E /* Sources */, + D6C32CC827DDD47F001AA22E /* Frameworks */, + D6C32CCA27DDD47F001AA22E /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = spaces; + productName = alert; + productReference = D6C32CCF27DDD47F001AA22E /* libspaces.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; D6E164D31F4C262300B85D8A /* fsxattr */ = { isa = PBXNativeTarget; buildConfigurationList = D6E164D91F4C262300B85D8A /* Build configuration list for PBXNativeTarget "fsxattr" */; @@ -5515,9 +7197,13 @@ isa = PBXProject; attributes = { CLASSPREFIX = HS; - LastUpgradeCheck = 0800; + DefaultBuildSystemTypeForWorkspace = Latest; + LastUpgradeCheck = 1420; ORGANIZATIONNAME = "LateNite Films"; TargetAttributes = { + 22451847281ADF8400997BB0 = { + CreatedOnToolsVersion = 13.3.1; + }; 4F20B5281C1F1C5B00F52437 = { CreatedOnToolsVersion = 7.2; TestTargetID = 9445CA0A19083251002568BB; @@ -5526,7 +7212,13 @@ CreatedOnToolsVersion = 7.0; }; 9445CA0A19083251002568BB = { + DevelopmentTeam = A5HDJTY9X5; ProvisioningStyle = Manual; + SystemCapabilities = { + com.apple.HardenedRuntime = { + enabled = 1; + }; + }; }; D02F95231A00221C00E28BB2 = { CreatedOnToolsVersion = 6.1; @@ -5536,7 +7228,7 @@ }; buildConfigurationList = 9445CA0619083251002568BB /* Build configuration list for PBXProject "Hammerspoon" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -5554,12 +7246,17 @@ 4FBE2D051B72631600407788 /* applicationwatcher */, 4F70EEC91B726D170025A7B3 /* audiodevice */, 4FC93C9D1BCD872D0041B820 /* audiodevicewatcher */, + D633A9DF247B9BF2005C88E2 /* axuielement */, 4F70EEDF1B7273700025A7B3 /* base64 */, 4FDE05951B72984C00E9E8EE /* battery */, 4FDE05A41B72988C00E9E8EE /* batterywatcher */, + 226F95F427917D3B003DF60F /* blackmagic */, + D62F9EB12320B82100FAE188 /* bonjour */, + D62F9EBD2320B86300FAE188 /* bonjourservice */, 4FDE05BD1B72C22500E9E8EE /* brightness */, 4FDE05D21B734EA600E9E8EE /* caffeinate */, 4FDE05E31B734EE600E9E8EE /* caffeinatewatcher */, + 4FF0611A274AA7A200FB15D6 /* camera */, D68615FE1E04D5D20058A4F2 /* canvas */, D686160B1E04D6630058A4F2 /* canvasmatrix */, 4F5134541C2F315C00EFD6D4 /* chooser */, @@ -5569,7 +7266,6 @@ 22613FE81F297E0D00E05E11 /* dialog */, 4F85FECF1CCA918D00FBBAD7 /* distributednotifications */, 4F4CB39C1B7385C5000EA9B6 /* dockicon */, - 4F4CB3AD1B738769000EA9B6 /* drawing */, D6F310D41BDF0E1700045CCD /* drawing_color */, 4FD0ABCD1B74B2C500A82496 /* eventtap */, 4FD0ABD81B74B2FA00A82496 /* eventtapevent */, @@ -5590,6 +7286,8 @@ 4F6B3E9E1B73D6D300B2A4DE /* json */, 4F76944A1B74C96800536DE4 /* keycodes */, 4F6B3EB11B73DC4500B2A4DE /* location */, + 4FCA05AF27678B100089A5FC /* markdown */, + 4FCBAFC323B0D941007BA1D0 /* math */, 4F6B3EC81B73E23800B2A4DE /* menubar */, 22E4D7F91FA7488900C8CF5C /* midi */, 4F6B3EDD1B73E5AC00B2A4DE /* milight */, @@ -5602,16 +7300,21 @@ 4F6B3F021B73E98E00B2A4DE /* notify */, 4C3D55B01C7F0A880023B633 /* osascript */, 4F6B3F171B73EBB500B2A4DE /* pasteboard */, + 22DF5D1C23B9A9D300C41AE6 /* pasteboardwatcher */, 4F6B3F281B73EDD100B2A4DE /* pathwatcher */, 4FDD9DC31ED30DC9008F14D3 /* plist */, + 22FA060C27A160410039C37A /* razer */, 4F6B3F3A1B73EF4B00B2A4DE /* screen */, 4F6B3F4B1B73EFC100B2A4DE /* screenwatcher */, 4F6B3F601B73F0E300B2A4DE /* settings */, + 22EEC61924926E5100BAE4DA /* serial */, D61F4A261DCFA67900AEE223 /* sharing */, + 4F7F3B62272AF68100E05732 /* shortcuts */, 4CD203A31C6D76E20089706D /* socket */, 4CD96BD21C73ABD2009FF648 /* socketudp */, 4F6B3F711B73F44500B2A4DE /* sound */, - 4FD0AB141B7484D700A82496 /* spaceswatcher */, + 4FD0AB141B7484D700A82496 /* spaces_watcher */, + D6C32CC527DDD47F001AA22E /* spaces */, D6BB4FAE1C16959C000DC0A2 /* speech */, D6BB4FBB1C1695EC000DC0A2 /* speechlistener */, D6A212EA1DE38F5F00998C0B /* spotlight */, @@ -5621,9 +7324,11 @@ 4F9797B91BED0AC800719F3F /* task */, 4FD0AB2A1B74867600A82496 /* timer */, 4FD0AB3C1B749C8E00A82496 /* uielement */, + 4F9BA8BC23DF3C6B006349F2 /* uielementwatcher */, 4FD0AB511B749D7A00A82496 /* urlevent */, 4FD0AB641B74A67500A82496 /* usb */, 4FD0AB6F1B74A68900A82496 /* usbwatcher */, + 224BA32723D1ECA900487FDB /* websocket */, D641255A1BA07CEA000FB5F8 /* webview */, D6B946481D139C7D00177E0C /* webviewdatastore */, D6B946541D139CC500177E0C /* webviewtoolbar */, @@ -5631,11 +7336,24 @@ 4FD0AB8C1B74AE1900A82496 /* wifi */, 4FD0AB971B74AE2800A82496 /* wifiwatcher */, 4FD0ABB11B74AF4E00A82496 /* window */, + 2274781F2787F92E00DE6894 /* osc */, + 22451847281ADF8400997BB0 /* CommandPost */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 22451846281ADF8400997BB0 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2245184D281ADF8400997BB0 /* CommandPostViewController.xib in Resources */, + 22615F33281E3301003ADBC6 /* WorkflowExtension.icns in Resources */, + 2245184B281ADF8400997BB0 /* Assets.xcassets in Resources */, + 226BD80D281CE86200294634 /* CocoaAsyncSocket in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 4F20B5271C1F1C5B00F52437 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -5649,18 +7367,33 @@ buildActionMask = 2147483647; files = ( E29DDE461E85524F00313995 /* dsa_pub.pem in Resources */, - 4F11989F1FF0412600D279D8 /* switcher.lua in Resources */, - 4F3978841E89AE7200F30F05 /* Spoon.icns in Resources */, + 4FF73A252735954D0007074E /* timeout3 in Resources */, + 4FF73A23273594730007074E /* lua.json in Resources */, + 4FF73A2027358DDA0007074E /* HSChooserWindow.xib in Resources */, 4FC09F7C19F99ECE007542A6 /* docs.json in Resources */, - 4F8E84311B90EDBF00C25955 /* statusicon.pdf in Resources */, - 944A2D451989737E00D8DC90 /* Images.xcassets in Resources */, - E2491A2E1E98CAD80005A439 /* cpPlugin.icns in Resources */, + 227C36D126200DBE00224F53 /* cpTourBox.icns in Resources */, + 227C36DB26200DBE00224F53 /* cpMIDI.icns in Resources */, + 227C36DD26200DBE00224F53 /* cpMonogram.icns in Resources */, 944A2D431989737E00D8DC90 /* Credits.rtf in Resources */, + 227C36D426200DBE00224F53 /* cpHUD.icns in Resources */, 944A2D3A1989735300D8DC90 /* MainMenu.xib in Resources */, 949CDC001990759B00906CCE /* ConsoleWindow.xib in Resources */, + 227C36D326200DBE00224F53 /* cpSnippets.icns in Resources */, + 227C36D226200DBE00224F53 /* cpTouchBar.icns in Resources */, 949CDBFE1990747B00906CCE /* PreferencesWindow.xib in Resources */, + 227C36DC26200DBE00224F53 /* cpLoupedeckLive.icns in Resources */, + 227C36D626200DBE00224F53 /* cpLoupedeck.icns in Resources */, + 227C36D726200DBE00224F53 /* cpLoupedeckPlus.icns in Resources */, + 22F8F6502F1CE7E40035EC91 /* CommandPost.icon in Resources */, 945B65B2198D31FC002D2E30 /* setup.lua in Resources */, + 223A9693211F0EFF00596A79 /* cpCache.icns in Resources */, + 227C36D826200DBE00224F53 /* cpLoupedeckCT.icns in Resources */, + 227C36DE26200DBE00224F53 /* cpStreamDeck.icns in Resources */, + 227C36D526200DBE00224F53 /* cpTangent.icns in Resources */, + 227C36D926200DBE00224F53 /* cpShortcuts.icns in Resources */, + 227C36C226200D4D00224F53 /* cpPlugin.icns in Resources */, 4F5B6E6B1E9E86BB003FC580 /* CommandPost.sdef in Resources */, + 227C36DA26200DBE00224F53 /* cpPasteboard.icns in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5668,228 +7401,267 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + CE139CB128B24DAC00743C90 /* http.lua in Resources */, + 4F7BB9D426447C390077A926 /* test_hotkey.lua in Resources */, + 2273893624860C0E003EBC68 /* test_websocket.lua in Resources */, + 4FCBAFD923B1152F007BA1D0 /* test_math.lua in Resources */, 4FDD8E4A1C6E4FA100085D7A /* test_screen.lua in Resources */, 6AE181341D39C9570097211C /* test_noises.lua in Resources */, 4CB349EF1C7F74AD006F0DE0 /* test_javascript.lua in Resources */, 4CD64AAB1C6F168700EB6E39 /* test_socket.lua in Resources */, + 4FFFA01225D89BAF00D2997C /* test_mouse.lua in Resources */, 4FDD8E911C8DEE3700085D7A /* test_appfinder.lua in Resources */, + 4F3042FF21D4DEE300769310 /* test_inspect.lua in Resources */, 4F40EC441CCD126F006342D7 /* test_distributednotifications.lua in Resources */, + 4F8779D3200CD63F00E9DB42 /* test_window.lua in Resources */, 4CE639141C772DC700BB7CD2 /* test_udpsocket.lua in Resources */, 4FCC52CF1E1528D4007F93D0 /* test_brightness.lua in Resources */, 4FEF4D551C5FBC0F00E3B939 /* test_audiodevice.lua in Resources */, + 220B882A27F8F954006C0B2B /* test_image.lua in Resources */, 4C5BA6B71C85EB0400E68CA9 /* test_fs.lua in Resources */, 4C403D661CBE627200EE20ED /* test_application.lua in Resources */, 4F6CE1311C6B93A90016668E /* test_timer.lua in Resources */, 4FDD8E7C1C85A05700085D7A /* lsunit.lua in Resources */, 4FDD8E7E1C85A06800085D7A /* testinit.lua in Resources */, 4FDD8E8B1C8C8BD200085D7A /* test_coresetup.lua in Resources */, + CE139CB328B2539500743C90 /* test_http.lua in Resources */, 4FEE39DB1F0A69D600935F90 /* test_crash.lua in Resources */, 4CB349F31C7F74EE006F0DE0 /* test_applescript.lua in Resources */, + 4FB74B3C2049AB8B00B08851 /* test_task.lua in Resources */, 4FDD8E541C83616100085D7A /* test_alert.lua in Resources */, 4CB349F11C7F74E5006F0DE0 /* test_osascript.lua in Resources */, 4FDD8E501C834C9400085D7A /* test_base64.lua in Resources */, + 4F4F6EBF25DB1C7C000187FA /* test_json.lua in Resources */, 4C8F8CB51CC38BC500F72CE5 /* test_uielement.lua in Resources */, + 22A6626025FC080200AA329E /* test_serial.lua in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 4F1CF8D91A47F583001C8AE7 /* Upload binary to Crashlytics */ = { + 32AE478F5CB502BD4652FB25 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Hammerspoon/Pods-Hammerspoon-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack/CocoaLumberjackPrivacy.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/Sentry/Sentry.bundle", ); - name = "Upload binary to Crashlytics"; + name = "[CP] Copy Pods Resources"; outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/CocoaLumberjackPrivacy.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Sentry.bundle", ); runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/bash; - shellScript = "set -eux\n\nif [ -f ../token-crashlytics -a \"${CONFIGURATION}\" == \"Release\" ] ; then\n echo \"UPLOADING TO CRASHLYTICS\"\n source ../token-crashlytics\n ./Pods/Fabric/run $CRASHLYTICS_API_KEY $CRASHLYTICS_BUILD_SECRET -debug YES\n if [ \"$?\" != \"0\" ]; then\n echo \"CRASHLYTICS UPLOAD FAILED\"\n exit 1\n fi\nelse\n echo \"SKIPPING CRASHLYTICS UPLOAD: No secret token found, or not a Release build\"\nfi"; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Hammerspoon/Pods-Hammerspoon-resources.sh\"\n"; + showEnvVarsInLog = 0; }; - 4F251E7F1A49D5BE00AB6103 /* Prepare defines header file */ = { + 4F251E7F1A49D5BE00AB6103 /* Prepare secret header file */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Prepare defines header file"; + name = "Prepare secret header file"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "set -eux\n\nif [ -f ../token-crashlytics ] ; then\n source ../token-crashlytics\n > Hammerspoon/secrets.h\n echo \"#define CRASHLYTICS_API_KEY \\\"${CRASHLYTICS_API_KEY}\\\"\" >>Hammerspoon/secrets.h\nelse\n > Hammerspoon/secrets.h\nfi"; + shellScript = "set -eux\n\n# Skip this on Profile builds\nif [ \"${CONFIGURATION}\" != \"Release\" ]; then\n > Hammerspoon/secrets.h\n exit 0\nfi\n\nTOKENPATH=\"${HAMMERSPOON_TOKEN_PATH:-..}\"\n\nif [ -f \"${TOKENPATH}/token-sentry-api\" ] ; then\n source \"${TOKENPATH}/token-sentry-api\"\n > Hammerspoon/secrets.h\n echo \"#define SENTRY_API_URL \\\"${SENTRY_API_URL}\\\"\" >>Hammerspoon/secrets.h\nelse\n > Hammerspoon/secrets.h\nfi\n"; }; - 4F6689E61C288FF800E48AF1 /* Assert no stray init.lua's in app bundle */ = { + 4F6D9E3523074BC6006CC3E4 /* Update version/build numbers */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); + inputFileListPaths = ( + ); inputPaths = ( ); - name = "Assert no stray init.lua's in app bundle"; + name = "Update version/build numbers"; + outputFileListPaths = ( + ); outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if [ -f \"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/init.lua\" ]; then\n echo \"ERROR: At least one extension's init.lua has membership of the Hammerspoon.app target. While non-fatal, this should not be the case. Here is the first line of said init.lua file, which might help you find out which extension is at fault. Once you know, in Xcode, select View -> Utilities -> Show File Inspector and untick the file from the Hammerspoon target:\"\n echo -n \" \"\n head -1 \"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/init.lua\"\n exit 1\nfi\n\nexit 0"; + shellScript = "#Update build number with number of git commits if in release mode\nset -eux\n\n./scripts/update_version_build_numbers.sh\n"; }; - 4F7DB3571A5C513F00C22B03 /* Sign app/frameworks */ = { + 4FC09F7A19F99E48007542A6 /* Compile docs.json */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Sign app/frameworks"; + name = "Compile docs.json"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "set -eux\n\nif [ -f ../token-codesign ] ; then\n echo \"SIGNING CODE\"\n source ../token-codesign\n\n if [ \"${CONFIGURATION}\" == \"Debug\" ]; then\n CODESIGN_OPTS=\"--timestamp=none\"\n else\n CODESIGN_OPTS=\"\"\n fi\n\n LOCATION=\"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\n\n # sign Sparkle.framework if this is a release build\n if [ -e \"${LOCATION}/Sparkle.framework/Versions/A\" ] ; then\n codesign ${CODESIGN_OPTS} --verbose --force --sign \"$CODESIGN_IDENTITY\" \"${LOCATION}/Sparkle.framework/Versions/A\"\n fi\n\n # sign Hammerspoon Tests.xctest if this is a test build\n if [ -e \"${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/PlugIns/Hammerspoon Tests.xctest\" ] ; then\n codesign ${CODESIGN_OPTS} --verbose --force --sign \"$CODESIGN_IDENTITY\" \"${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/PlugIns/Hammerspoon Tests.xctest\"\n fi\n\n # sign LuaSkin.framework\n codesign ${CODESIGN_OPTS} --verbose --force --sign \"$CODESIGN_IDENTITY\" \"${LOCATION}/LuaSkin.framework/Versions/A\"\n # sign the Hammerspoon binary\n codesign ${CODESIGN_OPTS} --verbose --force --sign \"$CODESIGN_IDENTITY\" \"${CODESIGNING_FOLDER_PATH}\"\nelse\n echo \"SKIPPING CODE SIGNING\"\nfi"; + shellScript = "set -eux\n\n/bin/mkdir -p ./build\n./scripts/docs/bin/build_docs.py -o ./build/ --json Hammerspoon extensions\n"; }; - 4FA81F271B3F2A52000B5537 /* Copy LuaSkin.framework to build/bundle */ = { + 4FD0AC2E1B74C66200A82496 /* Prepare HammerspoonCertTemplate.h */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Copy LuaSkin.framework to build/bundle"; + name = "Prepare HammerspoonCertTemplate.h"; outputPaths = ( + "$(SRCROOT)/extensions/httpserver/HammerspoonCertTemplate.h", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "set -eux\nrsync -avr \"${BUILT_PRODUCTS_DIR}/LuaSkin.framework\" \"${SRCROOT}\"\nrsync -avr \"${BUILT_PRODUCTS_DIR}/LuaSkin.framework\" \"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}\""; + shellScript = "set -eux\n\nif [ ! -e \"${SRCROOT}/extensions/httpserver/HammerspoonCertTemplate.h\" ]; then\n pushd \"${SRCROOT}/extensions/httpserver/\"\n ./mkCertTemplate.sh\n popd\nfi\n"; }; - 4FBE2D161B7268DF00407788 /* Copy extensions to bundle */ = { + CDFA91F1078130B13A38C135 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); - name = "Copy extensions to bundle"; + name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Hammerspoon-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "set -eux\n\"${SRCROOT}/scripts/copy_extensions_to_bundle.sh\"\nxattr -cr ${BUILT_PRODUCTS_DIR}"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; }; - 4FC09F7A19F99E48007542A6 /* Compile docs.json */ = { + E2887C971E4B5BD200468A07 /* Copy CommandPost Files */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Compile docs.json"; + name = "Copy CommandPost Files"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "set -eux\n\nrm -f build/docs.json\nmake build/docs.json"; + shellScript = "set -eux\necho Copying CommandPost Setup from Source to App Bundle...\ncp -R \"${SRCROOT}/../CommandPost/src/setup/\"* \"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/\"\necho Copying CommandPost Extensions from Source to App Bundle...\ncp -R \"${SRCROOT}/../CommandPost/src/extensions/\"* \"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/extensions/\"\necho Creating plugins folder within App Bundle...\nmkdir -p \"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/plugins/\"\necho Copying CommandPost Plugins from Source to App Bundle...\ncp -R \"${SRCROOT}/../CommandPost/src/plugins/\"* \"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/plugins/\"\nxattr -cr ${BUILT_PRODUCTS_DIR}\n"; }; - 4FD0AC2E1B74C66200A82496 /* Prepare HammerspoonCertTemplate.h */ = { + E849AEC367EA9502A25B9A7C /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Hammerspoon/Pods-Hammerspoon-frameworks.sh", + "${PODS_ROOT}/Sparkle/Sparkle.framework", ); - name = "Prepare HammerspoonCertTemplate.h"; + name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Sparkle.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "set -eux\n\nif [ ! -e \"${SRCROOT}/extensions/httpserver/HammerspoonCertTemplate.h\" ]; then\n pushd \"${SRCROOT}/extensions/httpserver/\"\n ./mkCertTemplate.sh\n popd\nfi"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Hammerspoon/Pods-Hammerspoon-frameworks.sh\"\n"; + showEnvVarsInLog = 0; }; - 87D84F4E858960C510223FC4 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 22451844281ADF8400997BB0 /* Sources */ = { + isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( + 22627C1E2B3E3A1A0029A2F5 /* GCDAsyncSocket.m in Sources */, + 22451851281ADF8400997BB0 /* CommandPostViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Hammerspoon/Pods-Hammerspoon-resources.sh\"\n"; - showEnvVarsInLog = 0; }; - CDFA91F1078130B13A38C135 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; + 224BA32823D1ECA900487FDB /* Sources */ = { + isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Hammerspoon-checkManifestLockResult.txt", + 224BA32A23D1ECA900487FDB /* libwebsocket.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; }; - E2887C971E4B5BD200468A07 /* Copy CommandPost Files */ = { - isa = PBXShellScriptBuildPhase; + 22613FE91F297E0D00E05E11 /* Sources */ = { + isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 22613FF51F2A127E00E05E11 /* libdialog.m in Sources */, ); - inputPaths = ( - ); - name = "Copy CommandPost Files"; - outputPaths = ( + runOnlyForDeploymentPostprocessing = 0; + }; + 226F95F527917D3B003DF60F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 224B923327F6D326003F628E /* HSBlackmagicDeviceSpeedEditor.m in Sources */, + 226F960827917D63003DF60F /* libblackmagic.m in Sources */, + 226F960727917D63003DF60F /* HSBlackmagicManager.m in Sources */, + 224B922F27F6B846003F628E /* HSBlackmagicDeviceKeyboard.m in Sources */, + 226F960C27917D63003DF60F /* HSBlackmagicDevice.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "set -eux\necho Copying CommandPost Setup from Source to App Bundle...\ncp -R \"${SRCROOT}/../CommandPost/src/setup/\"* \"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/\"\necho Copying CommandPost Extensions from Source to App Bundle...\ncp -R \"${SRCROOT}/../CommandPost/src/extensions/\"* \"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/extensions/\"\necho Creating plugins folder within App Bundle...\nmkdir -p \"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/plugins/\"\necho Copying CommandPost Plugins from Source to App Bundle...\ncp -R \"${SRCROOT}/../CommandPost/src/plugins/\"* \"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/plugins/\"\nxattr -cr ${BUILT_PRODUCTS_DIR}"; }; - E849AEC367EA9502A25B9A7C /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; + 227478202787F92E00DE6894 /* Sources */ = { + isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 2274782A2787F94100DE6894 /* libosc.m in Sources */, ); - inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-Hammerspoon/Pods-Hammerspoon-frameworks.sh", - "${PODS_ROOT}/Sparkle/Sparkle.framework", - "${PODS_ROOT}/Sparkle/Sparkle.framework.dSYM", + runOnlyForDeploymentPostprocessing = 0; + }; + 22DF5D1D23B9A9D300C41AE6 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 22DF5D2823B9A9EA00C41AE6 /* libpasteboard_watcher.m in Sources */, ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Sparkle.framework", - "${DWARF_DSYM_FOLDER_PATH}/Sparkle.framework.dSYM", + runOnlyForDeploymentPostprocessing = 0; + }; + 22E4D7FA1FA7488900C8CF5C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 22E4D8031FA748AC00C8CF5C /* libmidi.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Hammerspoon/Pods-Hammerspoon-frameworks.sh\"\n"; - showEnvVarsInLog = 0; }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 22613FE91F297E0D00E05E11 /* Sources */ = { + 22EEC61A24926E5100BAE4DA /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 22613FF51F2A127E00E05E11 /* internal.m in Sources */, + 22EEC62424926E6E00BAE4DA /* libserial.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 22E4D7FA1FA7488900C8CF5C /* Sources */ = { + 22FA060D27A160410039C37A /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 22E4D8031FA748AC00C8CF5C /* internal.m in Sources */, + 2248D34228476C1300A379E3 /* HSRazerTartarusDevice.m in Sources */, + 22F223EB28AEFB6D00FF081E /* HSRazerTartarusChromaDevice.m in Sources */, + 22654EA327D43CB8004F8214 /* HSRazerDevice.m in Sources */, + 22E59E102852D6F00062292D /* HSRazerNostromoDevice.m in Sources */, + 22654EA427D43CB8004F8214 /* HSRazerManager.m in Sources */, + 22E59E132852FD270062292D /* HSRazerOrbweaverChromaDevice.m in Sources */, + 2290EB2028011DF100CEA572 /* HSRazerOrbweaverDevice.m in Sources */, + 22654EA527D43CB8004F8214 /* HSRazerTartarusV2Device.m in Sources */, + 22654EA627D43CB8004F8214 /* librazer.m in Sources */, + 2248D33F28460E4F00A379E3 /* HSRazerTartarusProDevice.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5898,7 +7670,7 @@ buildActionMask = 2147483647; files = ( 4C3D55C01C7F171E0023B633 /* NSAppleEventDescriptor+Parsing.m in Sources */, - 4C3D55BC1C7F0AA90023B633 /* internal.m in Sources */, + 4C3D55BC1C7F0AA90023B633 /* libosascript.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5906,7 +7678,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4CD203B21C6D77750089706D /* internal.m in Sources */, + 4CD203B21C6D77750089706D /* libsocket.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5914,7 +7686,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4CD96BDE1C73AC1C009FF648 /* udp.m in Sources */, + 4CD96BDE1C73AC1C009FF648 /* libsocket_udp.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5930,7 +7702,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F29C23E1C29E0E700B8A69D /* volume.m in Sources */, + 4F29C23E1C29E0E700B8A69D /* libfs_volume.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5938,10 +7710,20 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F2DF3EB1F60471400742D08 /* internal.m in Sources */, + 4F6653F72390351100DEE120 /* NSImage+JPEG.m in Sources */, + 4F6653EF238C7A1200DEE120 /* NSImage+Rotated.m in Sources */, + 220E0B1B29B07EFA003B0BBD /* HSStreamDeckDevicePedal.m in Sources */, + 4F2DF3EB1F60471400742D08 /* libstreamdeck.m in Sources */, + 4FFB210123CD14A500811E77 /* HSStreamDeckDeviceOriginalV2.m in Sources */, + 4FFB20FD23C5E01300811E77 /* HSStreamDeckDeviceXL.m in Sources */, + 22DC4FA8299E140100065BE1 /* HSStreamDeckDevicePlus.m in Sources */, 4F2DF3F51F605A9B00742D08 /* HSStreamDeckDevice.m in Sources */, + 4F5560A2279F6A0300B91FD8 /* HSStreamDeckDeviceMk2.m in Sources */, + 4F6653EB238C6B6600DEE120 /* HSStreamDeckDeviceMini.m in Sources */, + 4F6653E7238C36F100DEE120 /* HSStreamDeckDeviceOriginal.m in Sources */, 4F2DF3F91F6170BE00742D08 /* NSImage+BMP.m in Sources */, 4F2DF3F11F605A4900742D08 /* HSStreamDeckManager.m in Sources */, + 4F6653F3238C7BC600DEE120 /* NSImage+Flipped.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5949,7 +7731,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F4CB3951B737A5B000EA9B6 /* internal.m in Sources */, + 4F4CB3951B737A5B000EA9B6 /* libcrash.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5957,15 +7739,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F4CB3AA1B7385FB000EA9B6 /* internal.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 4F4CB3AE1B738769000EA9B6 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 4F4CB3BD1B7387AA000EA9B6 /* internal.m in Sources */, + 4F4CB3AA1B7385FB000EA9B6 /* libdockicon.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5973,7 +7747,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F4CB3D31B7391D3000EA9B6 /* internal.m in Sources */, + 4F4CB3D31B7391D3000EA9B6 /* libfs.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5981,7 +7755,9 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F4CB3F71B73A4EC000EA9B6 /* internal.m in Sources */, + D6A6C1132A05F3500018FC9B /* sha3.m in Sources */, + D6A6C1152A05F3500018FC9B /* algorithms.m in Sources */, + 4F4CB3F71B73A4EC000EA9B6 /* libhash.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5997,7 +7773,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F4CB41B1B73AC48000EA9B6 /* internal.m in Sources */, + 4F4CB41B1B73AC48000EA9B6 /* libhost.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6005,7 +7781,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F4CB42E1B73AD47000EA9B6 /* internal.m in Sources */, + 4F4CB42E1B73AD47000EA9B6 /* libhotkey.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6013,7 +7789,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F4CB4441B73AFD2000EA9B6 /* internal.m in Sources */, + 4F4CB4441B73AFD2000EA9B6 /* libhttp.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6021,7 +7797,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F4CB4561B73B0D5000EA9B6 /* internal.m in Sources */, + 4F4CB4561B73B0D5000EA9B6 /* libimage.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6031,10 +7807,11 @@ files = ( 4F3D9D081C3314570082E864 /* HSChooserWindow.m in Sources */, 4F0F080A1DC0DAAA00082B73 /* HSChooserRootView.m in Sources */, + 4F68B531227C2DD70076C4F8 /* HSChooserVerticallyCenteringTextFieldCell.m in Sources */, 4F3D9D041C3302CB0082E864 /* HSChooser.m in Sources */, 4F3D9D0C1C34773E0082E864 /* HSChooserTableView.m in Sources */, 4F0676081C32C0B30088C57C /* HSChooserCell.m in Sources */, - 4F51345F1C2F317800EFD6D4 /* internal.m in Sources */, + 4F51345F1C2F317800EFD6D4 /* libchooser.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6042,7 +7819,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3EAE1B73D79100B2A4DE /* internal.m in Sources */, + 4F6B3EAE1B73D79100B2A4DE /* libjson.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6050,7 +7827,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3EBF1B73DC8400B2A4DE /* internal.m in Sources */, + 4F6B3EBF1B73DC8400B2A4DE /* liblocation.m in Sources */, + 4F30430321D5673A00769310 /* EDSunriseSet.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6058,7 +7836,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3EDA1B73E29300B2A4DE /* internal.m in Sources */, + 4F6B3EDA1B73E29300B2A4DE /* libmenubar.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6066,7 +7844,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3EEE1B73E65800B2A4DE /* internal.m in Sources */, + 4F6B3EEE1B73E65800B2A4DE /* libmilight.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6074,7 +7852,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3EFF1B73E7F000B2A4DE /* internal.m in Sources */, + 4F6B3EFF1B73E7F000B2A4DE /* libmouse.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6082,7 +7860,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3F121B73E9C700B2A4DE /* internal.m in Sources */, + 4F6B3F121B73E9C700B2A4DE /* libnotify.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6090,7 +7868,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3F271B73EBFD00B2A4DE /* internal.m in Sources */, + 4F6B3F271B73EBFD00B2A4DE /* libpasteboard.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6098,7 +7876,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3F391B73EE1C00B2A4DE /* internal.m in Sources */, + 4F6B3F391B73EE1C00B2A4DE /* libpathwatcher.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6106,7 +7884,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3F4A1B73EF9A00B2A4DE /* internal.m in Sources */, + 4F6B3F4A1B73EF9A00B2A4DE /* libscreen.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6114,7 +7892,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3F581B73EFE600B2A4DE /* watcher.m in Sources */, + 4F6B3F581B73EFE600B2A4DE /* libscreen_watcher.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6122,7 +7900,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3F701B73F16700B2A4DE /* internal.m in Sources */, + 4F6B3F701B73F16700B2A4DE /* libsettings.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6130,7 +7908,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F6B3F821B73F49500B2A4DE /* internal.m in Sources */, + 4F6B3F821B73F49500B2A4DE /* libsound.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6138,7 +7916,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F70EED71B726D3F0025A7B3 /* internal.m in Sources */, + 4F70EED71B726D3F0025A7B3 /* libaudiodevice.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6146,7 +7924,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F70EEEF1B7273B00025A7B3 /* internal.m in Sources */, + 4F70EEEF1B7273B00025A7B3 /* libbase64.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6154,7 +7932,15 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F76945A1B74C9CA00536DE4 /* internal.m in Sources */, + 4F76945A1B74C9CA00536DE4 /* libkeycodes.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4F7F3B63272AF68100E05732 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4F7F3B6D272AF69D00E05732 /* libshortcuts.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6162,7 +7948,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F85FED91CCA91AC00FBBAD7 /* internal.m in Sources */, + 4F85FED91CCA91AC00FBBAD7 /* libdistributednotifications.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6178,7 +7964,15 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F9797C41BED0ADC00719F3F /* internal.m in Sources */, + 4F9797C41BED0ADC00719F3F /* libtask.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4F9BA8BD23DF3C6B006349F2 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4F9BA8C923DF3CBF006349F2 /* libuielement_watcher.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6186,7 +7980,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FBE2CFF1B7261E500407788 /* internal.m in Sources */, + 4F9BA8D023DF4E58006349F2 /* libapplication.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6194,7 +7988,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FBE2D111B72632800407788 /* watcher.m in Sources */, + 4FBE2D111B72632800407788 /* libapplication_watcher.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6202,7 +7996,31 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FC93CA81BCD87440041B820 /* watcher.m in Sources */, + 4FC93CA81BCD87440041B820 /* libaudiodevice_watcher.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4FCA05B027678B100089A5FC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4FCA05B127678B100089A5FC /* autolink.c in Sources */, + 4FCA05B227678B100089A5FC /* buffer.c in Sources */, + 4FCA05B327678B100089A5FC /* houdini_href_e.c in Sources */, + 4FCA05B427678B100089A5FC /* houdini_html_e.c in Sources */, + 4FCA05B627678B100089A5FC /* html.c in Sources */, + 4FCA05B727678B100089A5FC /* markdown.c in Sources */, + 4FCA05B827678B100089A5FC /* markdown.m in Sources */, + 4FCA05B927678B100089A5FC /* plaintext.c in Sources */, + 4FCA05BA27678B100089A5FC /* stack.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4FCBAFC423B0D941007BA1D0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4FCBAFD323B0F7F1007BA1D0 /* libmath.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6210,7 +8028,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0AB241B74857D00A82496 /* watcher.m in Sources */, + 4FB852922735B9BC00462DD0 /* libspaces_watcher.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6218,7 +8036,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0AB3A1B7486B100A82496 /* internal.m in Sources */, + 4FD0AB3A1B7486B100A82496 /* libtimer.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6226,7 +8044,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0AB4D1B749CDD00A82496 /* internal.m in Sources */, + 4FD0AB4D1B749CDD00A82496 /* libuielement.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6234,7 +8052,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0AB611B749DB300A82496 /* internal.m in Sources */, + 4FD0AB611B749DB300A82496 /* liburlevent.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6242,7 +8060,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0AB801B74A6E600A82496 /* internal.m in Sources */, + 4FD0AB801B74A6E600A82496 /* libusb.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6250,7 +8068,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0AB861B74A73300A82496 /* watcher.m in Sources */, + 4FD0AB861B74A73300A82496 /* libusb_watcher.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6258,7 +8076,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0ABA81B74AE6A00A82496 /* internal.m in Sources */, + 4FD0ABA81B74AE6A00A82496 /* libwifi.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6266,7 +8084,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0ABAB1B74AE8000A82496 /* watcher.m in Sources */, + 4FD0ABAB1B74AE8000A82496 /* libwifi_watcher.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6274,7 +8092,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0ABC01B74AF9900A82496 /* internal.m in Sources */, + 4FD0ABC01B74AF9900A82496 /* libwindow.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6282,7 +8100,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0ABE51B74B33500A82496 /* internal.m in Sources */, + 4FD0ABE51B74B33500A82496 /* libeventtap.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6290,7 +8108,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0ABEB1B74B36000A82496 /* event.m in Sources */, + 22652B39251C38AC000FF14D /* TouchEvents.c in Sources */, + 4FD0ABEB1B74B36000A82496 /* libeventtap_event.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6298,7 +8117,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0AC021B74BA1600A82496 /* internal.m in Sources */, + 4FD0AC021B74BA1600A82496 /* libipc.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6314,7 +8133,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FD0AC291B74C62200A82496 /* internal.m in Sources */, + 4FD0AC291B74C62200A82496 /* libhttpserver.m in Sources */, 4FD0AC2B1B74C62200A82496 /* MYAnonymousIdentity.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -6323,7 +8142,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FDD9DCD1ED30DEA008F14D3 /* internal.m in Sources */, + 4FDD9DCD1ED30DEA008F14D3 /* libplist.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6331,7 +8150,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FDE05A31B72987B00E9E8EE /* internal.m in Sources */, + 4FDE05A31B72987B00E9E8EE /* libbattery.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6339,7 +8158,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FDE05B11B7298AD00E9E8EE /* watcher.m in Sources */, + 4FDE05B11B7298AD00E9E8EE /* libbattery_watcher.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6347,7 +8166,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FDE05CD1B72C24700E9E8EE /* internal.m in Sources */, + 4FDE05CD1B72C24700E9E8EE /* libbrightness.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6355,7 +8174,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FDE05E01B734ECC00E9E8EE /* internal.m in Sources */, + 4FDE05E01B734ECC00E9E8EE /* libcaffeinate.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6363,7 +8182,15 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FDE05F21B734F0100E9E8EE /* watcher.m in Sources */, + 4FDE05F21B734F0100E9E8EE /* libcaffeinate_watcher.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4FF0611B274AA7A200FB15D6 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4FF06125274AA7BA00FB15D6 /* libcamera.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6372,7 +8199,7 @@ buildActionMask = 2147483647; files = ( 6AE181281D36E9260097211C /* detectors.cpp in Sources */, - 6AE1812A1D36E9260097211C /* internal.m in Sources */, + 6AE1812A1D36E9260097211C /* libnoises.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6384,6 +8211,8 @@ 942BF3911989E18600983892 /* MJAutoLaunch.m in Sources */, 9409203119A5940600B9964E /* MJVersionUtils.m in Sources */, 944A2DA91989760400D8DC90 /* MJConsoleWindowController.m in Sources */, + 4F9BA8D723DFAB03006349F2 /* HSuicore.m in Sources */, + 4F7F3B77272B3F3700E05732 /* HSExecuteLuaIntentHandler.m in Sources */, 94A1E5481993AC5C003AEB26 /* MJFileUtils.m in Sources */, 4FEF59431B29A352002344A7 /* HSGrowingTextField.m in Sources */, 949B520319A5576E00ED4F02 /* MJDockIcon.m in Sources */, @@ -6391,12 +8220,11 @@ D077B5BF1A001B5300369B30 /* variables.m in Sources */, 942E71AA19B11176001BA156 /* MJAccessibilityUtils.m in Sources */, 949B520619A55BF400ED4F02 /* MJMenuIcon.m in Sources */, + 4F7F3B71272B3E2900E05732 /* Intents.intentdefinition in Sources */, 943BF0F219A4B43E0017F79D /* MJUserNotificationManager.m in Sources */, 4F5B6E6E1E9E87CE003FC580 /* HSAppleScript.m in Sources */, 9422ACBD19B6163800F06A90 /* MJConfigUtils.m in Sources */, - 943BF0F319A4BC730017F79D /* Images.xcassets in Sources */, 942E71A619B1112F001BA156 /* MJPreferencesWindowController.m in Sources */, - E2E2B1FE1E8546FE009AEAD6 /* PFMoveApplication.m in Sources */, 4FA125882016739500F02FDF /* HSLogger.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -6405,7 +8233,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - B8524F32201A896000844F3D /* internal.m in Sources */, + B8524F32201A896000844F3D /* libhid.m in Sources */, + DAED28EC20B95E8F004602CB /* led.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6413,22 +8242,33 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 4FFF9FB525D89B3B00D2997C /* HSmouse.m in Sources */, 4FDD8E8F1C8DED1C00085D7A /* HSappfinder.m in Sources */, + CE139CB028B24B6500743C90 /* HShttp.m in Sources */, 6AE181321D39C8F10097211C /* HSnoises.m in Sources */, 4FCC52CE1E1527EF007F93D0 /* HSbrightness.m in Sources */, + 22A6626225FC087000AA329E /* HSserial.m in Sources */, 4FDD8E4E1C834C8100085D7A /* HSbase64.m in Sources */, + 4FCBAFD723B0FB95007BA1D0 /* HSmath.m in Sources */, + 4F8779D1200CD51200E9DB42 /* HSwindow.m in Sources */, 4FDD8E8D1C8C8BF200085D7A /* HScoresetup.m in Sources */, 4FDD8E4C1C6E4FBB00085D7A /* HSscreen.m in Sources */, + 4F7BB9D626447C640077A926 /* HShotkey.m in Sources */, + 4F2C0C7321BB4A04008F32C1 /* HSinspect.m in Sources */, 4FEE39D91F0A697400935F90 /* HScrash.m in Sources */, 4C403D641CBE5B9F00EE20ED /* HSapplication.m in Sources */, 4C8F8CB31CC38B7E00F72CE5 /* HSuielement.m in Sources */, D02F95291A00221C00E28BB2 /* HSrequire_all.m in Sources */, 4C5BA6B51C85EAEB00E68CA9 /* HSfs.m in Sources */, + 4F4F6DAA25DB1BB6000187FA /* HSjsonTests.m in Sources */, + 220B882C27F8F9A3006C0B2B /* HSimage.m in Sources */, 4F6CE1341C6B93E10016668E /* HStimer.m in Sources */, 4CD64AA91C6F15F400EB6E39 /* HSsocket.m in Sources */, 4FEF4D4F1C5FA01100E3B939 /* HSaudiodevice.m in Sources */, 4CEDEE1C1C640D11005CBF97 /* HSosascript.m in Sources */, + 22738935248606F0003EBC68 /* HSwebsocket.m in Sources */, 4F40EC401CCD0FE3006342D7 /* HSdistributednotifications.m in Sources */, + 4FB74B3B2049A9A600B08851 /* HStask.m in Sources */, 4FDD8E891C8AE3ED00085D7A /* HSTestCase.m in Sources */, 4FDD8E521C83612D00085D7A /* HSalert.m in Sources */, ); @@ -6438,7 +8278,34 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D61F4A341DCFA6DB00AEE223 /* internal.m in Sources */, + D61F4A341DCFA6DB00AEE223 /* libsharing.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D62F9EB22320B82100FAE188 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D62F9EBC2320B83B00FAE188 /* libbonjoir.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D62F9EBE2320B86300FAE188 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D62F9EC82320B88600FAE188 /* libbonjour_service.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D633A9E0247B9BF2005C88E2 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D633A9EA247B9C1A005C88E2 /* common.m in Sources */, + D6EE7C80249B488C0053FB3A /* axtextmarker.m in Sources */, + D633A9EB247B9C1A005C88E2 /* libaxuielement.m in Sources */, + D633A9EC247B9C1A005C88E2 /* observer.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6446,7 +8313,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D64125661BA07D20000FB5F8 /* internal.m in Sources */, + D64125661BA07D20000FB5F8 /* libwebview.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6454,7 +8321,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D6477C151C5ED61500F67BBC /* configurationinternal.m in Sources */, + D6477C151C5ED61500F67BBC /* libnetwork_configuration.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6462,7 +8329,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D6477C221C5ED82200F67BBC /* reachabilityinternal.m in Sources */, + D6477C221C5ED82200F67BBC /* libnetwork_reachability.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6470,7 +8337,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D6477C301C5ED83C00F67BBC /* hostinternal.m in Sources */, + D6477C301C5ED83C00F67BBC /* libnetwork_host.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6478,15 +8345,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D64964841CCB33120074540B /* autolink.c in Sources */, - D64964851CCB33120074540B /* buffer.c in Sources */, - D64964861CCB33120074540B /* houdini_href_e.c in Sources */, - D64964871CCB33120074540B /* houdini_html_e.c in Sources */, - D64964881CCB33120074540B /* html.c in Sources */, - D64964891CCB33120074540B /* markdown.c in Sources */, - D649648A1CCB33120074540B /* markdown.m in Sources */, - D649648B1CCB33120074540B /* plaintext.c in Sources */, - D649648C1CCB33120074540B /* stack.c in Sources */, + D6BACEAA23178ECA00110E1E /* libdoc.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6494,7 +8353,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D64B03471BA954A20006C468 /* usercontent.m in Sources */, + D64B03471BA954A20006C468 /* libwebview_usercontent.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6503,7 +8362,7 @@ buildActionMask = 2147483647; files = ( D68616081E04D60A0058A4F2 /* imageAdditions.m in Sources */, - D68616091E04D60A0058A4F2 /* internal.m in Sources */, + D68616091E04D60A0058A4F2 /* libcanvas.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6511,7 +8370,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D68616171E04D6BA0058A4F2 /* matrix_internal.m in Sources */, + D68616171E04D6BA0058A4F2 /* libcanvas_matrix.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6519,7 +8378,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D68CE6291E9C457400912154 /* internal.m in Sources */, + D68CE6291E9C457400912154 /* libhost_locale.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6527,7 +8386,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D6A212F41DE38F8200998C0B /* internal.m in Sources */, + D6A212F41DE38F8200998C0B /* libspotlight.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6535,7 +8394,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D6A318AB1DDD836800D9B328 /* internal.m in Sources */, + D6A318AB1DDD836800D9B328 /* libnetwork_ping.m in Sources */, D6A318AC1DDD836800D9B328 /* SimplePing.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -6544,7 +8403,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D6B946531D139CB800177E0C /* datastore.m in Sources */, + D6B946531D139CB800177E0C /* libwebview_datastore.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6552,7 +8411,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D63FBD951D1CFB77005255DD /* toolbar_internal.m in Sources */, + D63FBD951D1CFB77005255DD /* libwebview_toolbar.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6560,7 +8419,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D6BB4FBA1C1695BF000DC0A2 /* internal.m in Sources */, + D6BB4FBA1C1695BF000DC0A2 /* libspeech.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6568,7 +8427,15 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D6BB4FC81C169605000DC0A2 /* listener.m in Sources */, + D6BB4FC81C169605000DC0A2 /* libspeech_listener.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D6C32CC627DDD47F001AA22E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D6C32CD227DDD68E001AA22E /* libspaces.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6576,7 +8443,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D6E164DD1F4C264D00B85D8A /* xattr.m in Sources */, + D6E164DD1F4C264D00B85D8A /* libfs_xattr.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6584,7 +8451,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D6F310E11BDF0E5F00045CCD /* internal.m in Sources */, + D6F310E11BDF0E5F00045CCD /* libdrawing_color.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6592,7 +8459,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D6F310F01BDF113900045CCD /* internal.m in Sources */, + D6F310F01BDF113900045CCD /* libstyledtext.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6600,23 +8467,58 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D6FD56901C0422DE00BAE238 /* internal.m in Sources */, + D6FD56901C0422DE00BAE238 /* libconsole.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 22451855281ADF8400997BB0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 22451847281ADF8400997BB0 /* CommandPost */; + targetProxy = 22451854281ADF8400997BB0 /* PBXContainerItemProxy */; + }; + 224BA33623D1EFB300487FDB /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 224BA32723D1ECA900487FDB /* websocket */; + targetProxy = 224BA33523D1EFB300487FDB /* PBXContainerItemProxy */; + }; 22613FF41F297E7F00E05E11 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 22613FE81F297E0D00E05E11 /* dialog */; targetProxy = 22613FF31F297E7F00E05E11 /* PBXContainerItemProxy */; }; + 22654EAC27D43CF8004F8214 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 22FA060C27A160410039C37A /* razer */; + targetProxy = 22654EAB27D43CF8004F8214 /* PBXContainerItemProxy */; + }; + 226F960E27917DCB003DF60F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 226F95F427917D3B003DF60F /* blackmagic */; + targetProxy = 226F960D27917DCB003DF60F /* PBXContainerItemProxy */; + }; + 2274782D2787F9DD00DE6894 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2274781F2787F92E00DE6894 /* osc */; + targetProxy = 2274782C2787F9DD00DE6894 /* PBXContainerItemProxy */; + }; + 22DF5D2B23B9AA8C00C41AE6 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 22DF5D1C23B9A9D300C41AE6 /* pasteboardwatcher */; + targetProxy = 22DF5D2A23B9AA8C00C41AE6 /* PBXContainerItemProxy */; + }; 22E4D8051FA748E500C8CF5C /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 22E4D7F91FA7488900C8CF5C /* midi */; targetProxy = 22E4D8041FA748E500C8CF5C /* PBXContainerItemProxy */; }; + 22EEC62624926EAF00BAE4DA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 22EEC61924926E5100BAE4DA /* serial */; + targetProxy = 22EEC62524926EAF00BAE4DA /* PBXContainerItemProxy */; + }; 4C1CA6B11C6D9D5E00379CCE /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 4CD203A31C6D76E20089706D /* socket */; @@ -6652,11 +8554,6 @@ target = 4F4CB39C1B7385C5000EA9B6 /* dockicon */; targetProxy = 4F4CB3AB1B7386B5000EA9B6 /* PBXContainerItemProxy */; }; - 4F4CB3B91B738785000EA9B6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 4F4CB3AD1B738769000EA9B6 /* drawing */; - targetProxy = 4F4CB3B81B738785000EA9B6 /* PBXContainerItemProxy */; - }; 4F4CB3CE1B738FBC000EA9B6 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 4F4CB3C21B738F1E000EA9B6 /* fs */; @@ -6772,6 +8669,11 @@ target = 4F76944A1B74C96800536DE4 /* keycodes */; targetProxy = 4F7694551B74C98A00536DE4 /* PBXContainerItemProxy */; }; + 4F7F3B6F272AF7E100E05732 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4F7F3B62272AF68100E05732 /* shortcuts */; + targetProxy = 4F7F3B6E272AF7E100E05732 /* PBXContainerItemProxy */; + }; 4F85FEDB1CCAB22400FBBAD7 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 4F85FECF1CCA918D00FBBAD7 /* distributednotifications */; @@ -6787,6 +8689,11 @@ target = 4F9797B91BED0AC800719F3F /* task */; targetProxy = 4F9797C61BED0B5000719F3F /* PBXContainerItemProxy */; }; + 4F9BA8CB23DF3CCE006349F2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4F9BA8BC23DF3C6B006349F2 /* uielementwatcher */; + targetProxy = 4F9BA8CA23DF3CCE006349F2 /* PBXContainerItemProxy */; + }; 4FBE2D021B72624A00407788 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 4FBE2CEF1B7261A200407788 /* application */; @@ -6802,6 +8709,16 @@ target = 4FC93C9D1BCD872D0041B820 /* audiodevicewatcher */; targetProxy = 4FC93CAC1BCD87A60041B820 /* PBXContainerItemProxy */; }; + 4FCA05CC27678B330089A5FC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4FCA05AF27678B100089A5FC /* markdown */; + targetProxy = 4FCA05CB27678B330089A5FC /* PBXContainerItemProxy */; + }; + 4FCBAFD023B0D98F007BA1D0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4FCBAFC323B0D941007BA1D0 /* math */; + targetProxy = 4FCBAFCF23B0D98F007BA1D0 /* PBXContainerItemProxy */; + }; 4FCC42A71F6B800900485268 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 4F2DF3E11F6046F300742D08 /* streamdeck */; @@ -6809,7 +8726,7 @@ }; 4FD0AB1F1B74852B00A82496 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 4FD0AB141B7484D700A82496 /* spaceswatcher */; + target = 4FD0AB141B7484D700A82496 /* spaces_watcher */; targetProxy = 4FD0AB1E1B74852B00A82496 /* PBXContainerItemProxy */; }; 4FD0AB361B74869600A82496 /* PBXTargetDependency */ = { @@ -6907,6 +8824,11 @@ target = 4FDE05E31B734EE600E9E8EE /* caffeinatewatcher */; targetProxy = 4FDE05F51B73501800E9E8EE /* PBXContainerItemProxy */; }; + 4FF06127274AA7D900FB15D6 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4FF0611A274AA7A200FB15D6 /* camera */; + targetProxy = 4FF06126274AA7D900FB15D6 /* PBXContainerItemProxy */; + }; 6AE181301D36E9A30097211C /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 6AE1811E1D36E90B0097211C /* noises */; @@ -6927,6 +8849,21 @@ target = D61F4A261DCFA67900AEE223 /* sharing */; targetProxy = D61F4A351DCFA71E00AEE223 /* PBXContainerItemProxy */; }; + D62F9ECA2320B90200FAE188 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D62F9EB12320B82100FAE188 /* bonjour */; + targetProxy = D62F9EC92320B90200FAE188 /* PBXContainerItemProxy */; + }; + D62F9ECC2320B90200FAE188 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D62F9EBD2320B86300FAE188 /* bonjourservice */; + targetProxy = D62F9ECB2320B90200FAE188 /* PBXContainerItemProxy */; + }; + D633A9EF247B9C57005C88E2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D633A9DF247B9BF2005C88E2 /* axuielement */; + targetProxy = D633A9EE247B9C57005C88E2 /* PBXContainerItemProxy */; + }; D64125681BA07D35000FB5F8 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = D641255A1BA07CEA000FB5F8 /* webview */; @@ -7017,6 +8954,11 @@ target = D6BB4FBB1C1695EC000DC0A2 /* speechlistener */; targetProxy = D6BB4FCB1C16965C000DC0A2 /* PBXContainerItemProxy */; }; + D6C32CD527DDD78F001AA22E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D6C32CC527DDD47F001AA22E /* spaces */; + targetProxy = D6C32CD427DDD78F001AA22E /* PBXContainerItemProxy */; + }; D6FD56921C04230200BAE238 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = D6FD56851C0422B400BAE238 /* console */; @@ -7025,718 +8967,1312 @@ /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ - 22613FEF1F297E0D00E05E11 /* Debug */ = { + 220A07012788F97D0068DEA2 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - }; - name = Debug; - }; - 22613FF01F297E0D00E05E11 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; + PRODUCT_NAME = dialog; + WARNING_CFLAGS = ( + "-Weverything", + "-Wno-direct-ivar-access", + "-Wno-documentation-unknown-command", + "$(inherited)", + ); }; name = Release; }; - 22E4D8001FA7488900C8CF5C /* Debug */ = { + 22451858281ADF8400997BB0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; + ADDITIONAL_SDKS = /Library/Developer/SDKs/WorkflowExtensionSDK.sdk; + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_ENTITLEMENTS = "CommandPost Workflow Extension/Extras/CommandPost.entitlements"; + CODE_SIGN_IDENTITY = "Developer ID Application"; + CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = A5HDJTY9X5; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; + FRAMEWORK_SEARCH_PATHS = ( + /Library/Frameworks, + "$(inherited)", + ); + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + GENERATE_INFOPLIST_FILE = YES; + HEADER_SEARCH_PATHS = ( + /usr/include, + "$(inherited)", + ); + INFOPLIST_FILE = "CommandPost Workflow Extension/Extras/Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = CommandPost; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © LateNite Films Pty Ltd 2016-2025. All Rights Reserved."; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@executable_path/../../../../Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + /usr/lib, + "$(inherited)", + ); + MACH_O_TYPE = mh_execute; + MACOSX_DEPLOYMENT_TARGET = 12.3; + MARKETING_VERSION = 1.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = ( + "-fapplication-extension", + "-e", + _ProExtensionMain, + "-lProExtension", + ); + PRODUCT_BUNDLE_IDENTIFIER = org.latenitefilms.CommandPost.WorkflowExtension; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Pods/Headers/Public/**"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OBJC_BRIDGING_HEADER = "CommandPost/CommandPost-Bridging-Header.h"; + WRAPPER_EXTENSION = appex; }; name = Debug; }; - 22E4D8011FA7488900C8CF5C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Pods/Headers/Public/**"; - }; - name = Release; - }; - 4C3D55B91C7F0A880023B633 /* Debug */ = { + 22451859281ADF8400997BB0 /* Profile */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; + ADDITIONAL_SDKS = /Library/Developer/SDKs/WorkflowExtensionSDK.sdk; + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_ENTITLEMENTS = "CommandPost Workflow Extension/Extras/CommandPost.entitlements"; + CODE_SIGN_IDENTITY = "Developer ID Application"; + CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", + DEVELOPMENT_TEAM = A5HDJTY9X5; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + /Library/Frameworks, + "$(inherited)", + ); + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + GENERATE_INFOPLIST_FILE = YES; + HEADER_SEARCH_PATHS = ( + /usr/include, + "$(inherited)", + ); + INFOPLIST_FILE = "CommandPost Workflow Extension/Extras/Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = CommandPost; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © LateNite Films Pty Ltd 2016-2025. All Rights Reserved."; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@executable_path/../../../../Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + /usr/lib, + "$(inherited)", + ); + MACH_O_TYPE = mh_execute; + MACOSX_DEPLOYMENT_TARGET = 12.3; + MARKETING_VERSION = 1.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + OTHER_LDFLAGS = ( + "-fapplication-extension", + "-e", + _ProExtensionMain, + "-lProExtension", + ); + PRODUCT_BUNDLE_IDENTIFIER = org.latenitefilms.CommandPost.WorkflowExtension; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OBJC_BRIDGING_HEADER = "CommandPost/CommandPost-Bridging-Header.h"; + WRAPPER_EXTENSION = appex; + }; + name = Profile; + }; + 2245185A281ADF8400997BB0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ADDITIONAL_SDKS = /Library/Developer/SDKs/WorkflowExtensionSDK.sdk; + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_ENTITLEMENTS = "CommandPost Workflow Extension/Extras/CommandPost.entitlements"; + CODE_SIGN_STYLE = Manual; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = A5HDJTY9X5; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + /Library/Frameworks, + "$(inherited)", + ); + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + GENERATE_INFOPLIST_FILE = YES; + HEADER_SEARCH_PATHS = ( + /usr/include, + "$(inherited)", + ); + INFOPLIST_FILE = "CommandPost Workflow Extension/Extras/Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = CommandPost; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © LateNite Films Pty Ltd 2016-2025. All Rights Reserved."; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@executable_path/../../../../Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + /usr/lib, + "$(inherited)", + ); + MACH_O_TYPE = mh_execute; + MACOSX_DEPLOYMENT_TARGET = 12.3; + MARKETING_VERSION = 1.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + OTHER_LDFLAGS = ( + "-fapplication-extension", + "-e", + _ProExtensionMain, + "-lProExtension", + ); + PRODUCT_BUNDLE_IDENTIFIER = org.latenitefilms.CommandPost.WorkflowExtension; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OBJC_BRIDGING_HEADER = "CommandPost/CommandPost-Bridging-Header.h"; + WRAPPER_EXTENSION = appex; + }; + name = Release; + }; + 224BA32F23D1ECA900487FDB /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 224BA33023D1ECA900487FDB /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 224BA33123D1ECA900487FDB /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 22613FEF1F297E0D00E05E11 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = dialog; + WARNING_CFLAGS = ( + "-Weverything", + "-Wno-direct-ivar-access", + "-Wno-documentation-unknown-command", + "$(inherited)", + ); + }; + name = Debug; + }; + 226F95FB27917D3B003DF60F /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 226F95FC27917D3B003DF60F /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 226F95FD27917D3B003DF60F /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 227478262787F92E00DE6894 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 227478272787F92E00DE6894 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 227478282787F92E00DE6894 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 22DF5D2423B9A9D300C41AE6 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 22DF5D2523B9A9D300C41AE6 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 22DF5D2623B9A9D300C41AE6 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 22E4D8001FA7488900C8CF5C /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + WARNING_CFLAGS = ( + "-Weverything", + "-Wno-documentation-unknown-command", + "-Wno-direct-ivar-access", + "-Wno-nullable-to-nonnull-conversion", + "-Wno-missing-variable-declarations", + "-Wno-sign-compare", + "-Wno-missing-variable-declarations", + "$(inherited)", + ); + }; + name = Debug; + }; + 22E4D8011FA7488900C8CF5C /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + WARNING_CFLAGS = ( + "-Weverything", + "-Wno-documentation-unknown-command", + "-Wno-direct-ivar-access", + "-Wno-nullable-to-nonnull-conversion", + "-Wno-missing-variable-declarations", + "-Wno-sign-compare", + "-Wno-missing-variable-declarations", + "$(inherited)", + ); + }; + name = Release; + }; + 22EEC62024926E5100BAE4DA /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 22EEC62124926E5100BAE4DA /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 22EEC62224926E5100BAE4DA /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 22FA061827A160410039C37A /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 22FA061927A160410039C37A /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 22FA061A27A160410039C37A /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 4C3D55B91C7F0A880023B633 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 4C3D55BA1C7F0A880023B633 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 4CD203AF1C6D76E20089706D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 4CD203B01C6D76E20089706D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 4CD96BDA1C73ABD2009FF648 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 4CD96BDB1C73ABD2009FF648 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 4F04548C20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F7F3B7D272DE9F800E05732 /* Project-Base.xcconfig */; + buildSettings = { + }; + name = Profile; + }; + 4F04548D20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F7F3B7B272DE98800E05732 /* Hammerspoon-Profile.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = CommandPost; + INFOPLIST_FILE = "Hammerspoon/CommandPost-Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MARKETING_VERSION = 1.2.17; + PRODUCT_BUNDLE_IDENTIFIER = org.latenitefilms.CommandPost; + PRODUCT_NAME = CommandPost; + }; + name = Profile; + }; + 4F04548E20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_WARN_UNREACHABLE_CODE = YES; + COMBINE_HIDPI_IMAGES = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(DEVELOPER_FRAMEWORKS_DIR)", + "$(inherited)", + ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = "Hammerspoon Tests/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_BUNDLE_IDENTIFIER = "org.hammerspoon.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CommandPost.app/Contents/MacOS/CommandPost"; + WARNING_CFLAGS = ( + "-Wno-cstring-format-directive", + "-Wno-padded", + "-Wno-objc-missing-property-synthesis", + "-Wno-gnu-statement-expression", + ); + }; + name = Profile; + }; + 4F04548F20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_WARN_UNREACHABLE_CODE = YES; + COMBINE_HIDPI_IMAGES = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = HammerspoonUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_BUNDLE_IDENTIFIER = org.hammerspoon.HammerspoonUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_TARGET_NAME = Hammerspoon; + USES_XCTRUNNER = YES; + }; + name = Profile; + }; + 4F04549020F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F04549120F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F04549220F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F04549320F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F04549420F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F04549520F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F04549620F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F04549720F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F04549820F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F04549920F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F04549A20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F04549B20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F04549C20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F04549D20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F04549E20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F04549F20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454A020F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = dialog; + WARNING_CFLAGS = ( + "-Weverything", + "-Wno-direct-ivar-access", + "-Wno-documentation-unknown-command", + "$(inherited)", + ); + }; + name = Profile; + }; + 4F0454A120F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454A220F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454A420F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454A520F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454A620F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454A720F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454A820F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454A920F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454AA20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454AB20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454AC20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454AD20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454AE20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454AF20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454B020F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454B120F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454B220F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454B320F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454B420F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4FF73AA4273A85820007074E /* hs.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454B520F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454B620F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454B720F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454B820F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454B920F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + WARNING_CFLAGS = ( + "-Weverything", + "-Wno-documentation-unknown-command", + "-Wno-direct-ivar-access", + "-Wno-nullable-to-nonnull-conversion", + "-Wno-missing-variable-declarations", + "-Wno-sign-compare", + "-Wno-missing-variable-declarations", + "$(inherited)", ); }; - name = Debug; + name = Profile; + }; + 4F0454BA20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454BB20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454BC20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454BD20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; }; - 4C3D55BA1C7F0A880023B633 /* Release */ = { + 4F0454BE20F0EE7D00699F29 /* Profile */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; - name = Release; + name = Profile; }; - 4CD203AF1C6D76E20089706D /* Debug */ = { + 4F0454BF20F0EE7D00699F29 /* Profile */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Pods/Headers/Public/**"; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", + }; + name = Profile; + }; + 4F0454C020F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-Wno-missing-include-dirs", ); + PRODUCT_NAME = "$(TARGET_NAME)"; }; - name = Debug; + name = Profile; }; - 4CD203B01C6D76E20089706D /* Release */ = { + 4F0454C120F0EE7D00699F29 /* Profile */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Pods/Headers/Public/**"; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; - name = Release; + name = Profile; }; - 4CD96BDA1C73ABD2009FF648 /* Debug */ = { + 4F0454C220F0EE7D00699F29 /* Profile */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Pods/Headers/Public/**"; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; - name = Debug; + name = Profile; }; - 4CD96BDB1C73ABD2009FF648 /* Release */ = { + 4F0454C320F0EE7D00699F29 /* Profile */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Pods/Headers/Public/**"; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; - name = Release; + name = Profile; + }; + 4F0454C420F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454C520F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454C620F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454C720F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454C820F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454C920F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454CA20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454CB20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454CC20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454CD20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454CE20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454CF20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454D020F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454D120F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454D220F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454D320F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454D420F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454D520F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454D620F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454D720F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454D820F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454D920F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454DA20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454DB20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454DC20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454DD20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454DE20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454DF20F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F0454E020F0EE7D00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; }; 4F20B5311C1F1C5B00F52437 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_WARN_UNREACHABLE_CODE = YES; - CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = HammerspoonUITests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = org.hammerspoon.HammerspoonUITests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -7750,12 +10286,15 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_WARN_UNREACHABLE_CODE = YES; - CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = HammerspoonUITests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = org.hammerspoon.HammerspoonUITests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -7766,7807 +10305,1058 @@ }; 4F29C23B1C29E0A300B8A69D /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4F29C23C1C29E0A300B8A69D /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4F2DF3E81F6046F300742D08 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Debug; }; 4F2DF3E91F6046F300742D08 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Release; }; 4F4CB38F1B737953000EA9B6 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4F4CB3901B737953000EA9B6 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4F4CB3A41B7385C5000EA9B6 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4F4CB3A51B7385C5000EA9B6 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - }; - name = Release; - }; - 4F4CB3B51B738769000EA9B6 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - }; - name = Debug; - }; - 4F4CB3B61B738769000EA9B6 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4F4CB3CA1B738F1E000EA9B6 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Debug; }; 4F4CB3CB1B738F1E000EA9B6 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Release; }; 4F4CB3F11B73A3A1000EA9B6 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4F4CB3F21B73A3A1000EA9B6 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4F4CB4031B73A746000EA9B6 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4F4CB4041B73A746000EA9B6 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4F4CB4151B73AC1D000EA9B6 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4F4CB4161B73AC1D000EA9B6 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4F4CB4261B73AD0B000EA9B6 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4F4CB4271B73AD0B000EA9B6 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4F4CB43A1B73AF7E000EA9B6 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Pods/Headers/Public/**"; }; name = Debug; }; 4F4CB43B1B73AF7E000EA9B6 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Pods/Headers/Public/**"; }; name = Release; }; 4F4CB44E1B73B09C000EA9B6 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Pods/Headers/Public/**"; }; name = Debug; }; 4F4CB44F1B73B09C000EA9B6 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Pods/Headers/Public/**"; }; name = Release; }; 4F51345C1C2F315C00EFD6D4 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4F51345D1C2F315C00EFD6D4 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4F6B3EA61B73D6D300B2A4DE /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4F6B3EA71B73D6D300B2A4DE /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4F6B3EB91B73DC4500B2A4DE /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4F6B3EBA1B73DC4500B2A4DE /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4F6B3ED01B73E23800B2A4DE /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4F6B3ED11B73E23800B2A4DE /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4F6B3EE51B73E5AC00B2A4DE /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4F6B3EE61B73E5AC00B2A4DE /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4F6B3EF91B73E7C200B2A4DE /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4F6B3EFA1B73E7C200B2A4DE /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4F6B3F0A1B73E98E00B2A4DE /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4F6B3F0B1B73E98E00B2A4DE /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4F6B3F1F1B73EBB500B2A4DE /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4F6B3F201B73EBB500B2A4DE /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4F6B3F301B73EDD100B2A4DE /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4F6B3F311B73EDD100B2A4DE /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4F6B3F421B73EF4B00B2A4DE /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Debug; }; 4F6B3F431B73EF4B00B2A4DE /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Release; }; 4F6B3F531B73EFC100B2A4DE /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4F6B3F541B73EFC100B2A4DE /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4F6B3F681B73F0E300B2A4DE /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4F6B3F691B73F0E300B2A4DE /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4F6B3F791B73F44500B2A4DE /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4F6B3F7A1B73F44500B2A4DE /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4F70EED11B726D170025A7B3 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Debug; }; 4F70EED21B726D170025A7B3 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Release; }; 4F70EEE71B7273700025A7B3 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Debug; }; 4F70EEE81B7273700025A7B3 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Release; }; 4F7694521B74C96800536DE4 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4F7694531B74C96800536DE4 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 4F7F3B69272AF68100E05732 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 4F7F3B6A272AF68100E05732 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F7F3B6B272AF68100E05732 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 4F85FED61CCA918D00FBBAD7 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 4F85FED71CCA918D00FBBAD7 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 4F9618A71E24E60C0048F71D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 4F9618A81E24E60C0048F71D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 4F9797C11BED0AC800719F3F /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 4F9797C21BED0AC800719F3F /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 4F9BA8C423DF3C6B006349F2 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 4F9BA8C523DF3C6B006349F2 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4F9BA8C623DF3C6B006349F2 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; - 4F85FED61CCA918D00FBBAD7 /* Debug */ = { + 4FBE2CF71B7261A200407788 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Debug; }; - 4F85FED71CCA918D00FBBAD7 /* Release */ = { + 4FBE2CF81B7261A200407788 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Release; }; - 4F9618A71E24E60C0048F71D /* Debug */ = { + 4FBE2D0E1B72631600407788 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Debug; }; - 4F9618A81E24E60C0048F71D /* Release */ = { + 4FBE2D0F1B72631600407788 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Release; }; - 4F9797C11BED0AC800719F3F /* Debug */ = { + 4FC93CA51BCD872D0041B820 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; - 4F9797C21BED0AC800719F3F /* Release */ = { + 4FC93CA61BCD872D0041B820 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; - 4FBE2CF71B7261A200407788 /* Debug */ = { + 4FCA05C727678B100089A5FC /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; - 4FBE2CF81B7261A200407788 /* Release */ = { + 4FCA05C827678B100089A5FC /* Profile */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; - name = Release; + name = Profile; }; - 4FBE2D0E1B72631600407788 /* Debug */ = { + 4FCA05C927678B100089A5FC /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; - name = Debug; + name = Release; }; - 4FBE2D0F1B72631600407788 /* Release */ = { + 4FCBAFCA23B0D941007BA1D0 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; - name = Release; + name = Debug; }; - 4FC93CA51BCD872D0041B820 /* Debug */ = { + 4FCBAFCB23B0D941007BA1D0 /* Profile */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; - name = Debug; + name = Profile; }; - 4FC93CA61BCD872D0041B820 /* Release */ = { + 4FCBAFCC23B0D941007BA1D0 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4FD0AB1B1B7484D700A82496 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; + LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4FD0AB1C1B7484D700A82496 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; + LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4FD0AB321B74867600A82496 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Debug; }; 4FD0AB331B74867600A82496 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Release; }; 4FD0AB441B749C8E00A82496 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4FD0AB451B749C8E00A82496 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4FD0AB591B749D7A00A82496 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4FD0AB5A1B749D7A00A82496 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4FD0AB6C1B74A67500A82496 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4FD0AB6D1B74A67500A82496 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4FD0AB761B74A68900A82496 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4FD0AB771B74A68900A82496 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4FD0AB941B74AE1900A82496 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4FD0AB951B74AE1900A82496 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4FD0AB9E1B74AE2800A82496 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4FD0AB9F1B74AE2800A82496 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4FD0ABB91B74AF4E00A82496 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4FD0ABBA1B74AF4E00A82496 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4FD0ABD51B74B2C500A82496 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4FD0ABD61B74B2C500A82496 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4FD0ABDF1B74B2FA00A82496 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4FD0ABE01B74B2FA00A82496 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4FD0ABFC1B74B9DE00A82496 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4FD0ABFD1B74B9DE00A82496 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4FD0AC0E1B74BACD00A82496 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4FF73AA4273A85820007074E /* hs.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_WARN_UNREACHABLE_CODE = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; 4FD0AC0F1B74BACD00A82496 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4FF73AA4273A85820007074E /* hs.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_WARN_UNREACHABLE_CODE = YES; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_NAME = "$(TARGET_NAME)"; }; - name = Release; - }; - 4FD0AC1F1B74C58800A82496 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; + name = Release; + }; + 4FD0AC1F1B74C58800A82496 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Pods/Headers/Public/**"; }; name = Debug; }; 4FD0AC201B74C58800A82496 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Pods/Headers/Public/**"; }; name = Release; }; 4FDD9DCA1ED30DC9008F14D3 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Debug; }; 4FDD9DCB1ED30DC9008F14D3 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Release; }; 4FDE059D1B72984C00E9E8EE /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4FDE059E1B72984C00E9E8EE /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4FDE05AC1B72988C00E9E8EE /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4FDE05AD1B72988C00E9E8EE /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4FDE05C51B72C22500E9E8EE /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4FDE05C61B72C22500E9E8EE /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4FDE05DA1B734EA600E9E8EE /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4FDE05DB1B734EA600E9E8EE /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; 4FDE05ED1B734EE600E9E8EE /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; 4FDE05EE1B734EE600E9E8EE /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; - 6AE181251D36E90B0097211C /* Debug */ = { + 4FF06121274AA7A200FB15D6 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", + }; + name = Debug; + }; + 4FF06122274AA7A200FB15D6 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 4FF06123274AA7A200FB15D6 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 6AE181251D36E90B0097211C /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; + buildSettings = { + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-Wno-missing-include-dirs", ); + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; 6AE181261D36E90B0097211C /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-Wno-missing-include-dirs", ); + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; 9445CA3A19083251002568BB /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F7F3B7D272DE9F800E05732 /* Project-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/**"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_PEDANTIC = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.10; - ONLY_ACTIVE_ARCH = YES; - OTHER_LDFLAGS = ( - "-undefined", - dynamic_lookup, - ); - SDKROOT = macosx; - WARNING_CFLAGS = ( - "-Wno-cstring-format-directive", - "-Wno-padded", - "-Wno-objc-missing-property-synthesis", - "-Wno-auto-import", - "-Wno-gnu-statement-expression", - "-Wno-reserved-id-macro", - "-Wno-gnu-zero-variadic-macro-arguments", - ); }; name = Debug; }; 9445CA3B19083251002568BB /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C78272F4F28002CA157 /* Project-Release.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/**"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_PEDANTIC = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.10; - OTHER_LDFLAGS = ( - "-undefined", - dynamic_lookup, - ); - SDKROOT = macosx; - WARNING_CFLAGS = ( - "-Wno-cstring-format-directive", - "-Wno-padded", - "-Wno-objc-missing-property-synthesis", - "-Wno-auto-import", - "-Wno-gnu-statement-expression", - "-Wno-reserved-id-macro", - "-Wno-gnu-zero-variadic-macro-arguments", - ); }; name = Release; }; 9445CA3D19083251002568BB /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 867B086413FD65986CB40932 /* Pods-Hammerspoon.debug.xcconfig */; + baseConfigurationReference = 4F7F3B7A272DE83500E05732 /* Hammerspoon-Debug.xcconfig */; buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CODE_SIGN_IDENTITY = ""; - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = ""; - FRAMEWORK_SEARCH_PATHS = ( + ASSETCATALOG_COMPILER_APPICON_NAME = CommandPost; + INFOPLIST_FILE = "Hammerspoon/CommandPost-Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)", + "@executable_path/../Frameworks", ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "Hammerspoon/Hammerspoon-Prefix.pch"; - INFOPLIST_FILE = "Hammerspoon/CommandPost-Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks @executable_path/../Frameworks"; + MARKETING_VERSION = 1.2.17; PRODUCT_BUNDLE_IDENTIFIER = org.latenitefilms.CommandPost; PRODUCT_NAME = CommandPost; - SDKROOT = macosx; - STRIP_INSTALLED_PRODUCT = NO; - STRIP_STYLE = all; - WRAPPER_EXTENSION = app; }; name = Debug; }; 9445CA3E19083251002568BB /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = DE2547C1592A3EDD90D9815D /* Pods-Hammerspoon.release.xcconfig */; + baseConfigurationReference = 4F7F3B7C272DE99200E05732 /* Hammerspoon-Release.xcconfig */; buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CODE_SIGN_IDENTITY = ""; - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = ""; - FRAMEWORK_SEARCH_PATHS = ( + ASSETCATALOG_COMPILER_APPICON_NAME = CommandPost; + DEVELOPMENT_TEAM = A5HDJTY9X5; + INFOPLIST_FILE = "Hammerspoon/CommandPost-Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)", + "@executable_path/../Frameworks", ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "Hammerspoon/Hammerspoon-Prefix.pch"; - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - INFOPLIST_FILE = "Hammerspoon/CommandPost-Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks @executable_path/../Frameworks"; - OTHER_CODE_SIGN_FLAGS = ""; + MARKETING_VERSION = 1.2.17; PRODUCT_BUNDLE_IDENTIFIER = org.latenitefilms.CommandPost; PRODUCT_NAME = CommandPost; - SDKROOT = macosx; - STRIP_INSTALLED_PRODUCT = NO; - STRIP_STYLE = all; - WRAPPER_EXTENSION = app; }; name = Release; }; B8524F2F201A88CD00844F3D /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Debug; }; B8524F30201A88CD00844F3D /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Release; }; @@ -15586,11 +11376,15 @@ "$(inherited)", ); INFOPLIST_FILE = "Hammerspoon Tests/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "org.hammerspoon.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Hammerspoon.app/Contents/MacOS/Hammerspoon"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CommandPost.app/Contents/MacOS/CommandPost"; WARNING_CFLAGS = ( "-Wno-cstring-format-directive", "-Wno-padded", @@ -15612,11 +11406,15 @@ "$(inherited)", ); INFOPLIST_FILE = "Hammerspoon Tests/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "org.hammerspoon.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Hammerspoon.app/Contents/MacOS/Hammerspoon"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CommandPost.app/Contents/MacOS/CommandPost"; WARNING_CFLAGS = ( "-Wno-cstring-format-directive", "-Wno-padded", @@ -15626,2708 +11424,481 @@ }; name = Release; }; - D61F4A2D1DCFA67900AEE223 /* Debug */ = { + D61F4A2D1DCFA67900AEE223 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + D61F4A2E1DCFA67900AEE223 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + D62F9EB82320B82100FAE188 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + D62F9EB92320B82100FAE188 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + D62F9EBA2320B82100FAE188 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + D62F9EC42320B86300FAE188 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + D62F9EC52320B86300FAE188 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + D62F9EC62320B86300FAE188 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + D633A9E6247B9BF2005C88E2 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + D633A9E7247B9BF2005C88E2 /* Profile */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; - name = Debug; + name = Profile; }; - D61F4A2E1DCFA67900AEE223 /* Release */ = { + D633A9E8247B9BF2005C88E2 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; D64125621BA07CEA000FB5F8 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; D64125631BA07CEA000FB5F8 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; D6477C121C5ED5D000F67BBC /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; D6477C131C5ED5D000F67BBC /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; D6477C2A1C5ED82200F67BBC /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; D6477C2B1C5ED82200F67BBC /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; D6477C391C5ED83C00F67BBC /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; D6477C3A1C5ED83C00F67BBC /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; D64964811CCB32C70074540B /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Debug; }; D64964821CCB32C70074540B /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C79272F5EA7002CA157 /* Extensions-Ideal.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; - WARNING_CFLAGS = ( - "-Weverything", - "$(inherited)", - ); }; name = Release; }; D64B03441BA954780006C468 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; D64B03451BA954780006C468 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; D68616051E04D5D20058A4F2 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; D68616061E04D5D20058A4F2 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; D68616141E04D6630058A4F2 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; D68616151E04D6630058A4F2 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; D68CE6261E9C450E00912154 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; D68CE6271E9C450E00912154 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; D6A212F11DE38F5F00998C0B /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; D6A212F21DE38F5F00998C0B /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; D6A318A81DDD833100D9B328 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; D6A318A91DDD833100D9B328 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; D6B946501D139C7D00177E0C /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; D6B946511D139C7D00177E0C /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; D6B9465C1D139CC500177E0C /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; D6B9465D1D139CC500177E0C /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; D6BB4FB71C16959C000DC0A2 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; D6BB4FB81C16959C000DC0A2 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; D6BB4FC51C1695EC000DC0A2 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; D6BB4FC61C1695EC000DC0A2 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + D6C32CCC27DDD47F001AA22E /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + D6C32CCD27DDD47F001AA22E /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + D6C32CCE27DDD47F001AA22E /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; D6E164DA1F4C262300B85D8A /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; D6E164DB1F4C262300B85D8A /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; D6F310DE1BDF0E1700045CCD /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; D6F310DF1BDF0E1700045CCD /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; D6F310ED1BDF110500045CCD /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; D6F310EE1BDF110500045CCD /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; D6FD568D1C0422B400BAE238 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - ENABLE_TESTABILITY = YES; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Debug; }; D6FD568E1C0422B400BAE238 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C77272F3EE9002CA157 /* Extensions-Base.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = "$(inherited)"; - CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; - CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = "$(inherited)"; - CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = "$(inherited)"; - CLANG_WARN_ASSIGN_ENUM = "$(inherited)"; - CLANG_WARN_BOOL_CONVERSION = "$(inherited)"; - CLANG_WARN_CONSTANT_CONVERSION = "$(inherited)"; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = "$(inherited)"; - CLANG_WARN_EMPTY_BODY = "$(inherited)"; - CLANG_WARN_ENUM_CONVERSION = "$(inherited)"; - CLANG_WARN_IMPLICIT_SIGN_CONVERSION = "$(inherited)"; - CLANG_WARN_INT_CONVERSION = "$(inherited)"; - CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = "$(inherited)"; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = "$(inherited)"; - CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = "$(inherited)"; - CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = "$(inherited)"; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = "$(inherited)"; - CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE; - CLANG_WARN__ARC_BRIDGE_CAST_NONARC = "$(inherited)"; - CLANG_WARN__DUPLICATE_METHOD_MATCH = "$(inherited)"; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = "$(inherited)"; - EXECUTABLE_PREFIX = lib; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_TREAT_WARNINGS_AS_ERRORS = "$(inherited)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = "$(inherited)"; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = "$(inherited)"; - GCC_WARN_ABOUT_POINTER_SIGNEDNESS = "$(inherited)"; - GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = "$(inherited)"; - GCC_WARN_CHECK_SWITCH_STATEMENTS = "$(inherited)"; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = "$(inherited)"; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = "$(inherited)"; - GCC_WARN_MISSING_PARENTHESES = "$(inherited)"; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = "$(inherited)"; - GCC_WARN_PEDANTIC = "$(inherited)"; - GCC_WARN_SHADOW = "$(inherited)"; - GCC_WARN_SIGN_COMPARE = "$(inherited)"; - GCC_WARN_STRICT_SELECTOR_MATCH = "$(inherited)"; - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = "$(inherited)"; - GCC_WARN_UNDECLARED_SELECTOR = "$(inherited)"; - GCC_WARN_UNKNOWN_PRAGMAS = "$(inherited)"; - GCC_WARN_UNUSED_FUNCTION = "$(inherited)"; - GCC_WARN_UNUSED_LABEL = "$(inherited)"; - GCC_WARN_UNUSED_PARAMETER = "$(inherited)"; - GCC_WARN_UNUSED_VALUE = "$(inherited)"; - GCC_WARN_UNUSED_VARIABLE = "$(inherited)"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = "$(inherited)"; - SDKROOT = "$(inherited)"; - STRIP_INSTALLED_PRODUCT = NO; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 2245185B281ADF8400997BB0 /* Build configuration list for PBXNativeTarget "CommandPost" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 22451858281ADF8400997BB0 /* Debug */, + 22451859281ADF8400997BB0 /* Profile */, + 2245185A281ADF8400997BB0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + 224BA32E23D1ECA900487FDB /* Build configuration list for PBXNativeTarget "websocket" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 224BA32F23D1ECA900487FDB /* Debug */, + 224BA33023D1ECA900487FDB /* Profile */, + 224BA33123D1ECA900487FDB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; 22613FEE1F297E0D00E05E11 /* Build configuration list for PBXNativeTarget "dialog" */ = { isa = XCConfigurationList; buildConfigurations = ( 22613FEF1F297E0D00E05E11 /* Debug */, - 22613FF01F297E0D00E05E11 /* Release */, + 4F0454A020F0EE7D00699F29 /* Profile */, + 220A07012788F97D0068DEA2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + 226F95FA27917D3B003DF60F /* Build configuration list for PBXNativeTarget "blackmagic" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 226F95FB27917D3B003DF60F /* Debug */, + 226F95FC27917D3B003DF60F /* Profile */, + 226F95FD27917D3B003DF60F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + 227478252787F92E00DE6894 /* Build configuration list for PBXNativeTarget "osc" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 227478262787F92E00DE6894 /* Debug */, + 227478272787F92E00DE6894 /* Profile */, + 227478282787F92E00DE6894 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + 22DF5D2323B9A9D300C41AE6 /* Build configuration list for PBXNativeTarget "pasteboardwatcher" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 22DF5D2423B9A9D300C41AE6 /* Debug */, + 22DF5D2523B9A9D300C41AE6 /* Profile */, + 22DF5D2623B9A9D300C41AE6 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; @@ -18336,15 +11907,37 @@ isa = XCConfigurationList; buildConfigurations = ( 22E4D8001FA7488900C8CF5C /* Debug */, + 4F0454B920F0EE7D00699F29 /* Profile */, 22E4D8011FA7488900C8CF5C /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; + 22EEC61F24926E5100BAE4DA /* Build configuration list for PBXNativeTarget "serial" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 22EEC62024926E5100BAE4DA /* Debug */, + 22EEC62124926E5100BAE4DA /* Profile */, + 22EEC62224926E5100BAE4DA /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + 22FA061727A160410039C37A /* Build configuration list for PBXNativeTarget "razer" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 22FA061827A160410039C37A /* Debug */, + 22FA061927A160410039C37A /* Profile */, + 22FA061A27A160410039C37A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; 4C3D55B81C7F0A880023B633 /* Build configuration list for PBXNativeTarget "osascript" */ = { isa = XCConfigurationList; buildConfigurations = ( 4C3D55B91C7F0A880023B633 /* Debug */, + 4F0454C220F0EE7D00699F29 /* Profile */, 4C3D55BA1C7F0A880023B633 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18354,6 +11947,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4CD203AF1C6D76E20089706D /* Debug */, + 4F0454CA20F0EE7D00699F29 /* Profile */, 4CD203B01C6D76E20089706D /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18363,6 +11957,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4CD96BDA1C73ABD2009FF648 /* Debug */, + 4F0454CB20F0EE7D00699F29 /* Profile */, 4CD96BDB1C73ABD2009FF648 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18372,6 +11967,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F20B5311C1F1C5B00F52437 /* Debug */, + 4F04548F20F0EE7D00699F29 /* Profile */, 4F20B5321C1F1C5B00F52437 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18381,6 +11977,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F29C23B1C29E0A300B8A69D /* Debug */, + 4F0454A820F0EE7D00699F29 /* Profile */, 4F29C23C1C29E0A300B8A69D /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18390,6 +11987,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F2DF3E81F6046F300742D08 /* Debug */, + 4F0454D220F0EE7D00699F29 /* Profile */, 4F2DF3E91F6046F300742D08 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18399,6 +11997,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F4CB38F1B737953000EA9B6 /* Debug */, + 4F04549E20F0EE7D00699F29 /* Profile */, 4F4CB3901B737953000EA9B6 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18408,24 +12007,17 @@ isa = XCConfigurationList; buildConfigurations = ( 4F4CB3A41B7385C5000EA9B6 /* Debug */, + 4F0454A220F0EE7D00699F29 /* Profile */, 4F4CB3A51B7385C5000EA9B6 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; - 4F4CB3B41B738769000EA9B6 /* Build configuration list for PBXNativeTarget "drawing" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 4F4CB3B51B738769000EA9B6 /* Debug */, - 4F4CB3B61B738769000EA9B6 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; 4F4CB3C91B738F1E000EA9B6 /* Build configuration list for PBXNativeTarget "fs" */ = { isa = XCConfigurationList; buildConfigurations = ( 4F4CB3CA1B738F1E000EA9B6 /* Debug */, + 4F0454A720F0EE7D00699F29 /* Profile */, 4F4CB3CB1B738F1E000EA9B6 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18435,6 +12027,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F4CB3F11B73A3A1000EA9B6 /* Debug */, + 4F0454AA20F0EE7D00699F29 /* Profile */, 4F4CB3F21B73A3A1000EA9B6 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18444,6 +12037,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F4CB4031B73A746000EA9B6 /* Debug */, + 4F0454AC20F0EE7D00699F29 /* Profile */, 4F4CB4041B73A746000EA9B6 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18453,6 +12047,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F4CB4151B73AC1D000EA9B6 /* Debug */, + 4F0454AD20F0EE7D00699F29 /* Profile */, 4F4CB4161B73AC1D000EA9B6 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18462,6 +12057,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F4CB4261B73AD0B000EA9B6 /* Debug */, + 4F0454AF20F0EE7D00699F29 /* Profile */, 4F4CB4271B73AD0B000EA9B6 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18471,6 +12067,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F4CB43A1B73AF7E000EA9B6 /* Debug */, + 4F0454B020F0EE7D00699F29 /* Profile */, 4F4CB43B1B73AF7E000EA9B6 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18480,6 +12077,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F4CB44E1B73B09C000EA9B6 /* Debug */, + 4F0454B220F0EE7D00699F29 /* Profile */, 4F4CB44F1B73B09C000EA9B6 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18489,6 +12087,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F51345C1C2F315C00EFD6D4 /* Debug */, + 4F04549C20F0EE7D00699F29 /* Profile */, 4F51345D1C2F315C00EFD6D4 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18498,6 +12097,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F6B3EA61B73D6D300B2A4DE /* Debug */, + 4F0454B520F0EE7D00699F29 /* Profile */, 4F6B3EA71B73D6D300B2A4DE /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18507,6 +12107,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F6B3EB91B73DC4500B2A4DE /* Debug */, + 4F0454B720F0EE7D00699F29 /* Profile */, 4F6B3EBA1B73DC4500B2A4DE /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18516,6 +12117,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F6B3ED01B73E23800B2A4DE /* Debug */, + 4F0454B820F0EE7D00699F29 /* Profile */, 4F6B3ED11B73E23800B2A4DE /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18525,6 +12127,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F6B3EE51B73E5AC00B2A4DE /* Debug */, + 4F0454BA20F0EE7D00699F29 /* Profile */, 4F6B3EE61B73E5AC00B2A4DE /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18534,6 +12137,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F6B3EF91B73E7C200B2A4DE /* Debug */, + 4F0454BB20F0EE7D00699F29 /* Profile */, 4F6B3EFA1B73E7C200B2A4DE /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18543,6 +12147,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F6B3F0A1B73E98E00B2A4DE /* Debug */, + 4F0454C120F0EE7D00699F29 /* Profile */, 4F6B3F0B1B73E98E00B2A4DE /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18552,6 +12157,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F6B3F1F1B73EBB500B2A4DE /* Debug */, + 4F0454C320F0EE7D00699F29 /* Profile */, 4F6B3F201B73EBB500B2A4DE /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18561,6 +12167,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F6B3F301B73EDD100B2A4DE /* Debug */, + 4F0454C420F0EE7D00699F29 /* Profile */, 4F6B3F311B73EDD100B2A4DE /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18570,6 +12177,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F6B3F421B73EF4B00B2A4DE /* Debug */, + 4F0454C620F0EE7D00699F29 /* Profile */, 4F6B3F431B73EF4B00B2A4DE /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18579,6 +12187,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F6B3F531B73EFC100B2A4DE /* Debug */, + 4F0454C720F0EE7D00699F29 /* Profile */, 4F6B3F541B73EFC100B2A4DE /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18588,6 +12197,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F6B3F681B73F0E300B2A4DE /* Debug */, + 4F0454C820F0EE7D00699F29 /* Profile */, 4F6B3F691B73F0E300B2A4DE /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18597,6 +12207,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F6B3F791B73F44500B2A4DE /* Debug */, + 4F0454CC20F0EE7D00699F29 /* Profile */, 4F6B3F7A1B73F44500B2A4DE /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18606,6 +12217,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F70EED11B726D170025A7B3 /* Debug */, + 4F04549220F0EE7D00699F29 /* Profile */, 4F70EED21B726D170025A7B3 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18615,6 +12227,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F70EEE71B7273700025A7B3 /* Debug */, + 4F04549420F0EE7D00699F29 /* Profile */, 4F70EEE81B7273700025A7B3 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18624,15 +12237,27 @@ isa = XCConfigurationList; buildConfigurations = ( 4F7694521B74C96800536DE4 /* Debug */, + 4F0454B620F0EE7D00699F29 /* Profile */, 4F7694531B74C96800536DE4 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; + 4F7F3B68272AF68100E05732 /* Build configuration list for PBXNativeTarget "shortcuts" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4F7F3B69272AF68100E05732 /* Debug */, + 4F7F3B6A272AF68100E05732 /* Profile */, + 4F7F3B6B272AF68100E05732 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; 4F85FED51CCA918D00FBBAD7 /* Build configuration list for PBXNativeTarget "distributednotifications" */ = { isa = XCConfigurationList; buildConfigurations = ( 4F85FED61CCA918D00FBBAD7 /* Debug */, + 4F0454A120F0EE7D00699F29 /* Profile */, 4F85FED71CCA918D00FBBAD7 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18642,6 +12267,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4F9618A71E24E60C0048F71D /* Debug */, + 4F0454D120F0EE7D00699F29 /* Profile */, 4F9618A81E24E60C0048F71D /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18651,15 +12277,27 @@ isa = XCConfigurationList; buildConfigurations = ( 4F9797C11BED0AC800719F3F /* Debug */, + 4F0454D420F0EE7D00699F29 /* Profile */, 4F9797C21BED0AC800719F3F /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; + 4F9BA8C323DF3C6B006349F2 /* Build configuration list for PBXNativeTarget "uielementwatcher" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4F9BA8C423DF3C6B006349F2 /* Debug */, + 4F9BA8C523DF3C6B006349F2 /* Profile */, + 4F9BA8C623DF3C6B006349F2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; 4FBE2CF61B7261A200407788 /* Build configuration list for PBXNativeTarget "application" */ = { isa = XCConfigurationList; buildConfigurations = ( 4FBE2CF71B7261A200407788 /* Debug */, + 4F04549020F0EE7D00699F29 /* Profile */, 4FBE2CF81B7261A200407788 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18669,6 +12307,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FBE2D0E1B72631600407788 /* Debug */, + 4F04549120F0EE7D00699F29 /* Profile */, 4FBE2D0F1B72631600407788 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18678,15 +12317,37 @@ isa = XCConfigurationList; buildConfigurations = ( 4FC93CA51BCD872D0041B820 /* Debug */, + 4F04549320F0EE7D00699F29 /* Profile */, 4FC93CA61BCD872D0041B820 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; - 4FD0AB1A1B7484D700A82496 /* Build configuration list for PBXNativeTarget "spaceswatcher" */ = { + 4FCA05C627678B100089A5FC /* Build configuration list for PBXNativeTarget "markdown" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4FCA05C727678B100089A5FC /* Debug */, + 4FCA05C827678B100089A5FC /* Profile */, + 4FCA05C927678B100089A5FC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + 4FCBAFC923B0D941007BA1D0 /* Build configuration list for PBXNativeTarget "math" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4FCBAFCA23B0D941007BA1D0 /* Debug */, + 4FCBAFCB23B0D941007BA1D0 /* Profile */, + 4FCBAFCC23B0D941007BA1D0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + 4FD0AB1A1B7484D700A82496 /* Build configuration list for PBXNativeTarget "spaces_watcher" */ = { isa = XCConfigurationList; buildConfigurations = ( 4FD0AB1B1B7484D700A82496 /* Debug */, + 4F0454CD20F0EE7D00699F29 /* Profile */, 4FD0AB1C1B7484D700A82496 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18696,6 +12357,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FD0AB321B74867600A82496 /* Debug */, + 4F0454D520F0EE7D00699F29 /* Profile */, 4FD0AB331B74867600A82496 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18705,6 +12367,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FD0AB441B749C8E00A82496 /* Debug */, + 4F0454D620F0EE7D00699F29 /* Profile */, 4FD0AB451B749C8E00A82496 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18714,6 +12377,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FD0AB591B749D7A00A82496 /* Debug */, + 4F0454D720F0EE7D00699F29 /* Profile */, 4FD0AB5A1B749D7A00A82496 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18723,6 +12387,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FD0AB6C1B74A67500A82496 /* Debug */, + 4F0454D820F0EE7D00699F29 /* Profile */, 4FD0AB6D1B74A67500A82496 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18732,6 +12397,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FD0AB761B74A68900A82496 /* Debug */, + 4F0454D920F0EE7D00699F29 /* Profile */, 4FD0AB771B74A68900A82496 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18741,6 +12407,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FD0AB941B74AE1900A82496 /* Debug */, + 4F0454DE20F0EE7D00699F29 /* Profile */, 4FD0AB951B74AE1900A82496 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18750,6 +12417,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FD0AB9E1B74AE2800A82496 /* Debug */, + 4F0454DF20F0EE7D00699F29 /* Profile */, 4FD0AB9F1B74AE2800A82496 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18759,6 +12427,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FD0ABB91B74AF4E00A82496 /* Debug */, + 4F0454E020F0EE7D00699F29 /* Profile */, 4FD0ABBA1B74AF4E00A82496 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18768,6 +12437,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FD0ABD51B74B2C500A82496 /* Debug */, + 4F0454A520F0EE7D00699F29 /* Profile */, 4FD0ABD61B74B2C500A82496 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18777,6 +12447,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FD0ABDF1B74B2FA00A82496 /* Debug */, + 4F0454A620F0EE7D00699F29 /* Profile */, 4FD0ABE01B74B2FA00A82496 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18786,6 +12457,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FD0ABFC1B74B9DE00A82496 /* Debug */, + 4F0454B320F0EE7D00699F29 /* Profile */, 4FD0ABFD1B74B9DE00A82496 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18795,6 +12467,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FD0AC0E1B74BACD00A82496 /* Debug */, + 4F0454B420F0EE7D00699F29 /* Profile */, 4FD0AC0F1B74BACD00A82496 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18804,6 +12477,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FD0AC1F1B74C58800A82496 /* Debug */, + 4F0454B120F0EE7D00699F29 /* Profile */, 4FD0AC201B74C58800A82496 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18813,6 +12487,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FDD9DCA1ED30DC9008F14D3 /* Debug */, + 4F0454C520F0EE7D00699F29 /* Profile */, 4FDD9DCB1ED30DC9008F14D3 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18822,6 +12497,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FDE059D1B72984C00E9E8EE /* Debug */, + 4F04549520F0EE7D00699F29 /* Profile */, 4FDE059E1B72984C00E9E8EE /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18831,6 +12507,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FDE05AC1B72988C00E9E8EE /* Debug */, + 4F04549620F0EE7D00699F29 /* Profile */, 4FDE05AD1B72988C00E9E8EE /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18840,6 +12517,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FDE05C51B72C22500E9E8EE /* Debug */, + 4F04549720F0EE7D00699F29 /* Profile */, 4FDE05C61B72C22500E9E8EE /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18849,6 +12527,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FDE05DA1B734EA600E9E8EE /* Debug */, + 4F04549820F0EE7D00699F29 /* Profile */, 4FDE05DB1B734EA600E9E8EE /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18858,15 +12537,27 @@ isa = XCConfigurationList; buildConfigurations = ( 4FDE05ED1B734EE600E9E8EE /* Debug */, + 4F04549920F0EE7D00699F29 /* Profile */, 4FDE05EE1B734EE600E9E8EE /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; + 4FF06120274AA7A200FB15D6 /* Build configuration list for PBXNativeTarget "camera" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4FF06121274AA7A200FB15D6 /* Debug */, + 4FF06122274AA7A200FB15D6 /* Profile */, + 4FF06123274AA7A200FB15D6 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; 6AE181241D36E90B0097211C /* Build configuration list for PBXNativeTarget "noises" */ = { isa = XCConfigurationList; buildConfigurations = ( 6AE181251D36E90B0097211C /* Debug */, + 4F0454C020F0EE7D00699F29 /* Profile */, 6AE181261D36E90B0097211C /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18876,6 +12567,7 @@ isa = XCConfigurationList; buildConfigurations = ( 9445CA3A19083251002568BB /* Debug */, + 4F04548C20F0EE7D00699F29 /* Profile */, 9445CA3B19083251002568BB /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18885,6 +12577,7 @@ isa = XCConfigurationList; buildConfigurations = ( 9445CA3D19083251002568BB /* Debug */, + 4F04548D20F0EE7D00699F29 /* Profile */, 9445CA3E19083251002568BB /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18894,6 +12587,7 @@ isa = XCConfigurationList; buildConfigurations = ( B8524F2F201A88CD00844F3D /* Debug */, + 4F0454AB20F0EE7D00699F29 /* Profile */, B8524F30201A88CD00844F3D /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18903,6 +12597,7 @@ isa = XCConfigurationList; buildConfigurations = ( D02F952C1A00221C00E28BB2 /* Debug */, + 4F04548E20F0EE7D00699F29 /* Profile */, D02F952D1A00221C00E28BB2 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18912,15 +12607,47 @@ isa = XCConfigurationList; buildConfigurations = ( D61F4A2D1DCFA67900AEE223 /* Debug */, + 4F0454C920F0EE7D00699F29 /* Profile */, D61F4A2E1DCFA67900AEE223 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; + D62F9EB72320B82100FAE188 /* Build configuration list for PBXNativeTarget "bonjour" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D62F9EB82320B82100FAE188 /* Debug */, + D62F9EB92320B82100FAE188 /* Profile */, + D62F9EBA2320B82100FAE188 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + D62F9EC32320B86300FAE188 /* Build configuration list for PBXNativeTarget "bonjourservice" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D62F9EC42320B86300FAE188 /* Debug */, + D62F9EC52320B86300FAE188 /* Profile */, + D62F9EC62320B86300FAE188 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + D633A9E5247B9BF2005C88E2 /* Build configuration list for PBXNativeTarget "axuielement" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D633A9E6247B9BF2005C88E2 /* Debug */, + D633A9E7247B9BF2005C88E2 /* Profile */, + D633A9E8247B9BF2005C88E2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; D64125611BA07CEA000FB5F8 /* Build configuration list for PBXNativeTarget "webview" */ = { isa = XCConfigurationList; buildConfigurations = ( D64125621BA07CEA000FB5F8 /* Debug */, + 4F0454DA20F0EE7D00699F29 /* Profile */, D64125631BA07CEA000FB5F8 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18930,6 +12657,7 @@ isa = XCConfigurationList; buildConfigurations = ( D6477C121C5ED5D000F67BBC /* Debug */, + 4F0454BC20F0EE7D00699F29 /* Profile */, D6477C131C5ED5D000F67BBC /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18939,6 +12667,7 @@ isa = XCConfigurationList; buildConfigurations = ( D6477C2A1C5ED82200F67BBC /* Debug */, + 4F0454BF20F0EE7D00699F29 /* Profile */, D6477C2B1C5ED82200F67BBC /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18948,6 +12677,7 @@ isa = XCConfigurationList; buildConfigurations = ( D6477C391C5ED83C00F67BBC /* Debug */, + 4F0454BD20F0EE7D00699F29 /* Profile */, D6477C3A1C5ED83C00F67BBC /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18957,6 +12687,7 @@ isa = XCConfigurationList; buildConfigurations = ( D64964811CCB32C70074540B /* Debug */, + 4F04549F20F0EE7D00699F29 /* Profile */, D64964821CCB32C70074540B /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18966,6 +12697,7 @@ isa = XCConfigurationList; buildConfigurations = ( D64B03441BA954780006C468 /* Debug */, + 4F0454DD20F0EE7D00699F29 /* Profile */, D64B03451BA954780006C468 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18975,6 +12707,7 @@ isa = XCConfigurationList; buildConfigurations = ( D68616051E04D5D20058A4F2 /* Debug */, + 4F04549A20F0EE7D00699F29 /* Profile */, D68616061E04D5D20058A4F2 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18984,6 +12717,7 @@ isa = XCConfigurationList; buildConfigurations = ( D68616141E04D6630058A4F2 /* Debug */, + 4F04549B20F0EE7D00699F29 /* Profile */, D68616151E04D6630058A4F2 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -18993,6 +12727,7 @@ isa = XCConfigurationList; buildConfigurations = ( D68CE6261E9C450E00912154 /* Debug */, + 4F0454AE20F0EE7D00699F29 /* Profile */, D68CE6271E9C450E00912154 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -19002,6 +12737,7 @@ isa = XCConfigurationList; buildConfigurations = ( D6A212F11DE38F5F00998C0B /* Debug */, + 4F0454D020F0EE7D00699F29 /* Profile */, D6A212F21DE38F5F00998C0B /* Release */, ); defaultConfigurationIsVisible = 0; @@ -19011,6 +12747,7 @@ isa = XCConfigurationList; buildConfigurations = ( D6A318A81DDD833100D9B328 /* Debug */, + 4F0454BE20F0EE7D00699F29 /* Profile */, D6A318A91DDD833100D9B328 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -19020,6 +12757,7 @@ isa = XCConfigurationList; buildConfigurations = ( D6B946501D139C7D00177E0C /* Debug */, + 4F0454DB20F0EE7D00699F29 /* Profile */, D6B946511D139C7D00177E0C /* Release */, ); defaultConfigurationIsVisible = 0; @@ -19029,6 +12767,7 @@ isa = XCConfigurationList; buildConfigurations = ( D6B9465C1D139CC500177E0C /* Debug */, + 4F0454DC20F0EE7D00699F29 /* Profile */, D6B9465D1D139CC500177E0C /* Release */, ); defaultConfigurationIsVisible = 0; @@ -19038,6 +12777,7 @@ isa = XCConfigurationList; buildConfigurations = ( D6BB4FB71C16959C000DC0A2 /* Debug */, + 4F0454CE20F0EE7D00699F29 /* Profile */, D6BB4FB81C16959C000DC0A2 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -19047,15 +12787,27 @@ isa = XCConfigurationList; buildConfigurations = ( D6BB4FC51C1695EC000DC0A2 /* Debug */, + 4F0454CF20F0EE7D00699F29 /* Profile */, D6BB4FC61C1695EC000DC0A2 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; + D6C32CCB27DDD47F001AA22E /* Build configuration list for PBXNativeTarget "spaces" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D6C32CCC27DDD47F001AA22E /* Debug */, + D6C32CCD27DDD47F001AA22E /* Profile */, + D6C32CCE27DDD47F001AA22E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; D6E164D91F4C262300B85D8A /* Build configuration list for PBXNativeTarget "fsxattr" */ = { isa = XCConfigurationList; buildConfigurations = ( D6E164DA1F4C262300B85D8A /* Debug */, + 4F0454A920F0EE7D00699F29 /* Profile */, D6E164DB1F4C262300B85D8A /* Release */, ); defaultConfigurationIsVisible = 0; @@ -19065,6 +12817,7 @@ isa = XCConfigurationList; buildConfigurations = ( D6F310DE1BDF0E1700045CCD /* Debug */, + 4F0454A420F0EE7D00699F29 /* Profile */, D6F310DF1BDF0E1700045CCD /* Release */, ); defaultConfigurationIsVisible = 0; @@ -19074,6 +12827,7 @@ isa = XCConfigurationList; buildConfigurations = ( D6F310ED1BDF110500045CCD /* Debug */, + 4F0454D320F0EE7D00699F29 /* Profile */, D6F310EE1BDF110500045CCD /* Release */, ); defaultConfigurationIsVisible = 0; @@ -19083,6 +12837,7 @@ isa = XCConfigurationList; buildConfigurations = ( D6FD568D1C0422B400BAE238 /* Debug */, + 4F04549D20F0EE7D00699F29 /* Profile */, D6FD568E1C0422B400BAE238 /* Release */, ); defaultConfigurationIsVisible = 0; diff --git a/Hammerspoon.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Hammerspoon.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/Hammerspoon.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Hammerspoon.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/Hammerspoon.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings index 08de0be8d..dc8d12300 100644 --- a/Hammerspoon.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +++ b/Hammerspoon.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -2,6 +2,8 @@ + BuildSystemType + Latest IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded diff --git a/Hammerspoon.xcworkspace/xcshareddata/xcschemes/Hammerspoon.xcscheme b/Hammerspoon.xcworkspace/xcshareddata/xcschemes/Hammerspoon.xcscheme index ae8a1c1e5..6074bf0ab 100644 --- a/Hammerspoon.xcworkspace/xcshareddata/xcschemes/Hammerspoon.xcscheme +++ b/Hammerspoon.xcworkspace/xcshareddata/xcschemes/Hammerspoon.xcscheme @@ -1,7 +1,7 @@ + LastUpgradeVersion = "1420" + version = "1.8"> @@ -23,9 +23,9 @@ + buildForAnalyzing = "YES"> + + + + - - - - - - - - - - + codeCoverageEnabled = "YES"> + + + + + + + + + + + + + enableASanStackUseAfterReturn = "YES" + enableUBSanitizer = "YES" + codeCoverageEnabled = "YES"> + + + + + + + + + + + skipped = "NO" + testExecutionOrdering = "random"> + skipped = "NO" + testExecutionOrdering = "random"> - - - - - - - - - - + + + + destination + export + method + developer-id + + diff --git a/Hammerspoon/Build Configs/Extensions-Base.xcconfig b/Hammerspoon/Build Configs/Extensions-Base.xcconfig new file mode 100644 index 000000000..4e6dbafcb --- /dev/null +++ b/Hammerspoon/Build Configs/Extensions-Base.xcconfig @@ -0,0 +1,24 @@ +// +// Extensions-Base.xcconfig +// Hammerspoon +// +// Created by Chris Jones on 31/10/2021. +// Copyright © 2021 Hammerspoon. All rights reserved. +// + +// Configuration settings file format documentation can be found at: +// https://help.apple.com/xcode/#/dev745c5c974 + +// Dylib version info. Maybe we should bump these? But it doesn't really seem to matter +DYLIB_COMPATIBILITY_VERSION = 1 +DYLIB_CURRENT_VERSION = 1 + +// Executable prefix (this ends up being renamed by later scripts anyway) +// FIXME: See if we can do away with this and just adjust the copy script? +EXECUTABLE_PREFIX = lib + +// FIXME: Fix up hs.axuielement and remove this line +WARNING_CLAGS = $(inherited) -Wno-tautological-pointer-compare -Wno-bad-function-cast -Wno-deprecated-non-prototype + +// Don't try and install the library in /usr/local/lib when archiving/exporting +SKIP_INSTALL = YES diff --git a/Hammerspoon/Build Configs/Extensions-Ideal.xcconfig b/Hammerspoon/Build Configs/Extensions-Ideal.xcconfig new file mode 100644 index 000000000..acd180c5c --- /dev/null +++ b/Hammerspoon/Build Configs/Extensions-Ideal.xcconfig @@ -0,0 +1,18 @@ +// +// Extensions-Ideal.xcconfig +// Hammerspoon +// +// Created by Chris Jones on 31/10/2021. +// Copyright © 2021 Hammerspoon. All rights reserved. +// + +// Configuration settings file format documentation can be found at: +// https://help.apple.com/xcode/#/dev745c5c974 + +#include "Extensions-Base.xcconfig" + +// Add -Weverything to warning flags +WARNING_CFLAGS = -Weverything $(inherited) + +// Treat warnings as errors +GCC_TREAT_WARNINGS_AS_ERRORS = YES diff --git a/Hammerspoon/Build Configs/Hammerspoon-Base.xcconfig b/Hammerspoon/Build Configs/Hammerspoon-Base.xcconfig new file mode 100644 index 000000000..35b8d525f --- /dev/null +++ b/Hammerspoon/Build Configs/Hammerspoon-Base.xcconfig @@ -0,0 +1,47 @@ +// +// Hammerspoon-Base.xcconfig +// Hammerspoon +// +// Created by Chris Jones on 30/10/2021. +// Copyright © 2021 Hammerspoon. All rights reserved. +// + +// Configuration settings file format documentation can be found at: +// https://help.apple.com/xcode/#/dev745c5c974 + +// Packaging +INFOPLIST_FILE = Hammerspoon/Hammerspoon-Info.plist +PRODUCT_NAME = Hammerspoon +PRODUCT_BUNDLE_IDENTIFIER = org.hammerspoon.${PRODUCT_NAME:rfc1034identifier} +WRAPPER_EXTENSION = app + +// Version information. This is expected to be overridden later based on git tag/commit +CURRENT_PROJECT_VERSION = 1 +MARKETING_VERSION = 1.0 + +// App Icon Name +ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon + +// Header Search Paths +HEADER_SEARCH_PATHS = $(inherited)/** "$(SDKROOT)/usr/include/libxml2" "$(SDK_DIR)"/usr/include/libxml2 +// User Header Search Paths +USER_HEADER_SEARCH_PATHS = $(inherited)/** + +// Code Signing Entitlements +CODE_SIGN_ENTITLEMENTS = Hammerspoon/Hammerspoon-dev.entitlements + +// Code Signing Identity +CODE_SIGN_IDENTITY = - + +// Development Team +DEVELOPMENT_TEAM = + +// Enable Hardened Runtime +ENABLE_HARDENED_RUNTIME = YES + +// Prefix Header Stuff +GCC_PRECOMPILE_PREFIX_HEADER = YES +GCC_PREFIX_HEADER = Hammerspoon/Hammerspoon-Prefix.pch + +// SiriKit Intent (Shortcuts) generation language +INTENTS_CODEGEN_LANGUAGE = Objective-C diff --git a/Hammerspoon/Build Configs/Hammerspoon-Debug.xcconfig b/Hammerspoon/Build Configs/Hammerspoon-Debug.xcconfig new file mode 100644 index 000000000..f5cc96cca --- /dev/null +++ b/Hammerspoon/Build Configs/Hammerspoon-Debug.xcconfig @@ -0,0 +1,14 @@ +// +// Hammerspoon-Debug.xcconfig +// Hammerspoon +// +// Created by Chris Jones on 30/10/2021. +// Copyright © 2021 Hammerspoon. All rights reserved. +// + +// Configuration settings file format documentation can be found at: +// https://help.apple.com/xcode/#/dev745c5c974 + +#include "../../Pods/Target Support Files/Pods-Hammerspoon/Pods-Hammerspoon.debug.xcconfig" +#include "Hammerspoon-Base.xcconfig" +#include? "../../../Hammerspoon-Downstream.xcconfig" diff --git a/Hammerspoon/Build Configs/Hammerspoon-Profile.xcconfig b/Hammerspoon/Build Configs/Hammerspoon-Profile.xcconfig new file mode 100644 index 000000000..2919916c6 --- /dev/null +++ b/Hammerspoon/Build Configs/Hammerspoon-Profile.xcconfig @@ -0,0 +1,20 @@ +// +// Hammerspoon-Profile.xcconfig +// Hammerspoon +// +// Created by Chris Jones on 30/10/2021. +// Copyright © 2021 Hammerspoon. All rights reserved. +// + +// Configuration settings file format documentation can be found at: +// https://help.apple.com/xcode/#/dev745c5c974 + +#include "../../Pods/Target Support Files/Pods-Hammerspoon/Pods-Hammerspoon.debug.xcconfig" +#include "Hammerspoon-Base.xcconfig" +#include? "../../../Hammerspoon-Downstream.xcconfig" + +// Code Signing Entitlements +CODE_SIGN_ENTITLEMENTS = + +// Enable Hardened Runtime +ENABLE_HARDENED_RUNTIME = NO diff --git a/Hammerspoon/Build Configs/Hammerspoon-Release.xcconfig b/Hammerspoon/Build Configs/Hammerspoon-Release.xcconfig new file mode 100644 index 000000000..c9f1c1951 --- /dev/null +++ b/Hammerspoon/Build Configs/Hammerspoon-Release.xcconfig @@ -0,0 +1,22 @@ +// +// Hammerspoon-Release.xcconfig +// Hammerspoon +// +// Created by Chris Jones on 30/10/2021. +// Copyright © 2021 Hammerspoon. All rights reserved. +// + +// Configuration settings file format documentation can be found at: +// https://help.apple.com/xcode/#/dev745c5c974 + +#include "../../Pods/Target Support Files/Pods-Hammerspoon/Pods-Hammerspoon.release.xcconfig" +#include "Hammerspoon-Base.xcconfig" + +// Code Signing Entitlements +CODE_SIGN_ENTITLEMENTS = Hammerspoon/Hammerspoon.entitlements + +// Code Signing Identity +CODE_SIGN_IDENTITY = Developer ID Application +DEVELOPMENT_TEAM = VQCYSNZB89 + +#include? "../../../Hammerspoon-Downstream.xcconfig" diff --git a/Hammerspoon/Build Configs/Hammerspoon-Test.xcconfig b/Hammerspoon/Build Configs/Hammerspoon-Test.xcconfig new file mode 100644 index 000000000..50db7ad27 --- /dev/null +++ b/Hammerspoon/Build Configs/Hammerspoon-Test.xcconfig @@ -0,0 +1,17 @@ +// +// Hammerspoon-Test.xcconfig +// Hammerspoon +// +// Created by Chris Jones on 09/11/2021. +// Copyright © 2021 Hammerspoon. All rights reserved. +// + +// Configuration settings file format documentation can be found at: +// https://help.apple.com/xcode/#/dev745c5c974 + +#include "../../Pods/Target Support Files/Pods-Hammerspoon/Pods-Hammerspoon.debug.xcconfig" +#include "Hammerspoon-Base.xcconfig" +#include? "Hammerspoon-Downstream.xcconfig" + +GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES +GCC_GENERATE_TEST_COVERAGE_FILES = YES diff --git a/Hammerspoon/Build Configs/Project-Base.xcconfig b/Hammerspoon/Build Configs/Project-Base.xcconfig new file mode 100644 index 000000000..28f837ed5 --- /dev/null +++ b/Hammerspoon/Build Configs/Project-Base.xcconfig @@ -0,0 +1,154 @@ +// +// Project-Base.xcconfig +// Hammerspoon +// +// Created by Chris Jones on 30/10/2021. +// Copyright © 2021 Hammerspoon. All rights reserved. +// + +// Configuration settings file format documentation can be found at: +// https://help.apple.com/xcode/#/dev745c5c974 + +// Base SDK +SDKROOT = macosx +// macOS Deployment Target +MACOSX_DEPLOYMENT_TARGET = 13.0 +// Build Active Architecture Only +ONLY_ACTIVE_ARCH = YES + +// Debug Information Format +DEBUG_INFORMATION_FORMAT = dwarf-with-dsym +// Other Warning Flags +WARNING_CFLAGS = -Wno-cstring-format-directive -Wno-padded -Wno-objc-missing-property-synthesis -Wno-auto-import -Wno-gnu-statement-expression -Wno-reserved-id-macro -Wno-gnu-zero-variadic-macro-arguments -Wno-objc-messaging-id -Wno-declaration-after-statement -Wno-deprecated-non-prototype -Wno-reserved-identifier +// Other Linker Flags +OTHER_LDFLAGS = -undefined dynamic_lookup +// Enable Testability +ENABLE_TESTABILITY = YES +// Strip Debug Symbols During Copy +COPY_PHASE_STRIP = NO +// Strip Linked Product +STRIP_INSTALLED_PRODUCT = NO +// Treat warnings as errors +// FIXME: We really ought to have this enabled +//GCC_TREAT_WARNINGS_AS_ERRORS = YES + + +// Always Search User Paths (Deprecated) +ALWAYS_SEARCH_USER_PATHS = NO +// Header Search Paths +HEADER_SEARCH_PATHS = $(SRCROOT)/Pods/** $(SRCROOT)/Pods/Sentry/Sources/Sentry/include +// User Header Search Paths +USER_HEADER_SEARCH_PATHS = $(HEADER_SEARCH_PATHS) + +// Optimization Level +GCC_OPTIMIZATION_LEVEL = 0 +// Generate Position-Dependent Code +GCC_DYNAMIC_NO_PIC = NO +// No Common Blocks +GCC_NO_COMMON_BLOCKS = YES +// Symbols Hidden by Default +GCC_SYMBOLS_PRIVATE_EXTERN = NO + +// Combine HiDPI Images +COMBINE_HIDPI_IMAGES = YES + +// C Language Dialect +GCC_C_LANGUAGE_STANDARD = gnu99 +// C++ Language Dialect +CLANG_CXX_LANGUAGE_STANDARD = gnu++0x +// C++ Standard Library +CLANG_CXX_LIBRARY = libc++ +// Enable Modules (C and Objective-C) +CLANG_ENABLE_MODULES = YES +// Enable Objective-C Exceptions +GCC_ENABLE_OBJC_EXCEPTIONS = YES +// Objective-C Automatic Reference Counting +CLANG_ENABLE_OBJC_ARC = YES +// Enable Strict Checking of objc_msgSend Calls +ENABLE_STRICT_OBJC_MSGSEND = YES +// Preprocessor Macros +GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1 $(inherited) + +// Pedantic Warnings +GCC_WARN_PEDANTIC = YES +// Block Capture of Autoreleasing +CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES +// Empty Loop Bodies +CLANG_WARN_EMPTY_BODY = YES +// Implicit Boolean Conversions +CLANG_WARN_BOOL_CONVERSION = YES +// Implicit Constant Conversions +CLANG_WARN_CONSTANT_CONVERSION = YES +// Implicit Conversion to 32 Bit Type +GCC_WARN_64_TO_32_BIT_CONVERSION = YES +// Implicit Enum Conversions +CLANG_WARN_ENUM_CONVERSION = YES +// Implicit Integer to Pointer Conversions +CLANG_WARN_INT_CONVERSION = YES +// Implicit Non-Literal Null Conversions +CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES +// Infinite Recursion +CLANG_WARN_INFINITE_RECURSION = YES +// Mismatched Return Type +GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR +// Strict Prototypes +CLANG_WARN_STRICT_PROTOTYPES = YES +// Suspicious Commas +CLANG_WARN_COMMA = YES +// Uninitialized Variables +GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE +// Unreachable Code +CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE +// Unused Functions +GCC_WARN_UNUSED_FUNCTION = YES +// Unused Variables +GCC_WARN_UNUSED_VARIABLE = YES +// Range-based For Loops +CLANG_WARN_RANGE_LOOP_ANALYSIS = YES +// Suspicious Moves +CLANG_WARN_SUSPICIOUS_MOVE = YES +// Direct usage of 'isa' +CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR +// Duplicate Method Definitions +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +// Implicit Objective-C Literal Conversions +CLANG_WARN_OBJC_LITERAL_CONVERSION = YES +// Overriding Deprecated Objective-C Methods +CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES +// Undeclared Selector +GCC_WARN_UNDECLARED_SELECTOR = YES +// Unintentional Root Class +CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR +// Implicit retain of 'self' within blocks +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +// Missing Localizability +CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES +// Dead Store static analysis +CLANG_ANALYZER_DEADCODE_DEADSTORES = NO +// Floats used as loop counters +CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES +// Use of rand() +CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES +// Use of strcpy() & strcat +CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES + +// Experimenting with extra build warnings +// Hidden Local Variables +// FIXME: This breaks on hs.doc's autolink dependency +//GCC_WARN_SHADOW = YES + +// TODO: Try these at some point +//GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES +//CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES +//GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES +//GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES +//GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES +//GCC_WARN_ABOUT_MISSING_NEWLINE = YES +//CLANG_WARN_ASSIGN_ENUM = YES +//GCC_WARN_SIGN_COMPARE = YES +//CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES +//GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES +//GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES +//GCC_WARN_UNKNOWN_PRAGMAS = YES +//GCC_WARN_UNUSED_LABEL = YES +//GCC_WARN_UNUSED_PARAMETER = YES diff --git a/Hammerspoon/Build Configs/Project-Release.xcconfig b/Hammerspoon/Build Configs/Project-Release.xcconfig new file mode 100644 index 000000000..27e91cb0c --- /dev/null +++ b/Hammerspoon/Build Configs/Project-Release.xcconfig @@ -0,0 +1,30 @@ +// +// Project-Release.xcconfig +// Hammerspoon +// +// Created by Chris Jones on 31/10/2021. +// Copyright © 2021 Hammerspoon. All rights reserved. +// + +// Configuration settings file format documentation can be found at: +// https://help.apple.com/xcode/#/dev745c5c974 + +#include "Project-Base.xcconfig" + +// Code Signing Identity +CODE_SIGN_IDENTITY = Developer ID Application +DEVELOPMENT_TEAM = VQCYSNZB89 + +// Build Active Architecture Only +ONLY_ACTIVE_ARCH = NO + +// Enable Testability +ENABLE_TESTABILITY = NO + +// Optimization Level +GCC_OPTIMIZATION_LEVEL = s + +// Preprocessor Macros +GCC_PREPROCESSOR_DEFINITIONS = + +#include? "../../../Hammerspoon-Downstream.xcconfig" \ No newline at end of file diff --git a/Hammerspoon/Build Configs/hs.xcconfig b/Hammerspoon/Build Configs/hs.xcconfig new file mode 100644 index 000000000..9a8a4701b --- /dev/null +++ b/Hammerspoon/Build Configs/hs.xcconfig @@ -0,0 +1,13 @@ +// +// hs.xcconfig +// Hammerspoon +// +// Created by Chris Jones on 09/11/2021. +// Copyright © 2021 Hammerspoon. All rights reserved. +// + +// Configuration settings file format documentation can be found at: +// https://help.apple.com/xcode/#/dev745c5c974 + +SKIP_INSTALL=YES +ENABLE_HARDENED_RUNTIME = YES diff --git a/Hammerspoon/CommandPost-Info.plist b/Hammerspoon/CommandPost-Info.plist index c62245c82..cb46d10eb 100644 --- a/Hammerspoon/CommandPost-Info.plist +++ b/Hammerspoon/CommandPost-Info.plist @@ -118,7 +118,7 @@ Viewer LSItemContentTypes - org.latenitefilms.CommandPost.Plugin + org.latenitefilms.CommandPost.cpPlugin LSTypeIsPackage 1 @@ -138,8 +138,6 @@ CFBundleExecutable ${EXECUTABLE_NAME} - CFBundleIconFile - CommandPost CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion @@ -149,7 +147,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0.0-beta.22 + $(MARKETING_VERSION) CFBundleSignature ???? CFBundleURLTypes @@ -170,7 +168,7 @@ CFBundleTypeRole Editor CFBundleURLName - latenitefilms.CommandPost.http + org.latenitefilms.CommandPost.http CFBundleURLSchemes http @@ -180,29 +178,25 @@ CFBundleTypeRole Editor CFBundleURLName - latenitefilms.CommandPost.https + org.latenitefilms.CommandPost.https CFBundleURLSchemes https + + CFBundleTypeRole + Editor + CFBundleURLName + org.latenitefilms.CommandPost.mailto + CFBundleURLSchemes + + mailto + + CFBundleVersion - 1.0.0-beta.22 - Fabric - - APIKey - 4799997d730e264415e10b3cecc13d0f3cf205fa - Kits - - - KitInfo - - KitName - Crashlytics - - - + 7002 LSApplicationCategoryType public.app-category.video LSMinimumSystemVersion @@ -216,14 +210,24 @@ NSAllowsArbitraryLoads + NSAppleEventsUsageDescription + CommandPost needs to send events to automate applications. NSAppleScriptEnabled + NSCameraUsageDescription + Some CommandPost extensions require access to the camera. NSHumanReadableCopyright - Copyright Chris Hocking & David Peterson 2017. Released under MIT license. + Copyright Chris Hocking & David Peterson 2017-2026. Released under MIT license. + NSLocationAlwaysUsageDescription + Some CommandPost extensions (such as hs.location) require access to your location. NSMainNibFile MainMenu + NSMicrophoneUsageDescription + Some CommandPost extensions (such as hs.noises) require access to the microphone. + NSAppDataUsageDescription + CommandPost needs to be able to read files contained in other applications containers. For example, CommandPost's reads the files within Keyboard Maestro's folder to get a list of macros, and within Final Cut Pro's folders to get a list of Share Destinations. You can click 'Allow' to approve permission for this session, or alternatively grant CommandPost 'Full Disk Access' in System Settings to avoid getting this request each time CommandPost restarts. NSPrincipalClass - NSApplication + SentryCrashExceptionApplication NSServices @@ -257,6 +261,10 @@ + NSUserActivityTypes + + HSExecuteLuaIntent + NSUserNotificationAlertStyle alert OSAScriptingDefinition @@ -267,8 +275,14 @@ https://raw.githubusercontent.com/CommandPost/CommandPost/develop/appcast/appcast.xml SUPublicDSAKeyFile dsa_pub.pem + SUPublicEDKey + S1wC2URSE4x0agiMwDwigH8UJ6ATH0I3Cf8z0V1Lthk= SUScheduledCheckInterval 900 + UIDesignRequiresCompatibility + + CFBundleIconName + CommandPost UTExportedTypeDeclarations @@ -277,12 +291,14 @@ public.composite-content com.apple.package + UTTypeDescription + CommandPost Plugin UTTypeIconFile cpPlugin UTTypeIdentifier - org.latenitefilms.CommandPost.Plugin + org.latenitefilms.CommandPost.cpPlugin UTTypeReferenceURL - http://commandpost.io + UTTypeTagSpecification public.filename-extension @@ -291,6 +307,283 @@ + + UTTypeConformsTo + + public.data + + UTTypeDescription + CommandPost HUD Preferences + UTTypeIconFile + cpHUD + UTTypeIdentifier + org.latenitefilms.CommandPost. cpHUD + UTTypeTagSpecification + + public.filename-extension + + cpHUD + + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + CommandPost Loupedeck Preferences + UTTypeIconFile + cpLoupedeck + UTTypeIdentifier + org.latenitefilms.CommandPost. cpLoupedeck + UTTypeTagSpecification + + public.filename-extension + + cpLoupedeck + + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + CommandPost Loupedeck CT Preferences + UTTypeIconFile + cpLoupedeckCT + UTTypeIdentifier + org.latenitefilms.CommandPost.cpLoupedeckCT + UTTypeTagSpecification + + public.filename-extension + + cpLoupedeckCT + + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + CommandPost Loupedeck Live Preferences + UTTypeIconFile + cpLoupedeckLive + UTTypeIdentifier + org.latenitefilms.CommandPost.cpLoupedeckLive + UTTypeTagSpecification + + public.filename-extension + + cpLoupedeckLive + + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + CommandPost Loupedeck+ Preferences + UTTypeIconFile + cpLoupedeckPlus + UTTypeIdentifier + org.latenitefilms.CommandPost.cpLoupedeckPlus + UTTypeTagSpecification + + public.filename-extension + + cpLoupedeckPlus + + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + CommandPost MIDI Preferences + UTTypeIconFile + cpMIDI + UTTypeIdentifier + org.latenitefilms.CommandPost.cpMIDI + UTTypeTagSpecification + + public.filename-extension + + cpMIDI + + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + CommandPots Monogram Preferences + UTTypeIconFile + cpMonogram + UTTypeIdentifier + org.latenitefilms.CommandPost.cpMonogram + UTTypeTagSpecification + + public.filename-extension + + cpMonogram + + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + CommandPost Pasteboard Preferences + UTTypeIconFile + cpPasteboard + UTTypeIdentifier + org.latenitefilms.CommandPost.cpPasteboard + UTTypeTagSpecification + + public.filename-extension + + cpPasteboard + + + + + UTTypeDescription + CommandPost Shortcuts Preferences + UTTypeIconFile + cpShortcuts + UTTypeIdentifier + org.latenitefilms.CommandPost.cpShortcuts + UTTypeTagSpecification + + public.filename-extension + + cpShortcuts + + + + + UTTypeDescription + CommandPost Snippets Preferences + UTTypeIconFile + cpSnippets + UTTypeIdentifier + org.latenitefilms.CommandPost.cpSnippets + UTTypeTagSpecification + + public.filename-extension + + cpSnippets + + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + CommandPost Stream Deck Preferences + UTTypeIconFile + cpStreamDeck + UTTypeIdentifier + org.latenitefilms.CommandPost.cpStreamDeck + UTTypeTagSpecification + + public.filename-extension + + cpStreamDeck + + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + CommandPost Tangent Preferences + UTTypeIconFile + cpTangent + UTTypeIdentifier + org.latenitefilms.CommandPost.cpTangent + UTTypeTagSpecification + + public.filename-extension + + cpTangent + + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + CommandPost Touch Bar Preferences + UTTypeIconFile + cpTouchBar + UTTypeIdentifier + org.latenitefilms.CommandPost.cpTouchBar + UTTypeTagSpecification + + public.filename-extension + + cpTouchBar + + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + CommandPost TourBox Preferences + UTTypeIconFile + cpTourBox + UTTypeIdentifier + org.latenitefilms.CommandPost.cpTourBox + UTTypeTagSpecification + + public.filename-extension + + cpTourBox + + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + CommandPost Cache File + UTTypeIconFile + cpCache + UTTypeIdentifier + org.latenitefilms.CommandPost.cpCache + UTTypeTagSpecification + + public.filename-extension + + cpCache + + + diff --git a/Hammerspoon/CommandPost.icon/Assets/CommandPost.png b/Hammerspoon/CommandPost.icon/Assets/CommandPost.png new file mode 100644 index 000000000..02a5c8bb3 Binary files /dev/null and b/Hammerspoon/CommandPost.icon/Assets/CommandPost.png differ diff --git a/Hammerspoon/CommandPost.icon/icon.json b/Hammerspoon/CommandPost.icon/icon.json new file mode 100644 index 000000000..d735c1bce --- /dev/null +++ b/Hammerspoon/CommandPost.icon/icon.json @@ -0,0 +1,33 @@ +{ + "fill" : { + "linear-gradient" : [ + "display-p3:0.36667,0.58576,1.00000,1.00000", + "display-p3:0.20465,0.47096,0.96611,1.00000" + ] + }, + "groups" : [ + { + "layers" : [ + { + "glass" : false, + "image-name" : "CommandPost.png", + "name" : "CommandPost" + } + ], + "shadow" : { + "kind" : "none", + "opacity" : 0.5 + }, + "specular" : false, + "translucency" : { + "enabled" : false, + "value" : 0.5 + } + } + ], + "supported-platforms" : { + "squares" : [ + "macOS" + ] + } +} \ No newline at end of file diff --git a/Hammerspoon/ConsoleWindow.xib b/Hammerspoon/ConsoleWindow.xib index f8632bbb1..520e6a300 100644 --- a/Hammerspoon/ConsoleWindow.xib +++ b/Hammerspoon/ConsoleWindow.xib @@ -1,7 +1,8 @@ - + - + + @@ -14,47 +15,47 @@ - + + - + - - - - + + + + - - + + - - + + + - - - - - + + - + diff --git a/Hammerspoon/HSAppleScript.m b/Hammerspoon/HSAppleScript.m index 816e49bb0..fbdec85a2 100644 --- a/Hammerspoon/HSAppleScript.m +++ b/Hammerspoon/HSAppleScript.m @@ -18,8 +18,9 @@ // NSString* HSAppleScriptRunString(executeLua *self, NSString* command) { - LuaSkin *skin = [LuaSkin shared] ; + LuaSkin *skin = [LuaSkin sharedWithState:NULL] ; lua_State* L = skin.L; + _lua_stackguard_entry(L); lua_getglobal(L, "hs") ; if (lua_getfield(L, -1, "__appleScriptRunString") != LUA_TFUNCTION) { @@ -27,29 +28,34 @@ [self setScriptErrorNumber:-50]; [self setScriptErrorString:@"hs.__appleScriptRunString is not a function"]; lua_pop(L, 2) ; // "hs", and whatever "hs.__appleScriptRunString" is (could be nil) + _lua_stackguard_exit(L); return @"Error"; } lua_pushstring(L, [command UTF8String]); if ([skin protectedCallAndTraceback:1 nresults:2] == NO) { - NSString *errMsg = [NSString stringWithFormat:@"hs.__apleScriptRunString callback error:%s", lua_tostring(L, -1)] ; + NSString *errMsg = [NSString stringWithFormat:@"hs.__appleScriptRunString callback error:%s", lua_tostring(L, -1)] ; [skin logError:errMsg]; [self setScriptErrorNumber:-50]; [self setScriptErrorString:errMsg]; lua_pop(L, 2) ; // "hs", and error message + _lua_stackguard_exit(L); return @"Error"; } NSString *str = [skin toNSObjectAtIndex:-1] ; // modern LuaSkin forces a string to be UTF8 clean if we don't give it options BOOL good = lua_toboolean(L, -2) ; - lua_pop(L, 3) ; // "hs" and two results from hs.__apleScriptRunString: boolean, string + lua_pop(L, 3) ; // "hs" and two results from hs.__appleScriptRunString: boolean, string if (good) { + _lua_stackguard_exit(L); return str; } else { [self setScriptErrorNumber:-50]; [self setScriptErrorString:str]; + _lua_stackguard_exit(L); return @"Error"; } + _lua_stackguard_exit(L); } // diff --git a/Hammerspoon/HSExecuteLuaIntentHandler.h b/Hammerspoon/HSExecuteLuaIntentHandler.h new file mode 100644 index 000000000..53c704e3a --- /dev/null +++ b/Hammerspoon/HSExecuteLuaIntentHandler.h @@ -0,0 +1,22 @@ +// +// HSExecuteLuaIntentHandler.h +// Hammerspoon +// +// Created by Chris Jones on 28/10/2021. +// Copyright © 2021 Hammerspoon. All rights reserved. +// + +#import +@import Intents; +@import LuaSkin; +#import "MJLua.h" +#import "HSExecuteLuaIntent.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface HSExecuteLuaIntentHandler : NSObject +- (void)handleExecuteLua:(HSExecuteLuaIntent *)intent completion:(void (^)(HSExecuteLuaIntentResponse *response))completion NS_SWIFT_NAME(handle(intent:completion:)) API_AVAILABLE(macos(11.0)); +- (void)resolveSourceForExecuteLua:(HSExecuteLuaIntent *)intent withCompletion:(void (^)(HSExecuteLuaSourceResolutionResult *resolutionResult))completion NS_SWIFT_NAME(resolveSource(for:with:)) API_AVAILABLE(ios(13.0), macos(10.16), watchos(6.0)); +@end + +NS_ASSUME_NONNULL_END diff --git a/Hammerspoon/HSExecuteLuaIntentHandler.m b/Hammerspoon/HSExecuteLuaIntentHandler.m new file mode 100644 index 000000000..177317426 --- /dev/null +++ b/Hammerspoon/HSExecuteLuaIntentHandler.m @@ -0,0 +1,53 @@ +// +// HSExecuteLuaIntentHandler.m +// Hammerspoon +// +// Created by Chris Jones on 28/10/2021. +// Copyright © 2021 Hammerspoon. All rights reserved. +// + +#import "HSExecuteLuaIntentHandler.h" + +@implementation HSExecuteLuaIntentHandler +-(void)handleExecuteLua:(HSExecuteLuaIntent *)intent completion:(void (^)(HSExecuteLuaIntentResponse * _Nonnull))completion { + LuaSkin *skin = [LuaSkin sharedWithState:nil]; + + if (!intent.source) { + NSLog(@"HSExecuteLuaIntent failed: called with no source"); + completion([HSExecuteLuaIntentResponse failureIntentResponseWithError:@"No Lua source provided"]); + return; + } + + int result = luaL_dostring(skin.L, intent.source.UTF8String); + + NSString *output = @""; + if (lua_gettop(skin.L) > 0 && lua_type(skin.L, 1) == LUA_TSTRING) { + output = [NSString stringWithUTF8String:lua_tostring(skin.L, -1)]; + lua_pop(skin.L, 1); + } + + if (result == LUA_OK) { + NSLog(@"HSExecuteLuaIntent executed Lua correctly: %@", output); + HSExecuteLuaIntentResponse *response = [HSExecuteLuaIntentResponse successIntentResponseWithResult:output]; +// if (lua_gettop(skin.L) > 0) { +// NSLog(@"HSExecuteLuaIntent found additional return value of type: %d", lua_type(skin.L, 1)); +// NSData *outputData = [skin toNSObjectAtIndex:1 withOptions:LS_NSLuaStringAsDataOnly]; +// NSLog(@"HSExecuteLuaIntent fetched additional return value: %@", outputData); +// response.data = [INFile fileWithData:outputData filename:@"" typeIdentifier:nil]; +// } + completion(response); + } else { + NSLog(@"HSExecuteLuaIntent failed: %@", output); + completion([HSExecuteLuaIntentResponse failureIntentResponseWithError:output]); + } +} + +-(void)resolveSourceForExecuteLua:(HSExecuteLuaIntent *)intent withCompletion:(void (^)(HSExecuteLuaSourceResolutionResult * _Nonnull))completion { + NSLog(@"resolving source for HSExecuteLuaIntent"); + if (intent.source && (intent.source.length == 0)) { + completion([HSExecuteLuaSourceResolutionResult unsupportedForReason:HSExecuteLuaSourceUnsupportedReasonNoLua]); + } else { + completion([HSExecuteLuaSourceResolutionResult successWithResolvedString:intent.source]); + } +} +@end diff --git a/Hammerspoon/HSLogger.h b/Hammerspoon/HSLogger.h index 78bd90a5e..ec3d7aaae 100644 --- a/Hammerspoon/HSLogger.h +++ b/Hammerspoon/HSLogger.h @@ -7,20 +7,20 @@ // #import -#import -#ifdef CRASHLYTICS_API_KEY -# ifdef CLS_LOG -# define HSNSLOG(__FORMAT__, ...) CLSNSLog(__FORMAT__, ##__VA_ARGS__) -# endif -#endif +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wvariadic-macros" +#import "Sentry/Sentry.h" +#pragma clang diagnostic pop + +#import "secrets.h" -#ifndef HSNSLOG +#ifdef SENTRY_API_URL +# define HSNSLOG(__FORMAT__, ...) [LuaSkin logBreadcrumb:[NSString stringWithFormat:__FORMAT__, ##__VA_ARGS__]]; +#else # define HSNSLOG(__FORMAT__, ...) NSLog(__FORMAT__, ##__VA_ARGS__) #endif -#define HSLOG HSNSLOG - @interface HSLogger : NSObject { lua_State *_L; } @@ -30,4 +30,6 @@ - (instancetype)initWithLua:(lua_State *)L; - (void)setLuaState:(lua_State *)L; - (void) logForLuaSkinAtLevel:(int)level withMessage:(NSString *)theMessage; +- (void)logBreadcrumb:(NSString *)format, ...; +- (void)logKnownBug:(NSString *)format, ...; @end diff --git a/Hammerspoon/HSLogger.m b/Hammerspoon/HSLogger.m index 41cb22373..6d7a2c6aa 100644 --- a/Hammerspoon/HSLogger.m +++ b/Hammerspoon/HSLogger.m @@ -9,6 +9,13 @@ #import #import "HSLogger.h" +#ifdef SENTRY_API_URL +# pragma message "BUILD NOTE: Sentry API URL available" +@import Sentry; +#else +# pragma message "BUILD NOTE: Sentry API URL unavailable" +#endif + @implementation HSLogger @synthesize L = _L ; @@ -25,10 +32,11 @@ - (void)setLuaState:(lua_State *)L { _L = L; } +// VERY IMPORTANT NOTE: DO NOT CALL HSNSLOG() IN THIS METHOD. - (void) logForLuaSkinAtLevel:(int)level withMessage:(NSString *)theMessage { // If we haven't been given a lua_State object yet, log locally if (!_L) { - HSNSLOG(@"%@", theMessage); + [self logBreadcrumb:@"%@", theMessage]; return; } @@ -37,15 +45,15 @@ - (void) logForLuaSkinAtLevel:(int)level withMessage:(NSString *)theMessage { // (because such logs don't need to be shown to the user, just stored in our crashlog in case we crash) switch (level) { case LS_LOG_BREADCRUMB: - HSNSLOG(@"%@", theMessage); + [self logBreadcrumb:@"%@", theMessage]; break; - // Capture anything that isn't verbose/debug logging, in Crashlytics + // Capture anything that isn't verbose/debug logging, in Sentry // These intentionally fall through to default. case LS_LOG_ERROR: case LS_LOG_WARN: case LS_LOG_INFO: - HSNSLOG(@"%@", theMessage); + [self logBreadcrumb:@"%@", theMessage]; default: lua_getglobal(_L, "hs") ; lua_getfield(_L, -1, "handleLogMessage") ; lua_remove(_L, -2) ; lua_pushinteger(_L, level) ; @@ -53,12 +61,48 @@ - (void) logForLuaSkinAtLevel:(int)level withMessage:(NSString *)theMessage { int errState = lua_pcall(_L, 2, 0, 0) ; if (errState != LUA_OK) { NSArray *stateLabels = @[ @"OK", @"YIELD", @"ERRRUN", @"ERRSYNTAX", @"ERRMEM", @"ERRGCMM", @"ERRERR" ] ; - HSNSLOG(@"logForLuaSkin: error, state %@: %s", [stateLabels objectAtIndex:(NSUInteger)errState], - luaL_tolstring(_L, -1, NULL)) ; - lua_pop(_L, 2) ; // lua_pcall result + converted version from luaL_tolstring + [self logBreadcrumb:@"logForLuaSkin: error, state %@: %s", [stateLabels objectAtIndex:(NSUInteger)errState], + luaL_tolstring(_L, -1, NULL)] ; + lua_pop(_L, 2) ; // lua_pcall error + converted string from luaL_tolstring } break; } } +- (void)handleCatastrophe:(NSString *)message { + NSAlert *alert = [[NSAlert alloc] init]; + alert.messageText = message; + alert.informativeText = @"CommandPost critical error."; + [alert addButtonWithTitle:@"Quit"]; + [alert setAlertStyle:NSAlertStyleCritical]; + [alert runModal]; + exit(1); +} + +- (void)logBreadcrumb:(NSString *)format, ... { + va_list args; + va_start(args, format); + NSString *message = [[NSString alloc] initWithFormat:format arguments:args]; + NSLog(@"BREADCRUMB: %@", message); + SentryBreadcrumb *crumb = [[SentryBreadcrumb alloc] init]; + crumb.message = message; +#ifdef SENTRY_API_URL + [SentrySDK addBreadcrumb:crumb]; +#endif +} + +- (void)logKnownBug:(NSString *)format, ... { + va_list args; + va_start(args, format); + NSString *message = [[NSString alloc] initWithFormat:format arguments:args]; + NSLog(@"KNOWN BUG: %@", message); + + // FIXME: no idea why we can't use SentryLevel for this, but 4 currently means error. It may break at any future release of Sentry. + SentryEvent *event = [[SentryEvent alloc] initWithLevel:4]; + event.message = [[SentryMessage alloc] initWithFormatted:message]; + +#ifdef SENTRY_API_URL + [SentrySDK captureEvent:event]; +#endif +} @end diff --git a/Hammerspoon/HSuicore.h b/Hammerspoon/HSuicore.h new file mode 100644 index 000000000..e8713ade6 --- /dev/null +++ b/Hammerspoon/HSuicore.h @@ -0,0 +1,172 @@ +@import Foundation; +@import LuaSkin; + +#pragma mark - HSuielement declarations + +@interface HSuielement : NSObject +@property (nonatomic, readonly) AXUIElementRef elementRef; +@property (nonatomic) int selfRefCount; +@property (nonatomic, readonly, getter=isWindow) BOOL isWindow; +@property (nonatomic, readonly, getter=isApplication) BOOL isApplication; +@property (nonatomic, readonly, getter=getRole) NSString *role; +@property (nonatomic, readonly, getter=getSelectedText) NSString *selectedText; + +// Class methods ++(HSuielement *)focusedElement; + +// Instance initializer/destructor +-(HSuielement *)initWithElementRef:(AXUIElementRef)elementRef; +-(void)dealloc; + +// Instance methods +-(id)newWatcherAtIndex:(int)callbackRefIndex withUserdataAtIndex:(int)userDataRefIndex withLuaState:(lua_State *)L; +-(id)getElementProperty:(NSString *)property withDefaultValue:(id)defaultValue; +-(BOOL)isWindow; +-(BOOL)isWindow:(NSString *)role; +-(NSString *)getRole; +-(NSString *)getSelectedText; +@end + +@interface HSuielementWatcher : NSObject +@property (nonatomic) int selfRefCount; +@property (nonatomic) AXUIElementRef elementRef; +@property (nonatomic) LSRefTable refTable; +@property (nonatomic) int handlerRef; +@property (nonatomic) int userDataRef; +@property (nonatomic) int watcherRef; +@property (nonatomic) AXObserverRef observer; +@property (nonatomic) BOOL running; +@property (nonatomic) pid_t pid; +@property (nonatomic) BOOL watchDestroyed; +@property (nonatomic) LSGCCanary lsCanary; + +-(HSuielementWatcher *)initWithElement:(HSuielement *)element callbackRef:(int)callbackRef userdataRef:(int)userdataRef; +-(void)dealloc; + +-(void)start:(NSArray *)events withState:(lua_State *)L; +-(void)stop; +@end + +#pragma mark - HSapplication declaration + +@interface HSapplication : NSObject +@property (nonatomic, readonly) pid_t pid; +@property (nonatomic, readonly) AXUIElementRef elementRef; +@property (nonatomic, readonly) NSRunningApplication *runningApp; +@property (nonatomic, readonly) HSuielement *uiElement; +@property (nonatomic) int selfRefCount; +@property (nonatomic, getter=isHidden, setter=setHidden:) BOOL hidden; + +// Simplest class methods that just return an application ++(HSapplication *)frontmostApplicationWithState:(lua_State *)L; + +// Class methods that return an application matching a criteria ++(HSapplication *)applicationForPID:(pid_t)pid withState:(lua_State *)L; ++(HSapplication *)applicationForNSRunningApplication:(NSRunningApplication *)app withState:(lua_State *)L; + +// Class methods that return application metadata based on an argument ++(NSString *)nameForBundleID:(NSString *)bundleID; ++(NSString *)pathForBundleID:(NSString *)bundleID; ++(NSDictionary *)infoForBundleID:(NSString *)bundleID; ++(NSDictionary *)infoForBundlePath:(NSString *)bundlePath; ++(NSArray *)preferredLocalizationsForBundleID:(NSString *)bundleID; ++(NSArray *)preferredLocalizationsForBundlePath:(NSString *)bundlePath; ++(NSArray *)localizationsForBundlePath:(NSString *)bundlePath; ++(NSArray *)localizationsForBundleID:(NSString *)bundleID; + +// Class methods that return arrays of applications ++(NSArray*)runningApplicationsWithState:(lua_State *)L; ++(NSArray*)applicationsForBundleID:(NSString *)bundleID withState:(lua_State *)L; + +// Class methods that launch applications ++(BOOL)launchByName:(NSString *)name; ++(BOOL)launchByBundleID:(NSString *)bundleID; + +// Custom getter/setter methods +-(void)setHidden:(BOOL)shouldHide; +-(BOOL)isHidden; + +// Initialisers +-(HSapplication *)initWithPid:(pid_t)pid withState:(lua_State *)L; +-(HSapplication *)initWithNSRunningApplication:(NSRunningApplication *)app withState:(lua_State *)L; + +// Destructor +-(void)dealloc; + +// Instance methods +-(NSArray*)allWindows; +-(id)mainWindow; +-(id)focusedWindow; +-(BOOL)activate:(BOOL)allWindows; +-(BOOL)isResponsive; +-(BOOL)isRunningWithState:(lua_State *)L; +-(BOOL)setFrontmost:(BOOL)allWindows; +-(BOOL)isFrontmost; +-(NSString *)title; +-(NSString *)bundleID; +-(NSString *)path; +-(void)kill; +-(void)kill9; +-(int)kind; + +@end + +#pragma mark - HSwindow declaration + +@interface HSwindow : NSObject +@property (nonatomic, readonly) pid_t pid; +@property (nonatomic, readonly) AXUIElementRef elementRef; +@property (nonatomic, readonly) CGWindowID winID; +@property (nonatomic, readonly) HSuielement *uiElement; +@property (nonatomic) int selfRefCount; + +@property (nonatomic, readonly, getter=title) NSString *title; +@property (nonatomic, readonly, getter=role) NSString *role; +@property (nonatomic, readonly, getter=subRole) NSString *subRole; +@property (nonatomic, readonly, getter=isStandard) BOOL isStandard; +@property (nonatomic, getter=getTopLeft, setter=setTopLeft:) NSPoint topLeft; +@property (nonatomic, getter=getSize, setter=setSize:) NSSize size; +@property (nonatomic, getter=isFullscreen, setter=setFullscreen:) BOOL fullscreen; +@property (nonatomic, getter=isMinimized, setter=setMinimized:) BOOL minimized; +@property (nonatomic, getter=getApplication) id application; +@property (nonatomic, readonly, getter=getZoomButtonRect) NSRect zoomButtonRect; +@property (nonatomic, readonly, getter=getTabCount) int tabCount; + +// Class methods ++(NSArray*)orderedWindowIDs; ++(NSImage *)snapshotForID:(int)windowID keepTransparency:(BOOL)keepTransparency; ++(HSwindow *)focusedWindow; + +// Initialiser +-(HSwindow *)initWithAXUIElementRef:(AXUIElementRef)winRef; + +// Destructor +-(void)dealloc; + +// Instance methods +-(NSString *)title; +-(NSString *)subRole; +-(NSString *)role; +-(BOOL)isStandard; +-(NSPoint)getTopLeft; +-(void)setTopLeft:(NSPoint)topLeft; +-(NSSize)getSize; +-(void)setSize:(NSSize)size; +-(void)setFrame:(NSRect)frame; +-(BOOL)pushButton:(CFStringRef)buttonId; +-(void)toggleZoom; +-(NSRect)getZoomButtonRect; +-(BOOL)close; +-(BOOL)focusTab:(int)index; +-(int)getTabCount; +-(BOOL)isFullscreen; +-(void)setFullscreen:(BOOL)fullscreen; +-(BOOL)isMinimized; +-(void)setMinimized:(BOOL)minimize; +-(id)getApplication; +-(void)becomeMain; +-(void)raise; +-(NSImage *)snapshot:(BOOL)keepTransparency; +@end + +extern AXError _AXUIElementGetWindow(AXUIElementRef, CGWindowID* out); diff --git a/Hammerspoon/HSuicore.m b/Hammerspoon/HSuicore.m new file mode 100644 index 000000000..1bd0a2203 --- /dev/null +++ b/Hammerspoon/HSuicore.m @@ -0,0 +1,899 @@ +#import "HSuicore.h" + +#pragma mark - HSapplication implementation + +@implementation HSapplication + +#pragma mark - Class methods ++(HSapplication *)frontmostApplicationWithState:(lua_State *)L { + LuaSkin *skin = [LuaSkin sharedWithState:L]; + HSapplication *frontmostApp = nil; + + NSRunningApplication *runningApp = [[NSWorkspace sharedWorkspace] frontmostApplication]; + if (runningApp) { + frontmostApp = [HSapplication applicationForNSRunningApplication:runningApp withState:L]; + if (!frontmostApp) { + [skin logError:[NSString stringWithFormat:@"HSapplication::frontmostApplication failed for app: %@", runningApp.localizedName]]; + } + } else { + [skin logError:@"Unable to fetch frontmost application"]; + } + return frontmostApp; +} + ++(HSapplication *)applicationForNSRunningApplication:(NSRunningApplication *)app withState:(lua_State *)L { + return [[HSapplication alloc] initWithNSRunningApplication:app withState:L]; +} + ++(HSapplication *)applicationForPID:(pid_t)pid withState:(lua_State *)L { + return [[HSapplication alloc] initWithPid:pid withState:L]; +} + ++(NSString *)nameForBundleID:(NSString *)bundleID { + NSBundle *app = [NSBundle bundleWithPath:[HSapplication pathForBundleID:bundleID]]; + return [app objectForInfoDictionaryKey:(id)kCFBundleNameKey]; +} + ++(NSString *)pathForBundleID:(NSString *)bundleID { + NSString *path = @""; + NSURL *url = [[NSWorkspace sharedWorkspace] URLForApplicationWithBundleIdentifier:bundleID]; + if (url) { + path = url.path; + } + return path; +} + ++(NSDictionary *)infoForBundleID:(NSString *)bundleID { + NSString *appPath = [HSapplication pathForBundleID:bundleID]; + return [HSapplication infoForBundlePath:appPath]; +} + ++(NSDictionary *)infoForBundlePath:(NSString *)bundlePath { + NSDictionary *appInfo = nil; + + NSBundle *app = [NSBundle bundleWithPath:bundlePath]; + if (app) { + appInfo = app.infoDictionary; + } + return appInfo; +} + ++(NSArray *)preferredLocalizationsForBundleID:(NSString *)bundleID { + NSString *appPath = [HSapplication pathForBundleID:bundleID]; + return [HSapplication preferredLocalizationsForBundlePath:appPath]; +} + ++(NSArray *)preferredLocalizationsForBundlePath:(NSString *)bundlePath { + NSArray *preferredLocalizations = nil; + + NSBundle *app = [NSBundle bundleWithPath:bundlePath]; + if (app) { + preferredLocalizations = app.preferredLocalizations; + } + return preferredLocalizations; +} + ++(NSArray *)localizationsForBundleID:(NSString *)bundleID { + NSString *appPath = [HSapplication pathForBundleID:bundleID]; + return [HSapplication localizationsForBundlePath:appPath]; +} + ++(NSArray *)localizationsForBundlePath:(NSString *)bundlePath { + NSArray *localizations = nil; + + NSBundle *app = [NSBundle bundleWithPath:bundlePath]; + if (app) { + localizations = app.localizations; + } + return localizations; +} + ++(NSArray*)runningApplicationsWithState:(lua_State *)L { + NSMutableArray *apps = [[NSMutableArray alloc] init]; + + for (NSRunningApplication* runningApp in [[NSWorkspace sharedWorkspace] runningApplications]) { + HSapplication *app = [HSapplication applicationForNSRunningApplication:runningApp withState:L]; + if (app) { + [apps addObject:app]; + } + } + + return (NSArray *)[apps copy]; +} + ++(NSArray*)applicationsForBundleID:(NSString *)bundleID withState:(lua_State *)L { + NSMutableArray *apps = [[NSMutableArray alloc] init]; + + for (NSRunningApplication* runningApp in [NSRunningApplication runningApplicationsWithBundleIdentifier:bundleID]) { + HSapplication *app = [HSapplication applicationForNSRunningApplication:runningApp withState:L]; + if (app) { + [apps addObject:app]; + } + } + + return apps; +} + ++(BOOL)launchByName:(NSString *)name { + return [[NSWorkspace sharedWorkspace] launchApplication:name]; +} + ++(BOOL)launchByBundleID:(NSString *)bundleID { + return [[NSWorkspace sharedWorkspace] launchAppWithBundleIdentifier:bundleID + options:NSWorkspaceLaunchDefault + additionalEventParamDescriptor:nil + launchIdentifier:NULL]; +} + +#pragma mark - Custom getter/setter methods +-(void)setHidden:(BOOL)shouldHide { + AXUIElementSetAttributeValue(self.elementRef, (CFStringRef)NSAccessibilityHiddenAttribute, shouldHide ? kCFBooleanTrue : kCFBooleanFalse); +} + +-(BOOL)isHidden { + CFBooleanRef _isHidden; + NSNumber* isHidden = @NO; + AXError result = AXUIElementCopyAttributeValue(self.elementRef, + (CFStringRef)NSAccessibilityHiddenAttribute, + (CFTypeRef *)&_isHidden); + if (result == kAXErrorSuccess) { + isHidden = (__bridge_transfer NSNumber*)_isHidden; + } + return isHidden.boolValue; +} + +#pragma mark - Instance initialisers +-(HSapplication *)initWithPid:(pid_t)pid withState:(lua_State *)L { + LuaSkin *skin = [LuaSkin sharedWithState:L]; + + NSRunningApplication *runningApp = [NSRunningApplication runningApplicationWithProcessIdentifier:pid]; + if (!runningApp) { + //[skin logError:[NSString stringWithFormat:@"Unable to fetch NSRunningApplication for pid: %d", pid]]; + return nil; + } + + return [self initWithNSRunningApplication:runningApp withState:L]; +} + +-(HSapplication *)initWithNSRunningApplication:(NSRunningApplication *)app withState:(lua_State *)L { + LuaSkin *skin = [LuaSkin sharedWithState:L]; + + if (!app) { + [skin logError:@"HSapplication::initWithNSRunningApplication called with invalid application"]; + return nil; + } + + AXUIElementRef appRef = AXUIElementCreateApplication(app.processIdentifier); + if (!appRef) { + [skin logError:[NSString stringWithFormat:@"Unable to fetch AXUIElementRef for application: %@", app.localizedName]]; + return nil; + } + + self = [super init]; + if (self) { + _pid = app.processIdentifier; + _elementRef = appRef; // no retain required because of AXUIElementCreateApplication above + _runningApp = app; + _uiElement = [[HSuielement alloc] initWithElementRef:_elementRef]; + _selfRefCount = 0; + } else { + CFRelease(appRef); + } + return self; +} + +#pragma mark - Instance destructor +-(void)dealloc { + if (_elementRef) CFRelease(_elementRef) ; + _elementRef = NULL ; +} + +#pragma mark - Instance methods +-(NSArray*)allWindows { + NSMutableArray *allWindows = [[NSMutableArray alloc] init]; + CFArrayRef windows; + AXError result = AXUIElementCopyAttributeValues(self.elementRef, kAXWindowsAttribute, 0, 100, &windows); + if (result == kAXErrorSuccess) { + CFIndex windowCount = CFArrayGetCount(windows); + allWindows = [[NSMutableArray alloc] initWithCapacity:windowCount]; + for (NSInteger i = 0; i < windowCount; i++) { + AXUIElementRef win = CFArrayGetValueAtIndex(windows, i); + HSwindow *window = [[HSwindow alloc] initWithAXUIElementRef:win]; + [allWindows addObject:window]; + } + CFRelease(windows); + } + return allWindows; +} + +-(HSwindow *)mainWindow { + HSwindow *mainWindow = nil; + CFTypeRef window; + if (AXUIElementCopyAttributeValue(self.elementRef, kAXMainWindowAttribute, &window) == kAXErrorSuccess) { + mainWindow = [[HSwindow alloc] initWithAXUIElementRef:window]; + CFRelease(window); + } + return mainWindow; +} + +-(HSwindow *)focusedWindow { + HSwindow *focusedWindow = nil; + CFTypeRef window; + if (AXUIElementCopyAttributeValue(self.elementRef, kAXFocusedWindowAttribute, &window) == kAXErrorSuccess) { + focusedWindow = [[HSwindow alloc] initWithAXUIElementRef:window]; + CFRelease(window); + } + return focusedWindow; +} + +-(BOOL)activate:(BOOL)allWindows { + return [self.runningApp activateWithOptions:NSApplicationActivateIgnoringOtherApps | (allWindows ? NSApplicationActivateAllWindows : 0)]; +} + +-(BOOL)isResponsive { + // Define some private API we need + typedef int CGSConnectionID; + CG_EXTERN CGSConnectionID CGSMainConnectionID(void); + bool CGSEventIsAppUnresponsive(CGSConnectionID cid, const ProcessSerialNumber *psn); + // End of private API definitions + + ProcessSerialNumber psn; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + GetProcessForPID(self.pid, &psn); +#pragma clang diagnostic pop + + CGSConnectionID conn = CGSMainConnectionID(); + return !CGSEventIsAppUnresponsive(conn, &psn); +} + +-(BOOL)isRunningWithState:(lua_State *)L { + // FIXME: Figure out why we can't use NSRunningApplication.terminated here - it always seems to say NO + //BOOL isTerminated = self.runningApp.terminated; + HSapplication *test = [HSapplication applicationForPID:self.runningApp.processIdentifier withState:(lua_State *)L]; + return (test != nil); +} + +-(BOOL)setFrontmost:(BOOL)allWindows { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + ProcessSerialNumber psn; + GetProcessForPID(self.pid, &psn); + return (SetFrontProcessWithOptions(&psn, allWindows ? 0 : kSetFrontProcessFrontWindowOnly) == noErr); +#pragma clang diagnostic pop +} + +-(BOOL)isFrontmost { + CFTypeRef _isFrontmost; + NSNumber* isFrontmost = @NO; + + if (kAXErrorSuccess == AXUIElementCopyAttributeValue(self.elementRef, + (CFStringRef)NSAccessibilityFrontmostAttribute, + &_isFrontmost)) { + isFrontmost = (__bridge_transfer NSNumber *)_isFrontmost; +// } else { +// [LuaSkin logError:[NSString stringWithFormat:@"Unable to fetch element attribute NSAccessibilityFrontmostAttribute for: %@", [self.runningApp localizedName]]]; + } + + //[LuaSkin logBreadcrumb:[NSString stringWithFormat:@"FRONTMOST: %@:%@:%@", self.title, isFrontmost, AXIsProcessTrusted() ? @"YES" : @"NO"]]; + + return isFrontmost.boolValue; +} + +-(NSString *)title { + return self.runningApp.localizedName; +} + +-(NSString *)bundleID { + return self.runningApp.bundleIdentifier; +} + +-(NSString *)path { + return [NSBundle bundleWithURL:self.runningApp.bundleURL].bundlePath; +} + +-(void)kill { + [self.runningApp terminate]; +} + +-(void)kill9 { + [self.runningApp forceTerminate]; +} + +-(int)kind { + int kind = 1; + switch (self.runningApp.activationPolicy) { + case NSApplicationActivationPolicyAccessory: + kind = 0; + break; + case NSApplicationActivationPolicyProhibited: + kind = -1; + break; + default: break; + } + return kind; +} + +@end + +#pragma mark - HSuielement implementation + +@implementation HSuielement + +#pragma mark - Class methods ++(HSuielement *)focusedElement { + HSuielement *focused = nil; + AXUIElementRef focusedElement; + AXUIElementRef systemWide = AXUIElementCreateSystemWide(); + + AXError error = AXUIElementCopyAttributeValue(systemWide, kAXFocusedUIElementAttribute, (CFTypeRef *)&focusedElement); + CFRelease(systemWide); + + if (error == kAXErrorSuccess) { + focused = [[HSuielement alloc] initWithElementRef:focusedElement]; + CFRelease(focusedElement) ; + } + + return focused; +} + +#pragma mark - Instance initialiser +-(HSuielement *)initWithElementRef:(AXUIElementRef)elementRef { + self = [super init]; + if (self) { + _elementRef = CFRetain(elementRef); + _selfRefCount = 0; + } + return self; +} + +#pragma mark - Instance destructor +-(void)dealloc { + if (_elementRef) CFRelease(_elementRef) ; + _elementRef = NULL ; +} + +#pragma mark - Instance methods +-(id)newWatcherAtIndex:(int)callbackRefIndex withUserdataAtIndex:(int)userDataRefIndex withLuaState:(lua_State *)L { + LuaSkin *skin = [LuaSkin sharedWithState:L]; + + int callbackRef = [skin luaRef:LUA_REGISTRYINDEX atIndex:callbackRefIndex]; + + int userDataRef = LUA_REFNIL; + if (lua_type(L, userDataRefIndex) != LUA_TNONE) { + userDataRef = [skin luaRef:LUA_REGISTRYINDEX atIndex:userDataRefIndex]; + } + + HSuielementWatcher *watcher = [[HSuielementWatcher alloc] initWithElement:self + callbackRef:(int)callbackRef + userdataRef:(int)userDataRef]; + watcher.lsCanary = [skin createGCCanary]; + return watcher; +} + +-(id)getElementProperty:(NSString *)property withDefaultValue:(id)defaultValue { + CFTypeRef value; + if (AXUIElementCopyAttributeValue(self.elementRef, (__bridge CFStringRef)property, &value) == kAXErrorSuccess) { + return CFBridgingRelease(value); + } + return defaultValue; +} + +-(BOOL)isApplication { + return [self.role isEqualToString:(__bridge NSString *)kAXApplicationRole]; +} + +-(BOOL)isWindow { + return [self isWindow:self.role]; +} + +-(BOOL)isWindow:(NSString *)role { + // Most windows have a role of kAXWindowRole, but some apps are weird (e.g. Emacs) so we also do a duck-typing test for an expected window attribute + return ([role isEqualToString:(__bridge NSString *)kAXWindowRole] || [self getElementProperty:NSAccessibilityMinimizedAttribute withDefaultValue:nil]); +} + +-(NSString *)getRole { + return [self getElementProperty:NSAccessibilityRoleAttribute withDefaultValue:@""]; +} + +-(NSString *)getSelectedText { + NSString *selectedText = nil; + AXValueRef _selectedText = NULL; + if (AXUIElementCopyAttributeValue(self.elementRef, kAXSelectedTextAttribute, (CFTypeRef *)&_selectedText) == kAXErrorSuccess) { + selectedText = (__bridge_transfer NSString *)_selectedText; + } + return selectedText; +} + +@end + +#pragma mark - HSuielementWatcher implementation + +#pragma mark - Helper functions + +static void watcher_observer_callback(AXObserverRef observer __unused, AXUIElementRef element, + CFStringRef notificationName, void* contextData) { + HSuielementWatcher *watcher = (__bridge HSuielementWatcher *)contextData; + LuaSkin *skin = [LuaSkin sharedWithState:NULL]; + [skin checkGCCanary:watcher.lsCanary]; + _lua_stackguard_entry(skin.L); + + + [skin pushLuaRef:watcher.refTable ref:watcher.handlerRef]; // Callback function + + HSuielement *elementObj = [[HSuielement alloc] initWithElementRef:element]; + id pushObj = elementObj; + if (elementObj.isWindow) { + pushObj = [[HSwindow alloc] initWithAXUIElementRef:element]; + } else if ([elementObj.role isEqualToString:(__bridge NSString *)kAXApplicationRole]) { + pid_t pid; + AXUIElementGetPid(element, &pid); + pushObj = [[HSapplication alloc] initWithPid:pid withState:skin.L]; + } else { + // This isn't a window or an application, so we'll send it as an hs.uielement object + pushObj = elementObj; + } + + [skin pushNSObject:pushObj]; // Parameter 1: element + lua_pushstring(skin.L, CFStringGetCStringPtr(notificationName, kCFStringEncodingASCII)); // Parameter 2: event + [skin pushLuaRef:watcher.refTable ref:watcher.watcherRef]; // Parameter 3: watcher + if (watcher.userDataRef == LUA_NOREF || watcher.userDataRef == LUA_REFNIL) { + lua_pushnil(skin.L); + } else { + [skin pushLuaRef:watcher.refTable ref:watcher.userDataRef]; // Parameter 4: userData + } + + if (![skin protectedCallAndTraceback:4 nresults:0]) { + const char *errorMsg = lua_tostring(skin.L, -1); + [skin logError:[NSString stringWithUTF8String:errorMsg]]; + lua_pop(skin.L, 1); // remove error message + } + + _lua_stackguard_exit(skin.L); + return; +} + +@implementation HSuielementWatcher + +#pragma mark - Instance initialiser +// NOTE THAT THE LUA REF ARGUMENTS MUST BE ON LUA_REGISTRYINDEX AND NOT SOME OTHER REFTABLE +-(HSuielementWatcher *)initWithElement:(HSuielement *)element callbackRef:(int)callbackRef userdataRef:(int)userdataRef{ + self = [super init]; + if (self) { + _refTable = LUA_REGISTRYINDEX; + _elementRef = CFRetain(element.elementRef); + _selfRefCount = 0; + _handlerRef = callbackRef; + _userDataRef = userdataRef; + _watcherRef = LUA_NOREF; + _running = NO; + _watchDestroyed = NO; + AXUIElementGetPid(_elementRef, &_pid); + } + return self; +} + +#pragma mark - Instance destructor +-(void)dealloc { + if (_elementRef) CFRelease(_elementRef) ; + _elementRef = NULL ; +} + +#pragma mark - Instance methods + +-(void)start:(NSArray *)events withState:(lua_State *)L { + LuaSkin *skin = [LuaSkin sharedWithState:L]; + if (self.running) { + return; + } + + // Create our observer + AXObserverRef observer = NULL; + AXError err = AXObserverCreate(self.pid, watcher_observer_callback, &observer); + if (err != kAXErrorSuccess) { + [skin logBreadcrumb:[NSString stringWithFormat:@"AXObserverCreate error: %d", (int)err]]; + return; + } + + // Add specified events to the observer + for (NSString *event in events) { + AXObserverAddNotification(observer, self.elementRef, (__bridge CFStringRef)event, (__bridge void *)self); + } + + self.observer = observer; + self.running = YES; + + // Begin observing events + CFRunLoopAddSource([[NSRunLoop currentRunLoop] getCFRunLoop], + AXObserverGetRunLoopSource(observer), + kCFRunLoopDefaultMode); +} + +-(void)stop { + if (!self.running) { + return; + } + + CFRunLoopRemoveSource([[NSRunLoop currentRunLoop] getCFRunLoop], + AXObserverGetRunLoopSource(self.observer), + kCFRunLoopDefaultMode); + CFRelease(self.observer); + self.running = NO; +} +@end + +#pragma mark - HSwindow implementation + +#pragma mark - Helper functions +static AXUIElementRef system_wide_element() { + static AXUIElementRef element; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + element = AXUIElementCreateSystemWide(); + }); + return element; +} + +static AXUIElementRef get_window_tabs(AXUIElementRef win) { + AXUIElementRef tabs = NULL; + + CFArrayRef children = NULL; + if (AXUIElementCopyAttributeValues(win, kAXChildrenAttribute, 0, 100, &children) != noErr) { + goto cleanup; + } + CFIndex count = CFArrayGetCount(children); + + CFTypeRef typeRef; + for (CFIndex i = 0; i < count; ++i) { + AXUIElementRef child = CFArrayGetValueAtIndex(children, i); + if(AXUIElementCopyAttributeValue(child, kAXRoleAttribute, &typeRef) != noErr) goto cleanup; + CFStringRef role = (CFStringRef)typeRef; + BOOL correctRole = kCFCompareEqualTo == CFStringCompare(role, kAXTabGroupRole, 0); + CFRelease(role); + if (correctRole) { + tabs = child; + CFRetain(tabs); + break; + } + } + + // Safari 14 puts them into an AXGroup, not an AXTabsGroup + if (tabs == NULL) { + for (CFIndex i = 0; i < count; ++i) { + AXUIElementRef child = CFArrayGetValueAtIndex(children, i); + if(AXUIElementCopyAttributeValue(child, kAXRoleAttribute, &typeRef) != noErr) goto cleanup; + CFStringRef role = (CFStringRef)typeRef; + BOOL correctRole = kCFCompareEqualTo == CFStringCompare(role, kAXGroupRole, 0); + CFRelease(role); + if (correctRole) { + CFArrayRef attributeNames = NULL ; + if (AXUIElementCopyAttributeNames(child, &attributeNames) != noErr) goto cleanup ; + if (CFArrayContainsValue(attributeNames, CFRangeMake(0, CFArrayGetCount(attributeNames)), kAXTabsAttribute)) { + tabs = child; + CFRetain(tabs); + CFRelease(attributeNames) ; + break; + } + CFRelease(attributeNames) ; + } + } + } + +cleanup: + if (children) CFRelease(children); + + return tabs; +} + +@implementation HSwindow + +#pragma mark - Class methods ++(NSArray*)orderedWindowIDs { + NSMutableArray *windowIDs = [[NSMutableArray alloc] init]; + CFArrayRef wins = CGWindowListCreate(kCGWindowListOptionOnScreenOnly | kCGWindowListExcludeDesktopElements, kCGNullWindowID); + + if (wins) { + CFArrayRef windowDescs = CGWindowListCreateDescriptionFromArray(wins); + windowIDs = [[NSMutableArray alloc] initWithCapacity:CFArrayGetCount(wins)]; + for (CFIndex i = 0; i < CFArrayGetCount(wins); i++) { + CFDictionaryRef dict = CFArrayGetValueAtIndex(windowDescs, i); + CFNumberRef winid = CFDictionaryGetValue(dict, kCGWindowNumber); + [windowIDs addObject:(__bridge NSNumber *)winid]; + } + CFRelease(wins); + CFRelease(windowDescs); + } else { + [LuaSkin logBreadcrumb:@"hs.window._orderedwinids CGWindowListCreate returned NULL"] ; + } + return windowIDs; +} + ++(NSImage *)snapshotForID:(int)windowID keepTransparency:(BOOL)keepTransparency { + NSImage *image = nil; + CGWindowImageOption makeOpaque = keepTransparency ? kCGWindowImageDefault : kCGWindowImageShouldBeOpaque; + CGRect windowRect = CGRectNull; + CGImageRef windowImage = CGWindowListCreateImage(windowRect, kCGWindowListOptionIncludingWindow, windowID, kCGWindowImageBoundsIgnoreFraming | makeOpaque); + + if (windowImage) { + image = [[NSImage alloc] initWithCGImage:windowImage size:windowRect.size]; + CFRelease(windowImage); + } + return image; +} + ++(HSwindow *)focusedWindow { + HSwindow *window = nil; + CFTypeRef app; + AXUIElementCopyAttributeValue(system_wide_element(), kAXFocusedApplicationAttribute, &app); + + if (app) { + CFTypeRef win; + AXError result = AXUIElementCopyAttributeValue(app, (CFStringRef)NSAccessibilityFocusedWindowAttribute, &win); + + CFRelease(app); + + if (result == kAXErrorSuccess) { + window = [[HSwindow alloc] initWithAXUIElementRef:win]; + CFRelease(win); + } + } + return window; + +} + +#pragma mark - Initialiser +-(HSwindow *)initWithAXUIElementRef:(AXUIElementRef)winRef { + self = [super init]; + if (self) { + CFRetain(winRef); + _elementRef = winRef; // retained above + _selfRefCount = 0; + + pid_t pid; + if (AXUIElementGetPid(winRef, &pid) == kAXErrorSuccess) { + _pid = pid; + } + + CGWindowID winID; + AXError err = _AXUIElementGetWindow(winRef, &winID); + if (!err) { + _winID = winID; + } + + _uiElement = [[HSuielement alloc] initWithElementRef:_elementRef]; + } + return self; +} + +#pragma mark - Destructor +-(void)dealloc { + if (_elementRef) CFRelease(_elementRef) ; + _elementRef = NULL ; +} + +#pragma mark - Instance methods +-(id)getWindowProperty:(NSString *)property withDefaultValue:(id)defaultValue { + CFTypeRef value; + if (AXUIElementCopyAttributeValue(self.elementRef, (__bridge CFStringRef)property, &value) == kAXErrorSuccess) { + return CFBridgingRelease(value); + } + return defaultValue; +} + +-(BOOL)setWindowProperty:(NSString *)property withValue:(id)value { + BOOL result = NO; + if ([value isKindOfClass:NSNumber.class]) { + result = (AXUIElementSetAttributeValue(self.elementRef, (__bridge CFStringRef)property, (__bridge CFTypeRef)value) == kAXErrorSuccess); + } + return result; +} + +-(NSString *)title { + return [self getWindowProperty:NSAccessibilityTitleAttribute withDefaultValue:@""]; +} + +-(NSString *)subRole { + return [self getWindowProperty:NSAccessibilitySubroleAttribute withDefaultValue:@""]; +} + +-(NSString *)role { + return [self getWindowProperty:NSAccessibilityRoleAttribute withDefaultValue:@""]; +} + +-(BOOL)isStandard { + return [self.subRole isEqualToString:(NSString *)kAXStandardWindowSubrole]; +} + +// FIXME: Can getTopLeft/setTopLeft be converted to use/augment getWindowProperty/setWindowProperty? +-(NSPoint)getTopLeft { + CGPoint topLeft = CGPointZero; + CFTypeRef positionStorage; + if (AXUIElementCopyAttributeValue(self.elementRef, (CFStringRef)NSAccessibilityPositionAttribute, &positionStorage) == kAXErrorSuccess) { + if (!AXValueGetValue(positionStorage, kAXValueCGPointType, (void *)&topLeft)) { + topLeft = CGPointZero; + } + CFRelease(positionStorage); + } + return NSMakePoint(topLeft.x, topLeft.y); +} + +-(void)setTopLeft:(NSPoint)topLeft { + CFTypeRef positionStorage = (CFTypeRef)(AXValueCreate(kAXValueCGPointType, (const void *)&topLeft)); + AXUIElementSetAttributeValue(self.elementRef, (CFStringRef)NSAccessibilityPositionAttribute, positionStorage); + if (positionStorage) { + CFRelease(positionStorage); + } +} + +-(NSSize)getSize { + CGSize size = CGSizeZero; + CFTypeRef sizeStorage; + if (AXUIElementCopyAttributeValue(self.elementRef, (CFStringRef)NSAccessibilitySizeAttribute, &sizeStorage) == kAXErrorSuccess) { + if (!AXValueGetValue(sizeStorage, kAXValueCGSizeType, (void *)&size)) { + size = CGSizeZero; + } + CFRelease(sizeStorage); + } + return NSMakeSize(size.width, size.height); +} + +-(void)setSize:(NSSize)size { + CFTypeRef sizeStorage = (CFTypeRef)(AXValueCreate(kAXValueCGSizeType, (const void *)&size)); + AXUIElementSetAttributeValue(self.elementRef, (CFStringRef)NSAccessibilitySizeAttribute, sizeStorage); + if (sizeStorage) { + CFRelease(sizeStorage); + } +} + +-(void)setFrame:(NSRect)frame { + // Disable Enhanced UI during operation for better reliability + AXUIElementRef appElement = AXUIElementCreateApplication(self.pid); + CFBooleanRef enhancedUI = NULL; + BOOL hadEnhancedUI = NO; + + if (appElement) { + if (AXUIElementCopyAttributeValue(appElement, CFSTR("AXEnhancedUserInterface"), (CFTypeRef *)&enhancedUI) == kAXErrorSuccess) { + if (enhancedUI) { + hadEnhancedUI = CFBooleanGetValue(enhancedUI); + CFRelease(enhancedUI); + + if (hadEnhancedUI) { + AXUIElementSetAttributeValue(appElement, CFSTR("AXEnhancedUserInterface"), kCFBooleanFalse); + } + } + } + } + + // Step 1: Set size first (prepares for potential cross-display move) + [self setSize:frame.size]; + // Step 2: Set position (may move window to different display) + [self setTopLeft:frame.origin]; + // Step 3: Set size again (ensures correct size on target display) + [self setSize:frame.size]; + + if (appElement && hadEnhancedUI) { + AXUIElementSetAttributeValue(appElement, CFSTR("AXEnhancedUserInterface"), kCFBooleanTrue); + } + + if (appElement) { + CFRelease(appElement); + } +} + +-(BOOL)pushButton:(CFStringRef)buttonId { + BOOL worked = NO; + AXUIElementRef button = NULL; + if (AXUIElementCopyAttributeValue(self.elementRef, buttonId, (CFTypeRef*)&button) == noErr) { + if (AXUIElementPerformAction(button, kAXPressAction) == noErr) { + worked = YES; + } + CFRelease(button); + } + return worked; +} + +-(void)toggleZoom { + [self pushButton:kAXZoomButtonAttribute]; +} + +-(NSRect)getZoomButtonRect { + NSRect rect = NSZeroRect; + AXUIElementRef button = nil; + CFTypeRef pointRef, sizeRef; + CGPoint point; + CGSize size; + + if (AXUIElementCopyAttributeValue(self.elementRef, kAXZoomButtonAttribute, (CFTypeRef*)&button) == noErr) { + if ((AXUIElementCopyAttributeValue(button, kAXPositionAttribute, &pointRef) == noErr) && (AXUIElementCopyAttributeValue(button, kAXSizeAttribute, &sizeRef) == noErr)) { + if (AXValueGetValue(pointRef, kAXValueCGPointType, &point) && AXValueGetValue(sizeRef, kAXValueCGSizeType, &size)) { + rect = NSMakeRect(point.x, point.y, size.width, size.height); + } + } + CFRelease(button); + } + return rect; +} + +-(BOOL)close { + return [self pushButton:kAXCloseButtonAttribute]; +} + +-(int)getTabCount { + CFIndex count = 0; + AXUIElementRef tabs = get_window_tabs(self.elementRef); + if (tabs) { + AXUIElementGetAttributeValueCount(tabs, kAXTabsAttribute, &count); + CFRelease(tabs); + } + return (int)count; +} + +-(BOOL)focusTab:(int)index { + BOOL worked = NO; + CFArrayRef children = NULL; + AXUIElementRef tab = NULL; + + AXUIElementRef tabs = get_window_tabs(self.elementRef); + if(tabs == NULL) goto cleanup; + + if(AXUIElementCopyAttributeValues(tabs, kAXTabsAttribute, 0, 100, &children) != noErr) goto cleanup; + CFIndex count = CFArrayGetCount(children); + + CFIndex i = index; + if(i > count || i <= 0) { + i = count - 1; + } else { + i = i - 1 ; // adjust because lua style indexes start at 1 + } + tab = CFArrayGetValueAtIndex(children, i); + + if (AXUIElementPerformAction(tab, kAXPressAction) != noErr) goto cleanup; + + worked = YES; +cleanup: + if (tabs) CFRelease(tabs); + if (children) CFRelease(children); + + return worked; +} + +-(void)setFullscreen:(BOOL)fullscreen { + AXUIElementSetAttributeValue(self.elementRef, CFSTR("AXFullScreen"), fullscreen ? kCFBooleanTrue : kCFBooleanFalse); +} + +-(BOOL)isFullscreen { + BOOL fullscreen = NO; + CFBooleanRef _fullscreen = kCFBooleanFalse; + if (AXUIElementCopyAttributeValue(self.elementRef, CFSTR("AXFullScreen"), (CFTypeRef*)&_fullscreen) == noErr) { + fullscreen = CFBooleanGetValue(_fullscreen); + CFRelease(_fullscreen); + } + return fullscreen; +} + +-(BOOL)isMinimized { + NSNumber *minimized = [self getWindowProperty:NSAccessibilityMinimizedAttribute withDefaultValue:@(NO)]; + return minimized.boolValue; +} + +-(void)setMinimized:(BOOL)minimize { + [self setWindowProperty:NSAccessibilityMinimizedAttribute withValue:@(minimize)]; +} + +-(void)becomeMain { + [self setWindowProperty:NSAccessibilityMainAttribute withValue:@(YES)]; +} + +-(void)raise { + AXUIElementPerformAction(self.elementRef, kAXRaiseAction); +} + +-(NSImage *)snapshot:(BOOL)keepTransparency { + NSImage *image = nil; + CGWindowID windowID; + if (_AXUIElementGetWindow(self.elementRef, &windowID) == kAXErrorSuccess) { + image = [HSwindow snapshotForID:windowID keepTransparency:keepTransparency]; + } + return image; +} +@end diff --git a/Hammerspoon/Hammerspoon-dev.entitlements b/Hammerspoon/Hammerspoon-dev.entitlements new file mode 100644 index 000000000..7d1feca6f --- /dev/null +++ b/Hammerspoon/Hammerspoon-dev.entitlements @@ -0,0 +1,30 @@ + + + + + com.apple.security.automation.apple-events + + com.apple.security.cs.allow-jit + + com.apple.security.cs.allow-unsigned-executable-memory + + com.apple.security.cs.disable-executable-page-protection + + com.apple.security.cs.disable-library-validation + + com.apple.security.device.audio-input + + com.apple.security.device.camera + + com.apple.security.personal-information.addressbook + + com.apple.security.personal-information.calendars + + com.apple.security.personal-information.location + + com.apple.security.personal-information.photos-library + + com.apple.security.get-task-allow + + + diff --git a/Hammerspoon/Hammerspoon.entitlements b/Hammerspoon/Hammerspoon.entitlements new file mode 100644 index 000000000..b1a790494 --- /dev/null +++ b/Hammerspoon/Hammerspoon.entitlements @@ -0,0 +1,28 @@ + + + + + com.apple.security.automation.apple-events + + com.apple.security.cs.allow-jit + + com.apple.security.cs.allow-unsigned-executable-memory + + com.apple.security.cs.disable-executable-page-protection + + com.apple.security.cs.disable-library-validation + + com.apple.security.device.audio-input + + com.apple.security.device.camera + + com.apple.security.personal-information.addressbook + + com.apple.security.personal-information.calendars + + com.apple.security.personal-information.location + + com.apple.security.personal-information.photos-library + + + diff --git a/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_128.png b/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_128.png deleted file mode 100644 index 148b905fb..000000000 Binary files a/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_128.png and /dev/null differ diff --git a/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_128@2x.png b/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_128@2x.png deleted file mode 100644 index 18de670e2..000000000 Binary files a/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_128@2x.png and /dev/null differ diff --git a/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_16.png b/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_16.png deleted file mode 100644 index 023c252b6..000000000 Binary files a/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_16.png and /dev/null differ diff --git a/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_16@2x.png b/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_16@2x.png deleted file mode 100644 index 3e4f0946a..000000000 Binary files a/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_16@2x.png and /dev/null differ diff --git a/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_256.png b/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_256.png deleted file mode 100644 index f21e48915..000000000 Binary files a/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_256.png and /dev/null differ diff --git a/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_256@2x.png b/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_256@2x.png deleted file mode 100644 index 41af36bc3..000000000 Binary files a/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_256@2x.png and /dev/null differ diff --git a/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_32.png b/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_32.png deleted file mode 100644 index 38421fbef..000000000 Binary files a/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_32.png and /dev/null differ diff --git a/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_32@2x.png b/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_32@2x.png deleted file mode 100644 index cf7c97212..000000000 Binary files a/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_32@2x.png and /dev/null differ diff --git a/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_512.png b/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_512.png deleted file mode 100644 index b67ef7483..000000000 Binary files a/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_512.png and /dev/null differ diff --git a/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_512@2x.png b/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_512@2x.png deleted file mode 100644 index d241cb448..000000000 Binary files a/Hammerspoon/Images.xcassets/AppIcon.appiconset/CommandPost_Icon_512@2x.png and /dev/null differ diff --git a/Hammerspoon/Images.xcassets/AppIcon.appiconset/Contents.json b/Hammerspoon/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index ed04c4d31..000000000 --- a/Hammerspoon/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "images" : [ - { - "size" : "16x16", - "idiom" : "mac", - "filename" : "CommandPost_Icon_16.png", - "scale" : "1x" - }, - { - "size" : "16x16", - "idiom" : "mac", - "filename" : "CommandPost_Icon_16@2x.png", - "scale" : "2x" - }, - { - "size" : "32x32", - "idiom" : "mac", - "filename" : "CommandPost_Icon_32.png", - "scale" : "1x" - }, - { - "size" : "32x32", - "idiom" : "mac", - "filename" : "CommandPost_Icon_32@2x.png", - "scale" : "2x" - }, - { - "size" : "128x128", - "idiom" : "mac", - "filename" : "CommandPost_Icon_128.png", - "scale" : "1x" - }, - { - "size" : "128x128", - "idiom" : "mac", - "filename" : "CommandPost_Icon_128@2x.png", - "scale" : "2x" - }, - { - "size" : "256x256", - "idiom" : "mac", - "filename" : "CommandPost_Icon_256.png", - "scale" : "1x" - }, - { - "size" : "256x256", - "idiom" : "mac", - "filename" : "CommandPost_Icon_256@2x.png", - "scale" : "2x" - }, - { - "size" : "512x512", - "idiom" : "mac", - "filename" : "CommandPost_Icon_512.png", - "scale" : "1x" - }, - { - "size" : "512x512", - "idiom" : "mac", - "filename" : "CommandPost_Icon_512@2x.png", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Hammerspoon/Intents.intentdefinition b/Hammerspoon/Intents.intentdefinition new file mode 100644 index 000000000..fdd750dd4 --- /dev/null +++ b/Hammerspoon/Intents.intentdefinition @@ -0,0 +1,202 @@ + + + + + INEnums + + INIntentDefinitionModelVersion + 1.2 + INIntentDefinitionNamespace + 3vjQte + INIntentDefinitionSystemVersion + 21A559 + INIntentDefinitionToolsBuildVersion + 13A1030d + INIntentDefinitionToolsVersion + 13.1 + INIntents + + + INIntentCategory + generic + INIntentClassPrefix + HS + INIntentConfigurable + + INIntentDescription + Execute some Lua in CommandPost + INIntentDescriptionID + cqJRbd + INIntentIneligibleForSuggestions + + INIntentInput + source + INIntentKeyParameter + source + INIntentLastParameterTag + 1 + INIntentManagedParameterCombinations + + source + + INIntentParameterCombinationSupportsBackgroundExecution + + INIntentParameterCombinationTitle + Lua ${source}to execute in CommandPost + INIntentParameterCombinationTitleID + e44TdA + INIntentParameterCombinationUpdatesLinked + + + + INIntentName + ExecuteLua + INIntentParameters + + + INIntentParameterConfigurable + + INIntentParameterDisplayName + Source + INIntentParameterDisplayNameID + nEt2KT + INIntentParameterDisplayPriority + 1 + INIntentParameterMetadata + + INIntentParameterMetadataCapitalization + None + INIntentParameterMetadataDefaultValueID + aKQruG + INIntentParameterMetadataDisableAutocorrect + + INIntentParameterMetadataDisableSmartDashes + + INIntentParameterMetadataDisableSmartQuotes + + INIntentParameterMetadataMultiline + + + INIntentParameterName + source + INIntentParameterPromptDialogs + + + INIntentParameterPromptDialogCustom + + INIntentParameterPromptDialogType + Configuration + + + INIntentParameterPromptDialogCustom + + INIntentParameterPromptDialogFormatString + What Lua would you like to execute? + INIntentParameterPromptDialogFormatStringID + QipdpD + INIntentParameterPromptDialogType + Primary + + + INIntentParameterSupportsResolution + + INIntentParameterTag + 1 + INIntentParameterType + String + INIntentParameterUnsupportedReasons + + + INIntentParameterUnsupportedReasonCode + noLua + INIntentParameterUnsupportedReasonCustom + + INIntentParameterUnsupportedReasonFormatString + You must provide some Lua source to execute + INIntentParameterUnsupportedReasonFormatStringID + Ru3Gdb + + + + + INIntentResponse + + INIntentResponseCodes + + + INIntentResponseCodeConciseFormatString + ${result} + INIntentResponseCodeConciseFormatStringID + qf9VPR + INIntentResponseCodeFormatString + ${result} + INIntentResponseCodeFormatStringID + vBdg4y + INIntentResponseCodeName + success + INIntentResponseCodeSuccess + + + + INIntentResponseCodeConciseFormatString + ${error} + INIntentResponseCodeConciseFormatStringID + o25R8b + INIntentResponseCodeFormatString + ${error} + INIntentResponseCodeFormatStringID + SRd9Fu + INIntentResponseCodeName + failure + + + INIntentResponseLastParameterTag + 6 + INIntentResponseOutput + result + INIntentResponseParameters + + + INIntentResponseParameterDisplayName + Result + INIntentResponseParameterDisplayNameID + dvmcbi + INIntentResponseParameterDisplayPriority + 1 + INIntentResponseParameterName + result + INIntentResponseParameterTag + 1 + INIntentResponseParameterType + String + + + INIntentResponseParameterDisplayName + Error + INIntentResponseParameterDisplayNameID + 66aRAz + INIntentResponseParameterDisplayPriority + 2 + INIntentResponseParameterName + error + INIntentResponseParameterTag + 2 + INIntentResponseParameterType + String + + + + INIntentTitle + Execute Lua + INIntentTitleID + epdZG3 + INIntentType + Custom + INIntentVerb + Do + + + INTypes + + + diff --git a/Hammerspoon/MJAccessibilityUtils.m b/Hammerspoon/MJAccessibilityUtils.m index c903000cd..73cce528d 100644 --- a/Hammerspoon/MJAccessibilityUtils.m +++ b/Hammerspoon/MJAccessibilityUtils.m @@ -1,17 +1,22 @@ #import "MJAccessibilityUtils.h" +#import "HSLogger.h" extern Boolean AXIsProcessTrustedWithOptions(CFDictionaryRef options) __attribute__((weak_import)); extern CFStringRef kAXTrustedCheckOptionPrompt __attribute__((weak_import)); BOOL MJAccessibilityIsEnabled(void) { + BOOL isEnabled = NO; if (AXIsProcessTrustedWithOptions != NULL) - return AXIsProcessTrustedWithOptions(NULL); + isEnabled = AXIsProcessTrustedWithOptions(NULL); else #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - return AXAPIEnabled(); + isEnabled = AXAPIEnabled(); #pragma clang diagnostic pop + + HSNSLOG(@"Accessibility is: %@", isEnabled ? @"ENABLED" : @"DISABLED"); + return isEnabled; } void MJAccessibilityOpenPanel(void) { diff --git a/Hammerspoon/MJAppDelegate.h b/Hammerspoon/MJAppDelegate.h index cd8f61483..04acef00b 100644 --- a/Hammerspoon/MJAppDelegate.h +++ b/Hammerspoon/MJAppDelegate.h @@ -5,18 +5,30 @@ // Created by Chris Jones on 02/09/2015. // Copyright (c) 2015 Hammerspoon. All rights reserved. // -@import Crashlytics; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wvariadic-macros" +#define SENTRY_NO_UIKIT 1 +#define SDK_V9 0 +#define SWIFT_PACKAGE 0 +#import "Sentry.h" +#pragma clang diagnostic pop + +#ifndef NO_INTENTS +#import "HSExecuteLuaIntentHandler.h" +#endif @protocol HSOpenFileDelegate --(void)callbackWithURL:(NSString *)openUrl; +-(void)callbackWithURL:(NSString *)openUrl senderPID:(pid_t)pid; @end -@interface MJAppDelegate : NSObject +@interface MJAppDelegate : NSObject /* CRASHLYTICS DELEGATE WAS HERE */ @property IBOutlet NSMenu* menuBarMenu; @property (nonatomic, copy) NSAppleEventDescriptor *startupEvent; @property (nonatomic, copy) NSString *startupFile; @property (nonatomic, weak) id openFileDelegate; @property (nonatomic, strong) NSString* updateAvailable; +@property (nonatomic, strong) NSString* updateAvailableDisplayVersion; +@property (nonatomic, assign) BOOL luaInitialized; @end diff --git a/Hammerspoon/MJAppDelegate.m b/Hammerspoon/MJAppDelegate.m index 404c6ca8c..a166f43b6 100644 --- a/Hammerspoon/MJAppDelegate.m +++ b/Hammerspoon/MJAppDelegate.m @@ -1,4 +1,5 @@ #import +#import #import "MJAppDelegate.h" #import "MJConsoleWindowController.h" #import "MJPreferencesWindowController.h" @@ -9,24 +10,167 @@ #import "MJConfigUtils.h" #import "MJFileUtils.h" #import "MJAccessibilityUtils.h" +#import "HSLogger.h" #import "variables.h" #import "secrets.h" -#import "PFMoveApplication.h" + +#ifdef SENTRY_API_URL +@import Sentry; +#endif @implementation MJAppDelegate -/* -static BOOL MJFirstRunForCurrentVersion(void) { - NSString* key = [NSString stringWithFormat:@"%@_%d", MJHasRunAlreadyKey, MJVersionFromThisApp()]; +#pragma mark - LateNite App Validation + ++ (BOOL)isValidLateNiteAppInstalled { + NSLog(@"[LateNite Validation] Starting validation check..."); + + NSArray *lateNiteBundleIDs = @[ + @"com.latenitefilms.ATEMExporter", + @"com.latenitefilms.BRAWToolbox", + @"com.latenitefilms.Capacitor", + @"com.latenitefilms.FastCollections", + @"com.latenitefilms.GyroflowToolbox", + @"com.latenitefilms.LUTRobot", + @"com.latenitefilms.MarkerToolbox", + @"com.latenitefilms.Metaburner", + @"com.latenitefilms.NewsImport", + @"com.latenitefilms.RecallToolbox", + @"com.latenitefilms.TransferToolbox", + @"com.latenitefilms.ScriptStar", + @"com.latenitefilms.TransferToolbox", + @"com.latenitefilms.NotionToolbox", + @"com.latenitefilms.SmartScriptPro", + @"com.latenitefilms.SyncScriptPro", + @"com.latenitefilms.TimecodeToolbox", + @"com.latenitefilms.VFXToolbox", + @"com.latenitefilms.KeyframeToolbox", + @"com.latenitefilms.OutputToolbox", + @"com.latenitefilms.SmartLevels" + ]; + + NSString *expectedTeamID = @"A5HDJTY9X5"; + NSString *expectedAuthority = @"Apple Mac OS Application Signing"; + NSLog(@"[LateNite Validation] Expected Team ID: %@", expectedTeamID); + NSLog(@"[LateNite Validation] Expected Authority: %@", expectedAuthority); + + for (NSString *bundleID in lateNiteBundleIDs) { + NSLog(@"[LateNite Validation] Checking bundle ID: %@", bundleID); + + NSArray *appURLs = (__bridge_transfer NSArray *)LSCopyApplicationURLsForBundleIdentifier((__bridge CFStringRef)bundleID, NULL); + + if (appURLs && appURLs.count > 0) { + NSLog(@"[LateNite Validation] Found %lu app(s) for bundle ID", (unsigned long)appURLs.count); + + for (NSURL *appURL in appURLs) { + NSLog(@"[LateNite Validation] Checking app at path: %@", appURL.path); + + // Check code signature + SecStaticCodeRef staticCode = NULL; + OSStatus status = SecStaticCodeCreateWithPath((__bridge CFURLRef)appURL, kSecCSDefaultFlags, &staticCode); + + if (status != errSecSuccess) { + NSLog(@"[LateNite Validation] ERROR: SecStaticCodeCreateWithPath failed with status: %d", (int)status); + continue; + } + + if (staticCode == NULL) { + NSLog(@"[LateNite Validation] ERROR: staticCode is NULL"); + continue; + } + + NSLog(@"[LateNite Validation] Successfully created static code reference"); + + CFDictionaryRef signingInfo = NULL; + status = SecCodeCopySigningInformation(staticCode, kSecCSSigningInformation, &signingInfo); + + if (status != errSecSuccess) { + NSLog(@"[LateNite Validation] ERROR: SecCodeCopySigningInformation failed with status: %d", (int)status); + CFRelease(staticCode); + continue; + } + + if (signingInfo == NULL) { + NSLog(@"[LateNite Validation] ERROR: signingInfo is NULL"); + CFRelease(staticCode); + continue; + } + + NSLog(@"[LateNite Validation] Successfully retrieved signing information"); + + NSDictionary *signingDict = (__bridge NSDictionary *)signingInfo; + + // Check Team ID + NSString *teamID = signingDict[(__bridge NSString *)kSecCodeInfoTeamIdentifier]; + NSLog(@"[LateNite Validation] Team ID: %@", teamID ?: @"(nil)"); + + BOOL teamIDMatches = [teamID isEqualToString:expectedTeamID]; + NSLog(@"[LateNite Validation] Team ID match: %@", teamIDMatches ? @"YES" : @"NO"); + + if (!teamIDMatches) { + CFRelease(signingInfo); + CFRelease(staticCode); + continue; + } + + // Check for Mac App Store signature (Apple Mac OS Application Signing) + NSArray *certificateChain = signingDict[(__bridge NSString *)kSecCodeInfoCertificates]; + BOOL isAppStoreApp = NO; + + if (certificateChain && certificateChain.count > 0) { + SecCertificateRef certificate = (__bridge SecCertificateRef)certificateChain[0]; + CFStringRef commonName = NULL; + OSStatus certStatus = SecCertificateCopyCommonName(certificate, &commonName); + + if (certStatus == errSecSuccess && commonName != NULL) { + NSString *commonNameStr = (__bridge NSString *)commonName; + NSLog(@"[LateNite Validation] Certificate Authority: %@", commonNameStr); + isAppStoreApp = [commonNameStr isEqualToString:expectedAuthority]; + NSLog(@"[LateNite Validation] Is App Store app: %@", isAppStoreApp ? @"YES" : @"NO"); + CFRelease(commonName); + } + } + + if (teamIDMatches && isAppStoreApp) { + NSLog(@"[LateNite Validation] SUCCESS: Found valid Mac App Store LateNite app at %@", appURL.path); + CFRelease(signingInfo); + CFRelease(staticCode); + return YES; + } + + CFRelease(signingInfo); + CFRelease(staticCode); + } + } else { + NSLog(@"[LateNite Validation] No apps found for this bundle ID"); + } + } + + NSLog(@"[LateNite Validation] FAILED: No valid Mac App Store LateNite app found"); + return NO; +} - BOOL firstRun = ![[NSUserDefaults standardUserDefaults] boolForKey:key]; ++ (void)showNoValidAppAlert { + [NSApp activateIgnoringOtherApps:YES]; + + NSAlert *alert = [[NSAlert alloc] init]; + alert.alertStyle = NSAlertStyleInformational; + alert.messageText = @"CommandPost v2 (and later) requires a paid LateNite App installed."; + alert.informativeText = @"After 9 years of free updates, to ensure that CommandPost continues to be developed, improved, and stay open-source, we've decided that you need at least ONE paid LateNite application installed to use CommandPost moving forward.\n\nThank you to EVERYONE who has supported CommandPost throughout these years!\n\nPlease download and install a LateNite App from the Mac App Store or roll back to a previous version of CommandPost v1."; - if (firstRun) - [[NSUserDefaults standardUserDefaults] setBool:YES forKey:key]; + [alert addButtonWithTitle:@"Open Mac App Store"]; + [alert addButtonWithTitle:@"Quit"]; + + NSModalResponse response = [alert runModal]; + + if (response == NSAlertFirstButtonReturn) { + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://apps.apple.com/au/developer/latenite-films-pty-ltd/id1652018641"]]; + } - return firstRun; + [NSApp terminate:nil]; } -*/ + +#pragma mark - Application Delegate Methods - (BOOL) applicationShouldHandleReopen:(NSApplication*)theApplication hasVisibleWindows:(BOOL)hasVisibleWindows { callDockIconCallback(); @@ -38,9 +182,6 @@ - (BOOL) applicationShouldHandleReopen:(NSApplication*)theApplication hasVisible -(void)applicationWillFinishLaunching:(NSNotification *)aNotification { - // LetsWatch: - PFMoveToApplicationsFolderIfNecessary(); - // Set up an early event manager handler so we can catch URLs used to launch us NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager]; [appleEventManager setEventHandler:self @@ -57,9 +198,20 @@ - (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppl self.startupEvent = event; } +#ifndef NO_INTENTS +- (id)application:(NSApplication *)application handlerForIntent:(INIntent *)intent API_AVAILABLE(macos(11.0)){ + NSLog(@"handlerForIntent: Checking for HSExecuteLuaIntent"); + if ([intent isKindOfClass:[HSExecuteLuaIntent class]]) { + NSLog(@"handlerForIntent: Found HSExecuteLuaIntent, dispatching to HSExecuteLuaIntentHandler"); + return ([[HSExecuteLuaIntentHandler alloc] init]); + } + return nil; +} +#endif + - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)fileAndPath { NSString *typeOfFile = [[NSWorkspace sharedWorkspace] typeOfFile:fileAndPath error:nil]; - + if ([typeOfFile isEqualToString:@"org.latenitefilms.commandpost.plugin"]) { // This is a Plugin, so we will attempt to copy it to the Plugin directory NSError *fileError; @@ -68,9 +220,15 @@ - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)fileAnd NSString *spoonPath = [@"~/Library/Application Support/CommandPost/Plugins/" stringByExpandingTildeInPath]; NSString *spoonName = [fileAndPath lastPathComponent]; NSString *dstSpoonFullPath = [spoonPath stringByAppendingPathComponent:spoonName]; + + if ([dstSpoonFullPath isEqualToString:fileAndPath]) { + NSLog(@"User double clicked on a Spoon in %@, skipping", MJConfigDirAbsolute()); + return YES; + } + NSFileManager *fileManager = [NSFileManager defaultManager]; - - // Remove any pre-existing copy of the Plugin + + // Remove any preexisting copy of the Spoon if ([fileManager fileExistsAtPath:dstSpoonFullPath]) { NSLog(@"Plugin already exists at %@, removing the old version", dstSpoonFullPath); upgrade = YES; @@ -81,12 +239,13 @@ - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)fileAnd [alert addButtonWithTitle:@"OK"]; [alert setMessageText:@"Error upgrading Plugin"]; [alert setInformativeText:[NSString stringWithFormat:@"%@\n\nSource: %@\nDest: %@", fileError.localizedDescription, fileAndPath, spoonPath]]; - [alert setAlertStyle:NSCriticalAlertStyle]; + [alert setAlertStyle:NSAlertStyleCritical]; [alert runModal]; return YES; } } - + + success = [[NSFileManager defaultManager] moveItemAtPath:fileAndPath toPath:dstSpoonFullPath error:&fileError]; if (!success) { NSLog(@"Unable to move %@ to %@: %@", fileAndPath, spoonPath, fileError); @@ -94,7 +253,7 @@ - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)fileAnd [alert addButtonWithTitle:@"OK"]; [alert setMessageText:@"Error installing Plugin"]; [alert setInformativeText:[NSString stringWithFormat:@"%@\n\nSource: %@\nDest: %@", fileError.localizedDescription, fileAndPath, spoonPath]]; - [alert setAlertStyle:NSCriticalAlertStyle]; + [alert setAlertStyle:NSAlertStyleCritical]; [alert runModal]; } else { NSUserNotification *notification = [[NSUserNotification alloc] init]; @@ -106,44 +265,66 @@ - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)fileAnd } return YES; // Note that we always return YES here because otherwise macOS tells the user that we can't open Spoons, which is ludicrous } - + NSString *fileExtension = [fileAndPath pathExtension]; NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary]; NSArray *supportedExtensions = [infoDict valueForKeyPath:@"CFBundleDocumentTypes.CFBundleTypeExtensions"]; NSArray *flatSupportedExtensions = [supportedExtensions valueForKeyPath:@"@unionOfArrays.self"]; - + // Files to be processed by hs.urlevent if ([flatSupportedExtensions containsObject:fileExtension]) { if (!self.openFileDelegate) { self.startupFile = fileAndPath; } else { - if ([self.openFileDelegate respondsToSelector:@selector(callbackWithURL:)]) { - [self.openFileDelegate callbackWithURL:fileAndPath]; + if ([self.openFileDelegate respondsToSelector:@selector(callbackWithURL:senderPID:)]) { + [self.openFileDelegate callbackWithURL:fileAndPath senderPID:-1]; } } } else { // Trigger File Dropped to Dock Icon Callback fileDroppedToDockIcon(fileAndPath); } - + return YES; } +- (BOOL)application:(NSApplication *)application + continueUserActivity:(NSUserActivity *)userActivity + restorationHandler:(nonnull void (^)(NSArray> *_Nullable))restorationHandler +{ + //NSLog(@"Open URL in NSUserActivityTypeBrowsingWeb"); + if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) { + [[NSWorkspace sharedWorkspace] openURL:userActivity.webpageURL]; + return YES; + } + return NO; +} + - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { - + + // Check for valid LateNite app before proceeding + if (![MJAppDelegate isValidLateNiteAppInstalled]) { + [MJAppDelegate showNoValidAppAlert]; + return; // This won't be reached as showNoValidAppAlert terminates the app + } + + BOOL isTesting = NO; + // User is holding down Command (0x37) & Option (0x3A) keys: if (CGEventSourceKeyState(kCGEventSourceStateCombinedSessionState,0x3A) && CGEventSourceKeyState(kCGEventSourceStateCombinedSessionState,0x37)) { - + NSAlert *alert = [[NSAlert alloc] init]; - [alert addButtonWithTitle:@"Continue"]; - [alert addButtonWithTitle:@"Delete Preferences"]; + NSButton *deleteButton = [alert addButtonWithTitle:@"Delete Preferences"]; + deleteButton.hasDestructiveAction = YES; + + [alert addButtonWithTitle:@"Cancel"]; [alert setMessageText:@"Do you want to delete the preferences?"]; [alert setInformativeText:@"Deleting the preferences will reset all application settings to their defaults."]; - [alert setAlertStyle:NSWarningAlertStyle]; - - if ([alert runModal] == NSAlertSecondButtonReturn) { - + [alert setAlertStyle:NSAlertStyleWarning]; + + if ([alert runModal] == NSAlertFirstButtonReturn) { + // Reset Preferences: NSDictionary * allObjects; allObjects = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]; @@ -152,10 +333,10 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { [[NSUserDefaults standardUserDefaults] removeObjectForKey: key]; } [[NSUserDefaults standardUserDefaults] synchronize]; - + } } - + [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(accessibilityChanged:) name:@"com.apple.accessibility.api" object:nil]; // Remove our early event manager handler so hs.urlevent can register for it later, if the user has it configured to @@ -164,6 +345,8 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { if(NSClassFromString(@"XCTest") != nil) { // Hammerspoon Tests NSLog(@"in testing mode!"); + isTesting = YES; + NSBundle *mainBundle = [NSBundle mainBundle]; NSBundle *bundle = [NSBundle bundleWithPath:[NSString stringWithFormat:@"%@/Contents/Plugins/Hammerspoon Tests.xctest", mainBundle.bundlePath]]; NSString *lsUnitPath = [bundle pathForResource:@"lsunit" ofType:@"lua"]; @@ -222,12 +405,25 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { [self registerDefaultDefaults]; - // Enable Crashlytics, if we have an API key available -#ifdef CRASHLYTICS_API_KEY - if (HSUploadCrashData()) { - Crashlytics *crashlytics = [Crashlytics sharedInstance]; - crashlytics.debugMode = YES; - [Crashlytics startWithAPIKey:[NSString stringWithUTF8String:CRASHLYTICS_API_KEY] delegate:self]; + // Enable Sentry, if we have an API URL available +#ifdef SENTRY_API_URL + if (HSUploadCrashData() && !isTesting) { + SentryEvent* (^sentryWillUploadCrashReport) (SentryEvent *event) = ^SentryEvent* (SentryEvent *event) { + if ([event.extra objectForKey:@"MjolnirModuleLoaded"]) { + dispatch_async(dispatch_get_main_queue(), ^{ + [self showMjolnirMigrationNotification]; + }); + } + return event; + }; + + [SentrySDK startWithConfigureOptions:^(SentryOptions *options) { + options.dsn = @SENTRY_API_URL; + options.beforeSend = sentryWillUploadCrashReport; + options.releaseName = NSBundle.mainBundle.infoDictionary[@"CFBundleShortVersionString"]; + options.enableAppHangTracking = NO; + options.debug = YES; // Enabled debug when first installing is always helpful + }]; } #endif @@ -254,16 +450,16 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { MJDockIconSetup(); [[MJConsoleWindowController singleton] setup]; MJLuaCreate(); + self.luaInitialized = YES; - // FIXME: Do we care about showing the prefs on the first run of each new version? (Ng does not care) - //if (MJFirstRunForCurrentVersion() || !MJAccessibilityIsEnabled()) + //if (!MJAccessibilityIsEnabled()) //[[MJPreferencesWindowController singleton] showWindow: nil]; } // Dragging & Dropping of Text to Dock Item -(void) processDockIconDraggedText:(NSPasteboard *)pboard userData:(NSString *)userData error:(NSString **)error { - NSString *pboardString = [pboard stringForType:NSStringPboardType]; + NSString *pboardString = [pboard stringForType:NSPasteboardTypeString]; textDroppedToDockIcon(pboardString); } @@ -276,13 +472,16 @@ -(void) processDockIconDraggedFile:(NSPasteboard *)pboard userData:(NSString *)u } - (void) accessibilityChanged:(NSNotification*)note { + HSNSLOG(@"accessibilityChanged: %@", MJAccessibilityIsEnabled() ? @"ENABLED" : @"DISABLED"); dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.15 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ callAccessibilityStateCallback(); }); } - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender { - MJLuaDestroy(); + if (self.luaInitialized) { + MJLuaDestroy(); + } return NSTerminateNow; } @@ -293,8 +492,8 @@ - (void) registerDefaultDefaults { MJShowMenuIconKey: @NO, HSAutoLoadExtensions: @YES, HSUploadCrashDataKey: @YES, - HSAppleScriptEnabledKey: @YES, - HSOpenConsoleOnDockClickKey: @NO, + HSAppleScriptEnabledKey: @NO, + HSOpenConsoleOnDockClickKey: @YES, HSPreferencesDarkModeKey: @YES, HSConsoleDarkModeKey: @YES, }]; @@ -319,7 +518,7 @@ - (IBAction) showAboutPanel:(id)sender { @try { [[NSApplication sharedApplication] orderFrontStandardAboutPanel: nil]; } @catch (NSException *exception) { - [[LuaSkin shared] logError:@"Unable to open About dialog. This may mean your CommandPost installation is corrupt. Please re-install it!"]; + [[LuaSkin sharedWithState:NULL] logError:@"Unable to open About dialog. This may mean your CommandPost installation is corrupt. Please re-install it!"]; } } @@ -348,51 +547,20 @@ - (void)showMjolnirMigrationNotification { [alert addButtonWithTitle:@"OK"]; [alert setMessageText:@"CommandPost crash detected"]; [alert setInformativeText:@"Your init.lua is loading Mjolnir modules and a previous launch crashed.\n\nCommandPost ships with updated versions of many of the Mjolnir modules, with both new features and many bug fixes.\n\nPlease consult our API documentation and migrate your config."]; - [alert setAlertStyle:NSCriticalAlertStyle]; + [alert setAlertStyle:NSAlertStyleCritical]; [alert runModal]; } -// Commented out by Chris Hocking: -/* -- (void)crashlyticsDidDetectReportForLastExecution:(CLSReport *)report completionHandler:(void (^)(BOOL submit))completionHandler { - BOOL showMjolnirMigrationDialog = NO; - - if ([report.customKeys objectForKey:@"MjolnirModuleLoaded"]) { - showMjolnirMigrationDialog = YES; - } - - completionHandler(YES); - - if (showMjolnirMigrationDialog) { - [self showMjolnirMigrationNotification]; - } -} -*/ - -// Added by Chris Hocking: -- (void)crashlyticsDidDetectReportForLastExecution:(CLSReport *)report completionHandler:(void (^)(BOOL))completionHandler { - // Use this opportunity to take synchronous action on a crash. See Crashlytics.h for - // details and implications. - - // Maybe consult NSUserDefaults or show a UI prompt. - - // But, make ABSOLUTELY SURE you invoke completionHandler, as the SDK - // will not submit the report until you do. You can do this from any - // thread, but that's optional. If you want, you can just call the - // completionHandler and return. - [[NSOperationQueue mainQueue] addOperationWithBlock:^{ - completionHandler(YES); - }]; -} - #pragma mark - Sparkle delegate methods - (void)updater:(id)updater didFindValidUpdate:(id)update { - NSLog(@"Update found: %@", [update valueForKey:@"versionString"]); + NSLog(@"Update found: %@ (Build: %@)", [update valueForKey:@"displayVersionString"], [update valueForKey:@"versionString"]); self.updateAvailable = [update valueForKey:@"versionString"]; + self.updateAvailableDisplayVersion = [update valueForKey:@"displayVersionString"]; } - (void)updaterDidNotFindUpdate:(id)update { self.updateAvailable = nil; + self.updateAvailableDisplayVersion = nil; } @end diff --git a/Hammerspoon/MJAutoLaunch.m b/Hammerspoon/MJAutoLaunch.m index 9677004ed..8389a2e36 100644 --- a/Hammerspoon/MJAutoLaunch.m +++ b/Hammerspoon/MJAutoLaunch.m @@ -4,7 +4,10 @@ static LSSharedFileListRef shared_file_list() { static LSSharedFileListRef list; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" list = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL); +#pragma clang diagnostic pop }); return list; } @@ -13,7 +16,10 @@ BOOL MJAutoLaunchGet(void) { NSURL *appURL = [[[NSBundle mainBundle] bundleURL] fileReferenceURL]; UInt32 seed; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" NSArray *sharedFileListArray = (__bridge_transfer NSArray*)LSSharedFileListCopySnapshot(shared_file_list(), &seed); +#pragma clang diagnostic pop for (id item in sharedFileListArray) { LSSharedFileListItemRef sharedFileItem = (__bridge LSSharedFileListItemRef)item; CFURLRef url = NULL; @@ -45,6 +51,8 @@ void MJAutoLaunchSet(BOOL opensAtLogin) { } if (opensAtLogin) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" LSSharedFileListItemRef result = LSSharedFileListInsertItemURL(shared_file_list(), kLSSharedFileListItemLast, NULL, @@ -52,11 +60,15 @@ void MJAutoLaunchSet(BOOL opensAtLogin) { (__bridge CFURLRef)appURL, NULL, NULL); +#pragma clang diagnostic pop if (result) CFRelease(result); } else { UInt32 seed; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" NSArray *sharedFileListArray = (__bridge_transfer NSArray*)LSSharedFileListCopySnapshot(shared_file_list(), &seed); +#pragma clang diagnostic pop for (id item in sharedFileListArray) { LSSharedFileListItemRef sharedFileItem = (__bridge LSSharedFileListItemRef)item; CFURLRef url = NULL; @@ -67,7 +79,10 @@ void MJAutoLaunchSet(BOOL opensAtLogin) { #pragma clang diagnostic pop if (result == noErr && url != nil) { if ([appURL isEqual: [(__bridge NSURL*)url fileReferenceURL]]) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" LSSharedFileListItemRemove(shared_file_list(), sharedFileItem); +#pragma clang diagnostic pop CFRelease(url); } diff --git a/Hammerspoon/MJConfigUtils.h b/Hammerspoon/MJConfigUtils.h index f8f140aaf..6520e9c25 100644 --- a/Hammerspoon/MJConfigUtils.h +++ b/Hammerspoon/MJConfigUtils.h @@ -1,4 +1,5 @@ #import NSString* MJConfigDir(void); +NSString* MJConfigDirAbsolute(void); NSString* MJConfigFileFullPath(void); diff --git a/Hammerspoon/MJConfigUtils.m b/Hammerspoon/MJConfigUtils.m index 2773517c5..c00c6ba68 100644 --- a/Hammerspoon/MJConfigUtils.m +++ b/Hammerspoon/MJConfigUtils.m @@ -5,6 +5,11 @@ return [MJConfigFileFullPath() stringByDeletingLastPathComponent]; } +NSString* MJConfigDirAbsolute(void) { + return [MJConfigDir() stringByResolvingSymlinksInPath]; +} + NSString* MJConfigFileFullPath(void) { return [MJConfigFile stringByStandardizingPath]; } + diff --git a/Hammerspoon/MJConsoleWindowController.h b/Hammerspoon/MJConsoleWindowController.h index e91fd82d8..743127f9f 100644 --- a/Hammerspoon/MJConsoleWindowController.h +++ b/Hammerspoon/MJConsoleWindowController.h @@ -7,6 +7,7 @@ @property NSColor *MJColorForCommand ; @property NSColor *MJColorForResult ; @property NSFont *consoleFont ; +@property NSNumber *maxConsoleOutputHistory ; + (instancetype) singleton; - (void) setup; diff --git a/Hammerspoon/MJConsoleWindowController.m b/Hammerspoon/MJConsoleWindowController.m index 9008276c8..6878513d2 100644 --- a/Hammerspoon/MJConsoleWindowController.m +++ b/Hammerspoon/MJConsoleWindowController.m @@ -22,6 +22,8 @@ @interface MJConsoleWindowController () @property (weak) IBOutlet NSTextField* inputField; @property NSMutableArray* preshownStdouts; @property NSDateFormatter *dateFormatter; +@property NSMutableArray *outputBuffer; +@property NSTimer *outputTimer; @end @@ -41,6 +43,34 @@ - (id) init { [self.dateFormatter setLocale:enUSPOSIXLocale]; [self.dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; + self.outputBuffer = [[NSMutableArray alloc] initWithCapacity:1000]; + + // Strings that we want to add to the console window are batched up in self.outputBuffer and this timer drains them + self.outputTimer = [NSTimer timerWithTimeInterval:0.2 repeats:YES block:^(NSTimer * _Nonnull timer) { + if (self.outputBuffer.count > 0) { + @autoreleasepool { + NSTextStorage *storage = self.outputView.textStorage; + [storage beginEditing]; + + for (NSAttributedString *attrstr in self.outputBuffer) { + int curLength = (int)storage.length; + int maxLength = self.maxConsoleOutputHistory.intValue; + int addLength = (int)attrstr.length; + + [storage appendAttributedString:attrstr]; + if (curLength > maxLength && maxLength > 0) { + [storage deleteCharactersInRange:NSMakeRange(0, curLength - maxLength + addLength)]; + } + } + + [self.outputBuffer removeAllObjects]; + [storage endEditing]; + [self.outputView scrollToEndOfDocument:self]; + } + } + }]; + [[NSRunLoop mainRunLoop] addTimer:self.outputTimer forMode:NSRunLoopCommonModes]; + [self initializeConsoleColorsAndFont] ; } return self; @@ -51,6 +81,7 @@ - (void)initializeConsoleColorsAndFont { self.MJColorForCommand = [NSColor blackColor] ; self.MJColorForResult = [NSColor colorWithCalibratedHue:0.54 saturation:1.0 brightness:0.7 alpha:1.0] ; self.consoleFont = [NSFont fontWithName:@"Menlo" size:12.0] ; + self.maxConsoleOutputHistory = [NSNumber numberWithInt:100000]; } - (NSString*) windowNibName { @@ -123,7 +154,12 @@ - (void) windowDidLoad { } - (void) appendString:(NSString*)str type:(MJReplLineType)type { - NSColor* color = nil; + NSColor* color = self.MJColorForStdout; + + if (!str) { + return; + } + switch (type) { case MJReplLineTypeStdout: color = self.MJColorForStdout; break; case MJReplLineTypeCommand: color = self.MJColorForCommand; break; @@ -136,9 +172,9 @@ - (void) appendString:(NSString*)str type:(MJReplLineType)type { NSDictionary* attrs = @{NSFontAttributeName: self.consoleFont, NSForegroundColorAttributeName: color}; NSAttributedString* attrstr = [[NSAttributedString alloc] initWithString:str attributes:attrs]; - [[self.outputView textStorage] performSelectorOnMainThread:@selector(appendAttributedString:) - withObject:attrstr - waitUntilDone:YES]; + + // We don't actually append the string immediately, it goes into a buffer that drains on a timer (see above) + [self.outputBuffer addObject:attrstr]; } - (NSString*) run:(NSString*)command { diff --git a/Hammerspoon/MJDockIcon.m b/Hammerspoon/MJDockIcon.m index eb1b45dab..9fefb9128 100644 --- a/Hammerspoon/MJDockIcon.m +++ b/Hammerspoon/MJDockIcon.m @@ -18,13 +18,28 @@ void MJDockIconSetVisible(BOOL visible) { } static void reflect_defaults(void) { - NSApplication* app = [NSApplication sharedApplication]; // NSApp is typed to 'id'; lame + NSApplication* app = [NSApplication sharedApplication]; + NSApplicationActivationPolicy currentPolicy = app.activationPolicy; + NSApplicationActivationPolicy targetPolicy = MJDockIconVisible() ? NSApplicationActivationPolicyRegular : NSApplicationActivationPolicyAccessory; + + if (currentPolicy == targetPolicy) { + // No need to do anything, we already have the policy we want + return; + } + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" NSDisableScreenUpdates(); - [app setActivationPolicy: MJDockIconVisible() ? NSApplicationActivationPolicyRegular : NSApplicationActivationPolicyAccessory]; +#pragma clang diagnostic pop + + [app setActivationPolicy:targetPolicy]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [app unhide: nil]; [app activateIgnoringOtherApps:YES]; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" NSEnableScreenUpdates(); +#pragma clang diagnostic pop }); } diff --git a/Hammerspoon/MJLua.m b/Hammerspoon/MJLua.m index 4a9c799ec..05a5c5120 100644 --- a/Hammerspoon/MJLua.m +++ b/Hammerspoon/MJLua.m @@ -11,21 +11,37 @@ #import "MJAutoLaunch.h" #import "MJDockIcon.h" #import "HSAppleScript.h" -#import -#import "HSLogger.h" // This should come after Crashlytics + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wvariadic-macros" +#define SDK_V9 0 +#define SWIFT_PACKAGE 0 +#import "Sentry.h" +#pragma clang diagnostic pop + +#import "HSLogger.h" // This should come after Sentry +#import +#import +#import +#import +#import +#import +#import +#import +#import @interface MJPreferencesWindowController () - (void) reflectDefaults ; @end -static LuaSkin* MJLuaState; +// static LuaSkin* MJLuaState; // we can no longer trust that this points to the correct thread -- get it anew as needed static HSLogger* MJLuaLogDelegate; static int evalfn; static int completionsForWordFn; static lua_CFunction oldPanicFunction ; -static int refTable; +static LSRefTable refTable; static void(^loghandler)(NSString* str); void MJLuaSetupLogHandler(void(^blk)(NSString* str)) { @@ -44,9 +60,9 @@ void MJLuaSetupLogHandler(void(^blk)(NSString* str)) { /// /// Notes: /// * If at all possible, please do allow Hammerspoon to upload crash reports to us, it helps a great deal in keeping Hammerspoon stable -/// * Our Privacy Policy can be found here: [http://www.hammerspoon.org/privacy.html](http://www.hammerspoon.org/privacy.html) +/// * Our Privacy Policy can be found here: [https://www.hammerspoon.org/privacy.html](https://www.hammerspoon.org/privacy.html) static int core_uploadCrashData(lua_State* L) { - if (lua_isboolean(L, -1)) { HSSetUploadCrashData(lua_toboolean(L, -1)); } + if (lua_isboolean(L, 1)) { HSSetUploadCrashData(lua_toboolean(L, 1)); } lua_pushboolean(L, HSUploadCrashData()) ; return 1; } @@ -61,7 +77,7 @@ static int core_uploadCrashData(lua_State* L) { /// Returns: /// * True if Hammerspoon is currently (or has just been) set to launch on login or False if Hammerspoon is not. static int core_autolaunch(lua_State* L) { - if (lua_isboolean(L, -1)) { MJAutoLaunchSet(lua_toboolean(L, -1)); } + if (lua_isboolean(L, 1)) { MJAutoLaunchSet(lua_toboolean(L, 1)); } lua_pushboolean(L, MJAutoLaunchGet()) ; return 1; } @@ -76,7 +92,7 @@ static int core_autolaunch(lua_State* L) { /// Returns: /// * True if the icon is currently set (or has just been) to be visible or False if it is not. static int core_menuicon(lua_State* L) { - if (lua_isboolean(L, -1)) { MJMenuIconSetVisible(lua_toboolean(L, -1)); } + if (lua_isboolean(L, 1)) { MJMenuIconSetVisible(lua_toboolean(L, 1)); } lua_pushboolean(L, MJMenuIconVisible()) ; return 1; } @@ -96,7 +112,7 @@ static int core_menuicon(lua_State* L) { /// Returns: /// * True if the console is currently set (or has just been) to be always on top when visible or False if it is not. static int core_consoleontop(lua_State* L) { - if (lua_isboolean(L, -1)) { MJConsoleWindowSetAlwaysOnTop(lua_toboolean(L, -1)); } + if (lua_isboolean(L, 1)) { MJConsoleWindowSetAlwaysOnTop(lua_toboolean(L, 1)); } lua_pushboolean(L, MJConsoleWindowAlwaysOnTop()) ; return 1; } @@ -104,6 +120,12 @@ static int core_consoleontop(lua_State* L) { /// hs.openAbout() /// Function /// Displays the OS X About panel for Hammerspoon; implicitly focuses Hammerspoon. +/// +/// Parameters: +/// * None +/// +/// Returns: +/// * None static int core_openabout(lua_State* __unused L) { [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; [[NSApplication sharedApplication] orderFrontStandardAboutPanel:nil]; @@ -113,6 +135,12 @@ static int core_openabout(lua_State* __unused L) { /// hs.openPreferences() /// Function /// Displays the Hammerspoon Preferences panel; implicitly focuses Hammerspoon. +/// +/// Parameters: +/// * None +/// +/// Returns: +/// * None static int core_openpreferences(lua_State* __unused L) { [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; [[MJPreferencesWindowController singleton] showWindow: nil]; @@ -120,12 +148,29 @@ static int core_openpreferences(lua_State* __unused L) { return 0 ; } +/// hs.closePreferences() +/// Function +/// Closes the Hammerspoon Preferences window +/// +/// Parameters: +/// * None +/// +/// Returns: +/// * None +static int core_closepreferences(lua_State* __unused L) { + [[MJPreferencesWindowController singleton].window orderOut:nil]; + return 0; +} + /// hs.openConsole([bringToFront]) /// Function /// Opens the Hammerspoon Console window and optionally focuses it. /// /// Parameters: /// * bringToFront - if true (default), the console will be focused as well as opened. +/// +/// Returns: +/// * None static int core_openconsole(lua_State* L) { if (!(lua_isboolean(L,1) && !lua_toboolean(L, 1))) [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; @@ -133,6 +178,20 @@ static int core_openconsole(lua_State* L) { return 0; } +/// hs.closeConsole() +/// Function +/// Closes the Hammerspoon Console window +/// +/// Parameters: +/// * None +/// +/// Returns: +/// * None +static int core_closeconsole(lua_State* L) { + [[MJConsoleWindowController singleton].window orderOut:nil]; + return 0; +} + /// hs.open(filePath) /// Function /// Opens a file as if it were opened with /usr/bin/open @@ -143,10 +202,11 @@ static int core_openconsole(lua_State* L) { /// Returns: /// * A boolean, true if the file was opened successfully, otherwise false static int core_open(lua_State *L) { - LuaSkin *skin = [LuaSkin shared]; + LuaSkin *skin = [LuaSkin sharedWithState:L]; [skin checkArgs:LS_TSTRING, LS_TBREAK]; - BOOL result = [[NSWorkspace sharedWorkspace] openFile:[skin toNSObjectAtIndex:1]]; + NSURL *pathURL = [NSURL fileURLWithPath:[skin toNSObjectAtIndex:1]]; + BOOL result = [NSWorkspace.sharedWorkspace openURL:pathURL]; lua_pushboolean(L, result); return 1; @@ -155,6 +215,12 @@ static int core_open(lua_State *L) { /// hs.reload() /// Function /// Reloads your init-file in a fresh Lua environment. +/// +/// Parameters: +/// * None +/// +/// Returns: +/// * None static int core_reload(lua_State* L) { dispatch_async(dispatch_get_main_queue(), ^{ MJLuaReplace(); @@ -166,29 +232,51 @@ static int core_reload(lua_State* L) { /// Constant /// A table containing read-only information about the Hammerspoon application instance currently running. static int push_hammerAppInfo(lua_State* L) { - lua_newtable(L) ; - lua_pushstring(L, [[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] UTF8String]) ; - lua_setfield(L, -2, "version") ; - lua_pushstring(L, [[[NSBundle mainBundle] resourcePath] fileSystemRepresentation]); - lua_setfield(L, -2, "resourcePath"); - lua_pushstring(L, [[[NSBundle mainBundle] bundlePath] fileSystemRepresentation]); - lua_setfield(L, -2, "bundlePath"); - lua_pushstring(L, [[[NSBundle mainBundle] executablePath] fileSystemRepresentation]); - lua_setfield(L, -2, "executablePath"); - lua_pushinteger(L, getpid()) ; - lua_setfield(L, -2, "processID") ; -// Take this out of hs.settings? - lua_pushstring(L, [[[NSBundle mainBundle] bundleIdentifier] UTF8String]) ; - lua_setfield(L, -2, "bundleID") ; + LuaSkin *skin = [LuaSkin sharedWithState:L]; + + // Fetch the CPU architecture in use + NSString *arch = @"Unknown"; + struct utsname utsname; + if (uname(&utsname) == 0) { + arch = [NSString stringWithCString:utsname.machine encoding:NSUTF8StringEncoding]; + } + + // Determine if we're running under Rosetta + int isTranslated = 0; + size_t size = sizeof(isTranslated); + if (sysctlbyname("sysctl.proc_translated", &isTranslated, &size, NULL, 0) == -1) { + if (errno == ENOENT) + isTranslated = 0; + // Technically to reach here we have an error in the sysctl, but we'll ignore it + // isTranslated = -1; + } + + NSDictionary *appInfo = @{ + @"version": [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"], + @"build": [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"], + @"resourcePath": @([[[NSBundle mainBundle] resourcePath] fileSystemRepresentation]), + @"bundlePath": @([[[NSBundle mainBundle] bundlePath] fileSystemRepresentation]), + @"executablePath": @([[[NSBundle mainBundle] executablePath] fileSystemRepresentation]), + @"frameworksPath": @([[[NSBundle mainBundle] privateFrameworksPath] fileSystemRepresentation]), + @"processID": @(getpid()), + @"bundleID": [[NSBundle mainBundle] bundleIdentifier], + @"arch": arch, + @"isRosetta": [NSNumber numberWithBool:isTranslated], + @"buildTime": @(__DATE__ ", " __TIME__), #ifdef DEBUG - lua_pushstring(L, __DATE__ ", " __TIME__) ; lua_setfield(L, -2, "buildTime") ; - lua_pushboolean(L, YES) ; lua_setfield(L, -2, "debugBuild") ; + @"debugBuild": @(YES), +#else + @"debugBuild": @(NO), #endif + }; + + [skin pushNSObject:appInfo]; return 1; } /// hs.accessibilityState(shouldPrompt) -> isEnabled /// Function +/// Checks the Accessibility Permissions for Hammerspoon, and optionally allows you to prompt for permissions. /// /// Parameters: /// * shouldPrompt - an optional boolean value indicating if the dialog box asking if the System Preferences application should be opened should be presented when Accessibility is not currently enabled for Hammerspoon. Defaults to false. @@ -209,6 +297,200 @@ static int core_accessibilityState(lua_State* L) { return 1; } +// SOURCE: https://stackoverflow.com/a/58985069 +bool isScreenRecordingEnabled(void) +{ + if (@available(macos 10.15, *)) { + BOOL canRecordScreen = YES; + if (@available(macOS 10.15, *)) { + canRecordScreen = NO; + NSRunningApplication *runningApplication = NSRunningApplication.currentApplication; + NSNumber *ourProcessIdentifier = [NSNumber numberWithInteger:runningApplication.processIdentifier]; + + CFArrayRef windowList = CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly, kCGNullWindowID); + NSUInteger numberOfWindows = CFArrayGetCount(windowList); + for (int index = 0; index < numberOfWindows; index++) { + // get information for each window + NSDictionary *windowInfo = (NSDictionary *)CFArrayGetValueAtIndex(windowList, index); + NSString *windowName = windowInfo[(id)kCGWindowName]; + NSNumber *processIdentifier = windowInfo[(id)kCGWindowOwnerPID]; + + // don't check windows owned by this process + if (! [processIdentifier isEqual:ourProcessIdentifier]) { + // get process information for each window + pid_t pid = processIdentifier.intValue; + NSRunningApplication *windowRunningApplication = [NSRunningApplication runningApplicationWithProcessIdentifier:pid]; + if (! windowRunningApplication) { + // ignore processes we don't have access to, such as WindowServer, which manages the windows named "Menubar" and "Backstop Menubar" + } + else { + NSString *windowExecutableName = windowRunningApplication.executableURL.lastPathComponent; + if (windowName) { + if ([windowExecutableName isEqual:@"Dock"]) { + // ignore the Dock, which provides the desktop picture + } + else { + canRecordScreen = YES; + break; + } + } + } + } + } + if (windowList) { + CFRelease(windowList); + } + } + return canRecordScreen; + } else { + return true; + } +} + +/// hs.screenRecordingState(shouldPrompt) -> isEnabled +/// Function +/// Checks the Screen Recording Permissions for Hammerspoon, and optionally allows you to prompt for permissions. +/// +/// Parameters: +/// * shouldPrompt - an optional boolean value indicating if the dialog box asking if the System Preferences application should be opened should be presented when Screen Recording is not currently enabled for Hammerspoon. Defaults to false. +/// +/// Returns: +/// * True or False indicating whether or not Screen Recording is enabled for Hammerspoon. +/// +/// Notes: +/// * If you trigger the prompt and the user denies it, you cannot bring up the prompt again - the user must manually enable it in System Preferences. +static int core_screenRecordingState(lua_State* L) { + BOOL shouldprompt = lua_toboolean(L, 1); + BOOL enabled = isScreenRecordingEnabled(); + if (shouldprompt) { + CGDisplayStreamRef stream = CGDisplayStreamCreate(CGMainDisplayID(), 1, 1, kCVPixelFormatType_32BGRA, nil, ^(CGDisplayStreamFrameStatus status, uint64_t displayTime, IOSurfaceRef frameSurface, CGDisplayStreamUpdateRef updateRef) { + }); + if (stream) { + CFRelease(stream); + } + } + lua_pushboolean(L, enabled); + return 1; +} + +/// hs.microphoneState(shouldPrompt) -> boolean +/// Function +/// Checks the Microphone Permissions for Hammerspoon, and optionally allows you to prompt for permissions. +/// +/// Parameters: +/// * shouldPrompt - an optional boolean value indicating if we should request microphone access. Defaults to false. +/// +/// Returns: +/// * `true` or `false` indicating whether or not Microphone access is enabled for Hammerspoon. +/// +/// Notes: +/// * Will always return `true` on macOS 10.13 or earlier. +static int core_microphoneState(lua_State* L) { + LuaSkin *skin = [LuaSkin sharedWithState:L]; + BOOL shouldprompt = lua_toboolean(L, 1); + + // Request permission to access the camera and microphone. + if (@available(macOS 10.14, *)) { + switch ([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeAudio]) + { + case AVAuthorizationStatusAuthorized: + { + // The user has previously granted access to the camera. + lua_pushboolean(L, YES) ; + break; + } + case AVAuthorizationStatusNotDetermined: + { + if (shouldprompt) { + // The app hasn't yet asked the user for camera access. + [AVCaptureDevice requestAccessForMediaType:AVMediaTypeAudio completionHandler:^(BOOL granted) { + if (!granted) { + [skin logWarn:@"Hammerspoon has been declined Microphone access by the user."] ; + } + }]; + } + lua_pushboolean(L, NO) ; + break; + } + case AVAuthorizationStatusDenied: + { + // The user has previously denied access. + lua_pushboolean(L, NO) ; + break; + } + case AVAuthorizationStatusRestricted: + { + // The user can't grant access due to restrictions. + lua_pushboolean(L, NO) ; + break; + } + } + } else { + // Fallback on earlier versions + lua_pushboolean(L, YES) ; + } + return 1; +} + +/// hs.cameraState(shouldPrompt) -> boolean +/// Function +/// Checks the Camera Permissions for Hammerspoon, and optionally allows you to prompt for permissions. +/// +/// Parameters: +/// * shouldPrompt - an optional boolean value indicating if we should request camera access. Defaults to false. +/// +/// Returns: +/// * `true` or `false` indicating whether or not Camera access is enabled for Hammerspoon. +/// +/// Notes: +/// * Will always return `true` on macOS 10.13 or earlier. +static int core_cameraState(lua_State* L) { + LuaSkin *skin = [LuaSkin sharedWithState:L]; + BOOL shouldprompt = lua_toboolean(L, 1); + + // Request permission to access the camera and microphone. + if (@available(macOS 10.14, *)) { + switch ([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]) + { + case AVAuthorizationStatusAuthorized: + { + // The user has previously granted access to the camera. + lua_pushboolean(L, YES) ; + break; + } + case AVAuthorizationStatusNotDetermined: + { + if (shouldprompt) { + // The app hasn't yet asked the user for camera access. + [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) { + if (!granted) { + [skin logWarn:@"Hammerspoon has been declined Microphone access by the user."] ; + } + }]; + } + lua_pushboolean(L, NO) ; + break; + } + case AVAuthorizationStatusDenied: + { + // The user has previously denied access. + lua_pushboolean(L, NO) ; + break; + } + case AVAuthorizationStatusRestricted: + { + // The user can't grant access due to restrictions. + lua_pushboolean(L, NO) ; + break; + } + } + } else { + // Fallback on earlier versions + lua_pushboolean(L, YES) ; + } + return 1; +} + /// hs.automaticallyCheckForUpdates([setting]) -> bool /// Function /// Gets and optionally sets the Hammerspoon option to automatically check for updates. @@ -222,7 +504,7 @@ static int core_accessibilityState(lua_State* L) { /// Notes: /// * If you are running a non-release or locally compiled version of Hammerspoon then the results of this function are unspecified. static int automaticallyChecksForUpdates(lua_State *L) { - //LuaSkin *skin = [LuaSkin shared]; + LuaSkin *skin = [LuaSkin sharedWithState:L]; if (NSClassFromString(@"SUUpdater")) { NSString *frameworkPath = [[[NSBundle mainBundle] privateFrameworksPath] stringByAppendingPathComponent:@"Sparkle.framework"]; if ([[NSBundle bundleWithPath:frameworkPath] load]) { @@ -244,10 +526,18 @@ static int automaticallyChecksForUpdates(lua_State *L) { // for any method which accepts the same signature list for the target. [myInvocation setSelector:@selector(setAutomaticallyChecksForUpdates:)]; [myInvocation setArgument:&myBoolValue atIndex:2]; + //[myInvocation setReturnValue:&myBoolValue]; [myInvocation invoke]; } - lua_pushboolean(L, (BOOL)[sharedUpdater performSelector:@selector(automaticallyChecksForUpdates)]) ; + BOOL autoCheckUpdates = NO; + NSMethodSignature *autoCheckSignature = [NSClassFromString(@"SUUpdater") instanceMethodSignatureForSelector:@selector(automaticallyChecksForUpdates)]; + NSInvocation *autoCheckInvocation = [NSInvocation invocationWithMethodSignature:autoCheckSignature]; + [autoCheckInvocation setTarget:sharedUpdater]; + [autoCheckInvocation setSelector:@selector(automaticallyChecksForUpdates)]; + [autoCheckInvocation invoke]; + [autoCheckInvocation getReturnValue:&autoCheckUpdates]; + lua_pushboolean(L, autoCheckUpdates) ; #pragma clang diagnostic pop } else { //[skin logWarn:@"Sparkle Update framework not available for the running instance of CommandPost."] ; @@ -273,7 +563,7 @@ static int automaticallyChecksForUpdates(lua_State *L) { /// Notes: /// * If you are running a non-release or locally compiled version of Hammerspoon then the results of this function are unspecified. static int checkForUpdates(lua_State *L) { - LuaSkin *skin = [LuaSkin shared]; + LuaSkin *skin = [LuaSkin sharedWithState:L]; [skin checkArgs:LS_TBOOLEAN|LS_TOPTIONAL, LS_TBREAK]; if (NSClassFromString(@"SUUpdater")) { @@ -299,20 +589,21 @@ static int checkForUpdates(lua_State *L) { return 0 ; } -/// hs.updateAvailable() -> string or false +/// hs.updateAvailable() -> string or false, string /// Function -/// Gets the version number of an available update +/// Gets the version & build number of an available update /// /// Parameters: /// * None /// /// Returns: -/// * A string containing the version number of the latest release, or a boolean false if no update is available +/// * A string containing the display version of the latest release, or a boolean false if no update is available +/// * A string containing the build number of the latest release, or `nil` if no update is available /// /// Notes: /// * This is not a live check, it is a cached result of whatever the previous update check found. By default Hammerspoon checks for updates every few hours, but you can also add your own timer to check for updates more frequently with `hs.checkForUpdates()` static int updateAvailable(lua_State *L) { - LuaSkin *skin = [LuaSkin shared]; + LuaSkin *skin = [LuaSkin sharedWithState:L]; [skin checkArgs:LS_TBREAK]; id appDelegate = [[NSApplication sharedApplication] delegate]; @@ -321,14 +612,17 @@ static int updateAvailable(lua_State *L) { #pragma clang diagnostic ignored "-Wundeclared-selector" NSString *updateAvailable = [appDelegate performSelector:@selector(updateAvailable)]; + NSString *updateAvailableDisplayVersion = [appDelegate performSelector:@selector(updateAvailableDisplayVersion)]; if (updateAvailable == nil) { lua_pushboolean(L, 0); + return 1; } else { + [skin pushNSObject:updateAvailableDisplayVersion]; [skin pushNSObject:updateAvailable]; + return 2; } #pragma clang diagnostic pop - return 1; } /// hs.canCheckForUpdates() -> boolean @@ -344,7 +638,7 @@ static int updateAvailable(lua_State *L) { /// Notes: /// * The Sparkle framework is included in all regular releases of Hammerspoon but not included if you are running a non-release or locally compiled version of Hammerspoon, so this function can be used as a simple test to determine whether or not you are running a formal release Hammerspoon or not. static int canCheckForUpdates(lua_State *L) { - LuaSkin *skin = [LuaSkin shared]; + LuaSkin *skin = [LuaSkin sharedWithState:L]; [skin checkArgs:LS_TBREAK]; BOOL canUpdate = NO ; @@ -368,14 +662,14 @@ static int canCheckForUpdates(lua_State *L) { /// Returns: /// * A boolean, true if dark mode is enabled otherwise false. static int preferencesDarkMode(lua_State* L) { - LuaSkin *skin = [LuaSkin shared]; + LuaSkin *skin = [LuaSkin sharedWithState:L]; [skin checkArgs:LS_TBOOLEAN|LS_TOPTIONAL, LS_TBREAK]; - - if (lua_isboolean(L, -1)) { - PreferencesDarkModeSetEnabled(lua_toboolean(L, -1)); + + if (lua_isboolean(L, 1)) { + PreferencesDarkModeSetEnabled(lua_toboolean(L, 1)); [[MJPreferencesWindowController singleton] reflectDefaults] ; } - + lua_pushboolean(L, PreferencesDarkModeEnabled()) ; return 1; } @@ -397,20 +691,19 @@ static int preferencesDarkMode(lua_State* L) { /// - Open `/Applications/Utilities/Script Editor.app` /// - Click `File > Open Dictionary...` /// - Select Hammerspoon from the list of Applications -/// - This will now open a Dictionary containing all of the availible Hammerspoon AppleScript commands. +/// - This will now open a Dictionary containing all of the available Hammerspoon AppleScript commands. /// * Note that strings within the Lua code you pass from AppleScript can be delimited by `[[` and `]]` rather than normal quotes /// * Example: -/// /// ```lua /// tell application "Hammerspoon" /// execute lua code "hs.alert([[Hello from AppleScript]])" /// end tell``` static int core_appleScript(lua_State* L) { - LuaSkin *skin = [LuaSkin shared]; + LuaSkin *skin = [LuaSkin sharedWithState:L]; [skin checkArgs:LS_TBOOLEAN|LS_TOPTIONAL, LS_TBREAK]; - if (lua_isboolean(L, -1)) { - HSAppleScriptSetEnabled(lua_toboolean(L, -1)); + if (lua_isboolean(L, 1)) { + HSAppleScriptSetEnabled(lua_toboolean(L, 1)); } lua_pushboolean(L, HSAppleScriptEnabled()) ; @@ -430,11 +723,11 @@ static int core_appleScript(lua_State* L) { /// Notes: /// * This only refers to dock icon clicks while Hammerspoon is already running. The console window is not opened by launching the app static int core_openConsoleOnDockClick(lua_State* L) { - LuaSkin *skin = [LuaSkin shared]; + LuaSkin *skin = [LuaSkin sharedWithState:L]; [skin checkArgs:LS_TBOOLEAN|LS_TOPTIONAL, LS_TBREAK]; - if (lua_isboolean(L, -1)) { - HSOpenConsoleOnDockClickSetEnabled(lua_toboolean(L, -1)); + if (lua_isboolean(L, 1)) { + HSOpenConsoleOnDockClickSetEnabled(lua_toboolean(L, 1)); } lua_pushboolean(L, HSOpenConsoleOnDockClickEnabled()) ; @@ -444,6 +737,12 @@ static int core_openConsoleOnDockClick(lua_State* L) { /// hs.focus() /// Function /// Makes Hammerspoon the foreground app. +/// +/// Parameters: +/// * None +/// +/// Returns: +/// * None static int core_focus(lua_State* L) { [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; return 0; @@ -459,7 +758,7 @@ static int core_focus(lua_State* L) { /// Returns: /// * The extension's object metatable, or nil if an error occurred static int core_getObjectMetatable(lua_State *L) { - LuaSkin *skin = [LuaSkin shared]; + LuaSkin *skin = [LuaSkin sharedWithState:L]; [skin checkArgs:LS_TSTRING, LS_TBREAK]; luaL_getmetatable(L, lua_tostring(L,1)); return 1; @@ -480,7 +779,7 @@ static int core_getObjectMetatable(lua_State *L) { /// * This function does not modify the original string - to actually replace it, assign the result of this function to the original string. /// * This function is a more specifically targeted version of the `hs.utf8.fixUTF8(...)` function. static int core_cleanUTF8(lua_State *L) { - LuaSkin *skin = [LuaSkin shared] ; + LuaSkin *skin = [LuaSkin sharedWithState:L] ; [skin checkArgs:LS_TANY, LS_TBREAK] ; [skin pushNSObject:[skin getValidUTF8AtIndex:1]] ; return 1 ; @@ -518,11 +817,13 @@ static int core_notify(lua_State* L) { {"preferencesDarkMode", preferencesDarkMode}, {"openConsoleOnDockClick", core_openConsoleOnDockClick}, {"openConsole", core_openconsole}, + {"closeConsole", core_closeconsole}, {"consoleOnTop", core_consoleontop}, {"openAbout", core_openabout}, {"menuIcon", core_menuicon}, {"allowAppleScript", core_appleScript}, {"openPreferences", core_openpreferences}, + {"closePreferences", core_closepreferences}, {"open", core_open}, {"autoLaunch", core_autolaunch}, {"automaticallyCheckForUpdates", automaticallyChecksForUpdates}, @@ -533,6 +834,9 @@ static int core_notify(lua_State* L) { {"reload", core_reload}, {"focus", core_focus}, {"accessibilityState", core_accessibilityState}, + {"screenRecordingState", core_screenRecordingState}, + {"microphoneState", core_microphoneState}, + {"cameraState", core_cameraState}, {"getObjectMetatable", core_getObjectMetatable}, {"uploadCrashData", core_uploadCrashData}, {"cleanUTF8forConsole", core_cleanUTF8}, @@ -580,22 +884,28 @@ static int MJLuaAtPanic(lua_State *L) { // Create a Lua environment with LuaSkin void MJLuaAlloc(void) { - MJLuaLogDelegate = [[HSLogger alloc] initWithLua:nil]; + if (!MJLuaLogDelegate) { + MJLuaLogDelegate = [[HSLogger alloc] initWithLua:nil]; + } LuaSkin *skin = [LuaSkin sharedWithDelegate:MJLuaLogDelegate]; // on a reload, this won't get created in sharedWithDelegate:, so do it manually here - if (!skin.L) { + if (!LuaSkin.mainLuaState) { [skin createLuaState]; + skin.delegate = MJLuaLogDelegate; // FIXME: Is this needed? + // ANS: since a new delegate object is created here, yes because LuaSkin's initWithDelegate isn't called, so the new delegate isn't assigned + // should consider whether or not we really need to create new object but that's for another day... + skin = [LuaSkin sharedWithState:NULL] ; // make sure skin.L points to the main state since we just created a new one } - MJLuaState = skin; [MJLuaLogDelegate setLuaState:skin.L]; oldPanicFunction = lua_atpanic([skin L], &MJLuaAtPanic) ; } // Configure a Lua environment that has already been created by LuaSkin void MJLuaInit(void) { - lua_State* L = MJLuaState.L; + LuaSkin *skin = [LuaSkin sharedWithState:NULL] ; + lua_State* L = skin.L; - refTable = [MJLuaState registerLibrary:corelib metaFunctions:nil]; + refTable = [skin registerLibrary:"core" functions:corelib metaFunctions:nil]; push_hammerAppInfo(L) ; lua_setfield(L, -2, "processInfo") ; @@ -608,12 +918,13 @@ void MJLuaInit(void) { [alert addButtonWithTitle:@"OK"]; [alert setMessageText:@"CommandPost installation is corrupted"]; [alert setInformativeText:@"Please re-install CommandPost"]; - [alert setAlertStyle:NSCriticalAlertStyle]; + [alert setAlertStyle:NSAlertStyleCritical]; [alert runModal]; [[NSApplication sharedApplication] terminate: nil]; } lua_pushstring(L, [[[NSBundle mainBundle] pathForResource:@"extensions" ofType:nil] fileSystemRepresentation]); + lua_pushstring(L, [[NSBundle mainBundle].privateFrameworksPath fileSystemRepresentation]); lua_pushstring(L, [MJConfigFile UTF8String]); lua_pushstring(L, [MJConfigFileFullPath() UTF8String]); lua_pushstring(L, [MJConfigDir() UTF8String]); @@ -621,166 +932,221 @@ void MJLuaInit(void) { lua_pushboolean(L, [[NSFileManager defaultManager] fileExistsAtPath: MJConfigFileFullPath()]); lua_pushboolean(L, [[NSUserDefaults standardUserDefaults] boolForKey:HSAutoLoadExtensions]); - if (lua_pcall(L, 7, 2, 0) != LUA_OK) { + if (lua_pcall(L, 8, 2, 0) != LUA_OK) { NSString *errorMessage = [NSString stringWithFormat:@"%s", lua_tostring(L, -1)] ; + lua_pop(L, 1); // Pop the error message off the stack HSNSLOG(@"Error running setup.lua:%@", errorMessage); NSAlert *alert = [[NSAlert alloc] init]; [alert addButtonWithTitle:@"OK"]; [alert setMessageText:@"CommandPost initialization failed"]; [alert setInformativeText:errorMessage]; - [alert setAlertStyle:NSCriticalAlertStyle]; + [alert setAlertStyle:NSAlertStyleCritical]; [alert runModal]; } else { - evalfn = [MJLuaState luaRef:refTable]; - completionsForWordFn = [MJLuaState luaRef:refTable]; + if (lua_gettop(L) != 2 || lua_type(L, -1) != LUA_TFUNCTION || lua_type(L, -2) != LUA_TFUNCTION) { + NSString *debugPart = [NSString stringWithFormat:@"setup.lua returned this: %d:%d:%d", lua_gettop(L), (lua_gettop(L) >= 1) ? lua_type(L, -1) : -10, (lua_gettop(L) >= 2) ? lua_type(L, -2) : -10]; + + NSString *errorMessage = [NSString stringWithFormat:@"setup.lua failed to return the two items it is supposed to.\nThis is a severe bug. We would really appreciate your help in getting this fixed - please relaunch Hammerspoon so a crash report can be uploaded, then contact the Hammerspoon developers via GitHub."]; + NSAlert *alert = [[NSAlert alloc] init]; + [alert addButtonWithTitle:@"OK"]; + [alert setMessageText:@"Critical startup failure bug"]; + [alert setInformativeText:errorMessage]; + [alert setAlertStyle:NSAlertStyleCritical]; + [alert runModal]; + + [skin logBreadcrumb:[NSString stringWithFormat:@"setup.lua returned incorrectly: %@", debugPart]]; + + // Fall through this, so we crash, so we can get the crash report + } + evalfn = [skin luaRef:refTable]; + completionsForWordFn = [skin luaRef:refTable]; + [skin logBreadcrumb:@"setup.lua completed"]; } } // Accessibility State Callback: void callAccessibilityStateCallback(void) { - LuaSkin *skin = MJLuaState; - lua_State *L = MJLuaState.L; + LuaSkin *skin = [LuaSkin sharedWithState:NULL]; + lua_State *L = skin.L; + _lua_stackguard_entry(L); lua_getglobal(L, "hs"); lua_getfield(L, -1, "accessibilityStateCallback"); - if (lua_type(L, -1) == LUA_TFUNCTION) { - [skin protectedCallAndTraceback:0 nresults:0]; + if (lua_type(L, -1) == LUA_TNIL) { + // There is no callback set, so just pop the callback and carry on + lua_pop(L, 1); + } else { + [skin protectedCallAndError:@"hs.callAccessibilityStateCallback" nargs:0 nresults:0]; } + + // Pop the hs global off the stack + lua_pop(L, 1); + _lua_stackguard_exit(L); } // Text Dropped to Dock Icon Callback: void textDroppedToDockIcon(NSString *pboardString) { - LuaSkin *skin = MJLuaState; + LuaSkin *skin = [LuaSkin sharedWithState:NULL]; lua_State *L = skin.L; + _lua_stackguard_entry(L); lua_getglobal(L, "hs"); lua_getfield(L, -1, "textDroppedToDockIconCallback"); - if (lua_type(L, -1) == LUA_TFUNCTION) { - [skin pushNSObject:pboardString]; - [skin protectedCallAndTraceback:1 nresults:0]; + if (lua_type(L, -1) == LUA_TNIL) { + // There is no callback set, so just pop the callback and carry on + lua_pop(L, 1); } else { - [skin logError:@"Text was dropped on our dock icon, but no callback handler is set in hs.textDroppedToDockIconCallback"]; + [skin pushNSObject:pboardString]; + [skin protectedCallAndError:@"hs.textDroppedToDockIconCallback" nargs:1 nresults:0]; } + + // Pop the hs global off the stack + lua_pop(L, 1); + _lua_stackguard_exit(L); } // File Dropped to Dock Icon Callback: void fileDroppedToDockIcon(NSString *filePath) { - LuaSkin *skin = MJLuaState; + LuaSkin *skin = [LuaSkin sharedWithState:NULL]; lua_State *L = skin.L; + _lua_stackguard_entry(L); lua_getglobal(L, "hs"); lua_getfield(L, -1, "fileDroppedToDockIconCallback"); - if (lua_type(L, -1) == LUA_TFUNCTION) { - [skin pushNSObject:filePath]; - [skin protectedCallAndTraceback:1 nresults:0]; + if (lua_type(L, -1) == LUA_TNIL) { + // There is no callback set, so just pop the callback and carry on + lua_pop(L, 1); } else { - [skin logError:@"File was dropped on our dock icon, but no callback handler is set in hs.fileDroppedToDockIconCallback"]; + [skin pushNSObject:filePath]; + [skin protectedCallAndError:@"hs.fileDroppedToDockIconCallback" nargs:1 nresults:0]; } + + // Pop the hs global off the stack + lua_pop(L, 1); + _lua_stackguard_exit(L); } -// Accessibility State Callback: +// Dock Icon Click Callback: void callDockIconCallback(void) { - LuaSkin *skin = MJLuaState; - lua_State *L = MJLuaState.L; + LuaSkin *skin = [LuaSkin sharedWithState:NULL]; + lua_State *L = skin.L; + + if (L == NULL) { + // It seems to be possible that NSApplicationDelegate:applicationShouldHandleReopen can be called before a Lua state has been created. We need to bail out immediately or we'll cause a crash. + return; + } + + _lua_stackguard_entry(L); lua_getglobal(L, "hs"); lua_getfield(L, -1, "dockIconClickCallback"); - if (lua_type(L, -1) == LUA_TFUNCTION) { - [skin protectedCallAndTraceback:0 nresults:0]; + if (lua_type(L, -1) == LUA_TNIL) { + // There is no callback set, so just pop the callback and carry on + lua_pop(L, 1); + } else { + [skin protectedCallAndError:@"hs.dockIconClickCallback" nargs:0 nresults:0]; } + + // Pop the hs global off the stack + lua_pop(L, 1); + _lua_stackguard_exit(L); } +// Shutdown Callback static int callShutdownCallback(lua_State *L) { + LuaSkin *skin = [LuaSkin sharedWithState:L]; + _lua_stackguard_entry(skin.L); + lua_getglobal(L, "hs"); lua_getfield(L, -1, "shutdownCallback"); - if (lua_type(L, -1) == LUA_TFUNCTION) { - [MJLuaState protectedCallAndTraceback:0 nresults:0]; + if (lua_type(L, -1) == LUA_TNIL) { + // There is no callback set, so just pop the callback and carry on + lua_pop(L, 1); + } else { + [skin protectedCallAndError:@"hs.shutdownCallback" nargs:0 nresults:0]; } + // Pop the hs global off the stack + lua_pop(L, 1); + _lua_stackguard_exit(skin.L); return 0; } // Deconfigure a Lua environment that will shortly be destroyed by LuaSkin void MJLuaDeinit(void) { - LuaSkin *skin = MJLuaState; + LuaSkin *skin = [LuaSkin sharedWithState:NULL]; callShutdownCallback(skin.L); - if (MJLuaLogDelegate) { - [MJLuaState setDelegate:nil] ; - MJLuaLogDelegate = nil ; - } + [MJLuaLogDelegate setLuaState:nil]; } // Destroy a Lua environment with LuaSiin void MJLuaDealloc(void) { - LuaSkin *skin = MJLuaState; + LuaSkin *skin = [LuaSkin sharedWithState:NULL]; [skin destroyLuaState]; } NSString* MJLuaRunString(NSString* command) { - lua_State* L = MJLuaState.L; + LuaSkin *skin = [LuaSkin sharedWithState:NULL]; + lua_State* L = skin.L; + _lua_stackguard_entry(L); - [MJLuaState pushLuaRef:refTable ref:evalfn]; + [skin pushLuaRef:refTable ref:evalfn]; if (!lua_isfunction(L, -1)) { HSNSLOG(@"ERROR: MJLuaRunString doesn't seem to have an evalfn"); if (lua_isstring(L, -1)) { HSNSLOG(@"evalfn appears to be a string: %s", lua_tostring(L, -1)); } + // Whatever evalfn was, it wasn't a function, so pop it + lua_pop(L, 1); + _lua_stackguard_exit(L); return @""; } lua_pushstring(L, [command UTF8String]); - if ([MJLuaState protectedCallAndTraceback:1 nresults:1] == NO) { + if ([skin protectedCallAndTraceback:1 nresults:1] == NO) { const char *errorMsg = lua_tostring(L, -1); - [MJLuaState logError:[NSString stringWithUTF8String:errorMsg]]; + [skin logError:[NSString stringWithUTF8String:errorMsg]]; } size_t len; - const char* s = lua_tolstring(L, -1, &len); + const unsigned char* s = (const unsigned char *)lua_tolstring(L, -1, &len); NSString* str = [[NSString alloc] initWithData:[NSData dataWithBytes:s length:len] encoding:NSUTF8StringEncoding]; if (str == nil) { - lua_pushcfunction(L, core_cleanUTF8) ; - lua_pushvalue(L, -2) ; - if (lua_pcall(L, 1, 1, 0) == LUA_OK) { - s = lua_tolstring(L, -1, &len); - str = [[NSString alloc] initWithData:[NSData dataWithBytes:s length:len] encoding:NSUTF8StringEncoding]; - lua_pop(L, 1) ; - } else { - str = [[NSString alloc] initWithFormat:@"-- unable to clean for utf8 output: %s", lua_tostring(L, -1)] ; - lua_pop(L, 1) ; - } + str = [skin getValidUTF8:s ofLength:len]; } lua_pop(L, 1); + _lua_stackguard_exit(L); return str; } NSArray *MJLuaCompletionsForWord(NSString *completionWord) { //NSLog(@"Fetching completions for %@", completionWord); - LuaSkin *skin = MJLuaState; + LuaSkin *skin = [LuaSkin sharedWithState:NULL]; + _lua_stackguard_entry(skin.L); [skin pushLuaRef:refTable ref:completionsForWordFn]; - if (!lua_isfunction(skin.L, -1)) { - HSNSLOG(@"ERROR: MJLuaCompletionsForWord doesn't seem to have a completionsForWordFn"); - return @[]; - } [skin pushNSObject:completionWord]; - if ([skin protectedCallAndTraceback:1 nresults:1] == NO) { - const char *errorMsg = lua_tostring(skin.L, -1); - [skin logError:[NSString stringWithFormat:@"MJLuaCompletionsForWord: %s", errorMsg]]; + if ([skin protectedCallAndError:@"MJLuaCompletionsForWord" nargs:1 nresults:1] == NO) { + _lua_stackguard_exit(skin.L); return @[]; } - return [skin toNSObjectAtIndex:-1]; + NSArray *completions = [skin toNSObjectAtIndex:-1]; + lua_pop(skin.L, 1); + _lua_stackguard_exit(skin.L); + return completions; } // C-Code helper to return current active LuaState. Useful for callbacks to // verify stored LuaState still matches active one if GC fails to clear it. -lua_State* MJGetActiveLuaState() { - return MJLuaState.L ; +lua_State* MJGetActiveLuaState(void) { + LuaSkin *skin = [LuaSkin sharedWithState:NULL]; + return skin.L ; } diff --git a/Hammerspoon/MJMenuIcon.m b/Hammerspoon/MJMenuIcon.m index aa6f9fe8c..068ce3ee9 100644 --- a/Hammerspoon/MJMenuIcon.m +++ b/Hammerspoon/MJMenuIcon.m @@ -27,8 +27,7 @@ static void reflect_defaults(void) { [icon setTemplate:YES]; statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength]; - [statusItem setImage:icon]; - [statusItem setHighlightMode:YES]; + statusItem.button.image = icon; [statusItem setMenu: menuItemMenu]; } else { diff --git a/Hammerspoon/MJPreferencesWindowController.m b/Hammerspoon/MJPreferencesWindowController.m index e4eb24241..ebf4bbf96 100644 --- a/Hammerspoon/MJPreferencesWindowController.m +++ b/Hammerspoon/MJPreferencesWindowController.m @@ -67,16 +67,17 @@ - (void) reflectDefaults { } - (void)updateFeedbackDisplay:(NSNotification __unused *)notification { - [self.openAtLoginCheckbox setState:MJAutoLaunchGet() ? NSOnState : NSOffState]; - [self.showDockIconCheckbox setState: MJDockIconVisible() ? NSOnState : NSOffState]; - [self.showMenuIconCheckbox setState: MJMenuIconVisible() ? NSOnState : NSOffState]; - [self.keepConsoleOnTopCheckbox setState: MJConsoleWindowAlwaysOnTop() ? NSOnState : NSOffState]; - [self.uploadCrashDataCheckbox setState: HSUploadCrashData() ? NSOnState : NSOffState]; -#ifndef CRASHLYTICS_API_KEY - [self.uploadCrashDataCheckbox setState:NSOffState]; - [self.uploadCrashDataCheckbox setEnabled:NO]; + dispatch_async(dispatch_get_main_queue(), ^{ + [self.openAtLoginCheckbox setState:MJAutoLaunchGet() ? NSControlStateValueOn : NSControlStateValueOff]; + [self.showDockIconCheckbox setState: MJDockIconVisible() ? NSControlStateValueOn : NSControlStateValueOff]; + [self.showMenuIconCheckbox setState: MJMenuIconVisible() ? NSControlStateValueOn : NSControlStateValueOff]; + [self.keepConsoleOnTopCheckbox setState: MJConsoleWindowAlwaysOnTop() ? NSControlStateValueOn : NSControlStateValueOff]; + [self.uploadCrashDataCheckbox setState: HSUploadCrashData() ? NSControlStateValueOn : NSControlStateValueOff]; +#ifndef SENTRY_API_URL + [self.uploadCrashDataCheckbox setState:NSControlStateValueOff]; + [self.uploadCrashDataCheckbox setEnabled:NO]; #endif - + }); } - (void) showWindow:(id)sender { @@ -97,11 +98,11 @@ - (void)windowDidLoad { [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(accessibilityChanged:) name:@"com.apple.accessibility.api" object:nil]; - [self.openAtLoginCheckbox setState:MJAutoLaunchGet() ? NSOnState : NSOffState]; - [self.showDockIconCheckbox setState: MJDockIconVisible() ? NSOnState : NSOffState]; - [self.showMenuIconCheckbox setState: MJMenuIconVisible() ? NSOnState : NSOffState]; - [self.keepConsoleOnTopCheckbox setState: MJConsoleWindowAlwaysOnTop() ? NSOnState : NSOffState]; - [self.uploadCrashDataCheckbox setState: HSUploadCrashData() ? NSOnState : NSOffState]; + [self.openAtLoginCheckbox setState:MJAutoLaunchGet() ? NSControlStateValueOn : NSControlStateValueOff]; + [self.showDockIconCheckbox setState: MJDockIconVisible() ? NSControlStateValueOn : NSControlStateValueOff]; + [self.showMenuIconCheckbox setState: MJMenuIconVisible() ? NSControlStateValueOn : NSControlStateValueOff]; + [self.keepConsoleOnTopCheckbox setState: MJConsoleWindowAlwaysOnTop() ? NSControlStateValueOn : NSControlStateValueOff]; + [self.uploadCrashDataCheckbox setState: HSUploadCrashData() ? NSControlStateValueOn : NSControlStateValueOff]; if (NSClassFromString(@"SUUpdater")) { NSString *frameworkPath = [[[NSBundle bundleForClass:[self class]] privateFrameworksPath] stringByAppendingPathComponent:@"Sparkle.framework"]; @@ -116,12 +117,12 @@ - (void)windowDidLoad { } } else { NSLog(@"SUUpdater doesn't exist, disabling updates checkbox in Preferences"); - [self.updatesCheckbox setState:NSOffState]; + [self.updatesCheckbox setState:NSControlStateValueOff]; [self.updatesCheckbox setEnabled:NO]; } -#ifndef CRASHLYTICS_API_KEY - [self.uploadCrashDataCheckbox setState:NSOffState]; +#ifndef SENTRY_API_URL + [self.uploadCrashDataCheckbox setState:NSControlStateValueOff]; [self.uploadCrashDataCheckbox setEnabled:NO]; #endif @@ -170,7 +171,7 @@ - (IBAction) openAccessibility:(id)sender { } - (IBAction) toggleOpensAtLogin:(NSButton*)sender { - BOOL enabled = [sender state] == NSOnState; + BOOL enabled = [sender state] == NSControlStateValueOn; MJAutoLaunchSet(enabled); } @@ -180,31 +181,31 @@ - (IBAction) toggleShowDockIcon:(NSButton*)sender { } - (void) actuallyToggleShowDockIcon { - BOOL enabled = [self.showDockIconCheckbox state] == NSOnState; + BOOL enabled = [self.showDockIconCheckbox state] == NSControlStateValueOn; MJDockIconSetVisible(enabled); [self maybeWarnAboutDockMenuProblem]; } - (IBAction) toggleMenuDockIcon:(NSButton*)sender { - BOOL enabled = [sender state] == NSOnState; + BOOL enabled = [sender state] == NSControlStateValueOn; MJMenuIconSetVisible(enabled); [self maybeWarnAboutDockMenuProblem]; } - (IBAction) toggleKeepConsoleOnTop:(id)sender { - MJConsoleWindowSetAlwaysOnTop([sender state] == NSOnState); + MJConsoleWindowSetAlwaysOnTop([sender state] == NSControlStateValueOn); } - (IBAction) toggleUploadCrashData:(id)sender { - HSSetUploadCrashData([sender state] == NSOnState); + HSSetUploadCrashData([sender state] == NSControlStateValueOn); } - (IBAction) privacyPolicyClicked:(id)sender { - [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://www.hammerspoon.org/privacy"]]; + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://www.hammerspoon.org/privacy"]]; } - (void) dockMenuProblemAlertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo { - BOOL skipNextTime = ([[alert suppressionButton] state] == NSOnState); + BOOL skipNextTime = ([[alert suppressionButton] state] == NSControlStateValueOn); [[NSUserDefaults standardUserDefaults] setBool:skipNextTime forKey:MJSkipDockMenuIconProblemAlertKey]; } @@ -216,7 +217,7 @@ - (void) maybeWarnAboutDockMenuProblem { return; NSAlert* alert = [[NSAlert alloc] init]; - [alert setAlertStyle:NSWarningAlertStyle]; + [alert setAlertStyle:NSAlertStyleWarning]; [alert setMessageText:@"How to get back to this window"]; [alert setInformativeText:@"When both the dock icon and menu icon are disabled, you can get back to this Preferences window by activating Hammerspoon from Spotlight or by running `open -a Hammerspoon` from Terminal, and then pressing Command + Comma."]; [alert setShowsSuppressionButton:YES]; diff --git a/Hammerspoon/MainMenu.xib b/Hammerspoon/MainMenu.xib index e1f9eaf4c..d79bfbea8 100644 --- a/Hammerspoon/MainMenu.xib +++ b/Hammerspoon/MainMenu.xib @@ -1,7 +1,8 @@ - + - + + @@ -77,7 +78,7 @@ - + @@ -90,7 +91,7 @@ - + @@ -375,6 +376,7 @@ + @@ -424,6 +426,7 @@ + diff --git a/Hammerspoon/PreferencesWindow.xib b/Hammerspoon/PreferencesWindow.xib index 4ecc97c79..a6c6a4508 100644 --- a/Hammerspoon/PreferencesWindow.xib +++ b/Hammerspoon/PreferencesWindow.xib @@ -1,7 +1,8 @@ - + - + + @@ -18,146 +19,184 @@ - + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/Hammerspoon/Spoon.icns b/Hammerspoon/Spoon.icns deleted file mode 100644 index d3c848ddb..000000000 Binary files a/Hammerspoon/Spoon.icns and /dev/null differ diff --git a/Hammerspoon/cpCache.icns b/Hammerspoon/cpCache.icns new file mode 100644 index 000000000..902e1e218 Binary files /dev/null and b/Hammerspoon/cpCache.icns differ diff --git a/Hammerspoon/cpHUD.icns b/Hammerspoon/cpHUD.icns new file mode 100644 index 000000000..ecd5a2c10 Binary files /dev/null and b/Hammerspoon/cpHUD.icns differ diff --git a/Hammerspoon/cpLoupedeck.icns b/Hammerspoon/cpLoupedeck.icns new file mode 100644 index 000000000..d4deefea8 Binary files /dev/null and b/Hammerspoon/cpLoupedeck.icns differ diff --git a/Hammerspoon/cpLoupedeckCT.icns b/Hammerspoon/cpLoupedeckCT.icns new file mode 100644 index 000000000..ab21908b2 Binary files /dev/null and b/Hammerspoon/cpLoupedeckCT.icns differ diff --git a/Hammerspoon/cpLoupedeckLive.icns b/Hammerspoon/cpLoupedeckLive.icns new file mode 100644 index 000000000..7a93fa9a2 Binary files /dev/null and b/Hammerspoon/cpLoupedeckLive.icns differ diff --git a/Hammerspoon/cpLoupedeckPlus.icns b/Hammerspoon/cpLoupedeckPlus.icns new file mode 100644 index 000000000..e4ace8545 Binary files /dev/null and b/Hammerspoon/cpLoupedeckPlus.icns differ diff --git a/Hammerspoon/cpMIDI.icns b/Hammerspoon/cpMIDI.icns new file mode 100644 index 000000000..007e5b312 Binary files /dev/null and b/Hammerspoon/cpMIDI.icns differ diff --git a/Hammerspoon/cpMonogram.icns b/Hammerspoon/cpMonogram.icns new file mode 100644 index 000000000..fd2299267 Binary files /dev/null and b/Hammerspoon/cpMonogram.icns differ diff --git a/Hammerspoon/cpPasteboard.icns b/Hammerspoon/cpPasteboard.icns new file mode 100644 index 000000000..dfc246c71 Binary files /dev/null and b/Hammerspoon/cpPasteboard.icns differ diff --git a/Hammerspoon/cpPlugin.icns b/Hammerspoon/cpPlugin.icns index 464e31ab7..f949ff01d 100644 Binary files a/Hammerspoon/cpPlugin.icns and b/Hammerspoon/cpPlugin.icns differ diff --git a/Hammerspoon/cpShortcuts.icns b/Hammerspoon/cpShortcuts.icns new file mode 100644 index 000000000..df12e3f2f Binary files /dev/null and b/Hammerspoon/cpShortcuts.icns differ diff --git a/Hammerspoon/cpSnippets.icns b/Hammerspoon/cpSnippets.icns new file mode 100644 index 000000000..bd6ba20df Binary files /dev/null and b/Hammerspoon/cpSnippets.icns differ diff --git a/Hammerspoon/cpStreamDeck.icns b/Hammerspoon/cpStreamDeck.icns new file mode 100644 index 000000000..e1e1a6c82 Binary files /dev/null and b/Hammerspoon/cpStreamDeck.icns differ diff --git a/Hammerspoon/cpTangent.icns b/Hammerspoon/cpTangent.icns new file mode 100644 index 000000000..11f513903 Binary files /dev/null and b/Hammerspoon/cpTangent.icns differ diff --git a/Hammerspoon/cpTouchBar.icns b/Hammerspoon/cpTouchBar.icns new file mode 100644 index 000000000..b774aadfb Binary files /dev/null and b/Hammerspoon/cpTouchBar.icns differ diff --git a/Hammerspoon/cpTourBox.icns b/Hammerspoon/cpTourBox.icns new file mode 100644 index 000000000..7aed695eb Binary files /dev/null and b/Hammerspoon/cpTourBox.icns differ diff --git a/Hammerspoon/setup.lua b/Hammerspoon/setup.lua index ced9ff2de..05bf89c50 100644 --- a/Hammerspoon/setup.lua +++ b/Hammerspoon/setup.lua @@ -1,17 +1,67 @@ -local modpath, prettypath, fullpath, configdir, docstringspath, hasinitfile, autoload_extensions = ... +local modpath, frameworkspath, prettypath, fullpath, configdir, docstringspath, hasinitfile, autoload_extensions = ... -print("-- Augmenting require paths") -package.path=configdir.."/?.lua"..";"..configdir.."/?/init.lua"..";"..configdir.."/Spoons/?.spoon/init.lua"..";"..package.path..";"..modpath.."/?.lua"..";"..modpath.."/?/init.lua" -package.cpath=configdir.."/?.so"..";"..package.cpath..";"..modpath.."/?.so" +local userruntime = os.getenv("HOME") .. "/.local/share/hammerspoon/site" -print("-- package.path:") -for part in string.gmatch(package.path, "([^;]+)") do - print(" "..part) -end +local paths = { + configdir .. "/?.lua", + configdir .. "/?/init.lua", + configdir .. "/Spoons/?.spoon/init.lua", + package.path, + modpath .. "/?.lua", + modpath .. "/?/init.lua", + userruntime .. "/?.lua", + userruntime .. "/?/init.lua", + userruntime .. "/Spoons/?.spoon/init.lua", +} -print("-- package.cpath:") -for part in string.gmatch(package.cpath, "([^;]+)") do - print(" "..part) -end +local cpaths = { + configdir .. "/?.dylib", + configdir .. "/?.so", + package.cpath, + frameworkspath .. "/?.dylib", + userruntime .. "/lib/?.dylib", + userruntime .. "/lib/?.so", +} + +package.path = table.concat(paths, ";") +package.cpath = table.concat(cpaths, ";") + +print("-- package.path: " .. package.path) +print("-- package.cpath: " .. package.cpath) + +local preload = function(m) return function() return require(m) end end +package.preload['hs.application.watcher'] = preload 'hs.libapplicationwatcher' +package.preload['hs.audiodevice.watcher'] = preload 'hs.libaudiodevicewatcher' +package.preload['hs.battery.watcher'] = preload 'hs.libbatterywatcher' +package.preload['hs.bonjour.service'] = preload 'hs.libbonjourservice' +package.preload['hs.caffeinate.watcher'] = preload 'hs.libcaffeinatewatcher' +package.preload['hs.canvas.matrix'] = preload 'hs.canvas_matrix' +package.preload['hs.drawing.color'] = preload 'hs.drawing_color' +package.preload['hs.doc.hsdocs'] = preload 'hs.hsdocs' +package.preload['hs.doc.markdown'] = preload 'hs.libmarkdown' +package.preload['hs.doc.builder'] = preload 'hs.doc_builder' +package.preload['hs.fs.volume'] = preload 'hs.libfsvolume' +package.preload['hs.fs.xattr'] = preload 'hs.libfsxattr' +package.preload['hs.host.locale'] = preload 'hs.host_locale' +package.preload['hs.httpserver.hsminweb'] = preload 'hs.httpserver_hsminweb' +package.preload['hs.location.geocoder'] = preload 'hs.location_geocoder' +package.preload['hs.network.configuration'] = preload 'hs.network_configuration' +package.preload['hs.network.host'] = preload 'hs.network_host' +package.preload['hs.network.ping'] = preload 'hs.network_ping' +package.preload['hs.pasteboard.watcher'] = preload 'hs.libpasteboardwatcher' +package.preload['hs.screen.watcher'] = preload 'hs.libscreenwatcher' +package.preload['hs.socket.udp'] = preload 'hs.libsocketudp' +package.preload['hs.spaces.watcher'] = preload 'hs.libspaces_watcher' +package.preload['hs.uielement.watcher'] = preload 'hs.libuielementwatcher' +package.preload['hs.usb.watcher'] = preload 'hs.libusbwatcher' +package.preload['hs.webview.datastore'] = preload 'hs.libwebviewdatastore' +package.preload['hs.webview.usercontent'] = preload 'hs.libwebviewusercontent' +package.preload['hs.webview.toolbar'] = preload 'hs.webview_toolbar' +package.preload['hs.wifi.watcher'] = preload 'hs.libwifiwatcher' +package.preload['hs.window.filter'] = preload 'hs.window_filter' +package.preload['hs.window.highlight'] = preload 'hs.window_highlight' +package.preload['hs.window.layout'] = preload 'hs.window_layout' +package.preload['hs.window.switcher'] = preload 'hs.window_switcher' +package.preload['hs.window.tiling'] = preload 'hs.window_tiling' return require'hs._coresetup'.setup(...) diff --git a/Hammerspoon/statusicon.pdf b/Hammerspoon/statusicon.pdf deleted file mode 100644 index 65b77bb46..000000000 Binary files a/Hammerspoon/statusicon.pdf and /dev/null differ diff --git a/LICENSE b/LICENSE index be3e883c3..a1119e08a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014-2017 [Various Contributors](https://github.com/Hammerspoon/hammerspoon/graphs/contributors) +Copyright (c) 2014-2025 [Various Contributors](https://github.com/Hammerspoon/hammerspoon/graphs/contributors) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 000000000..67a4afc08 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,48 @@ +MIT License + +Copyright (c) 2016-2022 LateNite Films Pty Ltd. +Copyright (c) 2016-2022 Chris Hocking & David Peterson. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- + +CommandPost-App is a fork of Hammerspoon: + +The MIT License (MIT) + +Copyright (c) 2014-2022 [Various Contributors](https://github.com/Hammerspoon/hammerspoon/graphs/contributors) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/LuaSkin/LuaSkin-Base.xcconfig b/LuaSkin/LuaSkin-Base.xcconfig new file mode 100644 index 000000000..be3a47fcf --- /dev/null +++ b/LuaSkin/LuaSkin-Base.xcconfig @@ -0,0 +1,92 @@ +// +// LuaSkin-Base.xcconfig +// LuaSkin +// +// Created by Chris Jones on 02/11/2021. +// Copyright © 2021 Hammerspoon. All rights reserved. +// + +// Configuration settings file format documentation can be found at: +// https://help.apple.com/xcode/#/dev745c5c974 + +// Base SDK +SDKROOT = macosx +// macOS Deployment Target +MACOSX_DEPLOYMENT_TARGET = 13.0 +// Build Active Architecture Only +ONLY_ACTIVE_ARCH = YES + +// Debug Information Format +DEBUG_INFORMATION_FORMAT = dwarf-with-dsym +// Enable Testability +ENABLE_TESTABILITY = YES +// Strip Debug Symbols During Copy +COPY_PHASE_STRIP = NO +// Strip Linked Product +STRIP_INSTALLED_PRODUCT = NO + +// Always Search User Paths (Deprecated) +ALWAYS_SEARCH_USER_PATHS = NO +// Current Project Version +CURRENT_PROJECT_VERSION = 1 +// Versioning Name Prefix +VERSION_INFO_PREFIX = +// Versioning System +VERSIONING_SYSTEM = apple-generic + +// Optimization Level +GCC_OPTIMIZATION_LEVEL = 0 +// Generate Position-Dependent Code +GCC_DYNAMIC_NO_PIC = NO +// No Common Blocks +GCC_NO_COMMON_BLOCKS = YES +// Symbols Hidden by Default +GCC_SYMBOLS_PRIVATE_EXTERN = NO + +// Other Warning Flags +WARNING_CFLAGS = -Weverything -Wno-cstring-format-directive -Wno-padded -Wno-auto-import -Wno-missing-variable-declarations -Wno-objc-missing-property-synthesis -Wno-cast-qual -Wno-gnu-zero-variadic-macro-arguments -Wno-objc-messaging-id -Wno-declaration-after-statement -Wno-reserved-identifier + +// C Language Dialect +GCC_C_LANGUAGE_STANDARD = gnu99 +// C++ Language Dialect +CLANG_CXX_LANGUAGE_STANDARD = gnu++0x +// C++ Standard Library +CLANG_CXX_LIBRARY = libc++ +// Enable Modules (C and Objective-C) +CLANG_ENABLE_MODULES = YES +// Enable Objective-C Exceptions +GCC_ENABLE_OBJC_EXCEPTIONS = YES +// Objective-C Automatic Reference Counting +CLANG_ENABLE_OBJC_ARC = YES +// Enable Strict Checking of objc_msgSend Calls +ENABLE_STRICT_OBJC_MSGSEND = YES +// Preprocessor Macros +GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1 $(inherited) + +// Various warning things +CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES +CLANG_WARN_EMPTY_BODY = YES +CLANG_WARN_BOOL_CONVERSION = YES +CLANG_WARN_CONSTANT_CONVERSION = YES +GCC_WARN_64_TO_32_BIT_CONVERSION = YES +CLANG_WARN_ENUM_CONVERSION = YES +CLANG_WARN_INT_CONVERSION = YES +CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES +CLANG_WARN_INFINITE_RECURSION = YES +GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR +CLANG_WARN_STRICT_PROTOTYPES = YES +CLANG_WARN_COMMA = YES +GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE +CLANG_WARN_UNREACHABLE_CODE = YES +GCC_WARN_UNUSED_FUNCTION = YES +GCC_WARN_UNUSED_VARIABLE = YES +CLANG_WARN_RANGE_LOOP_ANALYSIS = YES +CLANG_WARN_SUSPICIOUS_MOVE = YES +CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_OBJC_LITERAL_CONVERSION = YES +CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES +GCC_WARN_UNDECLARED_SELECTOR = YES +CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES diff --git a/LuaSkin/LuaSkin-Release.xcconfig b/LuaSkin/LuaSkin-Release.xcconfig new file mode 100644 index 000000000..c0c24894f --- /dev/null +++ b/LuaSkin/LuaSkin-Release.xcconfig @@ -0,0 +1,29 @@ +// +// LuaSkin-Release.xcconfig +// LuaSkin +// +// Created by Chris Jones on 02/11/2021. +// Copyright © 2021 Hammerspoon. All rights reserved. +// + +// Configuration settings file format documentation can be found at: +// https://help.apple.com/xcode/#/dev745c5c974 + +#include "LuaSkin-Base.xcconfig" + +// Code Signing Identity +CODE_SIGN_IDENTITY = Developer ID Application +DEVELOPMENT_TEAM = VQCYSNZB89 + +// Preprocessor Macros +GCC_PREPROCESSOR_DEFINITIONS = + +// Build Active Architecture Only +ONLY_ACTIVE_ARCH = NO +// Enable Testability +ENABLE_TESTABILITY = NO + +// Optimization Level +GCC_OPTIMIZATION_LEVEL = s + +#include? "../../LuaSkin-Downstream.xcconfig" diff --git a/LuaSkin/LuaSkin.xcodeproj/project.pbxproj b/LuaSkin/LuaSkin.xcodeproj/project.pbxproj index d6f71ba64..67745fb24 100644 --- a/LuaSkin/LuaSkin.xcodeproj/project.pbxproj +++ b/LuaSkin/LuaSkin.xcodeproj/project.pbxproj @@ -7,8 +7,95 @@ objects = { /* Begin PBXBuildFile section */ - 4F478F0C1DE6251400E0DC38 /* lobjectivec_exceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F478F0A1DE6251400E0DC38 /* lobjectivec_exceptions.h */; }; - 4F478F0D1DE6251400E0DC38 /* lobjectivec_exceptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F478F0B1DE6251400E0DC38 /* lobjectivec_exceptions.m */; }; + 4F13FA082C613DAD008E88A7 /* lapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9EB2C613C57008E88A7 /* lapi.h */; }; + 4F13FA092C613DAD008E88A7 /* lauxlib.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9D92C613C57008E88A7 /* lauxlib.h */; }; + 4F13FA0A2C613DAD008E88A7 /* lcode.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9D42C613C57008E88A7 /* lcode.h */; }; + 4F13FA0B2C613DAD008E88A7 /* lctype.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13FA062C613C58008E88A7 /* lctype.h */; }; + 4F13FA0C2C613DAD008E88A7 /* ldebug.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9FF2C613C57008E88A7 /* ldebug.h */; }; + 4F13FA0D2C613DAD008E88A7 /* ldo.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9EA2C613C57008E88A7 /* ldo.h */; }; + 4F13FA0E2C613DAD008E88A7 /* lfunc.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9D72C613C57008E88A7 /* lfunc.h */; }; + 4F13FA0F2C613DAD008E88A7 /* lgc.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9CD2C613C56008E88A7 /* lgc.h */; }; + 4F13FA102C613DAD008E88A7 /* ljumptab.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9FA2C613C57008E88A7 /* ljumptab.h */; }; + 4F13FA112C613DAD008E88A7 /* llex.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9CF2C613C56008E88A7 /* llex.h */; }; + 4F13FA122C613DAD008E88A7 /* llimits.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9FE2C613C57008E88A7 /* llimits.h */; }; + 4F13FA132C613DAD008E88A7 /* lmem.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9C92C613C56008E88A7 /* lmem.h */; }; + 4F13FA142C613DAD008E88A7 /* lobject.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9F82C613C57008E88A7 /* lobject.h */; }; + 4F13FA152C613DAD008E88A7 /* lobjectivec_exceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9E72C613C57008E88A7 /* lobjectivec_exceptions.h */; }; + 4F13FA162C613DAD008E88A7 /* lopcodes.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9D82C613C57008E88A7 /* lopcodes.h */; }; + 4F13FA172C613DAD008E88A7 /* lopnames.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9E12C613C57008E88A7 /* lopnames.h */; }; + 4F13FA182C613DAD008E88A7 /* lparser.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9D52C613C57008E88A7 /* lparser.h */; }; + 4F13FA192C613DAD008E88A7 /* lprefix.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9CA2C613C56008E88A7 /* lprefix.h */; }; + 4F13FA1A2C613DAD008E88A7 /* lstate.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9EF2C613C57008E88A7 /* lstate.h */; }; + 4F13FA1B2C613DAD008E88A7 /* lstring.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13FA022C613C58008E88A7 /* lstring.h */; }; + 4F13FA1C2C613DAD008E88A7 /* ltable.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9DE2C613C57008E88A7 /* ltable.h */; }; + 4F13FA1D2C613DAD008E88A7 /* ltm.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9E82C613C57008E88A7 /* ltm.h */; }; + 4F13FA1E2C613DAD008E88A7 /* lua.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9DD2C613C57008E88A7 /* lua.h */; }; + 4F13FA1F2C613DAD008E88A7 /* lua.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9DA2C613C57008E88A7 /* lua.hpp */; }; + 4F13FA202C613DAD008E88A7 /* luaconf.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9E22C613C57008E88A7 /* luaconf.h */; }; + 4F13FA212C613DAD008E88A7 /* lualib.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9D02C613C57008E88A7 /* lualib.h */; }; + 4F13FA222C613DAD008E88A7 /* lundump.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9E52C613C57008E88A7 /* lundump.h */; }; + 4F13FA232C613DAD008E88A7 /* lvm.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13FA002C613C58008E88A7 /* lvm.h */; }; + 4F13FA242C613DAD008E88A7 /* lzio.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9DC2C613C57008E88A7 /* lzio.h */; }; + 4F13FA252C613DF9008E88A7 /* lapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9E32C613C57008E88A7 /* lapi.c */; }; + 4F13FA262C613DF9008E88A7 /* lauxlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9F32C613C57008E88A7 /* lauxlib.c */; }; + 4F13FA272C613DF9008E88A7 /* lbaselib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9DF2C613C57008E88A7 /* lbaselib.c */; }; + 4F13FA282C613DF9008E88A7 /* lcode.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13FA032C613C58008E88A7 /* lcode.c */; }; + 4F13FA292C613DF9008E88A7 /* lcorolib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13FA042C613C58008E88A7 /* lcorolib.c */; }; + 4F13FA2A2C613DF9008E88A7 /* lctype.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13FA012C613C58008E88A7 /* lctype.c */; }; + 4F13FA2B2C613DF9008E88A7 /* ldblib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9CB2C613C56008E88A7 /* ldblib.c */; }; + 4F13FA2C2C613DF9008E88A7 /* ldebug.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9CE2C613C56008E88A7 /* ldebug.c */; }; + 4F13FA2D2C613DF9008E88A7 /* ldo.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9FD2C613C57008E88A7 /* ldo.c */; }; + 4F13FA2E2C613DF9008E88A7 /* ldump.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9E02C613C57008E88A7 /* ldump.c */; }; + 4F13FA2F2C613DF9008E88A7 /* lfunc.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9F22C613C57008E88A7 /* lfunc.c */; }; + 4F13FA302C613DF9008E88A7 /* lgc.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9F62C613C57008E88A7 /* lgc.c */; }; + 4F13FA312C613DF9008E88A7 /* linit.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9F92C613C57008E88A7 /* linit.c */; }; + 4F13FA322C613DF9008E88A7 /* liolib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9EE2C613C57008E88A7 /* liolib.c */; }; + 4F13FA332C613DF9008E88A7 /* llex.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9CC2C613C56008E88A7 /* llex.c */; }; + 4F13FA342C613DF9008E88A7 /* lmathlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9F52C613C57008E88A7 /* lmathlib.c */; }; + 4F13FA352C613DF9008E88A7 /* lmem.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9D22C613C57008E88A7 /* lmem.c */; }; + 4F13FA362C613DF9008E88A7 /* loadlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9EC2C613C57008E88A7 /* loadlib.c */; }; + 4F13FA372C613DF9008E88A7 /* lobject.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9F42C613C57008E88A7 /* lobject.c */; }; + 4F13FA382C613DF9008E88A7 /* lobjectivec_exceptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F13FA072C613C58008E88A7 /* lobjectivec_exceptions.m */; }; + 4F13FA392C613DF9008E88A7 /* lopcodes.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13FA052C613C58008E88A7 /* lopcodes.c */; }; + 4F13FA3A2C613DF9008E88A7 /* loslib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9FB2C613C57008E88A7 /* loslib.c */; }; + 4F13FA3B2C613DF9008E88A7 /* lparser.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9F72C613C57008E88A7 /* lparser.c */; }; + 4F13FA3C2C613DF9008E88A7 /* lstate.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9E42C613C57008E88A7 /* lstate.c */; }; + 4F13FA3D2C613DF9008E88A7 /* lstring.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9E92C613C57008E88A7 /* lstring.c */; }; + 4F13FA3E2C613DF9008E88A7 /* lstrlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9E62C613C57008E88A7 /* lstrlib.c */; }; + 4F13FA3F2C613DF9008E88A7 /* ltable.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9FC2C613C57008E88A7 /* ltable.c */; }; + 4F13FA402C613DF9008E88A7 /* ltablib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9F02C613C57008E88A7 /* ltablib.c */; }; + 4F13FA412C613DF9008E88A7 /* ltm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9D62C613C57008E88A7 /* ltm.c */; }; + 4F13FA422C613DF9008E88A7 /* lua.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9DB2C613C57008E88A7 /* lua.c */; }; + 4F13FA432C613DF9008E88A7 /* lundump.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9D12C613C57008E88A7 /* lundump.c */; }; + 4F13FA442C613DF9008E88A7 /* lutf8lib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9D32C613C57008E88A7 /* lutf8lib.c */; }; + 4F13FA452C613DF9008E88A7 /* lvm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9F12C613C57008E88A7 /* lvm.c */; }; + 4F13FA462C613DF9008E88A7 /* lzio.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F13F9ED2C613C57008E88A7 /* lzio.c */; }; + 4F13FA472C61418D008E88A7 /* lapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9EB2C613C57008E88A7 /* lapi.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA482C61418D008E88A7 /* lauxlib.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9D92C613C57008E88A7 /* lauxlib.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA492C61418D008E88A7 /* lcode.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9D42C613C57008E88A7 /* lcode.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA4A2C61418D008E88A7 /* lctype.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13FA062C613C58008E88A7 /* lctype.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA4B2C61418D008E88A7 /* ldebug.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9FF2C613C57008E88A7 /* ldebug.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA4C2C61418D008E88A7 /* ldo.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9EA2C613C57008E88A7 /* ldo.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA4D2C61418D008E88A7 /* lfunc.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9D72C613C57008E88A7 /* lfunc.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA4E2C61418D008E88A7 /* lgc.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9CD2C613C56008E88A7 /* lgc.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA502C61418D008E88A7 /* llex.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9CF2C613C56008E88A7 /* llex.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA512C61418D008E88A7 /* llimits.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9FE2C613C57008E88A7 /* llimits.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA522C61418D008E88A7 /* lmem.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9C92C613C56008E88A7 /* lmem.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA532C61418D008E88A7 /* lobject.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9F82C613C57008E88A7 /* lobject.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA552C61418D008E88A7 /* lopcodes.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9D82C613C57008E88A7 /* lopcodes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA562C61418D008E88A7 /* lopnames.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9E12C613C57008E88A7 /* lopnames.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA572C61418D008E88A7 /* lparser.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9D52C613C57008E88A7 /* lparser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA582C61418D008E88A7 /* lprefix.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9CA2C613C56008E88A7 /* lprefix.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA592C61418D008E88A7 /* lstate.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9EF2C613C57008E88A7 /* lstate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA5A2C61418D008E88A7 /* lstring.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13FA022C613C58008E88A7 /* lstring.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA5B2C61418D008E88A7 /* ltable.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9DE2C613C57008E88A7 /* ltable.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA5C2C61418D008E88A7 /* ltm.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9E82C613C57008E88A7 /* ltm.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA5D2C61418D008E88A7 /* lua.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9DD2C613C57008E88A7 /* lua.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA5E2C61418D008E88A7 /* luaconf.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9E22C613C57008E88A7 /* luaconf.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA5F2C61418D008E88A7 /* lualib.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9D02C613C57008E88A7 /* lualib.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA602C61418D008E88A7 /* lundump.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9E52C613C57008E88A7 /* lundump.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA612C61418D008E88A7 /* lvm.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13FA002C613C58008E88A7 /* lvm.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F13FA622C61418D008E88A7 /* lzio.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F13F9DC2C613C57008E88A7 /* lzio.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4FDC203D1E117F7500EDA72E /* luaskin.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4FDC203C1E117F7500EDA72E /* luaskin.lua */; }; 4FDD8E781C850AC800085D7A /* lsunit.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4FDD8E771C850AC800085D7A /* lsunit.lua */; }; 4FDD8E801C85A09600085D7A /* testinit.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4FDD8E7F1C85A09600085D7A /* testinit.lua */; }; @@ -18,90 +105,7 @@ 4FEF59711B29D0FB002344A7 /* Skin.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FEF596F1B29D0FB002344A7 /* Skin.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4FEF59721B29D0FB002344A7 /* Skin.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FEF59701B29D0FB002344A7 /* Skin.m */; }; 4FEF5AD51B29E017002344A7 /* liblua.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FEF5A981B29E005002344A7 /* liblua.a */; }; - 4FFC1A851E3FD6770036E0E5 /* lapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A0F1E3FD5E60036E0E5 /* lapi.c */; }; - 4FFC1A861E3FD6770036E0E5 /* lapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A101E3FD5E60036E0E5 /* lapi.h */; }; - 4FFC1A871E3FD6770036E0E5 /* lauxlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A111E3FD5E60036E0E5 /* lauxlib.c */; }; - 4FFC1A881E3FD6770036E0E5 /* lauxlib.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A121E3FD5E60036E0E5 /* lauxlib.h */; }; - 4FFC1A891E3FD6770036E0E5 /* lbaselib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A131E3FD5E60036E0E5 /* lbaselib.c */; }; - 4FFC1A8A1E3FD6770036E0E5 /* lbitlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A141E3FD5E60036E0E5 /* lbitlib.c */; }; - 4FFC1A8B1E3FD6770036E0E5 /* lcode.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A151E3FD5E60036E0E5 /* lcode.c */; }; - 4FFC1A8C1E3FD6770036E0E5 /* lcode.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A161E3FD5E60036E0E5 /* lcode.h */; }; - 4FFC1A8D1E3FD6770036E0E5 /* lcorolib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A171E3FD5E60036E0E5 /* lcorolib.c */; }; - 4FFC1A8E1E3FD6770036E0E5 /* lctype.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A181E3FD5E60036E0E5 /* lctype.c */; }; - 4FFC1A8F1E3FD6770036E0E5 /* lctype.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A191E3FD5E60036E0E5 /* lctype.h */; }; - 4FFC1A901E3FD6770036E0E5 /* ldblib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A1A1E3FD5E60036E0E5 /* ldblib.c */; }; - 4FFC1A911E3FD6770036E0E5 /* ldebug.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A1B1E3FD5E60036E0E5 /* ldebug.c */; }; - 4FFC1A921E3FD6770036E0E5 /* ldebug.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A1C1E3FD5E60036E0E5 /* ldebug.h */; }; - 4FFC1A931E3FD6770036E0E5 /* ldo.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A1D1E3FD5E60036E0E5 /* ldo.c */; }; - 4FFC1A941E3FD6770036E0E5 /* ldo.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A1E1E3FD5E60036E0E5 /* ldo.h */; }; - 4FFC1A951E3FD6770036E0E5 /* ldump.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A1F1E3FD5E60036E0E5 /* ldump.c */; }; - 4FFC1A961E3FD6770036E0E5 /* lfunc.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A201E3FD5E60036E0E5 /* lfunc.c */; }; - 4FFC1A971E3FD6770036E0E5 /* lfunc.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A211E3FD5E60036E0E5 /* lfunc.h */; }; - 4FFC1A981E3FD6770036E0E5 /* lgc.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A221E3FD5E60036E0E5 /* lgc.c */; }; - 4FFC1A991E3FD6770036E0E5 /* lgc.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A231E3FD5E60036E0E5 /* lgc.h */; }; - 4FFC1A9A1E3FD6770036E0E5 /* linit.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A241E3FD5E60036E0E5 /* linit.c */; }; - 4FFC1A9B1E3FD6770036E0E5 /* liolib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A251E3FD5E60036E0E5 /* liolib.c */; }; - 4FFC1A9C1E3FD6770036E0E5 /* llex.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A261E3FD5E60036E0E5 /* llex.c */; }; - 4FFC1A9D1E3FD6770036E0E5 /* llex.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A271E3FD5E60036E0E5 /* llex.h */; }; - 4FFC1A9E1E3FD6770036E0E5 /* llimits.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A281E3FD5E60036E0E5 /* llimits.h */; }; - 4FFC1A9F1E3FD6770036E0E5 /* lmathlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A291E3FD5E60036E0E5 /* lmathlib.c */; }; - 4FFC1AA01E3FD6770036E0E5 /* lmem.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A2A1E3FD5E60036E0E5 /* lmem.c */; }; - 4FFC1AA11E3FD6770036E0E5 /* lmem.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A2B1E3FD5E60036E0E5 /* lmem.h */; }; - 4FFC1AA21E3FD6770036E0E5 /* loadlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A2C1E3FD5E60036E0E5 /* loadlib.c */; }; - 4FFC1AA31E3FD6770036E0E5 /* lobject.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A2D1E3FD5E60036E0E5 /* lobject.c */; }; - 4FFC1AA41E3FD6770036E0E5 /* lobject.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A2E1E3FD5E60036E0E5 /* lobject.h */; }; - 4FFC1AA51E3FD6770036E0E5 /* lopcodes.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A2F1E3FD5E60036E0E5 /* lopcodes.c */; }; - 4FFC1AA61E3FD6770036E0E5 /* lopcodes.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A301E3FD5E60036E0E5 /* lopcodes.h */; }; - 4FFC1AA71E3FD6770036E0E5 /* loslib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A311E3FD5E60036E0E5 /* loslib.c */; }; - 4FFC1AA81E3FD6770036E0E5 /* lparser.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A321E3FD5E60036E0E5 /* lparser.c */; }; - 4FFC1AA91E3FD6770036E0E5 /* lparser.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A331E3FD5E60036E0E5 /* lparser.h */; }; - 4FFC1AAA1E3FD6770036E0E5 /* lprefix.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A341E3FD5E60036E0E5 /* lprefix.h */; }; - 4FFC1AAB1E3FD6770036E0E5 /* lstate.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A351E3FD5E60036E0E5 /* lstate.c */; }; - 4FFC1AAC1E3FD6770036E0E5 /* lstate.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A361E3FD5E60036E0E5 /* lstate.h */; }; - 4FFC1AAD1E3FD6770036E0E5 /* lstring.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A371E3FD5E60036E0E5 /* lstring.c */; }; - 4FFC1AAE1E3FD6770036E0E5 /* lstring.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A381E3FD5E60036E0E5 /* lstring.h */; }; - 4FFC1AAF1E3FD6770036E0E5 /* lstrlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A391E3FD5E60036E0E5 /* lstrlib.c */; }; - 4FFC1AB01E3FD6770036E0E5 /* ltable.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A3A1E3FD5E60036E0E5 /* ltable.c */; }; - 4FFC1AB11E3FD6770036E0E5 /* ltable.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A3B1E3FD5E60036E0E5 /* ltable.h */; }; - 4FFC1AB21E3FD6770036E0E5 /* ltablib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A3C1E3FD5E60036E0E5 /* ltablib.c */; }; - 4FFC1AB31E3FD6770036E0E5 /* ltm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A3D1E3FD5E60036E0E5 /* ltm.c */; }; - 4FFC1AB41E3FD6770036E0E5 /* ltm.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A3E1E3FD5E60036E0E5 /* ltm.h */; }; - 4FFC1AB51E3FD6770036E0E5 /* lua.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A3F1E3FD5E60036E0E5 /* lua.h */; }; - 4FFC1AB61E3FD6770036E0E5 /* lua.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A401E3FD5E60036E0E5 /* lua.hpp */; }; - 4FFC1AB71E3FD6770036E0E5 /* luaconf.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A411E3FD5E60036E0E5 /* luaconf.h */; }; - 4FFC1AB81E3FD6770036E0E5 /* lualib.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A421E3FD5E60036E0E5 /* lualib.h */; }; - 4FFC1AB91E3FD6770036E0E5 /* lundump.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A431E3FD5E60036E0E5 /* lundump.c */; }; - 4FFC1ABA1E3FD6770036E0E5 /* lundump.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A441E3FD5E60036E0E5 /* lundump.h */; }; - 4FFC1ABB1E3FD6770036E0E5 /* lutf8lib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A451E3FD5E60036E0E5 /* lutf8lib.c */; }; - 4FFC1ABC1E3FD6770036E0E5 /* lvm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A461E3FD5E60036E0E5 /* lvm.c */; }; - 4FFC1ABD1E3FD6770036E0E5 /* lvm.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A471E3FD5E60036E0E5 /* lvm.h */; }; - 4FFC1ABE1E3FD6770036E0E5 /* lzio.c in Sources */ = {isa = PBXBuildFile; fileRef = 4FFC1A481E3FD5E60036E0E5 /* lzio.c */; }; - 4FFC1ABF1E3FD6770036E0E5 /* lzio.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A491E3FD5E60036E0E5 /* lzio.h */; }; - 4FFC1AC01E3FD6950036E0E5 /* lapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A101E3FD5E60036E0E5 /* lapi.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1AC11E3FD6950036E0E5 /* lauxlib.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A121E3FD5E60036E0E5 /* lauxlib.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1AC21E3FD6950036E0E5 /* lcode.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A161E3FD5E60036E0E5 /* lcode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1AC31E3FD6950036E0E5 /* lctype.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A191E3FD5E60036E0E5 /* lctype.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1AC41E3FD6950036E0E5 /* ldebug.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A1C1E3FD5E60036E0E5 /* ldebug.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1AC51E3FD6950036E0E5 /* ldo.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A1E1E3FD5E60036E0E5 /* ldo.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1AC61E3FD6950036E0E5 /* lfunc.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A211E3FD5E60036E0E5 /* lfunc.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1AC71E3FD6950036E0E5 /* lgc.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A231E3FD5E60036E0E5 /* lgc.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1AC81E3FD6950036E0E5 /* llex.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A271E3FD5E60036E0E5 /* llex.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1AC91E3FD6950036E0E5 /* llimits.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A281E3FD5E60036E0E5 /* llimits.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1ACA1E3FD6950036E0E5 /* lmem.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A2B1E3FD5E60036E0E5 /* lmem.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1ACB1E3FD6950036E0E5 /* lobject.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A2E1E3FD5E60036E0E5 /* lobject.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1ACC1E3FD6950036E0E5 /* lopcodes.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A301E3FD5E60036E0E5 /* lopcodes.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1ACD1E3FD6950036E0E5 /* lparser.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A331E3FD5E60036E0E5 /* lparser.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1ACE1E3FD6950036E0E5 /* lprefix.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A341E3FD5E60036E0E5 /* lprefix.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1ACF1E3FD6950036E0E5 /* lstate.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A361E3FD5E60036E0E5 /* lstate.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1AD01E3FD6950036E0E5 /* lstring.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A381E3FD5E60036E0E5 /* lstring.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1AD11E3FD6950036E0E5 /* ltable.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A3B1E3FD5E60036E0E5 /* ltable.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1AD21E3FD6950036E0E5 /* ltm.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A3E1E3FD5E60036E0E5 /* ltm.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1AD31E3FD6950036E0E5 /* lua.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A3F1E3FD5E60036E0E5 /* lua.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1AD51E3FD6950036E0E5 /* luaconf.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A411E3FD5E60036E0E5 /* luaconf.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1AD61E3FD6950036E0E5 /* lualib.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A421E3FD5E60036E0E5 /* lualib.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1AD71E3FD6950036E0E5 /* lundump.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A441E3FD5E60036E0E5 /* lundump.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1AD81E3FD6950036E0E5 /* lvm.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A471E3FD5E60036E0E5 /* lvm.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4FFC1AD91E3FD6950036E0E5 /* lzio.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FFC1A491E3FD5E60036E0E5 /* lzio.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D671D314231EDA6B0043822A /* luaskin.m in Sources */ = {isa = PBXBuildFile; fileRef = D671D313231EDA6B0043822A /* luaskin.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -115,8 +119,71 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 4F478F0A1DE6251400E0DC38 /* lobjectivec_exceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lobjectivec_exceptions.h; path = LuaSkin/lobjectivec_exceptions.h; sourceTree = ""; }; - 4F478F0B1DE6251400E0DC38 /* lobjectivec_exceptions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = lobjectivec_exceptions.m; path = LuaSkin/lobjectivec_exceptions.m; sourceTree = ""; }; + 4F0C1C7D273143D0002CA157 /* LuaSkin-Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "LuaSkin-Base.xcconfig"; sourceTree = ""; }; + 4F0C1C7E273143DF002CA157 /* LuaSkin-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "LuaSkin-Release.xcconfig"; sourceTree = ""; }; + 4F13F9C92C613C56008E88A7 /* lmem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lmem.h; path = "lua-5.4.7/src/lmem.h"; sourceTree = ""; }; + 4F13F9CA2C613C56008E88A7 /* lprefix.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lprefix.h; path = "lua-5.4.7/src/lprefix.h"; sourceTree = ""; }; + 4F13F9CB2C613C56008E88A7 /* ldblib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = ldblib.c; path = "lua-5.4.7/src/ldblib.c"; sourceTree = ""; }; + 4F13F9CC2C613C56008E88A7 /* llex.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = llex.c; path = "lua-5.4.7/src/llex.c"; sourceTree = ""; }; + 4F13F9CD2C613C56008E88A7 /* lgc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lgc.h; path = "lua-5.4.7/src/lgc.h"; sourceTree = ""; }; + 4F13F9CE2C613C56008E88A7 /* ldebug.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = ldebug.c; path = "lua-5.4.7/src/ldebug.c"; sourceTree = ""; }; + 4F13F9CF2C613C56008E88A7 /* llex.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = llex.h; path = "lua-5.4.7/src/llex.h"; sourceTree = ""; }; + 4F13F9D02C613C57008E88A7 /* lualib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lualib.h; path = "lua-5.4.7/src/lualib.h"; sourceTree = ""; }; + 4F13F9D12C613C57008E88A7 /* lundump.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lundump.c; path = "lua-5.4.7/src/lundump.c"; sourceTree = ""; }; + 4F13F9D22C613C57008E88A7 /* lmem.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lmem.c; path = "lua-5.4.7/src/lmem.c"; sourceTree = ""; }; + 4F13F9D32C613C57008E88A7 /* lutf8lib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lutf8lib.c; path = "lua-5.4.7/src/lutf8lib.c"; sourceTree = ""; }; + 4F13F9D42C613C57008E88A7 /* lcode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lcode.h; path = "lua-5.4.7/src/lcode.h"; sourceTree = ""; }; + 4F13F9D52C613C57008E88A7 /* lparser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lparser.h; path = "lua-5.4.7/src/lparser.h"; sourceTree = ""; }; + 4F13F9D62C613C57008E88A7 /* ltm.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = ltm.c; path = "lua-5.4.7/src/ltm.c"; sourceTree = ""; }; + 4F13F9D72C613C57008E88A7 /* lfunc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lfunc.h; path = "lua-5.4.7/src/lfunc.h"; sourceTree = ""; }; + 4F13F9D82C613C57008E88A7 /* lopcodes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lopcodes.h; path = "lua-5.4.7/src/lopcodes.h"; sourceTree = ""; }; + 4F13F9D92C613C57008E88A7 /* lauxlib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lauxlib.h; path = "lua-5.4.7/src/lauxlib.h"; sourceTree = ""; }; + 4F13F9DA2C613C57008E88A7 /* lua.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = lua.hpp; path = "lua-5.4.7/src/lua.hpp"; sourceTree = ""; }; + 4F13F9DB2C613C57008E88A7 /* lua.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lua.c; path = "lua-5.4.7/src/lua.c"; sourceTree = ""; }; + 4F13F9DC2C613C57008E88A7 /* lzio.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lzio.h; path = "lua-5.4.7/src/lzio.h"; sourceTree = ""; }; + 4F13F9DD2C613C57008E88A7 /* lua.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lua.h; path = "lua-5.4.7/src/lua.h"; sourceTree = ""; }; + 4F13F9DE2C613C57008E88A7 /* ltable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ltable.h; path = "lua-5.4.7/src/ltable.h"; sourceTree = ""; }; + 4F13F9DF2C613C57008E88A7 /* lbaselib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lbaselib.c; path = "lua-5.4.7/src/lbaselib.c"; sourceTree = ""; }; + 4F13F9E02C613C57008E88A7 /* ldump.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = ldump.c; path = "lua-5.4.7/src/ldump.c"; sourceTree = ""; }; + 4F13F9E12C613C57008E88A7 /* lopnames.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lopnames.h; path = "lua-5.4.7/src/lopnames.h"; sourceTree = ""; }; + 4F13F9E22C613C57008E88A7 /* luaconf.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = luaconf.h; path = "lua-5.4.7/src/luaconf.h"; sourceTree = ""; }; + 4F13F9E32C613C57008E88A7 /* lapi.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lapi.c; path = "lua-5.4.7/src/lapi.c"; sourceTree = ""; }; + 4F13F9E42C613C57008E88A7 /* lstate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lstate.c; path = "lua-5.4.7/src/lstate.c"; sourceTree = ""; }; + 4F13F9E52C613C57008E88A7 /* lundump.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lundump.h; path = "lua-5.4.7/src/lundump.h"; sourceTree = ""; }; + 4F13F9E62C613C57008E88A7 /* lstrlib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lstrlib.c; path = "lua-5.4.7/src/lstrlib.c"; sourceTree = ""; }; + 4F13F9E72C613C57008E88A7 /* lobjectivec_exceptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lobjectivec_exceptions.h; path = "lua-5.4.7/src/lobjectivec_exceptions.h"; sourceTree = ""; }; + 4F13F9E82C613C57008E88A7 /* ltm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ltm.h; path = "lua-5.4.7/src/ltm.h"; sourceTree = ""; }; + 4F13F9E92C613C57008E88A7 /* lstring.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lstring.c; path = "lua-5.4.7/src/lstring.c"; sourceTree = ""; }; + 4F13F9EA2C613C57008E88A7 /* ldo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ldo.h; path = "lua-5.4.7/src/ldo.h"; sourceTree = ""; }; + 4F13F9EB2C613C57008E88A7 /* lapi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lapi.h; path = "lua-5.4.7/src/lapi.h"; sourceTree = ""; }; + 4F13F9EC2C613C57008E88A7 /* loadlib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = loadlib.c; path = "lua-5.4.7/src/loadlib.c"; sourceTree = ""; }; + 4F13F9ED2C613C57008E88A7 /* lzio.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lzio.c; path = "lua-5.4.7/src/lzio.c"; sourceTree = ""; }; + 4F13F9EE2C613C57008E88A7 /* liolib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = liolib.c; path = "lua-5.4.7/src/liolib.c"; sourceTree = ""; }; + 4F13F9EF2C613C57008E88A7 /* lstate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lstate.h; path = "lua-5.4.7/src/lstate.h"; sourceTree = ""; }; + 4F13F9F02C613C57008E88A7 /* ltablib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = ltablib.c; path = "lua-5.4.7/src/ltablib.c"; sourceTree = ""; }; + 4F13F9F12C613C57008E88A7 /* lvm.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lvm.c; path = "lua-5.4.7/src/lvm.c"; sourceTree = ""; }; + 4F13F9F22C613C57008E88A7 /* lfunc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lfunc.c; path = "lua-5.4.7/src/lfunc.c"; sourceTree = ""; }; + 4F13F9F32C613C57008E88A7 /* lauxlib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lauxlib.c; path = "lua-5.4.7/src/lauxlib.c"; sourceTree = ""; }; + 4F13F9F42C613C57008E88A7 /* lobject.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lobject.c; path = "lua-5.4.7/src/lobject.c"; sourceTree = ""; }; + 4F13F9F52C613C57008E88A7 /* lmathlib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lmathlib.c; path = "lua-5.4.7/src/lmathlib.c"; sourceTree = ""; }; + 4F13F9F62C613C57008E88A7 /* lgc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lgc.c; path = "lua-5.4.7/src/lgc.c"; sourceTree = ""; }; + 4F13F9F72C613C57008E88A7 /* lparser.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lparser.c; path = "lua-5.4.7/src/lparser.c"; sourceTree = ""; }; + 4F13F9F82C613C57008E88A7 /* lobject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lobject.h; path = "lua-5.4.7/src/lobject.h"; sourceTree = ""; }; + 4F13F9F92C613C57008E88A7 /* linit.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = linit.c; path = "lua-5.4.7/src/linit.c"; sourceTree = ""; }; + 4F13F9FA2C613C57008E88A7 /* ljumptab.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ljumptab.h; path = "lua-5.4.7/src/ljumptab.h"; sourceTree = ""; }; + 4F13F9FB2C613C57008E88A7 /* loslib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = loslib.c; path = "lua-5.4.7/src/loslib.c"; sourceTree = ""; }; + 4F13F9FC2C613C57008E88A7 /* ltable.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = ltable.c; path = "lua-5.4.7/src/ltable.c"; sourceTree = ""; }; + 4F13F9FD2C613C57008E88A7 /* ldo.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = ldo.c; path = "lua-5.4.7/src/ldo.c"; sourceTree = ""; }; + 4F13F9FE2C613C57008E88A7 /* llimits.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = llimits.h; path = "lua-5.4.7/src/llimits.h"; sourceTree = ""; }; + 4F13F9FF2C613C57008E88A7 /* ldebug.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ldebug.h; path = "lua-5.4.7/src/ldebug.h"; sourceTree = ""; }; + 4F13FA002C613C58008E88A7 /* lvm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lvm.h; path = "lua-5.4.7/src/lvm.h"; sourceTree = ""; }; + 4F13FA012C613C58008E88A7 /* lctype.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lctype.c; path = "lua-5.4.7/src/lctype.c"; sourceTree = ""; }; + 4F13FA022C613C58008E88A7 /* lstring.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lstring.h; path = "lua-5.4.7/src/lstring.h"; sourceTree = ""; }; + 4F13FA032C613C58008E88A7 /* lcode.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lcode.c; path = "lua-5.4.7/src/lcode.c"; sourceTree = ""; }; + 4F13FA042C613C58008E88A7 /* lcorolib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lcorolib.c; path = "lua-5.4.7/src/lcorolib.c"; sourceTree = ""; }; + 4F13FA052C613C58008E88A7 /* lopcodes.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lopcodes.c; path = "lua-5.4.7/src/lopcodes.c"; sourceTree = ""; }; + 4F13FA062C613C58008E88A7 /* lctype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lctype.h; path = "lua-5.4.7/src/lctype.h"; sourceTree = ""; }; + 4F13FA072C613C58008E88A7 /* lobjectivec_exceptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = lobjectivec_exceptions.m; path = "lua-5.4.7/src/lobjectivec_exceptions.m"; sourceTree = ""; }; 4FDC203C1E117F7500EDA72E /* luaskin.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = luaskin.lua; sourceTree = ""; }; 4FDD8E771C850AC800085D7A /* lsunit.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = lsunit.lua; sourceTree = ""; }; 4FDD8E7F1C85A09600085D7A /* testinit.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = testinit.lua; sourceTree = ""; }; @@ -129,65 +196,8 @@ 4FEF596F1B29D0FB002344A7 /* Skin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = Skin.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 4FEF59701B29D0FB002344A7 /* Skin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = Skin.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 4FEF5A981B29E005002344A7 /* liblua.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = liblua.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 4FFC1A0F1E3FD5E60036E0E5 /* lapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lapi.c; path = "lua-5.3.4/src/lapi.c"; sourceTree = ""; }; - 4FFC1A101E3FD5E60036E0E5 /* lapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lapi.h; path = "lua-5.3.4/src/lapi.h"; sourceTree = ""; }; - 4FFC1A111E3FD5E60036E0E5 /* lauxlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lauxlib.c; path = "lua-5.3.4/src/lauxlib.c"; sourceTree = ""; }; - 4FFC1A121E3FD5E60036E0E5 /* lauxlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lauxlib.h; path = "lua-5.3.4/src/lauxlib.h"; sourceTree = ""; }; - 4FFC1A131E3FD5E60036E0E5 /* lbaselib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lbaselib.c; path = "lua-5.3.4/src/lbaselib.c"; sourceTree = ""; }; - 4FFC1A141E3FD5E60036E0E5 /* lbitlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lbitlib.c; path = "lua-5.3.4/src/lbitlib.c"; sourceTree = ""; }; - 4FFC1A151E3FD5E60036E0E5 /* lcode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lcode.c; path = "lua-5.3.4/src/lcode.c"; sourceTree = ""; }; - 4FFC1A161E3FD5E60036E0E5 /* lcode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lcode.h; path = "lua-5.3.4/src/lcode.h"; sourceTree = ""; }; - 4FFC1A171E3FD5E60036E0E5 /* lcorolib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lcorolib.c; path = "lua-5.3.4/src/lcorolib.c"; sourceTree = ""; }; - 4FFC1A181E3FD5E60036E0E5 /* lctype.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lctype.c; path = "lua-5.3.4/src/lctype.c"; sourceTree = ""; }; - 4FFC1A191E3FD5E60036E0E5 /* lctype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lctype.h; path = "lua-5.3.4/src/lctype.h"; sourceTree = ""; }; - 4FFC1A1A1E3FD5E60036E0E5 /* ldblib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldblib.c; path = "lua-5.3.4/src/ldblib.c"; sourceTree = ""; }; - 4FFC1A1B1E3FD5E60036E0E5 /* ldebug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldebug.c; path = "lua-5.3.4/src/ldebug.c"; sourceTree = ""; }; - 4FFC1A1C1E3FD5E60036E0E5 /* ldebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ldebug.h; path = "lua-5.3.4/src/ldebug.h"; sourceTree = ""; }; - 4FFC1A1D1E3FD5E60036E0E5 /* ldo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldo.c; path = "lua-5.3.4/src/ldo.c"; sourceTree = ""; }; - 4FFC1A1E1E3FD5E60036E0E5 /* ldo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ldo.h; path = "lua-5.3.4/src/ldo.h"; sourceTree = ""; }; - 4FFC1A1F1E3FD5E60036E0E5 /* ldump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldump.c; path = "lua-5.3.4/src/ldump.c"; sourceTree = ""; }; - 4FFC1A201E3FD5E60036E0E5 /* lfunc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lfunc.c; path = "lua-5.3.4/src/lfunc.c"; sourceTree = ""; }; - 4FFC1A211E3FD5E60036E0E5 /* lfunc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lfunc.h; path = "lua-5.3.4/src/lfunc.h"; sourceTree = ""; }; - 4FFC1A221E3FD5E60036E0E5 /* lgc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lgc.c; path = "lua-5.3.4/src/lgc.c"; sourceTree = ""; }; - 4FFC1A231E3FD5E60036E0E5 /* lgc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lgc.h; path = "lua-5.3.4/src/lgc.h"; sourceTree = ""; }; - 4FFC1A241E3FD5E60036E0E5 /* linit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = linit.c; path = "lua-5.3.4/src/linit.c"; sourceTree = ""; }; - 4FFC1A251E3FD5E60036E0E5 /* liolib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = liolib.c; path = "lua-5.3.4/src/liolib.c"; sourceTree = ""; }; - 4FFC1A261E3FD5E60036E0E5 /* llex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = llex.c; path = "lua-5.3.4/src/llex.c"; sourceTree = ""; }; - 4FFC1A271E3FD5E60036E0E5 /* llex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = llex.h; path = "lua-5.3.4/src/llex.h"; sourceTree = ""; }; - 4FFC1A281E3FD5E60036E0E5 /* llimits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = llimits.h; path = "lua-5.3.4/src/llimits.h"; sourceTree = ""; }; - 4FFC1A291E3FD5E60036E0E5 /* lmathlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lmathlib.c; path = "lua-5.3.4/src/lmathlib.c"; sourceTree = ""; }; - 4FFC1A2A1E3FD5E60036E0E5 /* lmem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lmem.c; path = "lua-5.3.4/src/lmem.c"; sourceTree = ""; }; - 4FFC1A2B1E3FD5E60036E0E5 /* lmem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lmem.h; path = "lua-5.3.4/src/lmem.h"; sourceTree = ""; }; - 4FFC1A2C1E3FD5E60036E0E5 /* loadlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = loadlib.c; path = "lua-5.3.4/src/loadlib.c"; sourceTree = ""; }; - 4FFC1A2D1E3FD5E60036E0E5 /* lobject.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lobject.c; path = "lua-5.3.4/src/lobject.c"; sourceTree = ""; }; - 4FFC1A2E1E3FD5E60036E0E5 /* lobject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lobject.h; path = "lua-5.3.4/src/lobject.h"; sourceTree = ""; }; - 4FFC1A2F1E3FD5E60036E0E5 /* lopcodes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lopcodes.c; path = "lua-5.3.4/src/lopcodes.c"; sourceTree = ""; }; - 4FFC1A301E3FD5E60036E0E5 /* lopcodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lopcodes.h; path = "lua-5.3.4/src/lopcodes.h"; sourceTree = ""; }; - 4FFC1A311E3FD5E60036E0E5 /* loslib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = loslib.c; path = "lua-5.3.4/src/loslib.c"; sourceTree = ""; }; - 4FFC1A321E3FD5E60036E0E5 /* lparser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lparser.c; path = "lua-5.3.4/src/lparser.c"; sourceTree = ""; }; - 4FFC1A331E3FD5E60036E0E5 /* lparser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lparser.h; path = "lua-5.3.4/src/lparser.h"; sourceTree = ""; }; - 4FFC1A341E3FD5E60036E0E5 /* lprefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lprefix.h; path = "lua-5.3.4/src/lprefix.h"; sourceTree = ""; }; - 4FFC1A351E3FD5E60036E0E5 /* lstate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lstate.c; path = "lua-5.3.4/src/lstate.c"; sourceTree = ""; }; - 4FFC1A361E3FD5E60036E0E5 /* lstate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lstate.h; path = "lua-5.3.4/src/lstate.h"; sourceTree = ""; }; - 4FFC1A371E3FD5E60036E0E5 /* lstring.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lstring.c; path = "lua-5.3.4/src/lstring.c"; sourceTree = ""; }; - 4FFC1A381E3FD5E60036E0E5 /* lstring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lstring.h; path = "lua-5.3.4/src/lstring.h"; sourceTree = ""; }; - 4FFC1A391E3FD5E60036E0E5 /* lstrlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lstrlib.c; path = "lua-5.3.4/src/lstrlib.c"; sourceTree = ""; }; - 4FFC1A3A1E3FD5E60036E0E5 /* ltable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ltable.c; path = "lua-5.3.4/src/ltable.c"; sourceTree = ""; }; - 4FFC1A3B1E3FD5E60036E0E5 /* ltable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ltable.h; path = "lua-5.3.4/src/ltable.h"; sourceTree = ""; }; - 4FFC1A3C1E3FD5E60036E0E5 /* ltablib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ltablib.c; path = "lua-5.3.4/src/ltablib.c"; sourceTree = ""; }; - 4FFC1A3D1E3FD5E60036E0E5 /* ltm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ltm.c; path = "lua-5.3.4/src/ltm.c"; sourceTree = ""; }; - 4FFC1A3E1E3FD5E60036E0E5 /* ltm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ltm.h; path = "lua-5.3.4/src/ltm.h"; sourceTree = ""; }; - 4FFC1A3F1E3FD5E60036E0E5 /* lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lua.h; path = "lua-5.3.4/src/lua.h"; sourceTree = ""; }; - 4FFC1A401E3FD5E60036E0E5 /* lua.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = lua.hpp; path = "lua-5.3.4/src/lua.hpp"; sourceTree = ""; }; - 4FFC1A411E3FD5E60036E0E5 /* luaconf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = luaconf.h; path = "lua-5.3.4/src/luaconf.h"; sourceTree = ""; }; - 4FFC1A421E3FD5E60036E0E5 /* lualib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lualib.h; path = "lua-5.3.4/src/lualib.h"; sourceTree = ""; }; - 4FFC1A431E3FD5E60036E0E5 /* lundump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lundump.c; path = "lua-5.3.4/src/lundump.c"; sourceTree = ""; }; - 4FFC1A441E3FD5E60036E0E5 /* lundump.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lundump.h; path = "lua-5.3.4/src/lundump.h"; sourceTree = ""; }; - 4FFC1A451E3FD5E60036E0E5 /* lutf8lib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lutf8lib.c; path = "lua-5.3.4/src/lutf8lib.c"; sourceTree = ""; }; - 4FFC1A461E3FD5E60036E0E5 /* lvm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lvm.c; path = "lua-5.3.4/src/lvm.c"; sourceTree = ""; }; - 4FFC1A471E3FD5E60036E0E5 /* lvm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lvm.h; path = "lua-5.3.4/src/lvm.h"; sourceTree = ""; }; - 4FFC1A481E3FD5E60036E0E5 /* lzio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lzio.c; path = "lua-5.3.4/src/lzio.c"; sourceTree = ""; }; - 4FFC1A491E3FD5E60036E0E5 /* lzio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lzio.h; path = "lua-5.3.4/src/lzio.h"; sourceTree = ""; }; + 4FF625FB2B273D1E00C8E57C /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + D671D313231EDA6B0043822A /* luaskin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = luaskin.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -217,13 +227,86 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 4F13F9C82C613C20008E88A7 /* lua-5.4.7 */ = { + isa = PBXGroup; + children = ( + 4F13F9E32C613C57008E88A7 /* lapi.c */, + 4F13F9EB2C613C57008E88A7 /* lapi.h */, + 4F13F9F32C613C57008E88A7 /* lauxlib.c */, + 4F13F9D92C613C57008E88A7 /* lauxlib.h */, + 4F13F9DF2C613C57008E88A7 /* lbaselib.c */, + 4F13FA032C613C58008E88A7 /* lcode.c */, + 4F13F9D42C613C57008E88A7 /* lcode.h */, + 4F13FA042C613C58008E88A7 /* lcorolib.c */, + 4F13FA012C613C58008E88A7 /* lctype.c */, + 4F13FA062C613C58008E88A7 /* lctype.h */, + 4F13F9CB2C613C56008E88A7 /* ldblib.c */, + 4F13F9CE2C613C56008E88A7 /* ldebug.c */, + 4F13F9FF2C613C57008E88A7 /* ldebug.h */, + 4F13F9FD2C613C57008E88A7 /* ldo.c */, + 4F13F9EA2C613C57008E88A7 /* ldo.h */, + 4F13F9E02C613C57008E88A7 /* ldump.c */, + 4F13F9F22C613C57008E88A7 /* lfunc.c */, + 4F13F9D72C613C57008E88A7 /* lfunc.h */, + 4F13F9F62C613C57008E88A7 /* lgc.c */, + 4F13F9CD2C613C56008E88A7 /* lgc.h */, + 4F13F9F92C613C57008E88A7 /* linit.c */, + 4F13F9EE2C613C57008E88A7 /* liolib.c */, + 4F13F9FA2C613C57008E88A7 /* ljumptab.h */, + 4F13F9CC2C613C56008E88A7 /* llex.c */, + 4F13F9CF2C613C56008E88A7 /* llex.h */, + 4F13F9FE2C613C57008E88A7 /* llimits.h */, + 4F13F9F52C613C57008E88A7 /* lmathlib.c */, + 4F13F9D22C613C57008E88A7 /* lmem.c */, + 4F13F9C92C613C56008E88A7 /* lmem.h */, + 4F13F9EC2C613C57008E88A7 /* loadlib.c */, + 4F13F9F42C613C57008E88A7 /* lobject.c */, + 4F13F9F82C613C57008E88A7 /* lobject.h */, + 4F13F9E72C613C57008E88A7 /* lobjectivec_exceptions.h */, + 4F13FA072C613C58008E88A7 /* lobjectivec_exceptions.m */, + 4F13FA052C613C58008E88A7 /* lopcodes.c */, + 4F13F9D82C613C57008E88A7 /* lopcodes.h */, + 4F13F9E12C613C57008E88A7 /* lopnames.h */, + 4F13F9FB2C613C57008E88A7 /* loslib.c */, + 4F13F9F72C613C57008E88A7 /* lparser.c */, + 4F13F9D52C613C57008E88A7 /* lparser.h */, + 4F13F9CA2C613C56008E88A7 /* lprefix.h */, + 4F13F9E42C613C57008E88A7 /* lstate.c */, + 4F13F9EF2C613C57008E88A7 /* lstate.h */, + 4F13F9E92C613C57008E88A7 /* lstring.c */, + 4F13FA022C613C58008E88A7 /* lstring.h */, + 4F13F9E62C613C57008E88A7 /* lstrlib.c */, + 4F13F9FC2C613C57008E88A7 /* ltable.c */, + 4F13F9DE2C613C57008E88A7 /* ltable.h */, + 4F13F9F02C613C57008E88A7 /* ltablib.c */, + 4F13F9D62C613C57008E88A7 /* ltm.c */, + 4F13F9E82C613C57008E88A7 /* ltm.h */, + 4F13F9DB2C613C57008E88A7 /* lua.c */, + 4F13F9DD2C613C57008E88A7 /* lua.h */, + 4F13F9DA2C613C57008E88A7 /* lua.hpp */, + 4F13F9E22C613C57008E88A7 /* luaconf.h */, + 4F13F9D02C613C57008E88A7 /* lualib.h */, + 4F13F9D12C613C57008E88A7 /* lundump.c */, + 4F13F9E52C613C57008E88A7 /* lundump.h */, + 4F13F9D32C613C57008E88A7 /* lutf8lib.c */, + 4F13F9F12C613C57008E88A7 /* lvm.c */, + 4F13FA002C613C58008E88A7 /* lvm.h */, + 4F13F9ED2C613C57008E88A7 /* lzio.c */, + 4F13F9DC2C613C57008E88A7 /* lzio.h */, + ); + name = "lua-5.4.7"; + sourceTree = ""; + }; 4FEF59451B29CE06002344A7 = { isa = PBXGroup; children = ( - 4FFC1A0E1E3FD5920036E0E5 /* lua-5.3.4 */, + 4F13F9C82C613C20008E88A7 /* lua-5.4.7 */, + 4F0C1C7E273143DF002CA157 /* LuaSkin-Release.xcconfig */, + 4F0C1C7D273143D0002CA157 /* LuaSkin-Base.xcconfig */, 4FEF59511B29CE06002344A7 /* LuaSkin */, 4FEF595E1B29CE06002344A7 /* LuaSkinTests */, 4FEF59501B29CE06002344A7 /* Products */, + 4FF625FA2B273D1E00C8E57C /* Frameworks */, ); sourceTree = ""; }; @@ -240,6 +323,7 @@ 4FEF59511B29CE06002344A7 /* LuaSkin */ = { isa = PBXGroup; children = ( + D671D313231EDA6B0043822A /* luaskin.m */, 4FEF59541B29CE06002344A7 /* LuaSkin.h */, 4FEF59521B29CE06002344A7 /* Supporting Files */, 4FEF596F1B29D0FB002344A7 /* Skin.h */, @@ -276,72 +360,12 @@ name = "Supporting Files"; sourceTree = ""; }; - 4FFC1A0E1E3FD5920036E0E5 /* lua-5.3.4 */ = { + 4FF625FA2B273D1E00C8E57C /* Frameworks */ = { isa = PBXGroup; children = ( - 4F478F0A1DE6251400E0DC38 /* lobjectivec_exceptions.h */, - 4F478F0B1DE6251400E0DC38 /* lobjectivec_exceptions.m */, - 4FFC1A0F1E3FD5E60036E0E5 /* lapi.c */, - 4FFC1A101E3FD5E60036E0E5 /* lapi.h */, - 4FFC1A111E3FD5E60036E0E5 /* lauxlib.c */, - 4FFC1A121E3FD5E60036E0E5 /* lauxlib.h */, - 4FFC1A131E3FD5E60036E0E5 /* lbaselib.c */, - 4FFC1A141E3FD5E60036E0E5 /* lbitlib.c */, - 4FFC1A151E3FD5E60036E0E5 /* lcode.c */, - 4FFC1A161E3FD5E60036E0E5 /* lcode.h */, - 4FFC1A171E3FD5E60036E0E5 /* lcorolib.c */, - 4FFC1A181E3FD5E60036E0E5 /* lctype.c */, - 4FFC1A191E3FD5E60036E0E5 /* lctype.h */, - 4FFC1A1A1E3FD5E60036E0E5 /* ldblib.c */, - 4FFC1A1B1E3FD5E60036E0E5 /* ldebug.c */, - 4FFC1A1C1E3FD5E60036E0E5 /* ldebug.h */, - 4FFC1A1D1E3FD5E60036E0E5 /* ldo.c */, - 4FFC1A1E1E3FD5E60036E0E5 /* ldo.h */, - 4FFC1A1F1E3FD5E60036E0E5 /* ldump.c */, - 4FFC1A201E3FD5E60036E0E5 /* lfunc.c */, - 4FFC1A211E3FD5E60036E0E5 /* lfunc.h */, - 4FFC1A221E3FD5E60036E0E5 /* lgc.c */, - 4FFC1A231E3FD5E60036E0E5 /* lgc.h */, - 4FFC1A241E3FD5E60036E0E5 /* linit.c */, - 4FFC1A251E3FD5E60036E0E5 /* liolib.c */, - 4FFC1A261E3FD5E60036E0E5 /* llex.c */, - 4FFC1A271E3FD5E60036E0E5 /* llex.h */, - 4FFC1A281E3FD5E60036E0E5 /* llimits.h */, - 4FFC1A291E3FD5E60036E0E5 /* lmathlib.c */, - 4FFC1A2A1E3FD5E60036E0E5 /* lmem.c */, - 4FFC1A2B1E3FD5E60036E0E5 /* lmem.h */, - 4FFC1A2C1E3FD5E60036E0E5 /* loadlib.c */, - 4FFC1A2D1E3FD5E60036E0E5 /* lobject.c */, - 4FFC1A2E1E3FD5E60036E0E5 /* lobject.h */, - 4FFC1A2F1E3FD5E60036E0E5 /* lopcodes.c */, - 4FFC1A301E3FD5E60036E0E5 /* lopcodes.h */, - 4FFC1A311E3FD5E60036E0E5 /* loslib.c */, - 4FFC1A321E3FD5E60036E0E5 /* lparser.c */, - 4FFC1A331E3FD5E60036E0E5 /* lparser.h */, - 4FFC1A341E3FD5E60036E0E5 /* lprefix.h */, - 4FFC1A351E3FD5E60036E0E5 /* lstate.c */, - 4FFC1A361E3FD5E60036E0E5 /* lstate.h */, - 4FFC1A371E3FD5E60036E0E5 /* lstring.c */, - 4FFC1A381E3FD5E60036E0E5 /* lstring.h */, - 4FFC1A391E3FD5E60036E0E5 /* lstrlib.c */, - 4FFC1A3A1E3FD5E60036E0E5 /* ltable.c */, - 4FFC1A3B1E3FD5E60036E0E5 /* ltable.h */, - 4FFC1A3C1E3FD5E60036E0E5 /* ltablib.c */, - 4FFC1A3D1E3FD5E60036E0E5 /* ltm.c */, - 4FFC1A3E1E3FD5E60036E0E5 /* ltm.h */, - 4FFC1A3F1E3FD5E60036E0E5 /* lua.h */, - 4FFC1A401E3FD5E60036E0E5 /* lua.hpp */, - 4FFC1A411E3FD5E60036E0E5 /* luaconf.h */, - 4FFC1A421E3FD5E60036E0E5 /* lualib.h */, - 4FFC1A431E3FD5E60036E0E5 /* lundump.c */, - 4FFC1A441E3FD5E60036E0E5 /* lundump.h */, - 4FFC1A451E3FD5E60036E0E5 /* lutf8lib.c */, - 4FFC1A461E3FD5E60036E0E5 /* lvm.c */, - 4FFC1A471E3FD5E60036E0E5 /* lvm.h */, - 4FFC1A481E3FD5E60036E0E5 /* lzio.c */, - 4FFC1A491E3FD5E60036E0E5 /* lzio.h */, - ); - name = "lua-5.3.4"; + 4FF625FB2B273D1E00C8E57C /* Foundation.framework */, + ); + name = Frameworks; sourceTree = ""; }; /* End PBXGroup section */ @@ -351,33 +375,34 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 4FFC1ACA1E3FD6950036E0E5 /* lmem.h in Headers */, - 4FFC1AC41E3FD6950036E0E5 /* ldebug.h in Headers */, - 4FFC1ACC1E3FD6950036E0E5 /* lopcodes.h in Headers */, - 4FFC1ACF1E3FD6950036E0E5 /* lstate.h in Headers */, - 4FFC1AC91E3FD6950036E0E5 /* llimits.h in Headers */, - 4FFC1AC81E3FD6950036E0E5 /* llex.h in Headers */, - 4FFC1AD91E3FD6950036E0E5 /* lzio.h in Headers */, - 4FFC1AD11E3FD6950036E0E5 /* ltable.h in Headers */, - 4FFC1AD51E3FD6950036E0E5 /* luaconf.h in Headers */, - 4FFC1AD01E3FD6950036E0E5 /* lstring.h in Headers */, - 4FFC1AD61E3FD6950036E0E5 /* lualib.h in Headers */, - 4FFC1ACB1E3FD6950036E0E5 /* lobject.h in Headers */, - 4FFC1AC11E3FD6950036E0E5 /* lauxlib.h in Headers */, - 4FFC1ACE1E3FD6950036E0E5 /* lprefix.h in Headers */, - 4FFC1AD31E3FD6950036E0E5 /* lua.h in Headers */, - 4FFC1AD71E3FD6950036E0E5 /* lundump.h in Headers */, - 4FFC1AD81E3FD6950036E0E5 /* lvm.h in Headers */, - 4FFC1AC51E3FD6950036E0E5 /* ldo.h in Headers */, - 4FFC1AD21E3FD6950036E0E5 /* ltm.h in Headers */, - 4FFC1ACD1E3FD6950036E0E5 /* lparser.h in Headers */, 4FEF59551B29CE06002344A7 /* LuaSkin.h in Headers */, 4FEF59711B29D0FB002344A7 /* Skin.h in Headers */, - 4FFC1AC01E3FD6950036E0E5 /* lapi.h in Headers */, - 4FFC1AC61E3FD6950036E0E5 /* lfunc.h in Headers */, - 4FFC1AC71E3FD6950036E0E5 /* lgc.h in Headers */, - 4FFC1AC21E3FD6950036E0E5 /* lcode.h in Headers */, - 4FFC1AC31E3FD6950036E0E5 /* lctype.h in Headers */, + 4F13FA472C61418D008E88A7 /* lapi.h in Headers */, + 4F13FA482C61418D008E88A7 /* lauxlib.h in Headers */, + 4F13FA492C61418D008E88A7 /* lcode.h in Headers */, + 4F13FA4A2C61418D008E88A7 /* lctype.h in Headers */, + 4F13FA4B2C61418D008E88A7 /* ldebug.h in Headers */, + 4F13FA4C2C61418D008E88A7 /* ldo.h in Headers */, + 4F13FA4D2C61418D008E88A7 /* lfunc.h in Headers */, + 4F13FA4E2C61418D008E88A7 /* lgc.h in Headers */, + 4F13FA502C61418D008E88A7 /* llex.h in Headers */, + 4F13FA512C61418D008E88A7 /* llimits.h in Headers */, + 4F13FA522C61418D008E88A7 /* lmem.h in Headers */, + 4F13FA532C61418D008E88A7 /* lobject.h in Headers */, + 4F13FA552C61418D008E88A7 /* lopcodes.h in Headers */, + 4F13FA562C61418D008E88A7 /* lopnames.h in Headers */, + 4F13FA572C61418D008E88A7 /* lparser.h in Headers */, + 4F13FA582C61418D008E88A7 /* lprefix.h in Headers */, + 4F13FA592C61418D008E88A7 /* lstate.h in Headers */, + 4F13FA5A2C61418D008E88A7 /* lstring.h in Headers */, + 4F13FA5B2C61418D008E88A7 /* ltable.h in Headers */, + 4F13FA5C2C61418D008E88A7 /* ltm.h in Headers */, + 4F13FA5D2C61418D008E88A7 /* lua.h in Headers */, + 4F13FA5E2C61418D008E88A7 /* luaconf.h in Headers */, + 4F13FA5F2C61418D008E88A7 /* lualib.h in Headers */, + 4F13FA602C61418D008E88A7 /* lundump.h in Headers */, + 4F13FA612C61418D008E88A7 /* lvm.h in Headers */, + 4F13FA622C61418D008E88A7 /* lzio.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -385,33 +410,35 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 4FFC1ABF1E3FD6770036E0E5 /* lzio.h in Headers */, - 4FFC1A991E3FD6770036E0E5 /* lgc.h in Headers */, - 4FFC1A8F1E3FD6770036E0E5 /* lctype.h in Headers */, - 4FFC1A8C1E3FD6770036E0E5 /* lcode.h in Headers */, - 4FFC1A861E3FD6770036E0E5 /* lapi.h in Headers */, - 4FFC1ABD1E3FD6770036E0E5 /* lvm.h in Headers */, - 4FFC1AB41E3FD6770036E0E5 /* ltm.h in Headers */, - 4FFC1AAE1E3FD6770036E0E5 /* lstring.h in Headers */, - 4FFC1AA91E3FD6770036E0E5 /* lparser.h in Headers */, - 4FFC1AB81E3FD6770036E0E5 /* lualib.h in Headers */, - 4FFC1AB61E3FD6770036E0E5 /* lua.hpp in Headers */, - 4F478F0C1DE6251400E0DC38 /* lobjectivec_exceptions.h in Headers */, - 4FFC1A9D1E3FD6770036E0E5 /* llex.h in Headers */, - 4FFC1AA41E3FD6770036E0E5 /* lobject.h in Headers */, - 4FFC1AAC1E3FD6770036E0E5 /* lstate.h in Headers */, - 4FFC1A881E3FD6770036E0E5 /* lauxlib.h in Headers */, - 4FFC1AB51E3FD6770036E0E5 /* lua.h in Headers */, - 4FFC1AAA1E3FD6770036E0E5 /* lprefix.h in Headers */, - 4FFC1A971E3FD6770036E0E5 /* lfunc.h in Headers */, - 4FFC1A921E3FD6770036E0E5 /* ldebug.h in Headers */, - 4FFC1A9E1E3FD6770036E0E5 /* llimits.h in Headers */, - 4FFC1AB71E3FD6770036E0E5 /* luaconf.h in Headers */, - 4FFC1A941E3FD6770036E0E5 /* ldo.h in Headers */, - 4FFC1AA11E3FD6770036E0E5 /* lmem.h in Headers */, - 4FFC1AA61E3FD6770036E0E5 /* lopcodes.h in Headers */, - 4FFC1ABA1E3FD6770036E0E5 /* lundump.h in Headers */, - 4FFC1AB11E3FD6770036E0E5 /* ltable.h in Headers */, + 4F13FA082C613DAD008E88A7 /* lapi.h in Headers */, + 4F13FA092C613DAD008E88A7 /* lauxlib.h in Headers */, + 4F13FA0A2C613DAD008E88A7 /* lcode.h in Headers */, + 4F13FA0B2C613DAD008E88A7 /* lctype.h in Headers */, + 4F13FA0C2C613DAD008E88A7 /* ldebug.h in Headers */, + 4F13FA0D2C613DAD008E88A7 /* ldo.h in Headers */, + 4F13FA0E2C613DAD008E88A7 /* lfunc.h in Headers */, + 4F13FA0F2C613DAD008E88A7 /* lgc.h in Headers */, + 4F13FA102C613DAD008E88A7 /* ljumptab.h in Headers */, + 4F13FA112C613DAD008E88A7 /* llex.h in Headers */, + 4F13FA122C613DAD008E88A7 /* llimits.h in Headers */, + 4F13FA132C613DAD008E88A7 /* lmem.h in Headers */, + 4F13FA142C613DAD008E88A7 /* lobject.h in Headers */, + 4F13FA152C613DAD008E88A7 /* lobjectivec_exceptions.h in Headers */, + 4F13FA162C613DAD008E88A7 /* lopcodes.h in Headers */, + 4F13FA172C613DAD008E88A7 /* lopnames.h in Headers */, + 4F13FA182C613DAD008E88A7 /* lparser.h in Headers */, + 4F13FA192C613DAD008E88A7 /* lprefix.h in Headers */, + 4F13FA1A2C613DAD008E88A7 /* lstate.h in Headers */, + 4F13FA1B2C613DAD008E88A7 /* lstring.h in Headers */, + 4F13FA1C2C613DAD008E88A7 /* ltable.h in Headers */, + 4F13FA1D2C613DAD008E88A7 /* ltm.h in Headers */, + 4F13FA1E2C613DAD008E88A7 /* lua.h in Headers */, + 4F13FA1F2C613DAD008E88A7 /* lua.hpp in Headers */, + 4F13FA202C613DAD008E88A7 /* luaconf.h in Headers */, + 4F13FA212C613DAD008E88A7 /* lualib.h in Headers */, + 4F13FA222C613DAD008E88A7 /* lundump.h in Headers */, + 4F13FA232C613DAD008E88A7 /* lvm.h in Headers */, + 4F13FA242C613DAD008E88A7 /* lzio.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -477,7 +504,7 @@ 4FEF59461B29CE06002344A7 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0800; + LastUpgradeCheck = 1320; ORGANIZATIONNAME = Hammerspoon; TargetAttributes = { 4FEF594E1B29CE06002344A7 = { @@ -493,10 +520,11 @@ }; buildConfigurationList = 4FEF59491B29CE06002344A7 /* Build configuration list for PBXProject "LuaSkin" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = 4FEF59451B29CE06002344A7; productRefGroup = 4FEF59501B29CE06002344A7 /* Products */; @@ -536,6 +564,7 @@ buildActionMask = 2147483647; files = ( 4FEF59721B29D0FB002344A7 /* Skin.m in Sources */, + D671D314231EDA6B0043822A /* luaskin.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -551,40 +580,40 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4FFC1ABC1E3FD6770036E0E5 /* lvm.c in Sources */, - 4FFC1A961E3FD6770036E0E5 /* lfunc.c in Sources */, - 4FFC1AA31E3FD6770036E0E5 /* lobject.c in Sources */, - 4FFC1A931E3FD6770036E0E5 /* ldo.c in Sources */, - 4FFC1AB91E3FD6770036E0E5 /* lundump.c in Sources */, - 4FFC1AA71E3FD6770036E0E5 /* loslib.c in Sources */, - 4FFC1ABB1E3FD6770036E0E5 /* lutf8lib.c in Sources */, - 4FFC1AAB1E3FD6770036E0E5 /* lstate.c in Sources */, - 4FFC1A9F1E3FD6770036E0E5 /* lmathlib.c in Sources */, - 4FFC1AB21E3FD6770036E0E5 /* ltablib.c in Sources */, - 4FFC1A901E3FD6770036E0E5 /* ldblib.c in Sources */, - 4FFC1AAD1E3FD6770036E0E5 /* lstring.c in Sources */, - 4FFC1AB31E3FD6770036E0E5 /* ltm.c in Sources */, - 4FFC1A9A1E3FD6770036E0E5 /* linit.c in Sources */, - 4FFC1AB01E3FD6770036E0E5 /* ltable.c in Sources */, - 4FFC1A9B1E3FD6770036E0E5 /* liolib.c in Sources */, - 4FFC1A8D1E3FD6770036E0E5 /* lcorolib.c in Sources */, - 4F478F0D1DE6251400E0DC38 /* lobjectivec_exceptions.m in Sources */, - 4FFC1A8E1E3FD6770036E0E5 /* lctype.c in Sources */, - 4FFC1AAF1E3FD6770036E0E5 /* lstrlib.c in Sources */, - 4FFC1A981E3FD6770036E0E5 /* lgc.c in Sources */, - 4FFC1A891E3FD6770036E0E5 /* lbaselib.c in Sources */, - 4FFC1A951E3FD6770036E0E5 /* ldump.c in Sources */, - 4FFC1A9C1E3FD6770036E0E5 /* llex.c in Sources */, - 4FFC1A851E3FD6770036E0E5 /* lapi.c in Sources */, - 4FFC1A911E3FD6770036E0E5 /* ldebug.c in Sources */, - 4FFC1AA51E3FD6770036E0E5 /* lopcodes.c in Sources */, - 4FFC1A8B1E3FD6770036E0E5 /* lcode.c in Sources */, - 4FFC1AA81E3FD6770036E0E5 /* lparser.c in Sources */, - 4FFC1A8A1E3FD6770036E0E5 /* lbitlib.c in Sources */, - 4FFC1AA21E3FD6770036E0E5 /* loadlib.c in Sources */, - 4FFC1ABE1E3FD6770036E0E5 /* lzio.c in Sources */, - 4FFC1A871E3FD6770036E0E5 /* lauxlib.c in Sources */, - 4FFC1AA01E3FD6770036E0E5 /* lmem.c in Sources */, + 4F13FA252C613DF9008E88A7 /* lapi.c in Sources */, + 4F13FA262C613DF9008E88A7 /* lauxlib.c in Sources */, + 4F13FA272C613DF9008E88A7 /* lbaselib.c in Sources */, + 4F13FA282C613DF9008E88A7 /* lcode.c in Sources */, + 4F13FA292C613DF9008E88A7 /* lcorolib.c in Sources */, + 4F13FA2A2C613DF9008E88A7 /* lctype.c in Sources */, + 4F13FA2B2C613DF9008E88A7 /* ldblib.c in Sources */, + 4F13FA2C2C613DF9008E88A7 /* ldebug.c in Sources */, + 4F13FA2D2C613DF9008E88A7 /* ldo.c in Sources */, + 4F13FA2E2C613DF9008E88A7 /* ldump.c in Sources */, + 4F13FA2F2C613DF9008E88A7 /* lfunc.c in Sources */, + 4F13FA302C613DF9008E88A7 /* lgc.c in Sources */, + 4F13FA312C613DF9008E88A7 /* linit.c in Sources */, + 4F13FA322C613DF9008E88A7 /* liolib.c in Sources */, + 4F13FA332C613DF9008E88A7 /* llex.c in Sources */, + 4F13FA342C613DF9008E88A7 /* lmathlib.c in Sources */, + 4F13FA352C613DF9008E88A7 /* lmem.c in Sources */, + 4F13FA362C613DF9008E88A7 /* loadlib.c in Sources */, + 4F13FA372C613DF9008E88A7 /* lobject.c in Sources */, + 4F13FA382C613DF9008E88A7 /* lobjectivec_exceptions.m in Sources */, + 4F13FA392C613DF9008E88A7 /* lopcodes.c in Sources */, + 4F13FA3A2C613DF9008E88A7 /* loslib.c in Sources */, + 4F13FA3B2C613DF9008E88A7 /* lparser.c in Sources */, + 4F13FA3C2C613DF9008E88A7 /* lstate.c in Sources */, + 4F13FA3D2C613DF9008E88A7 /* lstring.c in Sources */, + 4F13FA3E2C613DF9008E88A7 /* lstrlib.c in Sources */, + 4F13FA3F2C613DF9008E88A7 /* ltable.c in Sources */, + 4F13FA402C613DF9008E88A7 /* ltablib.c in Sources */, + 4F13FA412C613DF9008E88A7 /* ltm.c in Sources */, + 4F13FA422C613DF9008E88A7 /* lua.c in Sources */, + 4F13FA432C613DF9008E88A7 /* lundump.c in Sources */, + 4F13FA442C613DF9008E88A7 /* lutf8lib.c in Sources */, + 4F13FA452C613DF9008E88A7 /* lvm.c in Sources */, + 4F13FA462C613DF9008E88A7 /* lzio.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -599,113 +628,116 @@ /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ - 4FEF59631B29CE06002344A7 /* Debug */ = { + 4F0454E120F1480E00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C7D273143D0002CA157 /* LuaSkin-Base.xcconfig */; + buildSettings = { + }; + name = Profile; + }; + 4F0454E220F1480E00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_DEADCODE_DEADSTORES = NO; + CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES; + CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES; + CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES; + CLANG_WARN_ASSIGN_ENUM = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; + CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES; + CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES; + CLANG_WARN_OBJC_RECEIVER_WEAK = YES; + CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES; + CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; + GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; + GCC_WARN_PEDANTIC = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_STRICT_SELECTOR_MATCH = YES; + GCC_WARN_UNKNOWN_PRAGMAS = YES; + GCC_WARN_UNUSED_LABEL = YES; + GCC_WARN_UNUSED_PARAMETER = YES; + INFOPLIST_FILE = LuaSkin/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "org.hammerspoon.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + WARNING_CFLAGS = "$(inherited)"; + }; + name = Profile; + }; + 4F0454E320F1480E00699F29 /* Profile */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; + COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(DEVELOPER_FRAMEWORKS_DIR)", + "$(inherited)", + ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = LuaSkinTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "org.hammerspoon.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WARNING_CFLAGS = ""; + }; + name = Profile; + }; + 4F0454E420F1480E00699F29 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_WARN_COMMA = NO; + COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; + EXECUTABLE_PREFIX = lib; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - STRIP_INSTALLED_PRODUCT = NO; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - WARNING_CFLAGS = ( - "-Weverything", - "-Wno-cstring-format-directive", - "-Wno-padded", - "-Wno-auto-import", - "-Wno-missing-variable-declarations", - "-Wno-objc-missing-property-synthesis", - "-Wno-cast-qual", - "-Wno-gnu-zero-variadic-macro-arguments", + GCC_WARN_UNINITIALIZED_AUTOS = NO; + OTHER_CFLAGS = ( + "-DLUA_COMPAT_5_3", + "-DLUA_USE_MACOSX", + "-DLUA_USE_APICHECK", + "-DLUAI_ASSERT", ); + OTHER_LDFLAGS = "-lreadline"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + STRIP_INSTALLED_PRODUCT = NO; + WARNING_CFLAGS = ""; + }; + name = Profile; + }; + 4FEF59631B29CE06002344A7 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C7D273143D0002CA157 /* LuaSkin-Base.xcconfig */; + buildSettings = { }; name = Debug; }; 4FEF59641B29CE06002344A7 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4F0C1C7E273143DF002CA157 /* LuaSkin-Release.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - STRIP_INSTALLED_PRODUCT = NO; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - WARNING_CFLAGS = ( - "-Weverything", - "-Wno-cstring-format-directive", - "-Wno-padded", - "-Wno-auto-import", - "-Wno-missing-variable-declarations", - "-Wno-objc-missing-property-synthesis", - "-Wno-cast-qual", - "-Wno-gnu-zero-variadic-macro-arguments", - ); }; name = Release; }; @@ -727,7 +759,6 @@ CLANG_WARN_OBJC_RECEIVER_WEAK = YES; CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES; CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; - COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -748,7 +779,6 @@ GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = YES; INFOPLIST_FILE = LuaSkin/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.hammerspoon.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -775,7 +805,6 @@ CLANG_WARN_OBJC_RECEIVER_WEAK = YES; CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES; CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; - COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -796,7 +825,6 @@ GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = YES; INFOPLIST_FILE = LuaSkin/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.hammerspoon.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -844,6 +872,7 @@ 4FEF5A9A1B29E006002344A7 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_WARN_COMMA = NO; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; EXECUTABLE_PREFIX = lib; @@ -851,12 +880,16 @@ "DEBUG=1", "$(inherited)", ); + GCC_WARN_UNINITIALIZED_AUTOS = NO; OTHER_CFLAGS = ( - "-DLUA_COMPAT_ALL", + "-DLUA_COMPAT_5_3", "-DLUA_USE_MACOSX", + "-DLUA_USE_APICHECK", + "-DLUAI_ASSERT", ); OTHER_LDFLAGS = "-lreadline"; PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; STRIP_INSTALLED_PRODUCT = NO; WARNING_CFLAGS = ""; }; @@ -865,14 +898,19 @@ 4FEF5A9B1B29E006002344A7 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_WARN_COMMA = NO; COMBINE_HIDPI_IMAGES = YES; EXECUTABLE_PREFIX = lib; + GCC_WARN_UNINITIALIZED_AUTOS = NO; OTHER_CFLAGS = ( - "-DLUA_COMPAT_ALL", + "-DLUA_COMPAT_5_3", "-DLUA_USE_MACOSX", + "-DLUA_USE_APICHECK", + "-DLUAI_ASSERT", ); OTHER_LDFLAGS = "-lreadline"; PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; STRIP_INSTALLED_PRODUCT = NO; WARNING_CFLAGS = ""; }; @@ -885,6 +923,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FEF59631B29CE06002344A7 /* Debug */, + 4F0454E120F1480E00699F29 /* Profile */, 4FEF59641B29CE06002344A7 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -894,6 +933,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FEF59661B29CE06002344A7 /* Debug */, + 4F0454E220F1480E00699F29 /* Profile */, 4FEF59671B29CE06002344A7 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -903,6 +943,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FEF59691B29CE06002344A7 /* Debug */, + 4F0454E320F1480E00699F29 /* Profile */, 4FEF596A1B29CE06002344A7 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -912,6 +953,7 @@ isa = XCConfigurationList; buildConfigurations = ( 4FEF5A9A1B29E006002344A7 /* Debug */, + 4F0454E420F1480E00699F29 /* Profile */, 4FEF5A9B1B29E006002344A7 /* Release */, ); defaultConfigurationIsVisible = 0; diff --git a/LuaSkin/LuaSkin.xcodeproj/xcshareddata/xcschemes/LuaSkin.xcscheme b/LuaSkin/LuaSkin.xcodeproj/xcshareddata/xcschemes/LuaSkin.xcscheme index ce7b5948d..14b8acd71 100644 --- a/LuaSkin/LuaSkin.xcodeproj/xcshareddata/xcschemes/LuaSkin.xcscheme +++ b/LuaSkin/LuaSkin.xcodeproj/xcshareddata/xcschemes/LuaSkin.xcscheme @@ -1,6 +1,6 @@ - - - - - + - - + + + + + + + + + + - - #import #import -#import #import #import #import @@ -31,6 +30,7 @@ FOUNDATION_EXPORT const unsigned char LuaSkinVersionString[]; #import #import #import +#import #import #import #import @@ -42,4 +42,4 @@ FOUNDATION_EXPORT const unsigned char LuaSkinVersionString[]; #import #import #import -#import \ No newline at end of file +#import diff --git a/LuaSkin/LuaSkin/Skin.h b/LuaSkin/LuaSkin/Skin.h index 87b62b451..1655d9342 100644 --- a/LuaSkin/LuaSkin/Skin.h +++ b/LuaSkin/LuaSkin/Skin.h @@ -10,49 +10,104 @@ @header Skin.h An Objective-C framework that both wraps and abstracts Lua @copyright The Hammerspoon Authors + + @ignorefuncmacro NS_OPTIONS + @ignorefuncmacro NS_ENUM */ -@import Foundation; +#import #import "lobject.h" #import "lapi.h" #import "lauxlib.h" #import "lualib.h" #import "lua.h" +#import +#import +#import + +extern const char * const LuaSkin_UD_TAG ; +extern int luaopen_luaskin_internal(lua_State* L) ; // entry vector to luaskin.m objectWrapper additions + +// Defines for Lua stack guard macros +/* +#ifdef DEBUG +# define _lua_stackguard_entry(L) int __lua_stackguard_entry=lua_gettop(L); NSLog(@"lua stack is %d at %s:%s:%d", __lua_stackguard_entry, __FILE__, __FUNCTION__, __LINE__); +# define _lua_stackguard_exit(L) NSLog(@"lua stack is %d at %s:ss%s:%d", lua_gettop(L), __FILE__, __FUNCTION__, __LINE__); assert(__lua_stackguard_entry == lua_gettop(L)); +#else + */ +# define _lua_stackguard_entry(L) int __lua_stackguard_entry=lua_gettop(L); +# define _lua_stackguard_exit(L) assert(__lua_stackguard_entry == lua_gettop(L)); +/* +#endif + */ + +#pragma mark - LuaSkin typedefs/defines + +// Define a break variable for the reference checker +#define LS_RBREAK INT_MIN + +typedef int LSRefTable; + +#define LSUUIDLen 37 +typedef struct LSGCCanary { + char uuid[LSUUIDLen]; +} LSGCCanary; // Define some bits for masking operations in the argument checker /*! - @definedblock Bit masks for Lua type checking with LuaSkin:checkArgs: - @hidesingletons + @definedblock Bit masks for Lua type checking + @abstract Bit masks indicating valid argument types for use with @link checkArgs: @/link + + @define LS_TBREAK The final value in all @link checkArgs: @/link calls, signals the end of the argument list + @define LS_TOPTIONAL Can be OR'd with any argument to indicate that it does not have to be present + @define LS_TNIL maps to LUA_TNIL + @define LS_TBOOLEAN maps to LUA_TBOOLEAN + @define LS_TNUMBER maps to LUA_TNUMBER + @define LS_TSTRING maps to LUA_TSTRING + @define LS_TTABLE maps to LUA_TTABLE + @define LS_TFUNCTION maps to LUA_TFUNCTION + @define LS_TUSERDATA maps to LUA_TUSERDATA + @define LS_TNONE maps to LUA_TNONE. Deprecated, as this serves no real use in checkArgs except to provide parity with Lua's LUA_TNONE, which is handled by optional argument tagging or as an argument count error. + @define LS_TANY indicates that any Lua variable type is accepted + @define LS_TINTEGER Can be OR'd with LS_TNUMBER to specify that the number must be an integer. This option is ignored if paired with other types. + @define LS_TVARARG Can be OR'd with LS_TBREAK to indicate that any additional arguments on the stack after this location are to be ignored by @link checkArgs: @/link. It is the responsibility of the module function to check and use or ignore any additional arguments. + @define LS_TTYPEDTABLE maps to LUA_TTABLE, but like LS_TUSERDATA, expects a string argument following which specifies the specific value expected in the __luaSkinType field of the table. + @define LS_TWRAPPEDOBJECT maps to a userdata which represents a raw Objective-C object. */ -#define LS_TBREAK 1 << 0 /*! @define LS_TBREAK The final value in all @link //apple_ref/occ/instm/LuaSkin/checkArgs: checkArgs @/link calls, signals the end of the argument list */ -#define LS_TOPTIONAL 1 << 1 /*! @define LS_TOPTIONAL Can be OR'd with any argument to indicate that it does not have to be present */ -#define LS_TNIL 1 << 2 /*! @define LS_TNIL maps to LUA_TNIL */ -#define LS_TBOOLEAN 1 << 3 /*! @define LS_TBOOLEAN maps to LUA_TBOOLEAN */ -#define LS_TNUMBER 1 << 4 /*! @define LS_TNUMBER maps to LUA_TNUMBER */ -#define LS_TSTRING 1 << 5 /*! @define LS_TSTRING maps to LUA_TSTRING */ -#define LS_TTABLE 1 << 6 /*! @define LS_TTABLE maps to LUA_TTABLE */ -#define LS_TFUNCTION 1 << 7 /*! @define LS_TFUNCTION maps to LUA_TFUNCTION */ -#define LS_TUSERDATA 1 << 8 /*! @define LS_TUSERDATA maps to LUA_TUSERDATA */ -#define LS_TNONE 1 << 9 /*! @define LS_TNONE maps to LUA_TNONE. Deprecated, as this serves no real use in checkArgs except to provide parity with Lua's LUA_TNONE, which is handled by optional argument tagging or as an argument count error. */ -#define LS_TANY 1 << 10 /*! @define LS_TANY indicates that any Lua variable type is accepted */ -#define LS_TINTEGER 1 << 11 /*! @define LS_TINTEGER Can be OR'd with LS_TNUMBER to specify that the number must be an integer. This option is ignored if paired with other types. */ -#define LS_TVARARG 1 << 12 /*! @define LS_TVARARG Can be OR'd with LS_TBREAK to indicate that any additional arguments on the stack after this location are to be ignored by @link //apple_ref/occ/instm/LuaSkin/checkArgs: checkArgs @/link. It is the responsibility of the module function to check and use or ignore any additional arguments. */ -#define LS_TTYPEDTABLE 1 << 13 /*! @define LS_TTYPEDTABLE maps to LUA_TTABLE, but like LS_TUSERDATA, expects a string argument following which specifies the specific value expected in the __luaSkinType field of the table. */ +#define LS_TBREAK 1 << 0 +#define LS_TOPTIONAL 1 << 1 +#define LS_TNIL 1 << 2 +#define LS_TBOOLEAN 1 << 3 +#define LS_TNUMBER 1 << 4 +#define LS_TSTRING 1 << 5 +#define LS_TTABLE 1 << 6 +#define LS_TFUNCTION 1 << 7 +#define LS_TUSERDATA 1 << 8 +#define LS_TNONE 1 << 9 +#define LS_TANY 1 << 10 +#define LS_TINTEGER 1 << 11 +#define LS_TVARARG 1 << 12 +#define LS_TTYPEDTABLE 1 << 13 +#define LS_TWRAPPEDOBJECT 1 << 14 /*! @/definedblock Bit masks for Lua type checking */ /*! + @typedef LS_NSConversionOptions @abstract Conversion options for @link pushNSObject:withOptions: @/link and @link toNSObjectAtIndex:withOptions: @/link - @constant LS_NSNone no options specified, use default beahvior - @constant LS_NSUnsignedLongLongPreserveBits convert NSNumber that contains an unsigned long long to a lua_Integer (long long) rather than preserve the numerical magnitude with lua_Number (double). Default is to preserve magnitude when the unsigned long long is greater than 0x7fffffffffffffff. - @constant LS_NSDescribeUnknownTypes when a date type or sub-type is unrecognized and does not match any defined converter, return a string describing the data (from [NSObject debugDescription] or luaL_tolstring, whichever is appropriate for the initial data type) instead of the default behavior of returing nil for the entire conversion. Not compatible with LS_NSDescribeUnknownTypes. - @constant LS_NSIgnoreUnknownTypes when a date type or sub-type is unrecognized and does not match any defined converter, return a nil placeholder (from [NSNull null] or lua_pushnil, whichever is appropriate for the initial data type) for the data or sub-component instead of the default behavior of returing nil for the entire conversion. Not compatible with LS_NSDescribeUnknownTypes. - @constant LS_NSPreserveLuaStringExactly If a Lua string contains character byte sequences which cannot be converted to a proper UTF8 Unicode character, return the string as an NSData object instead of the default lossy behavior of converting invalid sequences into the Unicode Invalid Character code. You should check your result to see if it is an NSString or an NSData object with the isKindOfClass: message if you select this option. Not compatible with LS_NSLuaStringAsDataOnly. - @constant LS_NSLuaStringAsDataOnly A lua string is always returned as an NSData object instead of the default lossy behavior of converting invalid sequences into the Unicode Invalid Character code. Not compatible with LS_NSPreserveLuaStringExactly. - @constant LS_NSAllowsSelfReference If a lua table contains a self reference (a table value which equals one of tables in which it is nested), allow the same self reference in the NSArray or NSDictionary object being created instead of the defualt behavior of returning nil for the entire conversion. Note that this option will create an object which likely cannot be fully collected by ARC without additional code due to strong internal references. - @constant LS_NSRawTables Always convert a Lua table to NSArray or NSDictionary, even if it contains a __luaSkinType field and a registered conversion function for the specified type exists. + @constant LS_NSNone (used by both methods) no options specified, use default behavior + @constant LS_NSUnsignedLongLongPreserveBits (used by @link pushNSObject:withOptions: @/link) convert NSNumber that contains an unsigned long long to a lua_Integer (long long) rather than preserve the numerical magnitude with lua_Number (double). Default is to preserve magnitude when the unsigned long long is greater than 0x7fffffffffffffff. + @constant LS_NSDescribeUnknownTypes (used by both methods) when a data type or sub-type is unrecognized and does not match any defined converter, return a string describing the data (from [NSObject debugDescription] or luaL_tolstring, whichever is appropriate for the initial data type) instead of the default behavior of returning nil for the entire conversion. Not compatible with LS_NSIgnoreUnknownTypes. + @constant LS_NSIgnoreUnknownTypes (used by both methods) when a date type or sub-type is unrecognized and does not match any defined converter, return a nil placeholder (from [NSNull null] or lua_pushnil, whichever is appropriate for the initial data type) for the data or sub-component instead of the default behavior of returning nil for the entire conversion. Not compatible with LS_NSDescribeUnknownTypes. + @constant LS_NSPreserveLuaStringExactly (used by @link toNSObjectAtIndex:withOptions: @/link) If a Lua string contains character byte sequences which cannot be converted to a proper UTF8 Unicode character, return the string as an NSData object instead of the default lossy behavior of converting invalid sequences into the Unicode Invalid Character code. You should check your result to see if it is an NSString or an NSData object with the isKindOfClass: message if you select this option. Not compatible with LS_NSLuaStringAsDataOnly. + @constant LS_NSLuaStringAsDataOnly (used by @link toNSObjectAtIndex:withOptions: @/link) A lua string is always returned as an NSData object instead of the default lossy behavior of converting invalid sequences into the Unicode Invalid Character code. Not compatible with LS_NSPreserveLuaStringExactly. + @constant LS_NSAllowsSelfReference (used by @link toNSObjectAtIndex:withOptions: @/link) If a lua table contains a self reference (a table value which equals one of tables in which it is nested), allow the same self reference in the NSArray or NSDictionary object being created instead of the default behavior of returning nil for the entire conversion. Note that this option will create an object which likely cannot be fully collected by ARC without additional code due to strong internal references. + @constant LS_NSRawTables (used by @link toNSObjectAtIndex:withOptions: @/link) Always convert a Lua table to NSArray or NSDictionary, even if it contains a __luaSkinType field and a registered conversion function for the specified type exists. + @constant LS_WithObjectWrapper (used by @link pushNSObject:withOptions: @/link) Push NSArray or NSDictionary as userdata instead of table to lua stack. Meta-methods allow Lua to (mostly) use this as it would a table, but reduces overhead by not requiring data to be duplicated and inserted into Lua VM. Defaults to read-only (i.e. attempts to add or remove table elements in Lua will fail). + @constant LS_OW_ReadWrite (used by @link pushNSObject:withOptions: @/link) When combined with @link LS_WithObjectWrapper @/link, the virtual table can be modified from Lua by adding or removing elements (as long as doing so would not change the underlying NSObject type), and the corresponding NSObject will be updated to reflect the changes. + @constant LS_OW_WithArrayConversion (used by @link pushNSObject:withOptions: @/link) When combined with @link LS_WithObjectWrapper @/link and @link LS_OW_ReadWrite @/link, modifying the virtual table in a way that would change the underlying NSObject type will cause it to be changed as necessary (e.g. adding a keyed element to an NSArray would change the underlying object to an NSDictionary; removing a keyed element from an NSDictionary that leaves only sequential integer keys starting at 1 will change the object to an NSArray.) */ typedef NS_OPTIONS(NSUInteger, LS_NSConversionOptions) { LS_NSNone = 0, @@ -66,18 +121,28 @@ typedef NS_OPTIONS(NSUInteger, LS_NSConversionOptions) { LS_NSAllowsSelfReference = 1 << 4, LS_NSRawTables = 1 << 6, + LS_WithObjectWrapper = 1 << 15, + LS_OW_ReadWrite = 1 << 16, + LS_OW_WithArrayConversion = 1 << 17, } ; /*! - @definedblock Log level definitions for logAtLevel:withMessage: - @hidesingletons + @definedblock Log level definitions + @abstract Log level definitions for use with @link logAtLevel:withMessage: @/link + + @define LS_LOG_BREADCRUMB for messages that should be considered for recording in crash logs + @define LS_LOG_VERBOSE for messages that contain excessive detail that is usually only of interest during debugging + @define LS_LOG_DEBUG for messages that are usually only of interest during debugging + @define LS_LOG_INFO for messages that are informative + @define LS_LOG_WARN for messages that contain warnings + @define LS_LOG_ERROR for messages that indicate an error has occurred */ -#define LS_LOG_BREADCRUMB 6 /*! @define LS_LOG_BREADCRUMB for messages that should be considered for recording in crash logs */ -#define LS_LOG_VERBOSE 5 /*! @define LS_LOG_VERBOSE for messages that contain excessive detail that is usually only of interest during debugging */ -#define LS_LOG_DEBUG 4 /*! @define LS_LOG_DEBUG for messages that are usually only of interest during debugging */ -#define LS_LOG_INFO 3 /*! @define LS_LOG_INFO for messages that are informative */ -#define LS_LOG_WARN 2 /*! @define LS_LOG_WARN for messages that contain warnings */ -#define LS_LOG_ERROR 1 /*! @define LS_LOG_ERROR for messages that indicate an error has occured */ +#define LS_LOG_BREADCRUMB 6 +#define LS_LOG_VERBOSE 5 +#define LS_LOG_DEBUG 4 +#define LS_LOG_INFO 3 +#define LS_LOG_WARN 2 +#define LS_LOG_ERROR 1 /*! @/definedblock Log level definitions */ @@ -94,9 +159,16 @@ NSString *specMaskToString(int spec); /*! @protocol LuaSkinDelegate - @abstract Delegate method for passing control back to the parent environment for environment specific handling. Curerntly only offers support for passing log messages back to the parent environment for display or processing. + @abstract Delegate method for passing control back to the parent environment for environment specific handling. Currently only offers support for passing log messages back to the parent environment for display or processing. */ @protocol LuaSkinDelegate + +/*! + @abstract LuaSkin has been unable to perform a vital operation, the delegate should make the attached message visible to the user and then exit + @param message A message to display to the user + */ +- (void)handleCatastrophe:(NSString *)message; + @optional /*! @abstract Pass log level and message back to parent for handling and/or display @@ -105,12 +177,19 @@ NSString *specMaskToString(int spec); @param theMessage The text of the message to be logged. */ - (void)logForLuaSkinAtLevel:(int)level withMessage:(NSString *)theMessage ; + +/*! + @abstract Log a known, but avoided issue via the log delegate, primarily to ensure it can be recorded in a crash reporting service + @discussion If no delegate has been assigned, the message is logged to the system logs via NSLog. + @param message The message to log + */ +- (void)logKnownBug:(NSString *)message, ...; @end /*! @class LuaSkin @abstract Abstraction layer for common operations on Lua state objects - @discussion LuaSkin was written for Hammerspoon (although it does not depend on any Hammerspoon functionality) to simplify our use of Lua. It includes a full, unmodified Lua distirbution, and provides an Objective C class that is capable of performing common operations such as creating/destroing a lua_State object, providing shared access to the object, Lua function argument type checking and bi-directional conversion of Lua objects and NSObject objects (with loadable plugins for your own converters) + @discussion LuaSkin was written for Hammerspoon (although it does not depend on any Hammerspoon functionality) to simplify our use of Lua. It includes a full, unmodified Lua distribution, and provides an Objective C class that is capable of performing common operations such as creating/destroying a lua_State object, providing shared access to the object, Lua function argument type checking and bi-directional conversion of Lua objects and NSObject objects (with loadable plugins for your own converters) */ @interface LuaSkin : NSObject @@ -125,37 +204,64 @@ NSString *specMaskToString(int spec); */ @property (atomic, readonly) lua_State *L; +/*! + @property mainLuaState + @abstract The lua state that LuaSkin was initialized with + @discussion Provides access to the raw Lua state object that was created when LuaSkin was initialized. This is the main lua thread where all callbacks should be run. Care should be taken when using this object, to ensure you are interacting with the Lua stack in a way that makes sense + */ +@property (class, readonly, atomic) lua_State *mainLuaState ; + +@property (atomic) NSUUID *uuid; + #pragma mark - Class lifecycle +/*! + @abstract Entrypoint from Lua to C + + This macro should be called at the start of every C function that is accessible from Lua. Its job is to create a LuaSkin object and validate the arguments expected to have been passed from Lua. + It is a wrapper that performs: +
@textblock
+  [LuaSkin sharedWithState:L];
+  [skin checkArgs:__VA_ARGS__];
+ @/textblock
+ +
If the arguments are incorrect, this call will never return and the user will get a nice Lua traceback instead + @discussion Each argument can use boolean OR's to allow multiple types to be accepted (e.g. LS_TNIL | LS_TBOOLEAN). + + Each argument can be OR'd with LS_TOPTIONAL to indicate that the argument is optional. + + LS_TUSERDATA arguments should be followed by a string containing the metatable tag name (e.g. "hs.screen" for objects from hs.screen). + + @warning The final argument MUST be LS_TBREAK, to signal the end of the list + + @param firstArg - An integer that defines the first acceptable Lua argument type. Possible values are defined @link //apple_ref/doc/title:macro/BitmasksforLuatypechecking here @/link. Followed by zero or more integers of the same possible values. The final value MUST be LS_TBREAK + */ +#define LS_API(...) [LuaSkin sharedWithState:L]; [skin checkArgs:__VA_ARGS__]; + /*! @abstract Returns the singleton LuaSkin.Skin object + @warning This method is deprecated and may go away at some point. Use +(id)sharedWithState:(lua_State *)L instead. @return Shared instance of LuaSkin.Skin */ + (id)shared; +/*! + @abstract Returns the singleton LuaSkin.Skin object with the internal lua thread pointer set to the specified state. + @param L the lua state representing the lua thread to assign to the LuaSkin internal lua thread pointer. If NULL, the lua state that was created by +(id)sharedWithDelegate:(id)delegate will be used. + @discussion This method will set the internal lua thread pointer to the specified state and should be invoked with the state passed into the C function defining a new lua function or method. For macOS delegates or other events which are triggered by the macOS rather than the lua engine executing a code block, pass in NULL for L. + @return Shared instance of LuaSkin.Skin +*/ ++ (id)sharedWithState:(lua_State *)L ; + /*! @abstract Returns the singleton LuaSkin.Skin object and sets its delegate @param delegate An object that responds to -(void)logForLuaSkinAtLevel:(int)level withMessage:(NSString *)theMessage - @discussion It is only appropriate to use this class method when you are first bootstrapping your LuaSkin instance, and its only reason for existence is to ensure that the logging delegate is set early enough to capture any messages that might arise during the initial Lua instantiation. For all other purposes, use [LuaSkin shared]. + @discussion It is only appropriate to use this class method when you are first bootstrapping your LuaSkin instance, and its only reason for existence is to ensure that the logging delegate is set early enough to capture any messages that might arise during the initial Lua instantiation. For all other purposes, use +(id)sharedWithState:(lua_State *)L. + @warning Calling this method leaves the lua thread pointer in the same state that invoking [LuaSkin sharedWithState:NULL] will. @return Shared instance of LuaSkinSkin */ + (id)sharedWithDelegate:(id)delegate; -/*! - @abstract Initialises a LuaSkin object - @discussion Typically you are unlikely to want to use the alloc/init pattern. Instead, see @link shared @/link for getting the singleton object. You should only call alloc/init directly if you need to manage multiple Lua environments - @return An initialised LuaSkin.Skin object - */ -- (id)init; - -/*! - @abstract Initialises a LuaSkin object and sets its delegate - @param delegate An object that responds to -(void)logForLuaSkinAtLevel:(int)level withMessage:(NSString *)theMessage - @discussion Typically you are unlikely to want to use the alloc/init pattern. Instead, see @link shared @/link for getting the singleton object. You should only call this method directly if you need to manage multiple Lua environments with logging delegates - @return An initialised LuaSkin.Skin object - */ -- (id)initWithDelegate:(id)delegate; - #pragma mark - lua_State lifecycle /*! @methodgroup Lua state lifecycle */ @@ -177,6 +283,10 @@ NSString *specMaskToString(int spec); */ - (void)resetLuaState; +- (BOOL)checkGCCanary:(LSGCCanary)canary; +- (LSGCCanary)createGCCanary; +- (void)destroyGCCanary:(LSGCCanary *)canary; + #pragma mark - Methods for calling into Lua from C /*! @methodgroup Calling Lua functions from Objective C */ @@ -200,12 +310,23 @@ NSString *specMaskToString(int spec); if (!result) handleSomeError(); @/textblock + @warning You are strongly advised to check the return code of this method - if it returns NO there will be an error message left on the Lua stack, which you should pop @return NO if the Lua code threw an exception, otherwise YES @param nargs An integer specifying how many function arguments you have pushed onto the stack @param nresults An integer specifying how many return values the Lua function will push onto the stack */ - (BOOL)protectedCallAndTraceback:(int)nargs nresults:(int)nresults; +/*!] + @abstract Calls protectedCallAndTraceback and will logError any failures + @discussion See the docs for protectedCallAndTraceback for all of the details of this method. The one difference is that this method will check for failure, log the error with logError, and leave nothing on the stack (although in the case of success, nresults elements will remain on the stack) + @return NO if the Lua code threw an exception, otherwise YES + @param nargs An integer specifying how many function arguments you have pushed onto the stack + @param nresults An integer specifying how many return values the Lua function will push onto the stack + @param message An NSString message to include in the error log + */ +- (BOOL)protectedCallAndError:(NSString*)message nargs:(int)nargs nresults:(int)nresults; + #pragma mark - Methods for registering libraries with Lua /*! @methodgroup Registering module libraries with Lua */ @@ -233,14 +354,49 @@ NSString *specMaskToString(int spec); {NULL, NULL} // Library arrays must always end with this }; - [luaSkin registerLibrary:myShinyLibrary metaFunctions:myShinyMetaLibrary]; + [luaSkin registerLibrary:"myShinyLibrary" functions:myShinyLibrary metaFunctions:myShinyMetaLibrary]; @/textblock + @param libraryName - A C string containing the name of the library @param functions - A static array of mappings between Lua function names and C function pointers. This provides the public API of the Lua library @param metaFunctions - A static array of mappings between special meta Lua function names (such as __gc) and C function pointers @return A Lua reference to the table created for this library to store its own references */ -- (int)registerLibrary:(const luaL_Reg *)functions metaFunctions:(const luaL_Reg *)metaFunctions; +- (LSRefTable)registerLibrary:(const char *)libraryName functions:(const luaL_Reg *)functions metaFunctions:(const luaL_Reg *)metaFunctions; + +/*! + @abstract (DEPRECATED) Defines a Lua library and creates a references table for the library + @discussion Lua libraries defined in C are simple mappings between Lua function names and C function pointers. + + NOTE: You should be using - (int)registerLibrary:(const char *)libraryName functions:(const luaL_Reg *)functions metaFunctions:(const luaL_Reg *)metaFunctions; + + A library consists of a series of Lua functions that are exposed to the user, and (optionally) several special Lua functions that will be used by Lua itself. The most common of these is __gc which will be called when Lua is performing garbage collection for the library. + These "special" functions are stored in the library's metatable. Other common metatable functions include __tostring and __index. + + The mapping between Lua functions and C functions is done using an array of type luaL_Reg + + Every C function pointed to in a luaL_Reg array must have the signature: static int someFunction(lua_State *L); + + Here is some sample code: +
@textblock
+ static const luaL_Reg myShinyLibrary[] = {
+    {"doThing", function_doThing},
+    {NULL, NULL} // Library arrays must always end with this
+ };
+
+ static const luaL_Reg myShinyMetaLibrary[] = {
+    {"__gc", function_doLibraryCleanup},
+    {NULL, NULL} // Library arrays must always end with this
+ };
+
+ [luaSkin registerLibrary:myShinyLibrary metaFunctions:myShinyMetaLibrary];
+ @/textblock
+ + @param functions - A static array of mappings between Lua function names and C function pointers. This provides the public API of the Lua library + @param metaFunctions - A static array of mappings between special meta Lua function names (such as __gc) and C function pointers + @return An opaque reference to the table created for this library to store its own references + */ +- (LSRefTable)registerLibrary:(const luaL_Reg *)functions metaFunctions:(const luaL_Reg *)metaFunctions __attribute__((deprecated("Please use the version of registerLibrary that takes the library name argument","registerLibrary:functions:metaFunctions:"))); /*! @abstract Defines a Lua library that creates objects, which have methods @@ -273,14 +429,14 @@ NSString *specMaskToString(int spec); @param functions - A static array of mappings between Lua function names and C function pointers. This provides the public API of the Lua library @param metaFunctions - A static array of mappings between special meta Lua function names (such as "__gc") and C function pointers @param objectFunctions - A static array of mappings between Lua object method names and C function pointers. This provides the public API of objects created by this library. Note that this object is also used as the metatable, so special functions (e.g. "__gc") should be included here - @return A Lua reference to the table created for this library to store its own references + @return An opaque reference to the table created for this library to store its own references */ -- (int)registerLibraryWithObject:(const char *)libraryName functions:(const luaL_Reg *)functions metaFunctions:(const luaL_Reg *)metaFunctions objectFunctions:(const luaL_Reg *)objectFunctions; +- (LSRefTable)registerLibraryWithObject:(const char *)libraryName functions:(const luaL_Reg *)functions metaFunctions:(const luaL_Reg *)metaFunctions objectFunctions:(const luaL_Reg *)objectFunctions; /*! @abstract Defines a Lua object with methods @discussion Here is some sample code: - @code +
@textblock
  char *objectName = "shinyObject";
 
  static const luaL_Reg myShinyObject[] = {
@@ -290,7 +446,7 @@ NSString *specMaskToString(int spec);
  };
 
  [luaSkin registerObject:objectName objectFunctions:myShinyObject];
- @endcode
+ @/textblock
@warning Every C function pointer must point to a function of the form: static int someFunction(lua_State *L); @@ -303,9 +459,9 @@ NSString *specMaskToString(int spec); /*! @abstract Stores a reference to the object at the top of the Lua stack, in the supplied table, and pops the object off the stack - @remark This method is functionally analogous to luaL_ref(), it just takes care of pushing the supplied table ref onto the stack, and removes it afterwards +
This method is functionally analogous to luaL_ref(), it just takes care of pushing the supplied table ref onto the stack, and removes it afterwards - @param refTable - An integer reference to a table, (e.g. the result of a previous luaRef on a table object or the result of the module's registration through registerLibrary:metaFunctions: or registerLibraryWithObject:functions:metaFunctions:objectFunctions:) + @param refTable - An opaque reference to a table, (e.g. the result of a previous luaRef on a table object or the result of the module's registration through registerLibrary:metaFunctions: or registerLibraryWithObject:functions:metaFunctions:objectFunctions:) @return An integer reference to the object that was at the top of the stack */ - (int)luaRef:(int)refTable; @@ -313,7 +469,7 @@ NSString *specMaskToString(int spec); /*! @abstract Stores a reference to the object at the specified position of the Lua stack, in the supplied table, without removing the object from the stack - @param refTable - An integer reference to a table, (e.g. the result of a previous luaRef on a table object or the result of the module's registration through registerLibrary:metaFunctions: or registerLibraryWithObject:functions:metaFunctions:objectFunctions:) + @param refTable - An opaque reference to a table, (e.g. the result of a previous luaRef on a table object or the result of the module's registration through registerLibrary:metaFunctions: or registerLibraryWithObject:functions:metaFunctions:objectFunctions:) @param idx - An integer stack position @return An integer reference to the object at the specified stack position */ @@ -322,9 +478,9 @@ NSString *specMaskToString(int spec); /*! @abstract Removes a reference from the supplied table - @remark This method is functionally analogous to luaL_unref(), it just takes care of pushing the supplied table ref onto the Lua stack, and removes it afterwards +
This method is functionally analogous to luaL_unref(), it just takes care of pushing the supplied table ref onto the Lua stack, and removes it afterwards - @param refTable - An integer reference to a table, (e.g. the result of a previous luaRef on a table object or the result of the module's registration through registerLibrary:metaFunctions: or registerLibraryWithObject:functions:metaFunctions:objectFunctions:) + @param refTable - An opaque reference to a table, (e.g. the result of a previous luaRef on a table object or the result of the module's registration through registerLibrary:metaFunctions: or registerLibraryWithObject:functions:metaFunctions:objectFunctions:) @param ref - An integer reference for an object that should be removed from the refTable table @return An integer, always LUA_NOREF (you are advised to store this value in the variable containing the ref parameter, so it does not become a stale reference) */ @@ -333,9 +489,9 @@ NSString *specMaskToString(int spec); /*! @abstract Pushes a stored reference onto the Lua stack - @remark This method is functionally analogous to lua_rawgeti(), it just takes care of pushing the supplied table ref onto the Lua stack, and removes it afterwards +
This method is functionally analogous to lua_rawgeti(), it just takes care of pushing the supplied table ref onto the Lua stack, and removes it afterwards - @param refTable - An integer reference to a table, (e.g. the result of a previous luaRef on a table object or the result of the module's registration through registerLibrary:metaFunctions: or registerLibraryWithObject:functions:metaFunctions:objectFunctions:) + @param refTable - An opaque reference to a table, (e.g. the result of a previous luaRef on a table object or the result of the module's registration through registerLibrary:metaFunctions: or registerLibraryWithObject:functions:metaFunctions:objectFunctions:) @param ref - An integer reference for an object that should be pushed onto the stack @return An integer containing the Lua type of the object pushed onto the stack */ @@ -346,7 +502,7 @@ NSString *specMaskToString(int spec); /*! @abstract Ensures a Lua->C call has the right arguments - @remark If the arguments are incorrect, this call will never return and the user will get a nice Lua traceback instead +
If the arguments are incorrect, this call will never return and the user will get a nice Lua traceback instead @discussion Each argument can use boolean OR's to allow multiple types to be accepted (e.g. LS_TNIL | LS_TBOOLEAN). Each argument can be OR'd with LS_TOPTIONAL to indicate that the argument is optional. @@ -355,7 +511,7 @@ NSString *specMaskToString(int spec); @warning The final argument MUST be LS_TBREAK, to signal the end of the list - @param firstArg - An integer that defines the first acceptable Lua argument type. Possible values are LS_TNIL, LS_TBOOLEAN, LS_TNUMBER, LS_TSTRING, LS_TTABLE, LS_TFUNCTION, LS_TUSERDATA, LS_TBREAK. Followed by zero or more integers of the same possible values. The final value MUST be LS_TBREAK + @param firstArg - An integer that defines the first acceptable Lua argument type. Possible values are defined @link //apple_ref/doc/title:macro/BitmasksforLuatypechecking here @/link. Followed by zero or more integers of the same possible values. The final value MUST be LS_TBREAK */ - (void)checkArgs:(int)firstArg, ...; @@ -378,7 +534,7 @@ NSString *specMaskToString(int spec); @discussion This method stores a reference to the object in the supplied table if it is able to. - @remark This can be used to prevent garbage collection of an object's userdata when the object must be retained whether or not the user has done so in lua. An object retained by this method can only be released through the use of luaRelease:forNSObject: or destroyLuaState:. Returns NO if canPushNSObject: returns NO. +
This can be used to prevent garbage collection of an object's userdata when the object must be retained whether or not the user has done so in lua. An object retained by this method can only be released through the use of luaRelease:forNSObject: or destroyLuaState:. Returns NO if canPushNSObject: returns NO. @param refTable - An integer reference to a table, (e.g. the result of a previous luaRef on a table object or the result of the module's registration through registerLibrary:metaFunctions: or registerLibraryWithObject:functions:metaFunctions:objectFunctions:) @@ -399,12 +555,21 @@ NSString *specMaskToString(int spec); */ - (void)luaRelease:(int)refTable forNSObject:(id)object ; +/*! + @abstract Checks a list of Lua references for validity + + @discussion This compares each argument against LUA_REFNIL and LUA_NOREF. If any of the supplied arguments contain either of those values, this method returns NO. It does not guarantee that the references are valid within the Lua environment, simply that they have not been explicitly invalidated. + @param firstRef - An integer containing a Lua reference. Followed by zero or more integers containing other Lua references. The final value MUST be LS_RBREAK. + @return YES or NO indicating whether all of the supplied references are valid or not + */ +- (BOOL)checkRefs:(int)firstRef, ...; + /*! @abstract Stores a reference for an NSObject in the supplied table. - @remark Use luaUnref:ref: to release an object retained by this method. Returns LUA_NOREF if canPushNSObject: returns NO. +
Use luaUnref:ref: to release an object retained by this method. Returns LUA_NOREF if canPushNSObject: returns NO. - @param refTable - An integer reference to a table, (e.g. the result of a previous luaRef on a table object or the result of the module's registration through registerLibrary:metaFunctions: or registerLibraryWithObject:functions:metaFunctions:objectFunctions:) + @param refTable - An opaque reference to a table, (e.g. the result of a previous luaRef on a table object or the result of the module's registration through registerLibrary:metaFunctions: or registerLibraryWithObject:functions:metaFunctions:objectFunctions:) @param object an NSObject @@ -412,6 +577,7 @@ NSString *specMaskToString(int spec); */ - (int)luaRef:(int)refTable forNSObject:(id)object ; + #pragma mark - Conversion from NSObjects into Lua objects /*! @methodgroup Converting NSObject objects into Lua variables */ @@ -447,7 +613,7 @@ NSString *specMaskToString(int spec); @discussion This method takes an NSObject and checks its class against registered classes and then against the built in defaults to determine the best way to represent it in Lua. - @remark The default classes are (in order): NSNull, NSNumber, NSValue, NSString, NSData, NSDate, NSArray, NSSet, NSOrderedSet, NSDictionary, NSURL, and NSObject. +
The default classes are (in order): NSNull, NSNumber, NSValue, NSString, NSData, NSDate, NSArray, NSSet, NSOrderedSet, NSDictionary, NSURL, and NSObject. @param obj an NSObject @param options options for the conversion made by using the bitwise OR operator with members of @link LS_NSConversionOptions @/link. @@ -516,9 +682,9 @@ NSString *specMaskToString(int spec); Userdata types and typed tables (a lua table with a __luaSkinType key-value pair) will be converted to the appropriate Objective-C type if a module has registered a helper function for the specified type. - @remark An empty table will be returned as an empty NSArray. +
An empty table will be returned as an empty NSArray. - @remark If the type is not in the above list, this method returns nil. +
If the type is not in the above list, this method returns nil. @warning This method is equivalent to invoking [LuaSkin toNSObjectAtIndex:idx withOptions:LS_NSNone]. See @link toNSObjectAtIndex:withOptions: @/link. @@ -547,9 +713,9 @@ NSString *specMaskToString(int spec); Userdata types and typed tables (a lua table with a __luaSkinType key-value pair) will be converted to the appropriate Objective-C type if a module has registered a helper function for the specified type. - @remark An empty table will be returned as an empty NSArray. +
An empty table will be returned as an empty NSArray. - @remark If the type is not in the above list, this method will return nil for the entire conversion, or [NSNull null] or a description of the unrecognized type for the data or sub-component depending upon the specified options. +
If the type is not in the above list, this method will return nil for the entire conversion, or [NSNull null] or a description of the unrecognized type for the data or sub-component depending upon the specified options. @param idx the index on lua stack which contains the data to convert @param options options for the conversion made by using the bitwise OR operator with members of @link LS_NSConversionOptions @/link. @@ -653,6 +819,7 @@ NSString *specMaskToString(int spec); */ - (BOOL)isValidUTF8AtIndex:(int)idx ; +- (NSString *)getValidUTF8:(const unsigned char *)src ofLength:(size_t)sourceLength; /*! @abstract Returns an NSString for the string at the specified index with invalid UTF8 byte sequences converted to the Unicode Invalid Character code. @@ -695,6 +862,15 @@ NSString *specMaskToString(int spec); */ - (BOOL)requireModule:(const char *)moduleName ; +/*! + @abstract Increases the size of Lua's stack + + @discussion This should be used before pushing items onto the stack. Each Lua->C transition is guaranteed to provide only 20 stack slots. It therefore seems wise to request more slots if we're going to be pushing things. + @warning If the stack size cannot be increased, a luaL_error() will be thrown + @param slots The number of additional slots to add to the stack + */ +- (void)growStack:(int)slots withMessage:(const char *)message; + #pragma mark - Logging methods /*! @methodgroup Logging methods */ @@ -715,87 +891,108 @@ NSString *specMaskToString(int spec); @discussion This method is equivalent to invoking @link logAtLevel:withMessage: @/link with level @link LS_LOG_VERBOSE @/link @param theMessage the message to log */ -- (void)logVerbose:(NSString *)theMessage ; +- (void)logVerbose:(NSString *)theMessage, ... ; /*! @abstract Log the specified message with LS_LOG_DEBUG level @discussion This method is equivalent to invoking @link logAtLevel:withMessage: @/link with level @link LS_LOG_DEBUG @/link @param theMessage the message to log */ -- (void)logDebug:(NSString *)theMessage ; +- (void)logDebug:(NSString *)theMessage, ... ; /*! @abstract Log the specified message with LS_LOG_INFO level @discussion This method is equivalent to invoking @link logAtLevel:withMessage: @/link with level @link LS_LOG_INFO @/link @param theMessage the message to log */ -- (void)logInfo:(NSString *)theMessage ; +- (void)logInfo:(NSString *)theMessage, ... ; /*! @abstract Log the specified message with LS_LOG_WARN level @discussion This method is equivalent to invoking @link logAtLevel:withMessage: @/link with level @link LS_LOG_WARN @/link @param theMessage the message to log */ -- (void)logWarn:(NSString *)theMessage ; +- (void)logWarn:(NSString *)theMessage, ... ; /*! @abstract Log the specified message with LS_LOG_ERROR level @discussion This method is equivalent to invoking @link logAtLevel:withMessage: @/link with level @link LS_LOG_ERROR @/link @param theMessage the message to log */ -- (void)logError:(NSString *)theMessage ; +- (void)logError:(NSString *)theMessage, ... ; /*! @abstract Log the specified message with LS_LOG_BREADCRUMB level @discussion This method is equivalent to invoking @link logAtLevel:withMessage: @/link with level @link LS_LOG_BREADCRUMB @/link @param theMessage the message to log */ -- (void)logBreadcrumb:(NSString *)theMessage ; +- (void)logBreadcrumb:(NSString *)theMessage, ... ; + +/*! + @abstract Log a known, but avoided issue via the log delegate, primarily to ensure it can be recorded in a crash reporting service + @discussion If no delegate has been assigned, the message is logged to the system logs via NSLog. + @param message The message to log + */ +- (void)logKnownBug:(NSString *)message, ... ; // FIXME: Should this be documented? Seems unnecessary to do so, at the moment + (void)classLogAtLevel:(int)level withMessage:(NSString *)theMessage; + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdocumentation-unknown-command" +// clang doesn't like apiuid, but it allows headerdoc2html to properly reference class methods with duplicate +// prototypes in the TOC + /*! + @apiuid //apple_ref/doc/classmethodparam/LuaSkin/logVerbose:/theMessage @abstract Log the specified message from any thread with LS_LOG_VERBOSE level @discussion This class method is equivalent to invoking @link logAtLevel:withMessage: @/link with level @link LS_LOG_VERBOSE @/link, but is safe to use from any thread, not just the main application thread. If this method is invoked from a thread other than the main thread, it uses dispatch_async to submit the logging message to the main thread for proper handling by the delegate. @param theMessage the message to log */ -+ (void)logVerbose:(NSString *)theMessage ; ++ (void)logVerbose:(NSString *)theMessage, ... ; /*! + @apiuid //apple_ref/doc/classmethodparam/LuaSkin/logDebug:/theMessage @abstract Log the specified message from any thread with LS_LOG_DEBUG level @discussion This class method is equivalent to invoking @link logAtLevel:withMessage: @/link with level @link LS_LOG_DEBUG @/link, but is safe to use from any thread, not just the main application thread. If this method is invoked from a thread other than the main thread, it uses dispatch_async to submit the logging message to the main thread for proper handling by the delegate. @param theMessage the message to log */ -+ (void)logDebug:(NSString *)theMessage ; ++ (void)logDebug:(NSString *)theMessage, ... ; /*! + @apiuid //apple_ref/doc/classmethodparam/LuaSkin/logInfo:/theMessage @abstract Log the specified message from any thread with LS_LOG_INFO level @discussion This class method is equivalent to invoking @link logAtLevel:withMessage: @/link with level @link LS_LOG_INFO @/link, but is safe to use from any thread, not just the main application thread. If this method is invoked from a thread other than the main thread, it uses dispatch_async to submit the logging message to the main thread for proper handling by the delegate. @param theMessage the message to log */ -+ (void)logInfo:(NSString *)theMessage ; ++ (void)logInfo:(NSString *)theMessage, ... ; /*! + @apiuid //apple_ref/doc/classmethodparam/LuaSkin/logWarn:/theMessage @abstract Log the specified message from any thread with LS_LOG_WARN level @discussion This class method is equivalent to invoking @link logAtLevel:withMessage: @/link with level @link LS_LOG_WARN @/link, but is safe to use from any thread, not just the main application thread. If this method is invoked from a thread other than the main thread, it uses dispatch_async to submit the logging message to the main thread for proper handling by the delegate. @param theMessage the message to log */ -+ (void)logWarn:(NSString *)theMessage ; ++ (void)logWarn:(NSString *)theMessage, ... ; /*! + @apiuid //apple_ref/doc/classmethodparam/LuaSkin/logError:/theMessage @abstract Log the specified message from any thread with LS_LOG_ERROR level @discussion This class method is equivalent to invoking @link logAtLevel:withMessage: @/link with level @link LS_LOG_ERROR @/link, but is safe to use from any thread, not just the main application thread. If this method is invoked from a thread other than the main thread, it uses dispatch_async to submit the logging message to the main thread for proper handling by the delegate. @param theMessage the message to log */ -+ (void)logError:(NSString *)theMessage ; ++ (void)logError:(NSString *)theMessage, ... ; /*! + @apiuid //apple_ref/doc/classmethodparam/LuaSkin/logBreadcrumb:/theMessage @abstract Log the specified message from any thread with LS_LOG_BREADCRUMB level @discussion This class method is equivalent to invoking @link logAtLevel:withMessage: @/link with level @link LS_LOG_BREADCRUMB @/link, but is safe to use from any thread, not just the main application thread. If this method is invoked from a thread other than the main thread, it uses dispatch_async to submit the logging message to the main thread for proper handling by the delegate. @param theMessage the message to log */ -+ (void)logBreadcrumb:(NSString *)theMessage ; ++ (void)logBreadcrumb:(NSString *)theMessage, ... ; + +#pragma clang diagnostic pop /*! @abstract Returns a string containing the current stack top, the absolute index position of the stack top, and the output from luaL_traceback. diff --git a/LuaSkin/LuaSkin/Skin.m b/LuaSkin/LuaSkin/Skin.m index 03c8a8062..3c024d0f4 100644 --- a/LuaSkin/LuaSkin/Skin.m +++ b/LuaSkin/LuaSkin/Skin.m @@ -1,4 +1,4 @@ - // +// // Skin.m // LuaSkin // @@ -8,6 +8,8 @@ #import "Skin.h" +const char * const LuaSkin_UD_TAG = "luaskin.objectWrapper" ; + typedef struct pushNSHelpers { const char *name; pushNSHelperFunction func; @@ -60,13 +62,42 @@ static int pushUserdataType(lua_State *L) { if (spec & LS_TBOOLEAN) { [parts addObject:@"boolean"]; } + if (spec & LS_TWRAPPEDOBJECT) { + [parts addObject:@"wrappedObject"] ; + } return [parts componentsJoinedByString:@" or "]; } +static NSString *getCallerFileName(void) { + NSString *executablePath = [[NSBundle mainBundle] executablePath] ; + Dl_info libraryInfo ; + NSArray *csa = [NSThread callStackReturnAddresses] ; + NSString *fname, *prevFname ; + for (NSNumber *entry in csa) { + prevFname = fname ; + fname = nil ; + uintptr_t add = entry.unsignedLongValue ; + if (dladdr((const void *)add, &libraryInfo) != 0) { + fname = [NSString stringWithUTF8String:libraryInfo.dli_fname] ; + if ([fname isEqualToString:executablePath]) { + fname = prevFname ; + break ; + } + if (![fname containsString:@"LuaSkin"]) break ; + } + } + return fname ; +} + // Extension to LuaSkin class to allow private modification of the lua_State property @interface LuaSkin () +@property (class, readwrite, assign, atomic) lua_State *mainLuaState ; +@property (class, readonly, atomic) LuaSkin *sharedLuaSkin ; + +@property (class, readonly, atomic) NSMutableSet *sharedWarnings ; + @property (readwrite, assign, atomic) lua_State *L; @property (readonly, atomic) NSMutableDictionary *registeredNSHelperFunctions ; @property (readonly, atomic) NSMutableDictionary *registeredNSHelperLocations ; @@ -76,6 +107,7 @@ @interface LuaSkin () @property (readonly, atomic) NSMutableDictionary *registeredLuaObjectHelperTableMappings; @property (readonly, atomic) NSMutableDictionary *retainedObjectsRefTableMappings ; +@property (readwrite, assign, atomic) int debugLibraryRef ; @end // Extension to LuaSkin class for conversion support @@ -98,17 +130,81 @@ - (id)tableAtIndex:(int)idx withLabel:(const char *)tableTag withOptions:(N @implementation LuaSkin +// class properties do not get synthesized by the compiler... +static lua_State *_mainLuaState ; + ++ (lua_State *)mainLuaState { + return _mainLuaState ; +} + ++ (void)setMainLuaState:(lua_State *)newL { + _mainLuaState = newL ; +} + +static LuaSkin *_sharedLuaSkin ; + ++ (LuaSkin *)sharedLuaSkin { + return _sharedLuaSkin ; +} + #pragma mark - Class lifecycle +static NSMutableSet *_sharedWarnings ; + ++ (NSMutableSet *)sharedWarnings { return _sharedWarnings ; } + + (id)shared { - return [LuaSkin sharedWithDelegate:nil]; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + _sharedWarnings = [NSMutableSet set] ; + }); + + // self in a class method == the class itself + LuaSkin *skin = [self sharedWithState:NULL] ; + + NSString *fname = getCallerFileName() ; + + if (fname) { + if (![_sharedWarnings containsObject:fname]) { + [LuaSkin logWarn:[NSString stringWithFormat:@"Deprecated LuaSkin method [LuaSkin shared] invoked by `%@`. Please notify developer of module to upgrade as this method is unsafe for use with coroutines and may disappear in a future Hammerspoon release.", fname]] ; + [_sharedWarnings addObject:fname] ; + } + } else { + [LuaSkin logWarn:@"Deprecated LuaSkin method [LuaSkin shared] invoked but unable to determine source library. Notify Hammerspoon developers and include the following stack trace:"] ; + [LuaSkin logWarn:[[NSThread callStackSymbols] componentsJoinedByString:@"\r"]] ; + } + + return skin ; +} + ++ (id)sharedWithState:(lua_State *)L { + // self in a class method == the class itself + LuaSkin *skin = [self sharedWithDelegate:nil] ; + if (L) { + if (lua_status(L) != LUA_OK) { + NSLog(@"GRAVE BUG: LUASKIN ATTEMPTING TO USE SUSPENDED OR DEAD LUATHREAD"); + for (NSString *stackSymbol in [NSThread callStackSymbols]) { + NSLog(@"Previous stack symbol: %@", stackSymbol); + } + NSException* myException = [NSException + exceptionWithName:@"LuaThreadNotOk" + reason:@"LuaSkin can only function on an active lua thread" + userInfo:nil]; + @throw myException; + } else { + skin.L = L ; + } + } else { + skin.L = _mainLuaState ; + } + return skin ; } + (id)sharedWithDelegate:(id)delegate { - static LuaSkin *sharedLuaSkin = nil; +// static LuaSkin *sharedLuaSkin = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - sharedLuaSkin = [[self alloc] initWithDelegate:delegate]; + _sharedLuaSkin = [[self alloc] initWithDelegate:delegate]; }); if (![NSThread isMainThread]) { NSLog(@"GRAVE BUG: LUA EXECUTION ON NON_MAIN THREAD"); @@ -121,7 +217,12 @@ + (id)sharedWithDelegate:(id)delegate { userInfo:nil]; @throw myException; } - return sharedLuaSkin; +#if 0 + NSLog(@"LuaSkin:shared stack size: %d", lua_gettop(_sharedLuaSkin.L)); +#endif + + _sharedLuaSkin.L = _mainLuaState ; + return _sharedLuaSkin; } - (id)init { @@ -153,43 +254,65 @@ - (id)initWithDelegate:(id)delegate { #pragma mark - lua_State lifecycle - (void)createLuaState { + NSString *catastropheText = @""; + NSLog(@"createLuaState"); - NSAssert((self.L == NULL), @"createLuaState called on a live Lua environment", nil); - self.L = luaL_newstate(); - luaL_openlibs(self.L); + NSAssert((LuaSkin.mainLuaState == NULL), @"createLuaState called on a live Lua environment", nil); + self.uuid = [NSUUID UUID]; + [self logBreadcrumb:[NSString stringWithFormat:@"createLuaState: %@", self.uuid]]; + + LuaSkin.mainLuaState = luaL_newstate(); + luaL_openlibs(LuaSkin.mainLuaState); + + lua_getglobal(LuaSkin.mainLuaState, "debug") ; + self.debugLibraryRef = luaL_ref(LuaSkin.mainLuaState, LUA_REGISTRYINDEX) ; NSString *luaSkinLua = [[NSBundle bundleForClass:[self class]] pathForResource:@"luaskin" ofType:@"lua"]; - NSAssert((luaSkinLua != nil), @"createLuaState was unable to find luaskin.lua. Your installation may be damaged"); + if (!luaSkinLua) { + catastropheText = @"createLuaState was unable to find luaskin.lua. Please re-install Hammerspoon"; + goto catastrophe; + } + + luaopen_luaskin_internal(LuaSkin.mainLuaState) ; // load objectWrapper userdata methods and create _G["ls"] - int loadresult = luaL_loadfile(self.L, luaSkinLua.fileSystemRepresentation); + int loadresult = luaL_loadfile(LuaSkin.mainLuaState, luaSkinLua.fileSystemRepresentation); // extend _G["ls"] if (loadresult != 0) { - NSLog(@"createLuaState was unable to load luaskin.lua. Your installation may be damaged."); - exit(1); + catastropheText = @"createLuaState was unable to load luaskin.lua. Please re-install Hammerspoon"; + goto catastrophe; } - int luaresult = lua_pcall(self.L, 0, 0, 0); + int luaresult = lua_pcall(LuaSkin.mainLuaState, 0, 0, 0); if (luaresult != LUA_OK) { - NSLog(@"createLuaState was unable to evaluate luaskin.lua. Your installation may be damaged."); - exit(1); + catastropheText = @"createLuaState was unable to evaluate luaskin.lua. Please re-install Hammerspoon"; + goto catastrophe; } + + return; + +catastrophe: + [self.delegate handleCatastrophe:catastropheText]; + exit(1); } - (void)destroyLuaState { - NSLog(@"destroyLuaState"); - NSAssert((self.L != NULL), @"destroyLuaState called with no Lua environment", nil); - if (self.L) { + [self logBreadcrumb:[NSString stringWithFormat:@"destroyLuaState: %@", self.uuid]]; + NSAssert((LuaSkin.mainLuaState != NULL), @"destroyLuaState called with no Lua environment", nil); + if (LuaSkin.mainLuaState) { [self.retainedObjectsRefTableMappings enumerateKeysAndObjectsUsingBlock:^(NSNumber *refTableN, NSMutableDictionary *objectMappings, __unused BOOL *stop) { if ([refTableN isKindOfClass:[NSNumber class]] && [objectMappings isKindOfClass:[NSDictionary class]]) { int tmpRefTable = refTableN.intValue ; for (id object in objectMappings.allValues) [self luaRelease:tmpRefTable forNSObject:object] ; } else { - NSLog(@"destroyLuaState - invalid retainedObject reference table entry:%@ = %@", refTableN, objectMappings) ; + [self logBreadcrumb:[NSString stringWithFormat:@"destroyLuaState - invalid retainedObject reference table entry: %@ = %@", refTableN, objectMappings]]; } }] ; [self.retainedObjectsRefTableMappings removeAllObjects] ; - lua_close(self.L); + luaL_unref(LuaSkin.mainLuaState, LUA_REGISTRYINDEX, self.debugLibraryRef) ; + self.debugLibraryRef = LUA_REFNIL ; + + lua_close(LuaSkin.mainLuaState); [self.registeredNSHelperFunctions removeAllObjects] ; [self.registeredNSHelperLocations removeAllObjects] ; [self.registeredLuaObjectHelperFunctions removeAllObjects] ; @@ -197,23 +320,74 @@ - (void)destroyLuaState { [self.registeredLuaObjectHelperUserdataMappings removeAllObjects]; [self.registeredLuaObjectHelperTableMappings removeAllObjects]; } - self.L = NULL; + if (self.L) { + self.L = NULL; + } + LuaSkin.mainLuaState = NULL; } - (void)resetLuaState { NSLog(@"resetLuaState"); - NSAssert((self.L != NULL), @"resetLuaState called with no Lua environment", nil); + NSAssert((LuaSkin.mainLuaState != NULL), @"resetLuaState called with no Lua environment", nil); [self destroyLuaState]; [self createLuaState]; } +- (BOOL)checkGCCanary:(LSGCCanary)canary { + if (!self.L) { + [self logBreadcrumb:@"LuaSkin nil lua_State detected"]; + return NO; + } + + NSString *NSlsCanary = [NSString stringWithCString:canary.uuid encoding:NSUTF8StringEncoding]; +#if 0 +//#ifdef DEBUG + // This gets kinda spammy if enabled all the time, but it's useful while debugging canary issues + NSLog(@"checkGCCanary (%@) comparing %@ vs %@", [NSThread.callStackSymbols objectAtIndex:1], self.uuid.UUIDString, NSlsCanary); +#endif + if (!NSlsCanary || ![self.uuid.UUIDString isEqualToString:NSlsCanary]) { + // Throwing an exception is not helpful in production, because the whole point of the canary check is to discard events that are being delivered to stale Lua instances. + // We can hang onto the code anyway in case we need it later. +// NSLog(@"LuaSkin caught an attempt to operate on an object that has been garbage collected."); +// for (NSString *stackSymbol in [NSThread callStackSymbols]) { +// NSLog(@"Previous stack symbol: %@", stackSymbol); +// } +// NSException* myException = [NSException +// exceptionWithName:@"LuaGCCanaryMismatch" +// reason:[NSString stringWithFormat:@"GC Canary changed: Expected %@, found %@", self.uuid.UUIDString, NSlsCanary] +// userInfo:nil]; +// @throw myException; + return NO; + } + + return YES; +} + +- (LSGCCanary)createGCCanary { + LSGCCanary canary; + memset(canary.uuid, 0, LSUUIDLen); + strncpy(canary.uuid, "UNINITIALISED", 13); + + const char *tmpUUID = [self.uuid.UUIDString cStringUsingEncoding:NSUTF8StringEncoding]; + if (tmpUUID) { + strncpy(canary.uuid, tmpUUID, LSUUIDLen); + } + + return canary; +} + +- (void)destroyGCCanary:(LSGCCanary *)canary { + memset(canary->uuid, 0, LSUUIDLen); + strncpy(canary->uuid, "GC", 2); +} + #pragma mark - Methods for calling into Lua from C - (BOOL)protectedCallAndTraceback:(int)nargs nresults:(int)nresults { // At this point we are being called with nargs+1 items on the stack, but we need to shove our traceback handler below that // Get debug.traceback() onto the top of the stack - lua_getglobal(self.L, "debug"); + lua_rawgeti(self.L, LUA_REGISTRYINDEX, self.debugLibraryRef); lua_getfield(self.L, -1, "traceback"); lua_remove(self.L, -2); @@ -238,8 +412,14 @@ - (BOOL)protectedCallAndTraceback:(int)nargs nresults:(int)nresults { int tracebackPosition = -nargs - 2; lua_insert(self.L, tracebackPosition); - if (lua_pcall(self.L, nargs, nresults, tracebackPosition) != LUA_OK) { + // if we call something that resumed a coroutine, we can't be positive what self.L points to + lua_State *backup = self.L ; + int status = lua_pcall(self.L, nargs, nresults, tracebackPosition) ; + self.L = backup ; + + if (status != LUA_OK) { lua_remove(self.L, -2) ; // remove the message handler + // At this point the error message from lua_pcall() is on the stack. Our caller is required to deal with this. return NO; } @@ -247,13 +427,41 @@ - (BOOL)protectedCallAndTraceback:(int)nargs nresults:(int)nresults { return YES; } +- (BOOL)protectedCallAndError:(NSString*)message nargs:(int)nargs nresults:(int)nresults { + BOOL result = [self protectedCallAndTraceback:nargs nresults:nresults]; + if (result == NO) { + [self logError:[NSString stringWithFormat:@"%@: %s", message, lua_tostring(self.L, -1)]]; + lua_pop(self.L, 1); + } + return result; +} + #pragma mark - Methods for registering libraries with Lua -- (int)registerLibrary:(const luaL_Reg *)functions metaFunctions:(const luaL_Reg *)metaFunctions { +- (LSRefTable)registerLibrary:(const luaL_Reg *)functions metaFunctions:(const luaL_Reg *)metaFunctions { + [self logWarn:@"This library is using an old registerLibrary method on LuaSkin"]; + return [self registerLibrary:"Unknown" functions:functions metaFunctions:metaFunctions]; +} + +- (LSRefTable)registerLibrary:(const char * _Nonnull)libraryName functions:(const luaL_Reg *)functions metaFunctions:(const luaL_Reg *)metaFunctions { + + NSAssert(libraryName != NULL, @"libraryName can not be NULL", nil); + // Ensure we're not given a null function table NSAssert(functions != NULL, @"functions can not be NULL", nil); + // Ensure that none of the functions we've been given are null + const luaL_Reg *l = functions; + for (; l->name != NULL; l++) { + NSAssert(l->func != NULL, @"registerLibrary given a null function pointer for %s", l->name); + } + + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:3 withMessage:"registerLibrary"]; + #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconstant-conversion" +#pragma GCC diagnostic ignored "-Wunknown-warning-option" +#pragma GCC diagnostic ignored "-Wsizeof-pointer-div" luaL_newlib(self.L, functions); if (metaFunctions != nil) { luaL_newlib(self.L, metaFunctions); @@ -261,13 +469,36 @@ - (int)registerLibrary:(const luaL_Reg *)functions metaFunctions:(const luaL_Reg lua_setmetatable(self.L, -2); } lua_newtable(self.L); + + NSString *fname = getCallerFileName() ; + + // FIXME: Can this all be replaced just by using the libraryName argument? + if (fname) { + NSRange range = [fname rangeOfString:@"/hs/"] ; + if (range.location == NSNotFound) range = [fname rangeOfString:@"/LuaSkin"] ; + if (range.location != NSNotFound) { + NSUInteger startAt = range.location + 1 ; + if (startAt < fname.length) { + fname = [fname substringFromIndex:startAt] ; + } + if ([fname hasSuffix:@".so"]) fname = [fname substringToIndex:(fname.length - 3)] ; + fname = [fname stringByReplacingOccurrencesOfString:@"/" withString:@"."] ; + } + lua_pushstring(self.L, fname.UTF8String) ; + } else { + lua_pushstring(self.L, "** unable to determine source file **" ) ; + } + lua_setfield(self.L, -2, "__type") ; + int tmpRefTable = luaL_ref(self.L, LUA_REGISTRYINDEX); + NSAssert(tmpRefTable != LUA_REFNIL, @"Unexpected LUA_REFNIL registering library: %@", fname); + lua_pushinteger(self.L, tmpRefTable) ; lua_setfield(self.L, -2, "__refTable") ; return tmpRefTable; } -- (int)registerLibraryWithObject:(const char *)libraryName functions:(const luaL_Reg *)functions metaFunctions:(const luaL_Reg *)metaFunctions objectFunctions:(const luaL_Reg *)objectFunctions { +- (LSRefTable)registerLibraryWithObject:(const char *)libraryName functions:(const luaL_Reg *)functions metaFunctions:(const luaL_Reg *)metaFunctions objectFunctions:(const luaL_Reg *)objectFunctions { NSAssert(libraryName != NULL, @"libraryName can not be NULL", nil); NSAssert(functions != NULL, @"functions can not be NULL (%s)", libraryName); @@ -275,17 +506,26 @@ - (int)registerLibraryWithObject:(const char *)libraryName functions:(const luaL [self registerObject:libraryName objectFunctions:objectFunctions]; - int moduleRefTable = [self registerLibrary:functions metaFunctions:metaFunctions]; - - return moduleRefTable; + return [self registerLibrary:libraryName functions:functions metaFunctions:metaFunctions]; } - (void)registerObject:(const char *)objectName objectFunctions:(const luaL_Reg *)objectFunctions { NSAssert(objectName != NULL, @"objectName can not be NULL", nil); NSAssert(objectFunctions != NULL, @"objectFunctions can not be NULL (%s)", objectName); + // Ensure that none of the functions we've been given are null + const luaL_Reg *l = objectFunctions; + for (; l->name != NULL; l++) { + NSAssert(l->func != NULL, @"registerObject given a null function pointer for %s:%s", objectName, l->name); + } + + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:2 withMessage:"registerObject"]; + #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconstant-conversion" +#pragma GCC diagnostic ignored "-Wunknown-warning-option" +#pragma GCC diagnostic ignored "-Wsizeof-pointer-div" luaL_newlib(self.L, objectFunctions); #pragma GCC diagnostic pop lua_pushvalue(self.L, -1); @@ -302,9 +542,23 @@ - (int)luaRef:(int)refTable { NSAssert((refTable != LUA_NOREF && refTable != LUA_REFNIL), @"ERROR: LuaSkin::luaRef was passed a NOREF/REFNIL refTable", nil); if (lua_isnil(self.L, -1)) { + // Remove the nil from the stack + lua_remove(self.L, -1); + return LUA_REFNIL; } + int ref = LUA_NOREF; + + if (refTable == LUA_REGISTRYINDEX) { + // Directly store the value in the global registry + ref = luaL_ref(self.L, LUA_REGISTRYINDEX); + return ref; + } + + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:1 withMessage:"luaRef:"]; + // Push refTable onto the stack lua_rawgeti(self.L, LUA_REGISTRYINDEX, refTable); @@ -312,7 +566,7 @@ - (int)luaRef:(int)refTable { lua_insert(self.L, -2); // Reference the object at the top of the stack (pops it off) - int ref = luaL_ref(self.L, -2); + ref = luaL_ref(self.L, -2); // Remove refTable from the stack lua_remove(self.L, -1); @@ -321,6 +575,8 @@ - (int)luaRef:(int)refTable { } - (int)luaRef:(int)refTable atIndex:(int)idx { + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:1 withMessage:"luaRef:atIndex"]; lua_pushvalue(self.L, idx); return [self luaRef:refTable]; } @@ -328,6 +584,14 @@ - (int)luaRef:(int)refTable atIndex:(int)idx { - (int)luaUnref:(int)refTable ref:(int)ref { NSAssert((refTable != LUA_NOREF && refTable != LUA_REFNIL), @"ERROR: LuaSkin::luaUnref was passed a NOREF/REFNIL refTable", nil); + if (refTable == LUA_REGISTRYINDEX && ref != LUA_NOREF && ref != LUA_REFNIL) { + luaL_unref(self.L, LUA_REGISTRYINDEX, ref); + return LUA_NOREF; + } + + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:1 withMessage:"luaUnref"]; + if (ref != LUA_NOREF && ref != LUA_REFNIL) { // Push refTable onto the stack lua_rawgeti(self.L, LUA_REGISTRYINDEX, refTable); @@ -345,11 +609,21 @@ - (int)pushLuaRef:(int)refTable ref:(int)ref { NSAssert((refTable != LUA_NOREF && refTable != LUA_REFNIL), @"ERROR: LuaSkin::pushLuaRef was passed a NOREF/REFNIL refTable", nil); NSAssert((ref != LUA_NOREF && ref != LUA_REFNIL), @"ERROR: LuaSkin::pushLuaRef was passed a NOREF/REFNIL ref", nil); + int type = LUA_TNONE; + + if (refTable == LUA_REGISTRYINDEX) { + type = lua_rawgeti(self.L, LUA_REGISTRYINDEX, ref); + return type; + } + + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:2 withMessage:"pushLuaRef"]; + // Push refTable onto the stack lua_rawgeti(self.L, LUA_REGISTRYINDEX, refTable); // Push ref onto the stack - int type = lua_rawgeti(self.L, -1, ref); + type = lua_rawgeti(self.L, -1, ref); // Remove refTable from the stack lua_remove(self.L, -2); @@ -357,6 +631,27 @@ - (int)pushLuaRef:(int)refTable ref:(int)ref { return type; } +- (BOOL)checkRefs:(int)firstRef, ... { + BOOL result = YES; + int ref = firstRef; + + va_list args; + va_start(args, firstRef); + + while (true) { + if (ref == LS_RBREAK) { + break; + } + if (ref == LUA_REFNIL || ref == LUA_NOREF) { + result = NO; + break; + } + ref = va_arg(args, int); + } + + return result; +} + - (void)checkArgs:(int)firstArg, ... { int idx = 1; int numArgs = lua_gettop(self.L); @@ -366,6 +661,9 @@ - (void)checkArgs:(int)firstArg, ... { va_list args; va_start(args, firstArg); + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:2 withMessage:"checkArgs"]; + while (true) { if (spec & LS_TBREAK) { idx--; @@ -450,14 +748,20 @@ - (void)checkArgs:(int)firstArg, ... { case LUA_TUSERDATA: lsType = LS_TUSERDATA; - // We have to duplicate this check here, because if the user wasn't supposed to pass userdata, we won't have a valid userdataTag value available - if (!(spec & lsType)) { - luaL_error(self.L, "ERROR: incorrect type '%s' for argument %d (expected %s)", luaL_typename(self.L, idx), idx, specMaskToString(spec).UTF8String); - } + if (spec & LS_TWRAPPEDOBJECT) { + if (!luaL_testudata(self.L, idx, LuaSkin_UD_TAG)) { + luaL_error(self.L, "ERROR: incorrect userdata type for argument %d (expected %s)", idx, LuaSkin_UD_TAG); + } + } else { + // We have to duplicate this check here, because if the user wasn't supposed to pass userdata, we won't have a valid userdataTag value available + if (!(spec & lsType)) { + luaL_error(self.L, "ERROR: incorrect type '%s' for argument %d (expected %s)", luaL_typename(self.L, idx), idx, specMaskToString(spec).UTF8String); + } - userdataTag = va_arg(args, char*); - if (!userdataTag || strlen(userdataTag) == 0 || !luaL_testudata(self.L, idx, userdataTag)) { - luaL_error(self.L, "ERROR: incorrect userdata type for argument %d (expected %s)", idx, userdataTag); + userdataTag = va_arg(args, char*); + if (!userdataTag || strlen(userdataTag) == 0 || !luaL_testudata(self.L, idx, userdataTag)) { + luaL_error(self.L, "ERROR: incorrect userdata type for argument %d (expected %s)", idx, userdataTag); + } } break; @@ -466,7 +770,7 @@ - (void)checkArgs:(int)firstArg, ... { break; } - if (!(spec & LS_TANY) && !(spec & lsType)) { + if (!(spec & LS_TANY) && !(spec & lsType) && !(spec & LS_TWRAPPEDOBJECT)) { luaL_error(self.L, "ERROR: incorrect type '%s' for argument %d (expected %s)", luaL_typename(self.L, idx), idx, specMaskToString(spec).UTF8String); } nextarg: @@ -483,6 +787,9 @@ - (void)checkArgs:(int)firstArg, ... { } - (int)luaTypeAtIndex:(int)idx { + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:1 withMessage:"luaTypeAtIndex"]; + int foundType = lua_type(self.L, idx) ; if (foundType == LUA_TTABLE) { if (luaL_getmetafield(self.L, idx, "__call") != LUA_TNIL) { @@ -537,25 +844,30 @@ - (int)pushNSObject:(id)obj withOptions:(NSUInteger)options { return results ; } -- (BOOL)registerPushNSHelper:(pushNSHelperFunction)helperFN forClass:(const char *)className { +- (BOOL)registerPushNSHelper:(pushNSHelperFunction)helperFN forClass:(const char *)cClassName { BOOL allGood = NO ; -// this hackery assumes that this method is only called from within the luaopen_* function of a module and -// attempts to compensate for a wrapper to "require"... I doubt anyone is actually using it anymore. - int level = (int)[[NSUserDefaults standardUserDefaults] integerForKey:@"HSLuaSkinRegisterRequireLevel"]; - if (level == 0) level = 3 ; + + NSString *className = nil; + @try { + className = @(cClassName); + } @catch (NSException __unused *exception) { + className = nil; + } if (className && helperFN) { - if (self.registeredNSHelperFunctions[@(className)]) { + if (self.registeredNSHelperFunctions[className]) { [self logAtLevel:LS_LOG_WARN withMessage:[NSString stringWithFormat:@"registerPushNSHelper:forClass:%s already defined at %@", - className, - self.registeredNSHelperLocations[@(className)]]] ; + cClassName, + self.registeredNSHelperLocations[className]]] ; } else { - luaL_where(self.L, level) ; - NSString *locationString = @(lua_tostring(self.L, -1)) ; - self.registeredNSHelperLocations[@(className)] = locationString; - self.registeredNSHelperFunctions[@(className)] = [NSValue valueWithPointer:(void *)helperFN]; - lua_pop(self.L, 1) ; + NSString *locationString = getCallerFileName() ; + if (locationString) { + self.registeredNSHelperLocations[className] = locationString; + } else { + self.registeredNSHelperLocations[className] = @"** unable to determine source file **" ; + } + self.registeredNSHelperFunctions[className] = [NSValue valueWithPointer:(void *)helperFN]; allGood = YES ; } } else { @@ -566,6 +878,9 @@ - (BOOL)registerPushNSHelper:(pushNSHelperFunction)helperFN forClass:(const char } - (int)pushNSRect:(NSRect)theRect { + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:2 withMessage:"pushNSRect"]; + lua_newtable(self.L) ; lua_pushnumber(self.L, theRect.origin.x) ; lua_setfield(self.L, -2, "x") ; lua_pushnumber(self.L, theRect.origin.y) ; lua_setfield(self.L, -2, "y") ; @@ -576,6 +891,9 @@ - (int)pushNSRect:(NSRect)theRect { } - (int)pushNSPoint:(NSPoint)thePoint { + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:2 withMessage:"pushNSPoint"]; + lua_newtable(self.L) ; lua_pushnumber(self.L, thePoint.x) ; lua_setfield(self.L, -2, "x") ; lua_pushnumber(self.L, thePoint.y) ; lua_setfield(self.L, -2, "y") ; @@ -584,6 +902,9 @@ - (int)pushNSPoint:(NSPoint)thePoint { } - (int)pushNSSize:(NSSize)theSize { + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:2 withMessage:"pushNSSize"]; + lua_newtable(self.L) ; lua_pushnumber(self.L, theSize.width) ; lua_setfield(self.L, -2, "w") ; lua_pushnumber(self.L, theSize.height) ; lua_setfield(self.L, -2, "h") ; @@ -626,25 +947,30 @@ - (id)luaObjectAtIndex:(int)idx toClass:(const char *)className { return nil ; } -- (BOOL)registerLuaObjectHelper:(luaObjectHelperFunction)helperFN forClass:(const char *)className { +- (BOOL)registerLuaObjectHelper:(luaObjectHelperFunction)helperFN forClass:(const char *)cClassName { BOOL allGood = NO ; -// this hackery assumes that this method is only called from within the luaopen_* function of a module and -// attempts to compensate for a wrapper to "require"... I doubt anyone is actually using it anymore. - int level = (int)[[NSUserDefaults standardUserDefaults] integerForKey:@"HSLuaSkinRegisterRequireLevel"]; - if (level == 0) level = 3 ; + + NSString *className = nil; + @try { + className = @(cClassName); + } @catch (NSException __unused *exception) { + className = nil; + } if (className && helperFN) { - if (self.registeredLuaObjectHelperFunctions[@(className)]) { + if (self.registeredLuaObjectHelperFunctions[className]) { [self logAtLevel:LS_LOG_WARN withMessage:[NSString stringWithFormat:@"registerLuaObjectHelper:forClass:%s already defined at %@", - className, - self.registeredLuaObjectHelperFunctions[@(className)]]] ; + cClassName, + self.registeredLuaObjectHelperFunctions[className]]] ; } else { - luaL_where(self.L, level) ; - NSString *locationString = @(lua_tostring(self.L, -1)) ; - self.registeredLuaObjectHelperLocations[@(className)] = locationString; - self.registeredLuaObjectHelperFunctions[@(className)] = [NSValue valueWithPointer:(void *)helperFN]; - lua_pop(self.L, 1) ; + NSString *locationString = getCallerFileName() ; + if (locationString) { + self.registeredLuaObjectHelperLocations[className] = locationString; + } else { + self.registeredLuaObjectHelperLocations[className] = @"** unable to determine source file **" ; + } + self.registeredLuaObjectHelperFunctions[className] = [NSValue valueWithPointer:(void *)helperFN]; allGood = YES ; } } else { @@ -654,30 +980,40 @@ - (BOOL)registerLuaObjectHelper:(luaObjectHelperFunction)helperFN forClass:(cons return allGood ; } -- (BOOL)registerLuaObjectHelper:(luaObjectHelperFunction)helperFN forClass:(const char *)className withUserdataMapping:(const char *)userdataTag { +- (BOOL)registerLuaObjectHelper:(luaObjectHelperFunction)helperFN forClass:(const char *)className withUserdataMapping:(const char *)cUserdataTag { BOOL allGood = [self registerLuaObjectHelper:helperFN forClass:className]; + NSString *userdataTag = @(cUserdataTag); + if (allGood) - self.registeredLuaObjectHelperUserdataMappings[@(userdataTag)] = @(className); + self.registeredLuaObjectHelperUserdataMappings[userdataTag] = @(className); return allGood ; } -- (BOOL)registerLuaObjectHelper:(luaObjectHelperFunction)helperFN forClass:(const char *)className withUserdataMapping:(const char *)userdataTag andTableMapping:(const char *)tableTag { +- (BOOL)registerLuaObjectHelper:(luaObjectHelperFunction)helperFN forClass:(const char *)className withUserdataMapping:(const char *)cUserdataTag andTableMapping:(const char *)cTableTag { BOOL allGood = [self registerLuaObjectHelper:helperFN forClass:className]; + NSString *userdataTag = @(cUserdataTag); + NSString *tableTag = @(cTableTag); + if (allGood) { - self.registeredLuaObjectHelperUserdataMappings[@(userdataTag)] = @(className); - self.registeredLuaObjectHelperTableMappings[@(tableTag)] = @(className); + self.registeredLuaObjectHelperUserdataMappings[userdataTag] = @(className); + self.registeredLuaObjectHelperTableMappings[tableTag] = @(className); } return allGood ; } -- (BOOL)registerLuaObjectHelper:(luaObjectHelperFunction)helperFN forClass:(const char *)className withTableMapping:(const char *)tableTag { +- (BOOL)registerLuaObjectHelper:(luaObjectHelperFunction)helperFN forClass:(const char *)className withTableMapping:(const char *)cTableTag { BOOL allGood = [self registerLuaObjectHelper:helperFN forClass:className]; + NSString *tableTag = @(cTableTag); + if (allGood) - self.registeredLuaObjectHelperTableMappings[@(tableTag)] = @(className); + self.registeredLuaObjectHelperTableMappings[tableTag] = @(className); return allGood ; } - (NSRect)tableToRectAtIndex:(int)idx { + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:4 withMessage:"tableToRectAtIndex"]; + idx = lua_absindex(self.L, idx) ; if (lua_type(self.L, idx) == LUA_TTABLE) { CGFloat x = (lua_getfield(self.L, idx, "x") == LUA_TNUMBER) ? lua_tonumber(self.L, -1) : 0.0 ; @@ -694,6 +1030,9 @@ - (NSRect)tableToRectAtIndex:(int)idx { } - (NSPoint)tableToPointAtIndex:(int)idx { + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:2 withMessage:"tableToPointAtIndex"]; + idx = lua_absindex(self.L, idx) ; if (lua_type(self.L, idx) == LUA_TTABLE) { CGFloat x = (lua_getfield(self.L, idx, "x") == LUA_TNUMBER) ? lua_tonumber(self.L, -1) : 0.0 ; @@ -708,6 +1047,9 @@ - (NSPoint)tableToPointAtIndex:(int)idx { } - (NSSize)tableToSizeAtIndex:(int)idx { + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:2 withMessage:"tableToSizeAtIndex"]; + idx = lua_absindex(self.L, idx) ; if (lua_type(self.L, idx) == LUA_TTABLE) { CGFloat w = (lua_getfield(self.L, idx, "w") == LUA_TNUMBER) ? lua_tonumber(self.L, -1) : 0.0 ; @@ -723,8 +1065,11 @@ - (NSSize)tableToSizeAtIndex:(int)idx { #pragma mark - Support Functions -// maxn returns the largest integer key in the table +// maxNatIndex returns the largest integer key in the table - (lua_Integer)maxNatIndex:(int)idx { + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:3 withMessage:"maxNatIndex"]; + idx = lua_absindex(self.L, idx) ; lua_Integer max = 0; if (lua_type(self.L, idx) == LUA_TTABLE) { @@ -743,8 +1088,11 @@ - (lua_Integer)maxNatIndex:(int)idx { return max ; } -// countn returns the number of items of any key type in the table +// countNatIndex returns the number of items of any key type in the table - (lua_Integer)countNatIndex:(int)idx { + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:3 withMessage:"countNatIndex"]; + idx = lua_absindex(self.L, idx) ; lua_Integer max = 0; if (lua_type(self.L, idx) == LUA_TTABLE) { @@ -836,10 +1184,7 @@ - (BOOL)isValidUTF8AtIndex:(int)idx { return YES; } -- (NSString *)getValidUTF8AtIndex:(int)idx { - idx = lua_absindex(self.L, idx) ; - size_t sourceLength ; - unsigned char *src = (unsigned char *)luaL_tolstring(self.L, idx, &sourceLength) ; +- (NSString *)getValidUTF8:(const unsigned char *)src ofLength:(size_t)sourceLength { NSMutableData *dest = [[NSMutableData alloc] init] ; unsigned char nullChar[] = { 0xE2, 0x88, 0x85 } ; @@ -869,20 +1214,42 @@ - (NSString *)getValidUTF8AtIndex:(int)idx { } } + return [[NSString alloc] initWithData:dest encoding:NSUTF8StringEncoding]; +} + +- (NSString *)getValidUTF8AtIndex:(int)idx { + idx = lua_absindex(self.L, idx) ; + size_t sourceLength ; + unsigned char *src = (unsigned char *)luaL_tolstring(self.L, idx, &sourceLength) ; + + NSString *cleanedString = [self getValidUTF8:src ofLength:sourceLength]; // we're done with src, so its safe to pop the stack of luaL_tolstring's value lua_pop(self.L, 1) ; - return [[NSString alloc] initWithData:dest encoding:NSUTF8StringEncoding] ; + return cleanedString; } - (BOOL)requireModule:(const char *)moduleName { + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:2 withMessage:"requireModule"]; + lua_getglobal(self.L, "require"); lua_pushstring(self.L, moduleName) ; return [self protectedCallAndTraceback:1 nresults:1] ; } +- (void)growStack:(int)slots withMessage:(const char *)message { +#if 0 + NSLog(@"growStack: %03d:%s", slots, message); +#endif + luaL_checkstack(self.L, slots, message); +} + #pragma mark - conversionSupport extensions to LuaSkin class - (int)pushNSObject:(id)obj withOptions:(NSUInteger)options alreadySeenObjects:(NSMutableDictionary *)alreadySeen { + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:2 withMessage:"pushNSObject"]; + if (obj) { // NOTE: We catch self-referential loops, do we also need a recursive depth? Will crash at depth of 512... if (alreadySeen[obj]) { @@ -892,6 +1259,16 @@ - (int)pushNSObject:(id)obj withOptions:(NSUInteger)options alreadySeenObjects:( // check for registered helpers + // first check for exact class match + for (id key in self.registeredNSHelperFunctions) { + if ([obj isMemberOfClass: NSClassFromString(key)]) { + pushNSHelperFunction theFunc = (pushNSHelperFunction)[self.registeredNSHelperFunctions[key] pointerValue] ; + int resultAnswer = theFunc(self.L, obj) ; + if (resultAnswer > -1) return resultAnswer ; + } + } + + // if we're still here, check for kind of class (i.e. possible superclass of object) for (id key in self.registeredNSHelperFunctions) { if ([obj isKindOfClass: NSClassFromString(key)]) { pushNSHelperFunction theFunc = (pushNSHelperFunction)[self.registeredNSHelperFunctions[key] pointerValue] ; @@ -936,7 +1313,7 @@ - (int)pushNSObject:(id)obj withOptions:(NSUInteger)options alreadySeenObjects:( } else if ((options & LS_NSIgnoreUnknownTypes) == LS_NSIgnoreUnknownTypes) { [self logVerbose:[NSString stringWithFormat:@"unrecognized type %@; ignoring", NSStringFromClass([obj class])]] ; return 0 ; - }else { + } else { [self logDebug:[NSString stringWithFormat:@"unrecognized type %@; returning nil", NSStringFromClass([obj class])]] ; lua_pushnil(self.L) ; } @@ -949,6 +1326,10 @@ - (int)pushNSObject:(id)obj withOptions:(NSUInteger)options alreadySeenObjects:( - (int)pushNSNumber:(id)obj withOptions:(NSUInteger)options { NSNumber *number = obj ; + + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:2 withMessage:"pushNSNumber"]; + if (number == (id)kCFBooleanTrue) lua_pushboolean(self.L, YES); else if (number == (id)kCFBooleanFalse) @@ -998,13 +1379,30 @@ - (int)pushNSValue:(id)obj withOptions:(__unused NSUInteger)options { NSValue *value = obj; const char *objCType = [value objCType]; - if (strcmp(objCType, @encode(NSPoint))==0) { + // @encode is a compiler directive that can give different results depending upon the + // architecture, so lets compare apples to apples: + static dispatch_once_t onceToken; + static const char *pointEncoding ; + static const char *sizeEncoding ; + static const char *rectEncoding ; + static const char *rangeEncoding ; + dispatch_once(&onceToken, ^{ + pointEncoding = [[NSValue valueWithPoint:NSZeroPoint] objCType] ; + sizeEncoding = [[NSValue valueWithSize:NSZeroSize] objCType] ; + rectEncoding = [[NSValue valueWithRect:NSZeroRect] objCType] ; + rangeEncoding = [[NSValue valueWithRange:NSMakeRange(0,1)] objCType] ; + }); + + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:3 withMessage:"pushNSValue"]; + + if (strcmp(objCType, pointEncoding)==0) { [self pushNSPoint:[value pointValue]] ; - } else if (strcmp(objCType, @encode(NSSize))==0) { + } else if (strcmp(objCType, sizeEncoding)==0) { [self pushNSSize:[value sizeValue]] ; - } else if (strcmp(objCType, @encode(NSRect))==0) { + } else if (strcmp(objCType, rectEncoding)==0) { [self pushNSRect:[value rectValue]] ; - } else if (strcmp(objCType, @encode(NSRange))==0) { + } else if (strcmp(objCType, rangeEncoding)==0) { NSRange holder = [value rangeValue] ; lua_newtable(self.L) ; lua_pushinteger(self.L, (lua_Integer)holder.location) ; lua_setfield(self.L, -2, "location") ; @@ -1030,22 +1428,46 @@ - (int)pushNSValue:(id)obj withOptions:(__unused NSUInteger)options { } - (int)pushNSArray:(id)obj withOptions:(NSUInteger)options alreadySeenObjects:(NSMutableDictionary *)alreadySeen { - NSArray* list = obj; - lua_newtable(self.L); - alreadySeen[obj] = @(luaL_ref(self.L, LUA_REGISTRYINDEX)) ; - lua_rawgeti(self.L, LUA_REGISTRYINDEX, [alreadySeen[obj] intValue]) ; // put it back on the stack - for (id item in list) { - int results = [self pushNSObject:item withOptions:options alreadySeenObjects:alreadySeen]; -// NOTE: This isn't a true representation of the intent of LS_NSIgnoreUnknownTypes as it will actually put `nil` -// in the indexed positions... is that a problem? Keeps the numbering indexing simple, though - if (results == 0) lua_pushnil(self.L) ; - lua_rawseti(self.L, -2, luaL_len(self.L, -2) + 1) ; + if ((options & LS_WithObjectWrapper) == LS_WithObjectWrapper) { + void** valuePtr = lua_newuserdata(self.L, sizeof(NSObject *)) ; + *valuePtr = (__bridge_retained void *)obj ; + luaL_getmetatable(self.L, LuaSkin_UD_TAG) ; + lua_setmetatable(self.L, -2) ; + + lua_newtable(self.L) ; + lua_pushboolean(self.L, ((options & LS_OW_ReadWrite) == LS_OW_ReadWrite)) ; + lua_setfield(self.L, -2, "mutable") ; + lua_pushboolean(self.L, ((options & LS_OW_WithArrayConversion) == LS_OW_WithArrayConversion)) ; + lua_setfield(self.L, -2, "arrayAutoConversion") ; + lua_setuservalue(self.L, -2) ; + lua_pushvalue(self.L, -1) ; + alreadySeen[obj] = @(luaL_ref(self.L, LUA_REGISTRYINDEX)) ; + } else { + NSArray* list = obj; + + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:2 withMessage:"pushNSArray"]; + + lua_newtable(self.L); + alreadySeen[obj] = @(luaL_ref(self.L, LUA_REGISTRYINDEX)) ; + lua_rawgeti(self.L, LUA_REGISTRYINDEX, [alreadySeen[obj] intValue]) ; // put it back on the stack + for (id item in list) { + int results = [self pushNSObject:item withOptions:options alreadySeenObjects:alreadySeen]; + // NOTE: This isn't a true representation of the intent of LS_NSIgnoreUnknownTypes as it will actually put `nil` + // in the indexed positions... is that a problem? Keeps the numbering indexing simple, though + if (results == 0) lua_pushnil(self.L) ; + lua_rawseti(self.L, -2, luaL_len(self.L, -2) + 1) ; + } } return 1 ; } - (int)pushNSSet:(id)obj withOptions:(NSUInteger)options alreadySeenObjects:(NSMutableDictionary *)alreadySeen { NSSet* list = obj; + + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:2 withMessage:"pushNSSet"]; + lua_newtable(self.L); alreadySeen[obj] = @(luaL_ref(self.L, LUA_REGISTRYINDEX)) ; lua_rawgeti(self.L, LUA_REGISTRYINDEX, [alreadySeen[obj] intValue]) ; // put it back on the stack @@ -1059,27 +1481,52 @@ - (int)pushNSSet:(id)obj withOptions:(NSUInteger)options alreadySeenObjects:(NSM } - (int)pushNSDictionary:(id)obj withOptions:(NSUInteger)options alreadySeenObjects:(NSMutableDictionary *)alreadySeen { - NSArray *keys = [obj allKeys]; - NSArray *values = [obj allValues]; - lua_newtable(self.L); - alreadySeen[obj] = @(luaL_ref(self.L, LUA_REGISTRYINDEX)) ; - lua_rawgeti(self.L, LUA_REGISTRYINDEX, [alreadySeen[obj] intValue]) ; // put it back on the stack - for (unsigned long i = 0; i < [keys count]; i++) { - int result = [self pushNSObject:keys[i] withOptions:options alreadySeenObjects:alreadySeen]; - if (result > 0) { - int result2 = [self pushNSObject:values[i] withOptions:options alreadySeenObjects:alreadySeen]; - if (result2 > 0) { - lua_settable(self.L, -3); - } else { - lua_pop(self.L, 1) ; // pop the key since we won't be using it - } - } // else nothing was pushed on the stack, so we don't need to pop anything + if ((options & LS_WithObjectWrapper) == LS_WithObjectWrapper) { + void** valuePtr = lua_newuserdata(self.L, sizeof(NSObject *)) ; + *valuePtr = (__bridge_retained void *)obj ; + luaL_getmetatable(self.L, LuaSkin_UD_TAG) ; + lua_setmetatable(self.L, -2) ; + + lua_newtable(self.L) ; + lua_pushboolean(self.L, ((options & LS_OW_ReadWrite) == LS_OW_ReadWrite)) ; + lua_setfield(self.L, -2, "mutable") ; + lua_pushboolean(self.L, ((options & LS_OW_WithArrayConversion) == LS_OW_WithArrayConversion)) ; + lua_setfield(self.L, -2, "arrayAutoConversion") ; + lua_setuservalue(self.L, -2) ; + lua_pushvalue(self.L, -1) ; + alreadySeen[obj] = @(luaL_ref(self.L, LUA_REGISTRYINDEX)) ; + } else { + NSArray *keys = [obj allKeys]; + NSArray *values = [obj allValues]; + + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:2 withMessage:"pushNSDictionary"]; + + lua_newtable(self.L); + alreadySeen[obj] = @(luaL_ref(self.L, LUA_REGISTRYINDEX)) ; + lua_rawgeti(self.L, LUA_REGISTRYINDEX, [alreadySeen[obj] intValue]) ; // put it back on the stack + for (unsigned long i = 0; i < [keys count]; i++) { + int result = [self pushNSObject:keys[i] withOptions:options alreadySeenObjects:alreadySeen]; + if (result > 0) { + int result2 = [self pushNSObject:values[i] withOptions:options alreadySeenObjects:alreadySeen]; + if (result2 > 0) { + lua_settable(self.L, -3); + } else { + lua_pop(self.L, 1) ; // pop the key since we won't be using it + } + } // else nothing was pushed on the stack, so we don't need to pop anything + } } return 1 ; } - (id)toNSObjectAtIndex:(int)idx withOptions:(NSUInteger)options alreadySeenObjects:(NSMutableDictionary *)alreadySeen { - const char *userdataTag = nil; + const char *cUserdataTag = nil; + NSString *userdataTag = nil; + + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:2 withMessage:"toNSObjectAtIndex"]; + idx = lua_absindex(self.L, idx) ; NSMutableArray *seenObject = alreadySeen[[NSValue valueWithPointer:lua_topointer(self.L, idx)]] ; if (seenObject) { @@ -1135,21 +1582,27 @@ - (id)toNSObjectAtIndex:(int)idx withOptions:(NSUInteger)options alreadySeenObje // userdataTag = (char *)lua_tostring(self.L, -1); // } // lua_pop(self.L, 1); + + if (luaL_testudata(self.L, idx, LuaSkin_UD_TAG)) { + return (__bridge NSObject *)*((void**)luaL_checkudata(self.L, idx, LuaSkin_UD_TAG)) ; + } + lua_pushcfunction(self.L, pushUserdataType) ; lua_pushvalue(self.L, idx) ; if ((lua_pcall(self.L, 1, 1, 0) == LUA_OK) && (lua_type(self.L, -1) == LUA_TSTRING)) { - userdataTag = lua_tostring(self.L, -1); + cUserdataTag = lua_tostring(self.L, -1); } // if the call errors b/c of missing __init in userdata, the error is on the stack, otherwise our result is. // In either case clean up after ourself. lua_pop(self.L, 1) ; - if (userdataTag) { - NSString *classMapping = self.registeredLuaObjectHelperUserdataMappings[@(userdataTag)]; + userdataTag = @(cUserdataTag); + if (cUserdataTag) { + NSString *classMapping = self.registeredLuaObjectHelperUserdataMappings[userdataTag]; if (classMapping) { return [self luaObjectAtIndex:idx toClass:(const char *)[classMapping UTF8String]]; } else { - [self logBreadcrumb:[NSString stringWithFormat:@"unrecognized userdata type %s", userdataTag]] ; + [self logBreadcrumb:[NSString stringWithFormat:@"unrecognized userdata type %s", cUserdataTag]] ; } } // we didn't handle the userdata, so fall through @@ -1171,27 +1624,32 @@ - (id)toNSObjectAtIndex:(int)idx withOptions:(NSUInteger)options alreadySeenObje // Note, options is currently unused in this category method, but it's included here in case a // reason for an NSValue related option comes up -- (id)tableAtIndex:(int)idx withLabel:(const char *)tableTag withOptions:(__unused NSUInteger)options { +- (id)tableAtIndex:(int)idx withLabel:(const char *)cTableTag withOptions:(__unused NSUInteger)options { id result ; + NSString *tableTag = @(cTableTag); + + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:2 withMessage:"tableAtIndex"]; + idx = lua_absindex(self.L, idx) ; - NSString *classMapping = self.registeredLuaObjectHelperTableMappings[@(tableTag)]; + NSString *classMapping = self.registeredLuaObjectHelperTableMappings[tableTag]; if ((classMapping) && self.registeredLuaObjectHelperFunctions[classMapping]) { luaObjectHelperFunction theFunc = (luaObjectHelperFunction)[self.registeredLuaObjectHelperFunctions[classMapping] pointerValue] ; result = theFunc(self.L, idx) ; } else { // check builtins (NSValue) - if (strcmp(tableTag, "NSPoint")==0) { + if (strcmp(cTableTag, "NSPoint")==0) { result = [NSValue valueWithPoint:[self tableToPointAtIndex:idx]] ; - } else if (strcmp(tableTag, "NSSize")==0) { + } else if (strcmp(cTableTag, "NSSize")==0) { result = [NSValue valueWithSize:[self tableToSizeAtIndex:idx]] ; - } else if (strcmp(tableTag, "NSRect")==0) { + } else if (strcmp(cTableTag, "NSRect")==0) { result = [NSValue valueWithRect:[self tableToRectAtIndex:idx]] ; - } else if (strcmp(tableTag, "NSRange")==0) { + } else if (strcmp(cTableTag, "NSRange")==0) { NSRange holder ; holder.location = (lua_getfield(self.L, idx, "location") == LUA_TNUMBER) ? (NSUInteger)lua_tointeger(self.L, -1) : 0 ; holder.length = (lua_getfield(self.L, idx, "length") == LUA_TNUMBER) ? (NSUInteger)lua_tointeger(self.L, -1) : 0 ; lua_pop(self.L, 2) ; result = [NSValue valueWithRange:holder] ; - } else if (strcmp(tableTag, "NSValue")==0) { + } else if (strcmp(cTableTag, "NSValue")==0) { NSData *rawData ; NSString *objCType ; if (lua_getfield(self.L, idx, "data") == LUA_TSTRING) { @@ -1220,6 +1678,10 @@ - (id)tableAtIndex:(int)idx withLabel:(const char *)tableTag withOptions:(__unus - (id)tableAtIndex:(int)idx withOptions:(NSUInteger)options alreadySeenObjects:(NSMutableDictionary *)alreadySeen { id result ; + + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:3 withMessage:"tableAtIndex"]; + idx = lua_absindex(self.L, idx) ; if ((lua_getfield(self.L, idx, "__luaSkinType") == LUA_TSTRING) && ((options & LS_NSRawTables) != LS_NSRawTables)) { @@ -1238,6 +1700,8 @@ - (id)tableAtIndex:(int)idx withOptions:(NSUInteger)options alreadySeenObjects:( if ([result isKindOfClass: [NSArray class]]) { lua_Integer tableLength = [self countNatIndex:idx] ; + // Ensure our Lua stack is large enough for the number of items being pushed + [self growStack:(int)tableLength withMessage:"tableAtIndex->NSArray"]; for (lua_Integer i = 0; i < tableLength ; i++) { lua_geti(self.L, idx, i + 1) ; id val = [self toNSObjectAtIndex:-1 withOptions:options alreadySeenObjects:alreadySeen] ; @@ -1292,30 +1756,134 @@ - (void) logAtLevel:(int)level withMessage:(NSString *)theMessage { } // shorthand -- (void)logVerbose:(NSString *)theMessage { [self logAtLevel:LS_LOG_VERBOSE withMessage:theMessage] ; } -- (void)logDebug:(NSString *)theMessage { [self logAtLevel:LS_LOG_DEBUG withMessage:theMessage] ; } -- (void)logInfo:(NSString *)theMessage { [self logAtLevel:LS_LOG_INFO withMessage:theMessage] ; } -- (void)logWarn:(NSString *)theMessage { [self logAtLevel:LS_LOG_WARN withMessage:theMessage] ; } -- (void)logError:(NSString *)theMessage { [self logAtLevel:LS_LOG_ERROR withMessage:theMessage] ; } -- (void)logBreadcrumb:(NSString *)theMessage { [self logAtLevel:LS_LOG_BREADCRUMB withMessage:theMessage] ; } + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wformat-nonliteral" + +- (void)logVerbose:(NSString *)format, ... { + va_list args; + va_start(args, format); + NSString *theMessage = [[NSString alloc] initWithFormat:format arguments:args]; + [self logAtLevel:LS_LOG_VERBOSE withMessage:theMessage] ; +} + +- (void)logDebug:(NSString *)format, ... { + va_list args; + va_start(args, format); + NSString *theMessage = [[NSString alloc] initWithFormat:format arguments:args]; + [self logAtLevel:LS_LOG_DEBUG withMessage:theMessage] ; +} + +- (void)logInfo:(NSString *)format, ... { + va_list args; + va_start(args, format); + NSString *theMessage = [[NSString alloc] initWithFormat:format arguments:args]; + [self logAtLevel:LS_LOG_INFO withMessage:theMessage] ; +} + +- (void)logWarn:(NSString *)format, ... { + va_list args; + va_start(args, format); + NSString *theMessage = [[NSString alloc] initWithFormat:format arguments:args]; + [self logAtLevel:LS_LOG_WARN withMessage:theMessage] ; +} + +- (void)logError:(NSString *)format, ... { + va_list args; + va_start(args, format); + NSString *theMessage = [[NSString alloc] initWithFormat:format arguments:args]; + [self logAtLevel:LS_LOG_ERROR withMessage:theMessage] ; +} + +- (void)logBreadcrumb:(NSString *)format, ... { + va_list args; + va_start(args, format); + NSString *theMessage = [[NSString alloc] initWithFormat:format arguments:args]; + [self logAtLevel:LS_LOG_BREADCRUMB withMessage:theMessage] ; +} + +- (void)logKnownBug:(NSString *)format, ... { + va_list args; + va_start(args, format); + NSString *message = [[NSString alloc] initWithFormat:format arguments:args]; + + id theDelegate = self.delegate; + + if (theDelegate && [theDelegate respondsToSelector:@selector(logKnownBug:)]) { + [theDelegate logKnownBug:message]; + } else { + NSLog(@"(missing delegate):known bug: %@", message); + } + +} + +#pragma clang diagnostic pop + (void)classLogAtLevel:(int)level withMessage:(NSString *)theMessage { if ([NSThread isMainThread]) { - [[[self class] shared] logAtLevel:level withMessage:theMessage] ; + // the class logging methods *do* use the shared instance, so backup the state/thread in case + // coroutines involved + lua_State *backup = _sharedLuaSkin.L ; + [[[self class] sharedWithState:NULL] logAtLevel:level withMessage:theMessage] ; + _sharedLuaSkin.L = backup ; } else { dispatch_async(dispatch_get_main_queue(), ^{ - [[[self class] shared] logAtLevel:level + // the class logging methods *do* use the shared instance, so backup the state/thread in case + // coroutines involved + lua_State *backup = _sharedLuaSkin.L ; + [[[self class] sharedWithState:NULL] logAtLevel:level withMessage:[@"(secondary thread): " stringByAppendingString:theMessage]] ; + _sharedLuaSkin.L = backup ; }) ; } } -+ (void)logVerbose:(NSString *)theMessage { [[self class] classLogAtLevel:LS_LOG_VERBOSE withMessage:theMessage]; } -+ (void)logDebug:(NSString *)theMessage { [[self class] classLogAtLevel:LS_LOG_DEBUG withMessage:theMessage]; } -+ (void)logInfo:(NSString *)theMessage { [[self class] classLogAtLevel:LS_LOG_INFO withMessage:theMessage]; } -+ (void)logWarn:(NSString *)theMessage { [[self class] classLogAtLevel:LS_LOG_WARN withMessage:theMessage]; } -+ (void)logError:(NSString *)theMessage { [[self class] classLogAtLevel:LS_LOG_ERROR withMessage:theMessage]; } -+ (void)logBreadcrumb:(NSString *)theMessage { [[self class] classLogAtLevel:LS_LOG_BREADCRUMB withMessage:theMessage]; } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wformat-nonliteral" + ++ (void)logVerbose:(NSString *)format, ... { + va_list args; + va_start(args, format); + NSString *theMessage = [[NSString alloc] initWithFormat:format arguments:args]; + [self classLogAtLevel:LS_LOG_VERBOSE withMessage:theMessage] ; +} + ++ (void)logDebug:(NSString *)format, ... { + va_list args; + va_start(args, format); + NSString *theMessage = [[NSString alloc] initWithFormat:format arguments:args]; + [self classLogAtLevel:LS_LOG_DEBUG withMessage:theMessage] ; +} + ++ (void)logInfo:(NSString *)format, ... { + va_list args; + va_start(args, format); + NSString *theMessage = [[NSString alloc] initWithFormat:format arguments:args]; + [self classLogAtLevel:LS_LOG_INFO withMessage:theMessage] ; +} + ++ (void)logWarn:(NSString *)format, ... { + va_list args; + va_start(args, format); + NSString *theMessage = [[NSString alloc] initWithFormat:format arguments:args]; + [self classLogAtLevel:LS_LOG_WARN withMessage:theMessage] ; +} + ++ (void)logError:(NSString *)format, ... { + va_list args; + va_start(args, format); + NSString *theMessage = [[NSString alloc] initWithFormat:format arguments:args]; + [self classLogAtLevel:LS_LOG_ERROR withMessage:theMessage] ; +} + ++ (void)logBreadcrumb:(NSString *)format, ... { + va_list args; + va_start(args, format); + NSString *theMessage = [[NSString alloc] initWithFormat:format arguments:args]; + [self classLogAtLevel:LS_LOG_BREADCRUMB withMessage:theMessage] ; +} + +#pragma clang diagnostic pop - (NSString *)tracebackWithTag:(NSString *)theTag fromStackPos:(int)level{ int topIndex = lua_gettop(self.L) ; diff --git a/LuaSkin/LuaSkin/luaskin.lua b/LuaSkin/LuaSkin/luaskin.lua index b09a65574..48bdf60d4 100644 --- a/LuaSkin/LuaSkin/luaskin.lua +++ b/LuaSkin/LuaSkin/luaskin.lua @@ -1,8 +1,11 @@ -local ls = {} +local USERDATA_TAG = "luaskin.objectWrapper" + +local ls = _G["ls"] +local owMT = debug.getregistry()[USERDATA_TAG] -- private variables and methods ----------------------------------------- --- copied from `hs.fnutils` to keep this file independant of Hammerspoon +-- copied from `hs.fnutils` to keep this file independent of Hammerspoon -- sorts a key-value table by the keys and returns an iterator function usable by the lua `for` command local _sortByKeys = function(t, f) -- a default, simple comparison that treats keys as strings only if their types differ @@ -32,7 +35,7 @@ _kMetaTable._k = setmetatable({}, {__mode = "k"}) _kMetaTable._t = setmetatable({}, {__mode = "k"}) _kMetaTable.__index = function(obj, key) if _kMetaTable._k[obj] then - if _kMetaTable._k[obj][key] then + if type(_kMetaTable._k[obj][key]) ~= "nil" then return _kMetaTable._k[obj][key] else for k,v in pairs(_kMetaTable._k[obj]) do @@ -103,6 +106,60 @@ end -- Public interface ------------------------------------------------------ +owMT.__pairs = function(self) + local keys, values = self:children(), {} + for _, v in ipairs(keys) do values[v] = self[v] end + return function(_, k) + local v + k, v = next(values, k) + return k, v + end, self, nil +end + +owMT.__index = function(self, key) + return rawget(owMT, key) or owMT.__index2(self, key) +end + ls.makeConstantsTable = _makeConstantsTable -_G["ls"] = ls +ls.deprecated = function(module, name, message) + assert(type(module) == "table", "expected module table for argument 1") + assert(type(name) == "string", "expected string specifying function name for argument 2") + assert(type(message) == "string", "expected string specifying deprecation message for argument 3") + + local shortName = name:match("%.([%w_]+)$") or name + assert(module[shortName] == nil, string.format("%s defined in module; can't deprecate", name)) + + module[shortName] = function(...) -- luacheck: ignore + error(string.format("%s has been deprecated; %s", name, message), 2) + end +end + +local warningsIssued = {} + +ls.deprecationWarning = function(module, name, message, fn) + assert(type(module) == "table", "expected module table for argument 1") + assert(type(name) == "string", "expected string specifying function name for argument 2") + assert(type(message) == "string", "expected string specifying deprecation message for argument 3") + + local shortName = name:match("%.([%w_]+)$") or name + if type(fn) == "nil" then fn = module[shortName] end + if type(module[shortName]) ~= "nil" then + assert(module[shortName] == fn, "if function predefined, specified function must match or be nil") + end + assert(type(fn) == "function" or (getmetatable(fn) or {}).__call, "expected function for argument 4") + + -- use math.random instead of hs.host.uuid to keep this non hammerspoon specific + local uniqueKey = math.random(1000000) + while type(warningsIssued[uniqueKey]) ~= "nil" do uniqueKey = math.random(1000000) end + + warningsIssued[uniqueKey] = false + module[shortName] = function(...) + if not warningsIssued[uniqueKey] then + warningsIssued[uniqueKey] = true + if hs and hs.openConsole then hs.openConsole() end + print(string.format("%s has been deprecated and may go away in the future; %s", name, message)) + end + return fn(...) + end +end diff --git a/LuaSkin/LuaSkin/luaskin.m b/LuaSkin/LuaSkin/luaskin.m new file mode 100644 index 000000000..ae5783033 --- /dev/null +++ b/LuaSkin/LuaSkin/luaskin.m @@ -0,0 +1,374 @@ +// @import Cocoa ; +// @import LuaSkin ; + +#import "Skin.h" + +static int refTable = LUA_NOREF; + +#define get_objectFromUserdata(objType, L, idx, tag) (objType*)*((void**)luaL_checkudata(L, idx, tag)) + +#pragma mark - Support Functions and Classes + +static void swapOutObjectInUserdata(lua_State *L, int idx, NSObject *obj, NSObject *newObj) { + LuaSkin *skin = [LuaSkin sharedWithState:L] ; + + // change existing userdata: release old object and retain new one + void** valuePtr = lua_touserdata(L, idx) ; + +#pragma clang diagnostic push +#if __has_warning("-Wunused-but-set-variable") +#pragma clang diagnostic ignored "-Wunused-but-set-variable" +#endif + NSObject *holding = (__bridge_transfer NSObject *)(*valuePtr) ; +#pragma clang diagnostic pop + *valuePtr = (__bridge_retained void *)newObj ; + holding = nil ; + + // get position in parent and change to newObj + lua_getuservalue(L, idx) ; + lua_getfield(L, -1, "_parent") ; + if (luaL_testudata(L, -1, LuaSkin_UD_TAG)) { + NSObject *parent = get_objectFromUserdata(__bridge NSObject, L, -1, LuaSkin_UD_TAG) ; + if ([parent isKindOfClass:[NSMutableArray class]]) { + NSUInteger arrayIndex = [(NSMutableArray *)parent indexOfObject:obj] ; + if (arrayIndex != NSNotFound) { + ((NSMutableArray *)parent)[arrayIndex] = newObj ; + } else { + [skin logWarn:[NSString stringWithFormat:@"%s.__newindex - original object '%@' not found in parent array", LuaSkin_UD_TAG, obj.description]] ; + } + } else if ([parent isKindOfClass:[NSMutableDictionary class]]) { + NSArray *keyList = [(NSMutableDictionary *)parent allKeysForObject:obj] ; + if (keyList.count > 0) { + [keyList enumerateObjectsUsingBlock:^(NSObject *key, __unused NSUInteger klIdx, __unused BOOL *stop) { + ((NSMutableDictionary *)parent)[(id )key] = newObj ; + }] ; + } else { + [skin logWarn:[NSString stringWithFormat:@"%s.__newindex - original object '%@' not found in parent dictionary", LuaSkin_UD_TAG, obj.description]] ; + } + } else { + [skin logWarn:[NSString stringWithFormat:@"%s.__newindex - expected array or dictionary for parent; found %@", LuaSkin_UD_TAG, parent.className]] ; + } + } + lua_pop(L, 2) ; +} + +#pragma mark - Module Functions + +static int obj_new(lua_State *L) { + LuaSkin *skin = [LuaSkin sharedWithState:L] ; + [skin checkArgs:LS_TANY, LS_TBOOLEAN | LS_TOPTIONAL, LS_TBOOLEAN | LS_TOPTIONAL, LS_TBREAK] ; + NSObject *obj = [skin toNSObjectAtIndex:1] ; + LS_NSConversionOptions options = LS_WithObjectWrapper ; + if (obj) { + if ((lua_gettop(L) > 1) && lua_toboolean(L, 2)) options |= LS_OW_ReadWrite ; + if ((lua_gettop(L) > 2) && lua_toboolean(L, 3)) options |= LS_OW_WithArrayConversion ; + } + [skin pushNSObject:obj withOptions:options] ; + + return 1 ; +} + +#pragma mark - Module Methods + +static int obj_isReadOnly(lua_State *L) { + LuaSkin *skin = [LuaSkin sharedWithState:L] ; + [skin checkArgs:LS_TWRAPPEDOBJECT, LS_TBREAK] ; + NSObject *obj = [skin toNSObjectAtIndex:1] ; + + BOOL isMutable = [obj isKindOfClass:[NSMutableArray class]] || + [obj isKindOfClass:[NSMutableDictionary class]] ; + + lua_getuservalue(L, 1) ; + lua_getfield(L, -1, "mutable") ; + isMutable = isMutable && lua_toboolean(L, -1) ; + lua_pop(L, 2) ; + + lua_pushboolean(L, !isMutable) ; + return 1 ; +} + +static int obj_children(lua_State *L) { + LuaSkin *skin = [LuaSkin sharedWithState:L] ; + [skin checkArgs:LS_TWRAPPEDOBJECT, LS_TBREAK] ; + NSObject *obj = [skin toNSObjectAtIndex:1] ; + + if ([obj isKindOfClass:[NSArray class]]) { + lua_newtable(L) ; + for (NSUInteger i = 0 ; i < [(NSArray *)obj count] ; i++) { + lua_pushinteger(L, (lua_Integer)(i + 1)) ; + lua_rawseti(L, -2, luaL_len(L, -2) + 1) ; + } + } else if ([obj isKindOfClass:[NSDictionary class]]) { + [skin pushNSObject:[(NSDictionary *)obj allKeys]] ; + } else { + lua_pushnil(L) ; + } + + return 1 ; +} + +static int obj_value(lua_State *L) { + LuaSkin *skin = [LuaSkin sharedWithState:L] ; + [skin checkArgs:LS_TWRAPPEDOBJECT, LS_TBREAK] ; + NSObject *obj = [skin toNSObjectAtIndex:1] ; + + [skin pushNSObject:obj withOptions:LS_NSDescribeUnknownTypes] ; + return 1 ; +} + +#pragma mark - Module Constants + +#pragma mark - objectWrapper metaFunctions + +static int obj_ud_index(lua_State *L) { + LuaSkin *skin = [LuaSkin sharedWithState:L] ; + NSObject *obj = get_objectFromUserdata(__bridge NSObject, L, 1, LuaSkin_UD_TAG) ; + NSObject *ans = nil ; + + if ([obj isKindOfClass:[NSArray class]] || [obj isKindOfClass:[NSDictionary class]]) { + int type = lua_type(L, 2) ; + if (type == LUA_TNUMBER && lua_isinteger(L, 2)) { + lua_Integer lIdx = lua_tointeger(L, 2) ; + if ([obj isKindOfClass:[NSArray class]]) { + if (lIdx < 1 || lIdx > (lua_Integer)[(NSArray *)obj count]) { + ans = nil ; + } else { + ans = [(NSArray *)obj objectAtIndex:(NSUInteger)(lIdx - 1)] ; + } + } else if ([obj isKindOfClass:[NSDictionary class]]) { + ans = [(NSDictionary *)obj objectForKey:@(lIdx)] ; + } else { + ans = nil ; + } + } else if (type == LUA_TSTRING) { + NSString *lKey = [skin toNSObjectAtIndex:2] ; + if ([obj isKindOfClass:[NSDictionary class]]) { + ans = [(NSDictionary *)obj objectForKey:lKey] ; + } else { + ans = nil ; + } + } else { + ans = nil ; + } + } else if ([obj isKindOfClass:[NSString class]]) { + // should be impossible for this implementation, but in case we copy this into something more + // generic, lets include it since strings can apparently be index in lua, but always return nil + ans = nil ; + } else { + return luaL_error(L, "attempt to index a %s value", obj.className.UTF8String) ; + } + + [skin pushNSObject:ans withOptions:LS_WithObjectWrapper | LS_NSDescribeUnknownTypes] ; + if (luaL_testudata(L, -1, LuaSkin_UD_TAG)) { + lua_getuservalue(L, -1) ; + lua_getuservalue(L, 1) ; + lua_pushnil(L) ; + while (lua_next(L, -2) != 0) { + const char *key = lua_tostring(L, -2) ; + if (strcmp("_parent", key)) { // i.e. does not equal + lua_setfield(L, -4, key) ; + } else { + lua_pop(L, 1) ; + } + } + lua_pop(L, 1) ; + lua_pushvalue(L, 1) ; + lua_setfield(L, -2, "_parent") ; + lua_setuservalue(L, -2) ; + } + return 1 ; +} + +static int obj_ud_newindex(lua_State *L) { + LuaSkin *skin = [LuaSkin sharedWithState:L] ; + NSObject *obj = get_objectFromUserdata(__bridge NSObject, L, 1, LuaSkin_UD_TAG) ; + BOOL isMutable = [obj isKindOfClass:[NSMutableArray class]] || + [obj isKindOfClass:[NSMutableDictionary class]] ; + BOOL arrayAutoConversion = NO ; + + lua_getuservalue(L, 1) ; + lua_getfield(L, -1, "mutable") ; + isMutable = isMutable && lua_toboolean(L, -1) ; + lua_getfield(L, -2, "arrayAutoConversion") ; + arrayAutoConversion = (BOOL)(lua_toboolean(L, -1)) ; + lua_pop(L, 3) ; + + if (isMutable) { +// return luaL_error(L, "modification of mutable objects not supported yet") ; + + if ([obj isKindOfClass:[NSMutableArray class]]) { + NSObject *value = [skin toNSObjectAtIndex:3 withOptions:LS_NSDescribeUnknownTypes] ; + + if (lua_isinteger(L, 2)) { + NSUInteger count = [(NSMutableArray *)obj count] ; + lua_Integer idx = lua_tointeger(L, 2) ; + if (idx > 0) { + if (value) { + while ((NSUInteger)idx > count) { + count++ ; + [(NSMutableArray *)obj addObject:[NSNull null]] ; + } + ((NSMutableArray *)obj)[(NSUInteger)(idx - 1)] = value ; + } else if ((NSUInteger)idx < count) { + ((NSMutableArray *)obj)[(NSUInteger)(idx - 1)] = [NSNull null] ; + } else if ((NSUInteger)idx == count) { + [(NSMutableArray *)obj removeLastObject] ; + } + return 0 ; + } // if it's a float or < 1 then we fall through for conversion to dictionary, if allowed + } + + if (value) { + if (arrayAutoConversion) { + NSObject *key = [skin toNSObjectAtIndex:2] ; + NSMutableDictionary *newObj = [NSMutableDictionary dictionaryWithCapacity:[(NSMutableArray *)obj count] + 1] ; + newObj[(id )key] = value ; + [(NSArray *)obj enumerateObjectsUsingBlock:^(NSObject *item, NSUInteger idx, __unused BOOL *stop) { + newObj[@(idx + 1)] = item ; + }] ; + + swapOutObjectInUserdata(L, 1, obj, newObj) ; + } else { + return luaL_error(L, "invalid key '%s'; expected integer equal to or greater than 1", obj.description.UTF8String) ; + } + } // else if value was nil, it doesn't really matter that the key type was invalid for an array + } else if ([obj isKindOfClass:[NSMutableDictionary class]]) { + NSObject *key = [skin toNSObjectAtIndex:2] ; + NSObject *value = [skin toNSObjectAtIndex:3 withOptions:LS_NSDescribeUnknownTypes] ; + if (key) { + if (value) { + [(NSMutableDictionary *)obj setObject:value forKey:(id )key] ; + } else { + [(NSMutableDictionary *)obj removeObjectForKey:(id )key] ; + } + if (arrayAutoConversion) { + NSUInteger totalKeys = [(NSMutableDictionary *)obj count] ; + NSUInteger count = 0 ; + while (((NSDictionary *)obj)[@(count + 1)]) count++ ; + if (totalKeys == count) { + NSMutableArray *newObj = [NSMutableArray arrayWithCapacity:totalKeys] ; + count = 0 ; + while (((NSDictionary *)obj)[@(count + 1)]) { + NSObject *item = ((NSDictionary *)obj)[@(count + 1)] ; + [newObj addObject:item] ; + count++ ; + } + + swapOutObjectInUserdata(L, 1, obj, newObj) ; + } + } + } else { + return luaL_error(L, "invalid key; %s is not a valid key type", lua_typename(L, lua_type(L, 2))) ; + } + } else { + return luaL_error(L, "expected array or dictionary; found %s", obj.className.UTF8String) ; + } + } else { + return luaL_error(L, "read-only object") ; + } + return 0 ; +} + +static int obj_ud_len(lua_State *L) { + NSObject *obj = get_objectFromUserdata(__bridge NSObject, L, 1, LuaSkin_UD_TAG) ; + if ([obj isKindOfClass:[NSArray class]]) { + lua_pushinteger(L, (lua_Integer)[(NSArray *)obj count]) ; + } else if ([obj isKindOfClass:[NSDictionary class]]) { + lua_Integer len = 0 ; + while (((NSDictionary *)obj)[@(len + 1)]) len++ ; + lua_pushinteger(L, len) ; + } else if ([obj isKindOfClass:[NSString class]]) { + // should be impossible for this implementation, but in case we copy this into something more + // generic, lets include it since strings can return a length in lua + lua_pushinteger(L, (lua_Integer)[(NSString *)obj lengthOfBytesUsingEncoding:NSUTF8StringEncoding]) ; + } else { + return luaL_error(L, "attempt to get length of a %s value", obj.className.UTF8String) ; + } + return 1 ; +} + +static int obj_ud_tostring(lua_State *L) { + LuaSkin *skin = [LuaSkin sharedWithState:L] ; + NSObject *obj = get_objectFromUserdata(__bridge NSObject, L, 1, LuaSkin_UD_TAG) ; + NSString *title = [(NSObject *)obj className] ; + [skin pushNSObject:[NSString stringWithFormat:@"%s: %@ (%p)", LuaSkin_UD_TAG, title, lua_topointer(L, 1)]] ; + return 1 ; +} + +static int obj_ud_eq(lua_State *L) { +// can't get here if at least one of us isn't a userdata type, and we only care if both types are ours, +// so use luaL_testudata before the macro causes a lua error + if (luaL_testudata(L, 1, LuaSkin_UD_TAG) && luaL_testudata(L, 2, LuaSkin_UD_TAG)) { + NSObject *obj1 = get_objectFromUserdata(__bridge NSObject, L, 1, LuaSkin_UD_TAG) ; + NSObject *obj2 = get_objectFromUserdata(__bridge NSObject, L, 2, LuaSkin_UD_TAG) ; + lua_pushboolean(L, [obj1 isEqualTo:obj2]) ; + } else { + lua_pushboolean(L, NO) ; + } + return 1 ; +} + +static int obj_ud_gc(lua_State *L) { +#pragma clang diagnostic push +#if __has_warning("-Wunused-but-set-variable") +#pragma clang diagnostic ignored "-Wunused-but-set-variable" +#endif + NSObject *obj = get_objectFromUserdata(__bridge_transfer NSObject, L, 1, LuaSkin_UD_TAG) ; +#pragma clang diagnostic pop + obj = nil ; + + // Remove the Metatable so future use of the variable in Lua won't think its valid + lua_pushnil(L) ; + lua_setmetatable(L, 1) ; + + return 0 ; +} + +#pragma mark - Hammerspoon/Lua Infrastructure + +// Metatable for userdata objects +static const luaL_Reg userdata_metaLib[] = { + {"children", obj_children}, + {"value", obj_value}, + {"isReadonly", obj_isReadOnly}, + +// __index will be set in LuaSkin registration, so wrap we'll wrap it in init.lua to call this + {"__index2", obj_ud_index}, + {"__newindex", obj_ud_newindex}, + {"__len", obj_ud_len}, +// wrapped in init.lua +// {"__pairs", obj_ud_pairs}, + {"__tostring", obj_ud_tostring}, + {"__eq", obj_ud_eq}, + {"__gc", obj_ud_gc}, + {NULL, NULL} +}; + +// Functions for returned object when module loads +static luaL_Reg moduleLib[] = { + {"newObject", obj_new}, + {NULL, NULL} +}; + +int luaopen_luaskin_internal(lua_State* L) { +// we can't use LuaSkin yet because we're still within createLuaState + luaL_newlib(L, userdata_metaLib) ; + lua_pushvalue(L, -1) ; + lua_setfield(L, -2, "__index") ; + lua_pushstring(L, LuaSkin_UD_TAG) ; + lua_setfield(L, -2, "__type") ; + lua_pushstring(L, LuaSkin_UD_TAG) ; + lua_setfield(L, -2, "__name") ; + lua_setfield(L, LUA_REGISTRYINDEX, LuaSkin_UD_TAG) ; + + luaL_newlib(L, moduleLib) ; + lua_newtable(L) ; + int tmpRefTable = luaL_ref(L, LUA_REGISTRYINDEX) ; + lua_pushinteger(L, tmpRefTable) ; + lua_setfield(L, -2, "__refTable") ; + refTable = tmpRefTable ; + + lua_setglobal(L, "ls") ; + + return 0 ; +} diff --git a/LuaSkin/LuaSkinTests/LuaSkinTests.m b/LuaSkin/LuaSkinTests/LuaSkinTests.m index 0a69796c8..c8ea32320 100644 --- a/LuaSkin/LuaSkinTests/LuaSkinTests.m +++ b/LuaSkin/LuaSkinTests/LuaSkinTests.m @@ -8,7 +8,8 @@ #import #import -#import "Skin.h" +@import LuaSkin; +//#import "Skin.h" #pragma mark - Defines @@ -142,7 +143,7 @@ - (void)logForLuaSkinAtLevel:(int)level withMessage:(NSString *)theMessage { @interface LuaSkinTests : XCTestCase @property LuaSkin *skin; -@property int refTable; +@property LSRefTable refTable; @property int evalfn; @end @@ -152,7 +153,7 @@ @implementation LuaSkinTests - (void)setUp { [super setUp]; - self.skin = [[LuaSkin alloc] init]; + self.skin = [LuaSkin sharedWithState:NULL]; libraryGCCalled = NO; libraryObjectGCCalled = NO; @@ -201,7 +202,7 @@ - (void)setUp { } - (void)tearDown { - [self.skin destroyLuaState]; + [self.skin resetLuaState]; [super tearDown]; } @@ -285,7 +286,7 @@ - (void)testSkinInit { } - (void)testSingletonality { - XCTAssertEqual([LuaSkin shared], [LuaSkin shared]); + XCTAssertEqual([LuaSkin sharedWithState:NULL], [LuaSkin sharedWithState:NULL]); } - (void)testBackgroundThreadCatcher { @@ -293,7 +294,7 @@ - (void)testBackgroundThreadCatcher { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){ @try { - LuaSkin *bg_skin = [LuaSkin shared]; + LuaSkin *bg_skin = [LuaSkin sharedWithState:NULL]; NSLog(@"Created skin: %@", bg_skin); // This should never be executed } @catch (NSException *exception) { @@ -361,19 +362,19 @@ - (void)testLuaCanFailToExecute { - (void)testProtectedCall { int loadResult = luaL_loadstring(self.skin.L, "print('Lua protected execution works')"); XCTAssertFalse(loadResult); - BOOL pcallResult = [self.skin protectedCallAndTraceback:0 nresults:0]; + BOOL pcallResult = [self.skin protectedCallAndError:@"testProtectedCall" nargs:0 nresults:0]; XCTAssertTrue(pcallResult); } - (void)testProtectedCallWithFailure { int loadResult = luaL_loadstring(self.skin.L, "require('impossible_module')"); XCTAssertFalse(loadResult); - BOOL pcallResult = [self.skin protectedCallAndTraceback:0 nresults:0]; + BOOL pcallResult = [self.skin protectedCallAndError:@"testProtectedCallWithFailure" nargs:0 nresults:0]; XCTAssertFalse(pcallResult); } - (void)testLibrary { - [self.skin registerLibrary:functions metaFunctions:metaFunctions]; + [self.skin registerLibrary:"testLibrary" functions:functions metaFunctions:metaFunctions]; // Normally we'd be returning to a luaopen_ function after registerLibrary, and thus the library would be inserted into the right namespace. Since we're not doing that here, we'll just go ahead and register it as a global, using the library name lua_setglobal(self.skin.L, libraryTestName); @@ -506,6 +507,30 @@ - (void)testCheckArgs { // It seems like we need to set a lua_atpanic() function and have that long jump to safety to prevent the abort(), but what can we jump to? } +- (void)testCheckRefs { + int valid = 4; + int also_valid = 28; + int not_valid = LUA_REFNIL; + int also_not_valid = LUA_NOREF; + + XCTAssertTrue(LS_RBREAK < LUA_REFNIL); + XCTAssertTrue(LS_RBREAK < LUA_NOREF); + + BOOL result; + + result = [self.skin checkRefs:valid, LS_RBREAK]; + XCTAssertTrue(result); + result = [self.skin checkRefs:valid, also_valid, LS_RBREAK]; + XCTAssertTrue(result); + + result = [self.skin checkRefs:not_valid, LS_RBREAK]; + XCTAssertFalse(result); + result = [self.skin checkRefs:not_valid, also_not_valid, LS_RBREAK]; + XCTAssertFalse(result); + result = [self.skin checkRefs:valid, not_valid, LS_RBREAK]; + XCTAssertFalse(result); +} + - (void)testLuaTypeAtIndex { lua_State *L = self.skin.L ; @@ -931,7 +956,7 @@ - (void)testTableWithLabelToNSValue { XCTAssertEqual(95.7, holder.d); XCTAssertEqual(-101, holder.i); XCTAssertEqual(101, holder.ui); - + } - (void)testIsValidUTF8AtIndex { @@ -945,7 +970,7 @@ - (void)testIsValidUTF8AtIndex { lua_pushstring(self.skin.L, "hello\x81there"); XCTAssertFalse([self.skin isValidUTF8AtIndex:-1]); - // FIXME: Thie should have lots more tests, including some that contain invalid UTF8 + // FIXME: This should have lots more tests, including some that contain invalid UTF8 } - (void) testMaxNatIndexAndCountNatIndex { @@ -966,7 +991,7 @@ - (void)testLogging { XCTestExpectation *expectation = nil; dispatch_block_t logBlock = ^{ - self.skin = [LuaSkin shared]; + self.skin = [LuaSkin sharedWithState:NULL]; LSTestDelegate *testDelegate = [[LSTestDelegate alloc] init]; self.skin.delegate = testDelegate; @@ -1076,7 +1101,7 @@ - (void)testLuaObjectHelper { } - (void)testObjCExceptionHandler { - [self.skin registerLibrary:functions metaFunctions:metaFunctions]; + [self.skin registerLibrary:"LuaSkinTests" functions:functions metaFunctions:metaFunctions]; // Normally we'd be returning to a luaopen_ function after registerLibrary, and thus the library would be inserted into the right namespace. Since we're not doing that here, we'll just go ahead and register it as a global, using the library name lua_setglobal(self.skin.L, libraryTestName); diff --git a/LuaSkin/LuaSkinTests/lsunit.lua b/LuaSkin/LuaSkinTests/lsunit.lua index b918f7abb..236cdd11d 100644 --- a/LuaSkin/LuaSkinTests/lsunit.lua +++ b/LuaSkin/LuaSkinTests/lsunit.lua @@ -32,7 +32,7 @@ function success() end function errorMsgEquality(expected, actual) - return string.format("expected: %s, actual: %s", expected, actual) + return string.format("expected: '%s', actual: '%s'", expected, actual) end -- Assertions @@ -77,7 +77,7 @@ end function assertIsNotNil(a) if a == nil then - failure("expected: nil, actual: "..tostring(a)) + failure("expected: not-nil, actual: "..tostring(a)) end end diff --git a/LuaSkin/lua-5.3.4/Makefile b/LuaSkin/lua-5.3.4/Makefile deleted file mode 100644 index 119110d2f..000000000 --- a/LuaSkin/lua-5.3.4/Makefile +++ /dev/null @@ -1,114 +0,0 @@ -# Makefile for installing Lua -# See doc/readme.html for installation and customization instructions. - -# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= - -# Your platform. See PLATS for possible values. -PLAT= none - -# Where to install. The installation starts in the src and doc directories, -# so take care if INSTALL_TOP is not an absolute path. See the local target. -# You may want to make INSTALL_LMOD and INSTALL_CMOD consistent with -# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h. -INSTALL_TOP= /usr/local -INSTALL_BIN= $(INSTALL_TOP)/bin -INSTALL_INC= $(INSTALL_TOP)/include -INSTALL_LIB= $(INSTALL_TOP)/lib -INSTALL_MAN= $(INSTALL_TOP)/man/man1 -INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V -INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V - -# How to install. If your install program does not support "-p", then -# you may have to run ranlib on the installed liblua.a. -INSTALL= install -p -INSTALL_EXEC= $(INSTALL) -m 0755 -INSTALL_DATA= $(INSTALL) -m 0644 -# -# If you don't have "install" you can use "cp" instead. -# INSTALL= cp -p -# INSTALL_EXEC= $(INSTALL) -# INSTALL_DATA= $(INSTALL) - -# Other utilities. -MKDIR= mkdir -p -RM= rm -f - -# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE ======= - -# Convenience platforms targets. -PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris - -# What to install. -TO_BIN= lua luac -TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp -TO_LIB= liblua.a -TO_MAN= lua.1 luac.1 - -# Lua version and release. -V= 5.3 -R= $V.4 - -# Targets start here. -all: $(PLAT) - -$(PLATS) clean: - cd src && $(MAKE) $@ - -test: dummy - src/lua -v - -install: dummy - cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD) - cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN) - cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) - cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) - cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) - -uninstall: - cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN) - cd src && cd $(INSTALL_INC) && $(RM) $(TO_INC) - cd src && cd $(INSTALL_LIB) && $(RM) $(TO_LIB) - cd doc && cd $(INSTALL_MAN) && $(RM) $(TO_MAN) - -local: - $(MAKE) install INSTALL_TOP=../install - -none: - @echo "Please do 'make PLATFORM' where PLATFORM is one of these:" - @echo " $(PLATS)" - @echo "See doc/readme.html for complete instructions." - -# make may get confused with test/ and install/ -dummy: - -# echo config parameters -echo: - @cd src && $(MAKE) -s echo - @echo "PLAT= $(PLAT)" - @echo "V= $V" - @echo "R= $R" - @echo "TO_BIN= $(TO_BIN)" - @echo "TO_INC= $(TO_INC)" - @echo "TO_LIB= $(TO_LIB)" - @echo "TO_MAN= $(TO_MAN)" - @echo "INSTALL_TOP= $(INSTALL_TOP)" - @echo "INSTALL_BIN= $(INSTALL_BIN)" - @echo "INSTALL_INC= $(INSTALL_INC)" - @echo "INSTALL_LIB= $(INSTALL_LIB)" - @echo "INSTALL_MAN= $(INSTALL_MAN)" - @echo "INSTALL_LMOD= $(INSTALL_LMOD)" - @echo "INSTALL_CMOD= $(INSTALL_CMOD)" - @echo "INSTALL_EXEC= $(INSTALL_EXEC)" - @echo "INSTALL_DATA= $(INSTALL_DATA)" - -# echo pkg-config data -pc: - @echo "version=$R" - @echo "prefix=$(INSTALL_TOP)" - @echo "libdir=$(INSTALL_LIB)" - @echo "includedir=$(INSTALL_INC)" - -# list targets that do not create files (but not all makes understand .PHONY) -.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho - -# (end of Makefile) diff --git a/LuaSkin/lua-5.3.4/README b/LuaSkin/lua-5.3.4/README deleted file mode 100644 index 0b31908a0..000000000 --- a/LuaSkin/lua-5.3.4/README +++ /dev/null @@ -1,6 +0,0 @@ - -This is Lua 5.3.4, released on 12 Jan 2017. - -For installation instructions, license details, and -further information about Lua, see doc/readme.html. - diff --git a/LuaSkin/lua-5.3.4/doc/lua.1 b/LuaSkin/lua-5.3.4/doc/lua.1 deleted file mode 100644 index d728d0b80..000000000 --- a/LuaSkin/lua-5.3.4/doc/lua.1 +++ /dev/null @@ -1,112 +0,0 @@ -.\" $Id: lua.man,v 1.14 2016/10/17 15:43:50 lhf Exp $ -.TH LUA 1 "$Date: 2016/10/17 15:43:50 $" -.SH NAME -lua \- Lua interpreter -.SH SYNOPSIS -.B lua -[ -.I options -] -[ -.I script -[ -.I args -] -] -.SH DESCRIPTION -.B lua -is the standalone Lua interpreter. -It loads and executes Lua programs, -either in textual source form or -in precompiled binary form. -(Precompiled binaries are output by -.BR luac , -the Lua compiler.) -.B lua -can be used as a batch interpreter and also interactively. -.LP -The given -.I options -are handled in order and then -the Lua program in file -.I script -is loaded and executed. -The given -.I args -are available to -.I script -as strings in a global table named -.BR arg . -If no options or arguments are given, -then -.B "\-v \-i" -is assumed when the standard input is a terminal; -otherwise, -.B "\-" -is assumed. -.LP -In interactive mode, -.B lua -prompts the user, -reads lines from the standard input, -and executes them as they are read. -If the line contains an expression or list of expressions, -then the line is evaluated and the results are printed. -If a line does not contain a complete statement, -then a secondary prompt is displayed and -lines are read until a complete statement is formed or -a syntax error is found. -.LP -At the very start, -before even handling the command line, -.B lua -checks the contents of the environment variables -.B LUA_INIT_5_3 -or -.BR LUA_INIT , -in that order. -If the contents is of the form -.RI '@ filename ', -then -.I filename -is executed. -Otherwise, the string is assumed to be a Lua statement and is executed. -.SH OPTIONS -.TP -.BI \-e " stat" -execute statement -.IR stat . -.TP -.B \-i -enter interactive mode after executing -.IR script . -.TP -.BI \-l " name" -execute the equivalent of -.IB name =require(' name ') -before executing -.IR script . -.TP -.B \-v -show version information. -.TP -.B \-E -ignore environment variables. -.TP -.B \-\- -stop handling options. -.TP -.B \- -stop handling options and execute the standard input as a file. -.SH "SEE ALSO" -.BR luac (1) -.br -The documentation at lua.org, -especially section 7 of the reference manual. -.SH DIAGNOSTICS -Error messages should be self explanatory. -.SH AUTHORS -R. Ierusalimschy, -L. H. de Figueiredo, -W. Celes -.\" EOF diff --git a/LuaSkin/lua-5.3.4/doc/osi-certified-72x60.png b/LuaSkin/lua-5.3.4/doc/osi-certified-72x60.png deleted file mode 100644 index 07df5f6ee..000000000 Binary files a/LuaSkin/lua-5.3.4/doc/osi-certified-72x60.png and /dev/null differ diff --git a/LuaSkin/lua-5.3.4/doc/readme.html b/LuaSkin/lua-5.3.4/doc/readme.html deleted file mode 100644 index 96a9386e2..000000000 --- a/LuaSkin/lua-5.3.4/doc/readme.html +++ /dev/null @@ -1,365 +0,0 @@ - - - -Lua 5.3 readme - - - - - - - -

-Lua -Welcome to Lua 5.3 -

- - - -

About Lua

-

-Lua is a powerful, fast, lightweight, embeddable scripting language -developed by a -team -at -PUC-Rio, -the Pontifical Catholic University of Rio de Janeiro in Brazil. -Lua is -free software -used in many products and projects around the world. - -

-Lua's -official web site -provides complete information -about Lua, -including -an -executive summary -and -updated -documentation, -especially the -reference manual, -which may differ slightly from the -local copy -distributed in this package. - -

Installing Lua

-

-Lua is distributed in -source -form. -You need to build it before using it. -Building Lua should be straightforward -because -Lua is implemented in pure ANSI C and compiles unmodified in all known -platforms that have an ANSI C compiler. -Lua also compiles unmodified as C++. -The instructions given below for building Lua are for Unix-like platforms. -See also -instructions for other systems -and -customization options. - -

-If you don't have the time or the inclination to compile Lua yourself, -get a binary from -LuaBinaries. -Try also -LuaDist, -a multi-platform distribution of Lua that includes batteries. - -

Building Lua

-

-In most Unix-like platforms, simply do "make" with a suitable target. -Here are the details. - -

    -
  1. -Open a terminal window and move to -the top-level directory, which is named lua-5.3.x. -The Makefile there controls both the build process and the installation process. -

    -

  2. - Do "make" and see if your platform is listed. - The platforms currently supported are: -

    -

    - aix bsd c89 freebsd generic linux macosx mingw posix solaris -

    -

    - If your platform is listed, just do "make xxx", where xxx - is your platform name. -

    - If your platform is not listed, try the closest one or posix, generic, - c89, in this order. -

    -

  3. -The compilation takes only a few moments -and produces three files in the src directory: -lua (the interpreter), -luac (the compiler), -and liblua.a (the library). -

    -

  4. - To check that Lua has been built correctly, do "make test" - after building Lua. This will run the interpreter and print its version. -
-

-If you're running Linux and get compilation errors, -make sure you have installed the readline development package -(which is probably named libreadline-dev or readline-devel). -If you get link errors after that, -then try "make linux MYLIBS=-ltermcap". - -

Installing Lua

-

- Once you have built Lua, you may want to install it in an official - place in your system. In this case, do "make install". The official - place and the way to install files are defined in the Makefile. You'll - probably need the right permissions to install files. - -

- To build and install Lua in one step, do "make xxx install", - where xxx is your platform name. - -

- To install Lua locally, do "make local". - This will create a directory install with subdirectories - bin, include, lib, man, share, - and install Lua as listed below. - - To install Lua locally, but in some other directory, do - "make install INSTALL_TOP=xxx", where xxx is your chosen directory. - The installation starts in the src and doc directories, - so take care if INSTALL_TOP is not an absolute path. - -

-
- bin: -
- lua luac -
- include: -
- lua.h luaconf.h lualib.h lauxlib.h lua.hpp -
- lib: -
- liblua.a -
- man/man1: -
- lua.1 luac.1 -
- -

- These are the only directories you need for development. - If you only want to run Lua programs, - you only need the files in bin and man. - The files in include and lib are needed for - embedding Lua in C or C++ programs. - -

Customization

-

- Three kinds of things can be customized by editing a file: -

    -
  • Where and how to install Lua — edit Makefile. -
  • How to build Lua — edit src/Makefile. -
  • Lua features — edit src/luaconf.h. -
- -

- You don't actually need to edit the Makefiles because you may set the - relevant variables in the command line when invoking make. - Nevertheless, it's probably best to edit and save the Makefiles to - record the changes you've made. - -

- On the other hand, if you need to customize some Lua features, you'll need - to edit src/luaconf.h before building and installing Lua. - The edited file will be the one installed, and - it will be used by any Lua clients that you build, to ensure consistency. - Further customization is available to experts by editing the Lua sources. - -

Building Lua on other systems

-

- If you're not using the usual Unix tools, then the instructions for - building Lua depend on the compiler you use. You'll need to create - projects (or whatever your compiler uses) for building the library, - the interpreter, and the compiler, as follows: - -

-
-library: -
-lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c -lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c -ltm.c lundump.c lvm.c lzio.c -lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c -lmathlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c loadlib.c linit.c -
-interpreter: -
- library, lua.c -
-compiler: -
- library, luac.c -
- -

- To use Lua as a library in your own programs you'll need to know how to - create and use libraries with your compiler. Moreover, to dynamically load - C libraries for Lua you'll need to know how to create dynamic libraries - and you'll need to make sure that the Lua API functions are accessible to - those dynamic libraries — but don't link the Lua library - into each dynamic library. For Unix, we recommend that the Lua library - be linked statically into the host program and its symbols exported for - dynamic linking; src/Makefile does this for the Lua interpreter. - For Windows, we recommend that the Lua library be a DLL. - In all cases, the compiler luac should be linked statically. - -

- As mentioned above, you may edit src/luaconf.h to customize - some features before building Lua. - -

Changes since Lua 5.2

-

-Here are the main changes introduced in Lua 5.3. -The -reference manual -lists the -incompatibilities that had to be introduced. - -

Main changes

-
    -
  • integers (64-bit by default) -
  • official support for 32-bit numbers -
  • bitwise operators -
  • basic utf-8 support -
  • functions for packing and unpacking values - -
- -Here are the other changes introduced in Lua 5.3: -

Language

-
    -
  • userdata can have any Lua value as uservalue -
  • floor division -
  • more flexible rules for some metamethods -
- -

Libraries

-
    -
  • ipairs and the table library respect metamethods -
  • strip option in string.dump -
  • table library respects metamethods -
  • new function table.move -
  • new function string.pack -
  • new function string.unpack -
  • new function string.packsize -
- -

C API

-
    -
  • simpler API for continuation functions in C -
  • lua_gettable and similar functions return type of resulted value -
  • strip option in lua_dump -
  • new function: lua_geti -
  • new function: lua_seti -
  • new function: lua_isyieldable -
  • new function: lua_numbertointeger -
  • new function: lua_rotate -
  • new function: lua_stringtonumber -
- -

Lua standalone interpreter

-
    -
  • can be used as calculator; no need to prefix with '=' -
  • arg table available to all code -
- -

License

-

- -[osi certified] - -Lua is free software distributed under the terms of the -MIT license -reproduced below; -it may be used for any purpose, including commercial purposes, -at absolutely no cost without having to ask us. - -The only requirement is that if you do use Lua, -then you should give us credit by including the appropriate copyright notice somewhere in your product or its documentation. - -For details, see -this. - -

-Copyright © 1994–2017 Lua.org, PUC-Rio. - -

-Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -

-The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -

-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -

-

- -

- - - - diff --git a/LuaSkin/lua-5.3.4/src/Makefile b/LuaSkin/lua-5.3.4/src/Makefile deleted file mode 100644 index d71c75c87..000000000 --- a/LuaSkin/lua-5.3.4/src/Makefile +++ /dev/null @@ -1,197 +0,0 @@ -# Makefile for building Lua -# See ../doc/readme.html for installation and customization instructions. - -# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= - -# Your platform. See PLATS for possible values. -PLAT= none - -CC= gcc -std=gnu99 -CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS) -LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) -LIBS= -lm $(SYSLIBS) $(MYLIBS) - -AR= ar rcu -RANLIB= ranlib -RM= rm -f - -SYSCFLAGS= -SYSLDFLAGS= -SYSLIBS= - -MYCFLAGS= -MYLDFLAGS= -MYLIBS= -MYOBJS= - -# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE ======= - -PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris - -LUA_A= liblua.a -CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \ - lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \ - ltm.o lundump.o lvm.o lzio.o -LIB_O= lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o \ - lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o -BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS) - -LUA_T= lua -LUA_O= lua.o - -LUAC_T= luac -LUAC_O= luac.o - -ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O) -ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) -ALL_A= $(LUA_A) - -# Targets start here. -default: $(PLAT) - -all: $(ALL_T) - -o: $(ALL_O) - -a: $(ALL_A) - -$(LUA_A): $(BASE_O) - $(AR) $@ $(BASE_O) - $(RANLIB) $@ - -$(LUA_T): $(LUA_O) $(LUA_A) - $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) - -$(LUAC_T): $(LUAC_O) $(LUA_A) - $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) - -clean: - $(RM) $(ALL_T) $(ALL_O) - -depend: - @$(CC) $(CFLAGS) -MM l*.c - -echo: - @echo "PLAT= $(PLAT)" - @echo "CC= $(CC)" - @echo "CFLAGS= $(CFLAGS)" - @echo "LDFLAGS= $(SYSLDFLAGS)" - @echo "LIBS= $(LIBS)" - @echo "AR= $(AR)" - @echo "RANLIB= $(RANLIB)" - @echo "RM= $(RM)" - -# Convenience targets for popular platforms -ALL= all - -none: - @echo "Please do 'make PLATFORM' where PLATFORM is one of these:" - @echo " $(PLATS)" - -aix: - $(MAKE) $(ALL) CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-ldl" SYSLDFLAGS="-brtl -bexpall" - -bsd: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-Wl,-E" - -c89: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_C89" CC="gcc -std=c89" - @echo '' - @echo '*** C89 does not guarantee 64-bit integers for Lua.' - @echo '' - - -freebsd: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -lreadline" - -generic: $(ALL) - -linux: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline" - -macosx: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline" CC=cc - -mingw: - $(MAKE) "LUA_A=lua53.dll" "LUA_T=lua.exe" \ - "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \ - "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe - $(MAKE) "LUAC_T=luac.exe" luac.exe - -posix: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX" - -solaris: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN -D_REENTRANT" SYSLIBS="-ldl" - -# list targets that do not create files (but not all makes understand .PHONY) -.PHONY: all $(PLATS) default o a clean depend echo none - -# DO NOT DELETE - -lapi.o: lapi.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ - lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lstring.h \ - ltable.h lundump.h lvm.h -lauxlib.o: lauxlib.c lprefix.h lua.h luaconf.h lauxlib.h -lbaselib.o: lbaselib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -lbitlib.o: lbitlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -lcode.o: lcode.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \ - llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \ - ldo.h lgc.h lstring.h ltable.h lvm.h -lcorolib.o: lcorolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -lctype.o: lctype.c lprefix.h lctype.h lua.h luaconf.h llimits.h -ldblib.o: ldblib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -ldebug.o: ldebug.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ - lobject.h ltm.h lzio.h lmem.h lcode.h llex.h lopcodes.h lparser.h \ - ldebug.h ldo.h lfunc.h lstring.h lgc.h ltable.h lvm.h -ldo.o: ldo.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ - lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lopcodes.h \ - lparser.h lstring.h ltable.h lundump.h lvm.h -ldump.o: ldump.c lprefix.h lua.h luaconf.h lobject.h llimits.h lstate.h \ - ltm.h lzio.h lmem.h lundump.h -lfunc.o: lfunc.c lprefix.h lua.h luaconf.h lfunc.h lobject.h llimits.h \ - lgc.h lstate.h ltm.h lzio.h lmem.h -lgc.o: lgc.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ - llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h -linit.o: linit.c lprefix.h lua.h luaconf.h lualib.h lauxlib.h -liolib.o: liolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -llex.o: llex.c lprefix.h lua.h luaconf.h lctype.h llimits.h ldebug.h \ - lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lgc.h llex.h lparser.h \ - lstring.h ltable.h -lmathlib.o: lmathlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -lmem.o: lmem.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ - llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h -loadlib.o: loadlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -lobject.o: lobject.c lprefix.h lua.h luaconf.h lctype.h llimits.h \ - ldebug.h lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h \ - lvm.h -lopcodes.o: lopcodes.c lprefix.h lopcodes.h llimits.h lua.h luaconf.h -loslib.o: loslib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -lparser.o: lparser.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \ - llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \ - ldo.h lfunc.h lstring.h lgc.h ltable.h -lstate.o: lstate.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ - lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h llex.h \ - lstring.h ltable.h -lstring.o: lstring.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \ - lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h -lstrlib.o: lstrlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -ltable.o: ltable.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ - llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h -ltablib.o: ltablib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -ltm.o: ltm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ - llimits.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h ltable.h lvm.h -lua.o: lua.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -luac.o: luac.c lprefix.h lua.h luaconf.h lauxlib.h lobject.h llimits.h \ - lstate.h ltm.h lzio.h lmem.h lundump.h ldebug.h lopcodes.h -lundump.o: lundump.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \ - lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h \ - lundump.h -lutf8lib.o: lutf8lib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -lvm.o: lvm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ - llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h \ - ltable.h lvm.h -lzio.o: lzio.c lprefix.h lua.h luaconf.h llimits.h lmem.h lstate.h \ - lobject.h ltm.h lzio.h - -# (end of Makefile) diff --git a/LuaSkin/lua-5.3.4/src/lapi.c b/LuaSkin/lua-5.3.4/src/lapi.c deleted file mode 100644 index c9455a5d8..000000000 --- a/LuaSkin/lua-5.3.4/src/lapi.c +++ /dev/null @@ -1,1298 +0,0 @@ -/* -** $Id: lapi.c,v 2.259 2016/02/29 14:27:14 roberto Exp $ -** Lua API -** See Copyright Notice in lua.h -*/ - -#define lapi_c -#define LUA_CORE - -#include "lprefix.h" - - -#include -#include - -#include "lua.h" - -#include "lapi.h" -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" -#include "lundump.h" -#include "lvm.h" - - - -const char lua_ident[] = - "$LuaVersion: " LUA_COPYRIGHT " $" - "$LuaAuthors: " LUA_AUTHORS " $"; - - -/* value at a non-valid index */ -#define NONVALIDVALUE cast(TValue *, luaO_nilobject) - -/* corresponding test */ -#define isvalid(o) ((o) != luaO_nilobject) - -/* test for pseudo index */ -#define ispseudo(i) ((i) <= LUA_REGISTRYINDEX) - -/* test for upvalue */ -#define isupvalue(i) ((i) < LUA_REGISTRYINDEX) - -/* test for valid but not pseudo index */ -#define isstackindex(i, o) (isvalid(o) && !ispseudo(i)) - -#define api_checkvalidindex(l,o) api_check(l, isvalid(o), "invalid index") - -#define api_checkstackindex(l, i, o) \ - api_check(l, isstackindex(i, o), "index not in the stack") - - -static TValue *index2addr (lua_State *L, int idx) { - CallInfo *ci = L->ci; - if (idx > 0) { - TValue *o = ci->func + idx; - api_check(L, idx <= ci->top - (ci->func + 1), "unacceptable index"); - if (o >= L->top) return NONVALIDVALUE; - else return o; - } - else if (!ispseudo(idx)) { /* negative index */ - api_check(L, idx != 0 && -idx <= L->top - (ci->func + 1), "invalid index"); - return L->top + idx; - } - else if (idx == LUA_REGISTRYINDEX) - return &G(L)->l_registry; - else { /* upvalues */ - idx = LUA_REGISTRYINDEX - idx; - api_check(L, idx <= MAXUPVAL + 1, "upvalue index too large"); - if (ttislcf(ci->func)) /* light C function? */ - return NONVALIDVALUE; /* it has no upvalues */ - else { - CClosure *func = clCvalue(ci->func); - return (idx <= func->nupvalues) ? &func->upvalue[idx-1] : NONVALIDVALUE; - } - } -} - - -/* -** to be called by 'lua_checkstack' in protected mode, to grow stack -** capturing memory errors -*/ -static void growstack (lua_State *L, void *ud) { - int size = *(int *)ud; - luaD_growstack(L, size); -} - - -LUA_API int lua_checkstack (lua_State *L, int n) { - int res; - CallInfo *ci = L->ci; - lua_lock(L); - api_check(L, n >= 0, "negative 'n'"); - if (L->stack_last - L->top > n) /* stack large enough? */ - res = 1; /* yes; check is OK */ - else { /* no; need to grow stack */ - int inuse = cast_int(L->top - L->stack) + EXTRA_STACK; - if (inuse > LUAI_MAXSTACK - n) /* can grow without overflow? */ - res = 0; /* no */ - else /* try to grow stack */ - res = (luaD_rawrunprotected(L, &growstack, &n) == LUA_OK); - } - if (res && ci->top < L->top + n) - ci->top = L->top + n; /* adjust frame top */ - lua_unlock(L); - return res; -} - - -LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) { - int i; - if (from == to) return; - lua_lock(to); - api_checknelems(from, n); - api_check(from, G(from) == G(to), "moving among independent states"); - api_check(from, to->ci->top - to->top >= n, "stack overflow"); - from->top -= n; - for (i = 0; i < n; i++) { - setobj2s(to, to->top, from->top + i); - to->top++; /* stack already checked by previous 'api_check' */ - } - lua_unlock(to); -} - - -LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) { - lua_CFunction old; - lua_lock(L); - old = G(L)->panic; - G(L)->panic = panicf; - lua_unlock(L); - return old; -} - - -LUA_API const lua_Number *lua_version (lua_State *L) { - static const lua_Number version = LUA_VERSION_NUM; - if (L == NULL) return &version; - else return G(L)->version; -} - - - -/* -** basic stack manipulation -*/ - - -/* -** convert an acceptable stack index into an absolute index -*/ -LUA_API int lua_absindex (lua_State *L, int idx) { - return (idx > 0 || ispseudo(idx)) - ? idx - : cast_int(L->top - L->ci->func) + idx; -} - - -LUA_API int lua_gettop (lua_State *L) { - return cast_int(L->top - (L->ci->func + 1)); -} - - -LUA_API void lua_settop (lua_State *L, int idx) { - StkId func = L->ci->func; - lua_lock(L); - if (idx >= 0) { - api_check(L, idx <= L->stack_last - (func + 1), "new top too large"); - while (L->top < (func + 1) + idx) - setnilvalue(L->top++); - L->top = (func + 1) + idx; - } - else { - api_check(L, -(idx+1) <= (L->top - (func + 1)), "invalid new top"); - L->top += idx+1; /* 'subtract' index (index is negative) */ - } - lua_unlock(L); -} - - -/* -** Reverse the stack segment from 'from' to 'to' -** (auxiliary to 'lua_rotate') -*/ -static void reverse (lua_State *L, StkId from, StkId to) { - for (; from < to; from++, to--) { - TValue temp; - setobj(L, &temp, from); - setobjs2s(L, from, to); - setobj2s(L, to, &temp); - } -} - - -/* -** Let x = AB, where A is a prefix of length 'n'. Then, -** rotate x n == BA. But BA == (A^r . B^r)^r. -*/ -LUA_API void lua_rotate (lua_State *L, int idx, int n) { - StkId p, t, m; - lua_lock(L); - t = L->top - 1; /* end of stack segment being rotated */ - p = index2addr(L, idx); /* start of segment */ - api_checkstackindex(L, idx, p); - api_check(L, (n >= 0 ? n : -n) <= (t - p + 1), "invalid 'n'"); - m = (n >= 0 ? t - n : p - n - 1); /* end of prefix */ - reverse(L, p, m); /* reverse the prefix with length 'n' */ - reverse(L, m + 1, t); /* reverse the suffix */ - reverse(L, p, t); /* reverse the entire segment */ - lua_unlock(L); -} - - -LUA_API void lua_copy (lua_State *L, int fromidx, int toidx) { - TValue *fr, *to; - lua_lock(L); - fr = index2addr(L, fromidx); - to = index2addr(L, toidx); - api_checkvalidindex(L, to); - setobj(L, to, fr); - if (isupvalue(toidx)) /* function upvalue? */ - luaC_barrier(L, clCvalue(L->ci->func), fr); - /* LUA_REGISTRYINDEX does not need gc barrier - (collector revisits it before finishing collection) */ - lua_unlock(L); -} - - -LUA_API void lua_pushvalue (lua_State *L, int idx) { - lua_lock(L); - setobj2s(L, L->top, index2addr(L, idx)); - api_incr_top(L); - lua_unlock(L); -} - - - -/* -** access functions (stack -> C) -*/ - - -LUA_API int lua_type (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - return (isvalid(o) ? ttnov(o) : LUA_TNONE); -} - - -LUA_API const char *lua_typename (lua_State *L, int t) { - UNUSED(L); - api_check(L, LUA_TNONE <= t && t < LUA_NUMTAGS, "invalid tag"); - return ttypename(t); -} - - -LUA_API int lua_iscfunction (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - return (ttislcf(o) || (ttisCclosure(o))); -} - - -LUA_API int lua_isinteger (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - return ttisinteger(o); -} - - -LUA_API int lua_isnumber (lua_State *L, int idx) { - lua_Number n; - const TValue *o = index2addr(L, idx); - return tonumber(o, &n); -} - - -LUA_API int lua_isstring (lua_State *L, int idx) { - const TValue *o = index2addr(L, idx); - return (ttisstring(o) || cvt2str(o)); -} - - -LUA_API int lua_isuserdata (lua_State *L, int idx) { - const TValue *o = index2addr(L, idx); - return (ttisfulluserdata(o) || ttislightuserdata(o)); -} - - -LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { - StkId o1 = index2addr(L, index1); - StkId o2 = index2addr(L, index2); - return (isvalid(o1) && isvalid(o2)) ? luaV_rawequalobj(o1, o2) : 0; -} - - -LUA_API void lua_arith (lua_State *L, int op) { - lua_lock(L); - if (op != LUA_OPUNM && op != LUA_OPBNOT) - api_checknelems(L, 2); /* all other operations expect two operands */ - else { /* for unary operations, add fake 2nd operand */ - api_checknelems(L, 1); - setobjs2s(L, L->top, L->top - 1); - api_incr_top(L); - } - /* first operand at top - 2, second at top - 1; result go to top - 2 */ - luaO_arith(L, op, L->top - 2, L->top - 1, L->top - 2); - L->top--; /* remove second operand */ - lua_unlock(L); -} - - -LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) { - StkId o1, o2; - int i = 0; - lua_lock(L); /* may call tag method */ - o1 = index2addr(L, index1); - o2 = index2addr(L, index2); - if (isvalid(o1) && isvalid(o2)) { - switch (op) { - case LUA_OPEQ: i = luaV_equalobj(L, o1, o2); break; - case LUA_OPLT: i = luaV_lessthan(L, o1, o2); break; - case LUA_OPLE: i = luaV_lessequal(L, o1, o2); break; - default: api_check(L, 0, "invalid option"); - } - } - lua_unlock(L); - return i; -} - - -LUA_API size_t lua_stringtonumber (lua_State *L, const char *s) { - size_t sz = luaO_str2num(s, L->top); - if (sz != 0) - api_incr_top(L); - return sz; -} - - -LUA_API lua_Number lua_tonumberx (lua_State *L, int idx, int *pisnum) { - lua_Number n; - const TValue *o = index2addr(L, idx); - int isnum = tonumber(o, &n); - if (!isnum) - n = 0; /* call to 'tonumber' may change 'n' even if it fails */ - if (pisnum) *pisnum = isnum; - return n; -} - - -LUA_API lua_Integer lua_tointegerx (lua_State *L, int idx, int *pisnum) { - lua_Integer res; - const TValue *o = index2addr(L, idx); - int isnum = tointeger(o, &res); - if (!isnum) - res = 0; /* call to 'tointeger' may change 'n' even if it fails */ - if (pisnum) *pisnum = isnum; - return res; -} - - -LUA_API int lua_toboolean (lua_State *L, int idx) { - const TValue *o = index2addr(L, idx); - return !l_isfalse(o); -} - - -LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { - StkId o = index2addr(L, idx); - if (!ttisstring(o)) { - if (!cvt2str(o)) { /* not convertible? */ - if (len != NULL) *len = 0; - return NULL; - } - lua_lock(L); /* 'luaO_tostring' may create a new string */ - luaO_tostring(L, o); - luaC_checkGC(L); - o = index2addr(L, idx); /* previous call may reallocate the stack */ - lua_unlock(L); - } - if (len != NULL) - *len = vslen(o); - return svalue(o); -} - - -LUA_API size_t lua_rawlen (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - switch (ttype(o)) { - case LUA_TSHRSTR: return tsvalue(o)->shrlen; - case LUA_TLNGSTR: return tsvalue(o)->u.lnglen; - case LUA_TUSERDATA: return uvalue(o)->len; - case LUA_TTABLE: return luaH_getn(hvalue(o)); - default: return 0; - } -} - - -LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - if (ttislcf(o)) return fvalue(o); - else if (ttisCclosure(o)) - return clCvalue(o)->f; - else return NULL; /* not a C function */ -} - - -LUA_API void *lua_touserdata (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - switch (ttnov(o)) { - case LUA_TUSERDATA: return getudatamem(uvalue(o)); - case LUA_TLIGHTUSERDATA: return pvalue(o); - default: return NULL; - } -} - - -LUA_API lua_State *lua_tothread (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - return (!ttisthread(o)) ? NULL : thvalue(o); -} - - -LUA_API const void *lua_topointer (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - switch (ttype(o)) { - case LUA_TTABLE: return hvalue(o); - case LUA_TLCL: return clLvalue(o); - case LUA_TCCL: return clCvalue(o); - case LUA_TLCF: return cast(void *, cast(size_t, fvalue(o))); - case LUA_TTHREAD: return thvalue(o); - case LUA_TUSERDATA: return getudatamem(uvalue(o)); - case LUA_TLIGHTUSERDATA: return pvalue(o); - default: return NULL; - } -} - - - -/* -** push functions (C -> stack) -*/ - - -LUA_API void lua_pushnil (lua_State *L) { - lua_lock(L); - setnilvalue(L->top); - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { - lua_lock(L); - setfltvalue(L->top, n); - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) { - lua_lock(L); - setivalue(L->top, n); - api_incr_top(L); - lua_unlock(L); -} - - -/* -** Pushes on the stack a string with given length. Avoid using 's' when -** 'len' == 0 (as 's' can be NULL in that case), due to later use of -** 'memcmp' and 'memcpy'. -*/ -LUA_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len) { - TString *ts; - lua_lock(L); - ts = (len == 0) ? luaS_new(L, "") : luaS_newlstr(L, s, len); - setsvalue2s(L, L->top, ts); - api_incr_top(L); - luaC_checkGC(L); - lua_unlock(L); - return getstr(ts); -} - - -LUA_API const char *lua_pushstring (lua_State *L, const char *s) { - lua_lock(L); - if (s == NULL) - setnilvalue(L->top); - else { - TString *ts; - ts = luaS_new(L, s); - setsvalue2s(L, L->top, ts); - s = getstr(ts); /* internal copy's address */ - } - api_incr_top(L); - luaC_checkGC(L); - lua_unlock(L); - return s; -} - - -LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt, - va_list argp) { - const char *ret; - lua_lock(L); - ret = luaO_pushvfstring(L, fmt, argp); - luaC_checkGC(L); - lua_unlock(L); - return ret; -} - - -LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) { - const char *ret; - va_list argp; - lua_lock(L); - va_start(argp, fmt); - ret = luaO_pushvfstring(L, fmt, argp); - va_end(argp); - luaC_checkGC(L); - lua_unlock(L); - return ret; -} - - -LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { - lua_lock(L); - if (n == 0) { - setfvalue(L->top, fn); - } - else { - CClosure *cl; - api_checknelems(L, n); - api_check(L, n <= MAXUPVAL, "upvalue index too large"); - cl = luaF_newCclosure(L, n); - cl->f = fn; - L->top -= n; - while (n--) { - setobj2n(L, &cl->upvalue[n], L->top + n); - /* does not need barrier because closure is white */ - } - setclCvalue(L, L->top, cl); - } - api_incr_top(L); - luaC_checkGC(L); - lua_unlock(L); -} - - -LUA_API void lua_pushboolean (lua_State *L, int b) { - lua_lock(L); - setbvalue(L->top, (b != 0)); /* ensure that true is 1 */ - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API void lua_pushlightuserdata (lua_State *L, void *p) { - lua_lock(L); - setpvalue(L->top, p); - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API int lua_pushthread (lua_State *L) { - lua_lock(L); - setthvalue(L, L->top, L); - api_incr_top(L); - lua_unlock(L); - return (G(L)->mainthread == L); -} - - - -/* -** get functions (Lua -> stack) -*/ - - -static int auxgetstr (lua_State *L, const TValue *t, const char *k) { - const TValue *slot; - TString *str = luaS_new(L, k); - if (luaV_fastget(L, t, str, slot, luaH_getstr)) { - setobj2s(L, L->top, slot); - api_incr_top(L); - } - else { - setsvalue2s(L, L->top, str); - api_incr_top(L); - luaV_finishget(L, t, L->top - 1, L->top - 1, slot); - } - lua_unlock(L); - return ttnov(L->top - 1); -} - - -LUA_API int lua_getglobal (lua_State *L, const char *name) { - Table *reg = hvalue(&G(L)->l_registry); - lua_lock(L); - return auxgetstr(L, luaH_getint(reg, LUA_RIDX_GLOBALS), name); -} - - -LUA_API int lua_gettable (lua_State *L, int idx) { - StkId t; - lua_lock(L); - t = index2addr(L, idx); - luaV_gettable(L, t, L->top - 1, L->top - 1); - lua_unlock(L); - return ttnov(L->top - 1); -} - - -LUA_API int lua_getfield (lua_State *L, int idx, const char *k) { - lua_lock(L); - return auxgetstr(L, index2addr(L, idx), k); -} - - -LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n) { - StkId t; - const TValue *slot; - lua_lock(L); - t = index2addr(L, idx); - if (luaV_fastget(L, t, n, slot, luaH_getint)) { - setobj2s(L, L->top, slot); - api_incr_top(L); - } - else { - setivalue(L->top, n); - api_incr_top(L); - luaV_finishget(L, t, L->top - 1, L->top - 1, slot); - } - lua_unlock(L); - return ttnov(L->top - 1); -} - - -LUA_API int lua_rawget (lua_State *L, int idx) { - StkId t; - lua_lock(L); - t = index2addr(L, idx); - api_check(L, ttistable(t), "table expected"); - setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1)); - lua_unlock(L); - return ttnov(L->top - 1); -} - - -LUA_API int lua_rawgeti (lua_State *L, int idx, lua_Integer n) { - StkId t; - lua_lock(L); - t = index2addr(L, idx); - api_check(L, ttistable(t), "table expected"); - setobj2s(L, L->top, luaH_getint(hvalue(t), n)); - api_incr_top(L); - lua_unlock(L); - return ttnov(L->top - 1); -} - - -LUA_API int lua_rawgetp (lua_State *L, int idx, const void *p) { - StkId t; - TValue k; - lua_lock(L); - t = index2addr(L, idx); - api_check(L, ttistable(t), "table expected"); - setpvalue(&k, cast(void *, p)); - setobj2s(L, L->top, luaH_get(hvalue(t), &k)); - api_incr_top(L); - lua_unlock(L); - return ttnov(L->top - 1); -} - - -LUA_API void lua_createtable (lua_State *L, int narray, int nrec) { - Table *t; - lua_lock(L); - t = luaH_new(L); - sethvalue(L, L->top, t); - api_incr_top(L); - if (narray > 0 || nrec > 0) - luaH_resize(L, t, narray, nrec); - luaC_checkGC(L); - lua_unlock(L); -} - - -LUA_API int lua_getmetatable (lua_State *L, int objindex) { - const TValue *obj; - Table *mt; - int res = 0; - lua_lock(L); - obj = index2addr(L, objindex); - switch (ttnov(obj)) { - case LUA_TTABLE: - mt = hvalue(obj)->metatable; - break; - case LUA_TUSERDATA: - mt = uvalue(obj)->metatable; - break; - default: - mt = G(L)->mt[ttnov(obj)]; - break; - } - if (mt != NULL) { - sethvalue(L, L->top, mt); - api_incr_top(L); - res = 1; - } - lua_unlock(L); - return res; -} - - -LUA_API int lua_getuservalue (lua_State *L, int idx) { - StkId o; - lua_lock(L); - o = index2addr(L, idx); - api_check(L, ttisfulluserdata(o), "full userdata expected"); - getuservalue(L, uvalue(o), L->top); - api_incr_top(L); - lua_unlock(L); - return ttnov(L->top - 1); -} - - -/* -** set functions (stack -> Lua) -*/ - -/* -** t[k] = value at the top of the stack (where 'k' is a string) -*/ -static void auxsetstr (lua_State *L, const TValue *t, const char *k) { - const TValue *slot; - TString *str = luaS_new(L, k); - api_checknelems(L, 1); - if (luaV_fastset(L, t, str, slot, luaH_getstr, L->top - 1)) - L->top--; /* pop value */ - else { - setsvalue2s(L, L->top, str); /* push 'str' (to make it a TValue) */ - api_incr_top(L); - luaV_finishset(L, t, L->top - 1, L->top - 2, slot); - L->top -= 2; /* pop value and key */ - } - lua_unlock(L); /* lock done by caller */ -} - - -LUA_API void lua_setglobal (lua_State *L, const char *name) { - Table *reg = hvalue(&G(L)->l_registry); - lua_lock(L); /* unlock done in 'auxsetstr' */ - auxsetstr(L, luaH_getint(reg, LUA_RIDX_GLOBALS), name); -} - - -LUA_API void lua_settable (lua_State *L, int idx) { - StkId t; - lua_lock(L); - api_checknelems(L, 2); - t = index2addr(L, idx); - luaV_settable(L, t, L->top - 2, L->top - 1); - L->top -= 2; /* pop index and value */ - lua_unlock(L); -} - - -LUA_API void lua_setfield (lua_State *L, int idx, const char *k) { - lua_lock(L); /* unlock done in 'auxsetstr' */ - auxsetstr(L, index2addr(L, idx), k); -} - - -LUA_API void lua_seti (lua_State *L, int idx, lua_Integer n) { - StkId t; - const TValue *slot; - lua_lock(L); - api_checknelems(L, 1); - t = index2addr(L, idx); - if (luaV_fastset(L, t, n, slot, luaH_getint, L->top - 1)) - L->top--; /* pop value */ - else { - setivalue(L->top, n); - api_incr_top(L); - luaV_finishset(L, t, L->top - 1, L->top - 2, slot); - L->top -= 2; /* pop value and key */ - } - lua_unlock(L); -} - - -LUA_API void lua_rawset (lua_State *L, int idx) { - StkId o; - TValue *slot; - lua_lock(L); - api_checknelems(L, 2); - o = index2addr(L, idx); - api_check(L, ttistable(o), "table expected"); - slot = luaH_set(L, hvalue(o), L->top - 2); - setobj2t(L, slot, L->top - 1); - invalidateTMcache(hvalue(o)); - luaC_barrierback(L, hvalue(o), L->top-1); - L->top -= 2; - lua_unlock(L); -} - - -LUA_API void lua_rawseti (lua_State *L, int idx, lua_Integer n) { - StkId o; - lua_lock(L); - api_checknelems(L, 1); - o = index2addr(L, idx); - api_check(L, ttistable(o), "table expected"); - luaH_setint(L, hvalue(o), n, L->top - 1); - luaC_barrierback(L, hvalue(o), L->top-1); - L->top--; - lua_unlock(L); -} - - -LUA_API void lua_rawsetp (lua_State *L, int idx, const void *p) { - StkId o; - TValue k, *slot; - lua_lock(L); - api_checknelems(L, 1); - o = index2addr(L, idx); - api_check(L, ttistable(o), "table expected"); - setpvalue(&k, cast(void *, p)); - slot = luaH_set(L, hvalue(o), &k); - setobj2t(L, slot, L->top - 1); - luaC_barrierback(L, hvalue(o), L->top - 1); - L->top--; - lua_unlock(L); -} - - -LUA_API int lua_setmetatable (lua_State *L, int objindex) { - TValue *obj; - Table *mt; - lua_lock(L); - api_checknelems(L, 1); - obj = index2addr(L, objindex); - if (ttisnil(L->top - 1)) - mt = NULL; - else { - api_check(L, ttistable(L->top - 1), "table expected"); - mt = hvalue(L->top - 1); - } - switch (ttnov(obj)) { - case LUA_TTABLE: { - hvalue(obj)->metatable = mt; - if (mt) { - luaC_objbarrier(L, gcvalue(obj), mt); - luaC_checkfinalizer(L, gcvalue(obj), mt); - } - break; - } - case LUA_TUSERDATA: { - uvalue(obj)->metatable = mt; - if (mt) { - luaC_objbarrier(L, uvalue(obj), mt); - luaC_checkfinalizer(L, gcvalue(obj), mt); - } - break; - } - default: { - G(L)->mt[ttnov(obj)] = mt; - break; - } - } - L->top--; - lua_unlock(L); - return 1; -} - - -LUA_API void lua_setuservalue (lua_State *L, int idx) { - StkId o; - lua_lock(L); - api_checknelems(L, 1); - o = index2addr(L, idx); - api_check(L, ttisfulluserdata(o), "full userdata expected"); - setuservalue(L, uvalue(o), L->top - 1); - luaC_barrier(L, gcvalue(o), L->top - 1); - L->top--; - lua_unlock(L); -} - - -/* -** 'load' and 'call' functions (run Lua code) -*/ - - -#define checkresults(L,na,nr) \ - api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na)), \ - "results from function overflow current stack size") - - -LUA_API void lua_callk (lua_State *L, int nargs, int nresults, - lua_KContext ctx, lua_KFunction k) { - StkId func; - lua_lock(L); - api_check(L, k == NULL || !isLua(L->ci), - "cannot use continuations inside hooks"); - api_checknelems(L, nargs+1); - api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); - checkresults(L, nargs, nresults); - func = L->top - (nargs+1); - if (k != NULL && L->nny == 0) { /* need to prepare continuation? */ - L->ci->u.c.k = k; /* save continuation */ - L->ci->u.c.ctx = ctx; /* save context */ - luaD_call(L, func, nresults); /* do the call */ - } - else /* no continuation or no yieldable */ - luaD_callnoyield(L, func, nresults); /* just do the call */ - adjustresults(L, nresults); - lua_unlock(L); -} - - - -/* -** Execute a protected call. -*/ -struct CallS { /* data to 'f_call' */ - StkId func; - int nresults; -}; - - -static void f_call (lua_State *L, void *ud) { - struct CallS *c = cast(struct CallS *, ud); - luaD_callnoyield(L, c->func, c->nresults); -} - - - -LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc, - lua_KContext ctx, lua_KFunction k) { - struct CallS c; - int status; - ptrdiff_t func; - lua_lock(L); - api_check(L, k == NULL || !isLua(L->ci), - "cannot use continuations inside hooks"); - api_checknelems(L, nargs+1); - api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); - checkresults(L, nargs, nresults); - if (errfunc == 0) - func = 0; - else { - StkId o = index2addr(L, errfunc); - api_checkstackindex(L, errfunc, o); - func = savestack(L, o); - } - c.func = L->top - (nargs+1); /* function to be called */ - if (k == NULL || L->nny > 0) { /* no continuation or no yieldable? */ - c.nresults = nresults; /* do a 'conventional' protected call */ - status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); - } - else { /* prepare continuation (call is already protected by 'resume') */ - CallInfo *ci = L->ci; - ci->u.c.k = k; /* save continuation */ - ci->u.c.ctx = ctx; /* save context */ - /* save information for error recovery */ - ci->extra = savestack(L, c.func); - ci->u.c.old_errfunc = L->errfunc; - L->errfunc = func; - setoah(ci->callstatus, L->allowhook); /* save value of 'allowhook' */ - ci->callstatus |= CIST_YPCALL; /* function can do error recovery */ - luaD_call(L, c.func, nresults); /* do the call */ - ci->callstatus &= ~CIST_YPCALL; - L->errfunc = ci->u.c.old_errfunc; - status = LUA_OK; /* if it is here, there were no errors */ - } - adjustresults(L, nresults); - lua_unlock(L); - return status; -} - - -LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data, - const char *chunkname, const char *mode) { - ZIO z; - int status; - lua_lock(L); - if (!chunkname) chunkname = "?"; - luaZ_init(L, &z, reader, data); - status = luaD_protectedparser(L, &z, chunkname, mode); - if (status == LUA_OK) { /* no errors? */ - LClosure *f = clLvalue(L->top - 1); /* get newly created function */ - if (f->nupvalues >= 1) { /* does it have an upvalue? */ - /* get global table from registry */ - Table *reg = hvalue(&G(L)->l_registry); - const TValue *gt = luaH_getint(reg, LUA_RIDX_GLOBALS); - /* set global table as 1st upvalue of 'f' (may be LUA_ENV) */ - setobj(L, f->upvals[0]->v, gt); - luaC_upvalbarrier(L, f->upvals[0]); - } - } - lua_unlock(L); - return status; -} - - -LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data, int strip) { - int status; - TValue *o; - lua_lock(L); - api_checknelems(L, 1); - o = L->top - 1; - if (isLfunction(o)) - status = luaU_dump(L, getproto(o), writer, data, strip); - else - status = 1; - lua_unlock(L); - return status; -} - - -LUA_API int lua_status (lua_State *L) { - return L->status; -} - - -/* -** Garbage-collection function -*/ - -LUA_API int lua_gc (lua_State *L, int what, int data) { - int res = 0; - global_State *g; - lua_lock(L); - g = G(L); - switch (what) { - case LUA_GCSTOP: { - g->gcrunning = 0; - break; - } - case LUA_GCRESTART: { - luaE_setdebt(g, 0); - g->gcrunning = 1; - break; - } - case LUA_GCCOLLECT: { - luaC_fullgc(L, 0); - break; - } - case LUA_GCCOUNT: { - /* GC values are expressed in Kbytes: #bytes/2^10 */ - res = cast_int(gettotalbytes(g) >> 10); - break; - } - case LUA_GCCOUNTB: { - res = cast_int(gettotalbytes(g) & 0x3ff); - break; - } - case LUA_GCSTEP: { - l_mem debt = 1; /* =1 to signal that it did an actual step */ - lu_byte oldrunning = g->gcrunning; - g->gcrunning = 1; /* allow GC to run */ - if (data == 0) { - luaE_setdebt(g, -GCSTEPSIZE); /* to do a "small" step */ - luaC_step(L); - } - else { /* add 'data' to total debt */ - debt = cast(l_mem, data) * 1024 + g->GCdebt; - luaE_setdebt(g, debt); - luaC_checkGC(L); - } - g->gcrunning = oldrunning; /* restore previous state */ - if (debt > 0 && g->gcstate == GCSpause) /* end of cycle? */ - res = 1; /* signal it */ - break; - } - case LUA_GCSETPAUSE: { - res = g->gcpause; - g->gcpause = data; - break; - } - case LUA_GCSETSTEPMUL: { - res = g->gcstepmul; - if (data < 40) data = 40; /* avoid ridiculous low values (and 0) */ - g->gcstepmul = data; - break; - } - case LUA_GCISRUNNING: { - res = g->gcrunning; - break; - } - default: res = -1; /* invalid option */ - } - lua_unlock(L); - return res; -} - - - -/* -** miscellaneous functions -*/ - - -LUA_API int lua_error (lua_State *L) { - lua_lock(L); - api_checknelems(L, 1); - luaG_errormsg(L); - /* code unreachable; will unlock when control actually leaves the kernel */ - return 0; /* to avoid warnings */ -} - - -LUA_API int lua_next (lua_State *L, int idx) { - StkId t; - int more; - lua_lock(L); - t = index2addr(L, idx); - api_check(L, ttistable(t), "table expected"); - more = luaH_next(L, hvalue(t), L->top - 1); - if (more) { - api_incr_top(L); - } - else /* no more elements */ - L->top -= 1; /* remove key */ - lua_unlock(L); - return more; -} - - -LUA_API void lua_concat (lua_State *L, int n) { - lua_lock(L); - api_checknelems(L, n); - if (n >= 2) { - luaV_concat(L, n); - } - else if (n == 0) { /* push empty string */ - setsvalue2s(L, L->top, luaS_newlstr(L, "", 0)); - api_incr_top(L); - } - /* else n == 1; nothing to do */ - luaC_checkGC(L); - lua_unlock(L); -} - - -LUA_API void lua_len (lua_State *L, int idx) { - StkId t; - lua_lock(L); - t = index2addr(L, idx); - luaV_objlen(L, L->top, t); - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { - lua_Alloc f; - lua_lock(L); - if (ud) *ud = G(L)->ud; - f = G(L)->frealloc; - lua_unlock(L); - return f; -} - - -LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) { - lua_lock(L); - G(L)->ud = ud; - G(L)->frealloc = f; - lua_unlock(L); -} - - -LUA_API void *lua_newuserdata (lua_State *L, size_t size) { - Udata *u; - lua_lock(L); - u = luaS_newudata(L, size); - setuvalue(L, L->top, u); - api_incr_top(L); - luaC_checkGC(L); - lua_unlock(L); - return getudatamem(u); -} - - - -static const char *aux_upvalue (StkId fi, int n, TValue **val, - CClosure **owner, UpVal **uv) { - switch (ttype(fi)) { - case LUA_TCCL: { /* C closure */ - CClosure *f = clCvalue(fi); - if (!(1 <= n && n <= f->nupvalues)) return NULL; - *val = &f->upvalue[n-1]; - if (owner) *owner = f; - return ""; - } - case LUA_TLCL: { /* Lua closure */ - LClosure *f = clLvalue(fi); - TString *name; - Proto *p = f->p; - if (!(1 <= n && n <= p->sizeupvalues)) return NULL; - *val = f->upvals[n-1]->v; - if (uv) *uv = f->upvals[n - 1]; - name = p->upvalues[n-1].name; - return (name == NULL) ? "(*no name)" : getstr(name); - } - default: return NULL; /* not a closure */ - } -} - - -LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { - const char *name; - TValue *val = NULL; /* to avoid warnings */ - lua_lock(L); - name = aux_upvalue(index2addr(L, funcindex), n, &val, NULL, NULL); - if (name) { - setobj2s(L, L->top, val); - api_incr_top(L); - } - lua_unlock(L); - return name; -} - - -LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { - const char *name; - TValue *val = NULL; /* to avoid warnings */ - CClosure *owner = NULL; - UpVal *uv = NULL; - StkId fi; - lua_lock(L); - fi = index2addr(L, funcindex); - api_checknelems(L, 1); - name = aux_upvalue(fi, n, &val, &owner, &uv); - if (name) { - L->top--; - setobj(L, val, L->top); - if (owner) { luaC_barrier(L, owner, L->top); } - else if (uv) { luaC_upvalbarrier(L, uv); } - } - lua_unlock(L); - return name; -} - - -static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) { - LClosure *f; - StkId fi = index2addr(L, fidx); - api_check(L, ttisLclosure(fi), "Lua function expected"); - f = clLvalue(fi); - api_check(L, (1 <= n && n <= f->p->sizeupvalues), "invalid upvalue index"); - if (pf) *pf = f; - return &f->upvals[n - 1]; /* get its upvalue pointer */ -} - - -LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) { - StkId fi = index2addr(L, fidx); - switch (ttype(fi)) { - case LUA_TLCL: { /* lua closure */ - return *getupvalref(L, fidx, n, NULL); - } - case LUA_TCCL: { /* C closure */ - CClosure *f = clCvalue(fi); - api_check(L, 1 <= n && n <= f->nupvalues, "invalid upvalue index"); - return &f->upvalue[n - 1]; - } - default: { - api_check(L, 0, "closure expected"); - return NULL; - } - } -} - - -LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1, - int fidx2, int n2) { - LClosure *f1; - UpVal **up1 = getupvalref(L, fidx1, n1, &f1); - UpVal **up2 = getupvalref(L, fidx2, n2, NULL); - luaC_upvdeccount(L, *up1); - *up1 = *up2; - (*up1)->refcount++; - if (upisopen(*up1)) (*up1)->u.open.touched = 1; - luaC_upvalbarrier(L, *up1); -} - - diff --git a/LuaSkin/lua-5.3.4/src/lapi.h b/LuaSkin/lua-5.3.4/src/lapi.h deleted file mode 100644 index 6d36dee3f..000000000 --- a/LuaSkin/lua-5.3.4/src/lapi.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -** $Id: lapi.h,v 2.9 2015/03/06 19:49:50 roberto Exp $ -** Auxiliary functions from Lua API -** See Copyright Notice in lua.h -*/ - -#ifndef lapi_h -#define lapi_h - - -#include "llimits.h" -#include "lstate.h" - -#define api_incr_top(L) {L->top++; api_check(L, L->top <= L->ci->top, \ - "stack overflow");} - -#define adjustresults(L,nres) \ - { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; } - -#define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \ - "not enough elements in the stack") - - -#endif diff --git a/LuaSkin/lua-5.3.4/src/lauxlib.c b/LuaSkin/lua-5.3.4/src/lauxlib.c deleted file mode 100644 index f7a383663..000000000 --- a/LuaSkin/lua-5.3.4/src/lauxlib.c +++ /dev/null @@ -1,1043 +0,0 @@ -/* -** $Id: lauxlib.c,v 1.289 2016/12/20 18:37:00 roberto Exp $ -** Auxiliary functions for building Lua libraries -** See Copyright Notice in lua.h -*/ - -#define lauxlib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include -#include -#include -#include -#include - - -/* -** This file uses only the official API of Lua. -** Any function declared here could be written as an application function. -*/ - -#include "lua.h" - -#include "lauxlib.h" - - -/* -** {====================================================== -** Traceback -** ======================================================= -*/ - - -#define LEVELS1 10 /* size of the first part of the stack */ -#define LEVELS2 11 /* size of the second part of the stack */ - - - -/* -** search for 'objidx' in table at index -1. -** return 1 + string at top if find a good name. -*/ -static int findfield (lua_State *L, int objidx, int level) { - if (level == 0 || !lua_istable(L, -1)) - return 0; /* not found */ - lua_pushnil(L); /* start 'next' loop */ - while (lua_next(L, -2)) { /* for each pair in table */ - if (lua_type(L, -2) == LUA_TSTRING) { /* ignore non-string keys */ - if (lua_rawequal(L, objidx, -1)) { /* found object? */ - lua_pop(L, 1); /* remove value (but keep name) */ - return 1; - } - else if (findfield(L, objidx, level - 1)) { /* try recursively */ - lua_remove(L, -2); /* remove table (but keep name) */ - lua_pushliteral(L, "."); - lua_insert(L, -2); /* place '.' between the two names */ - lua_concat(L, 3); - return 1; - } - } - lua_pop(L, 1); /* remove value */ - } - return 0; /* not found */ -} - - -/* -** Search for a name for a function in all loaded modules -*/ -static int pushglobalfuncname (lua_State *L, lua_Debug *ar) { - int top = lua_gettop(L); - lua_getinfo(L, "f", ar); /* push function */ - lua_getfield(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); - if (findfield(L, top + 1, 2)) { - const char *name = lua_tostring(L, -1); - if (strncmp(name, "_G.", 3) == 0) { /* name start with '_G.'? */ - lua_pushstring(L, name + 3); /* push name without prefix */ - lua_remove(L, -2); /* remove original name */ - } - lua_copy(L, -1, top + 1); /* move name to proper place */ - lua_pop(L, 2); /* remove pushed values */ - return 1; - } - else { - lua_settop(L, top); /* remove function and global table */ - return 0; - } -} - - -static void pushfuncname (lua_State *L, lua_Debug *ar) { - if (pushglobalfuncname(L, ar)) { /* try first a global name */ - lua_pushfstring(L, "function '%s'", lua_tostring(L, -1)); - lua_remove(L, -2); /* remove name */ - } - else if (*ar->namewhat != '\0') /* is there a name from code? */ - lua_pushfstring(L, "%s '%s'", ar->namewhat, ar->name); /* use it */ - else if (*ar->what == 'm') /* main? */ - lua_pushliteral(L, "main chunk"); - else if (*ar->what != 'C') /* for Lua functions, use */ - lua_pushfstring(L, "function <%s:%d>", ar->short_src, ar->linedefined); - else /* nothing left... */ - lua_pushliteral(L, "?"); -} - - -static int lastlevel (lua_State *L) { - lua_Debug ar; - int li = 1, le = 1; - /* find an upper bound */ - while (lua_getstack(L, le, &ar)) { li = le; le *= 2; } - /* do a binary search */ - while (li < le) { - int m = (li + le)/2; - if (lua_getstack(L, m, &ar)) li = m + 1; - else le = m; - } - return le - 1; -} - - -LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, - const char *msg, int level) { - lua_Debug ar; - int top = lua_gettop(L); - int last = lastlevel(L1); - int n1 = (last - level > LEVELS1 + LEVELS2) ? LEVELS1 : -1; - if (msg) - lua_pushfstring(L, "%s\n", msg); - luaL_checkstack(L, 10, NULL); - lua_pushliteral(L, "stack traceback:"); - while (lua_getstack(L1, level++, &ar)) { - if (n1-- == 0) { /* too many levels? */ - lua_pushliteral(L, "\n\t..."); /* add a '...' */ - level = last - LEVELS2 + 1; /* and skip to last ones */ - } - else { - lua_getinfo(L1, "Slnt", &ar); - lua_pushfstring(L, "\n\t%s:", ar.short_src); - if (ar.currentline > 0) - lua_pushfstring(L, "%d:", ar.currentline); - lua_pushliteral(L, " in "); - pushfuncname(L, &ar); - if (ar.istailcall) - lua_pushliteral(L, "\n\t(...tail calls...)"); - lua_concat(L, lua_gettop(L) - top); - } - } - lua_concat(L, lua_gettop(L) - top); -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Error-report functions -** ======================================================= -*/ - -LUALIB_API int luaL_argerror (lua_State *L, int arg, const char *extramsg) { - lua_Debug ar; - if (!lua_getstack(L, 0, &ar)) /* no stack frame? */ - return luaL_error(L, "bad argument #%d (%s)", arg, extramsg); - lua_getinfo(L, "n", &ar); - if (strcmp(ar.namewhat, "method") == 0) { - arg--; /* do not count 'self' */ - if (arg == 0) /* error is in the self argument itself? */ - return luaL_error(L, "calling '%s' on bad self (%s)", - ar.name, extramsg); - } - if (ar.name == NULL) - ar.name = (pushglobalfuncname(L, &ar)) ? lua_tostring(L, -1) : "?"; - return luaL_error(L, "bad argument #%d to '%s' (%s)", - arg, ar.name, extramsg); -} - - -static int typeerror (lua_State *L, int arg, const char *tname) { - const char *msg; - const char *typearg; /* name for the type of the actual argument */ - if (luaL_getmetafield(L, arg, "__name") == LUA_TSTRING) - typearg = lua_tostring(L, -1); /* use the given type name */ - else if (lua_type(L, arg) == LUA_TLIGHTUSERDATA) - typearg = "light userdata"; /* special name for messages */ - else - typearg = luaL_typename(L, arg); /* standard name */ - msg = lua_pushfstring(L, "%s expected, got %s", tname, typearg); - return luaL_argerror(L, arg, msg); -} - - -static void tag_error (lua_State *L, int arg, int tag) { - typeerror(L, arg, lua_typename(L, tag)); -} - - -/* -** The use of 'lua_pushfstring' ensures this function does not -** need reserved stack space when called. -*/ -LUALIB_API void luaL_where (lua_State *L, int level) { - lua_Debug ar; - if (lua_getstack(L, level, &ar)) { /* check function at level */ - lua_getinfo(L, "Sl", &ar); /* get info about it */ - if (ar.currentline > 0) { /* is there info? */ - lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline); - return; - } - } - lua_pushfstring(L, ""); /* else, no information available... */ -} - - -/* -** Again, the use of 'lua_pushvfstring' ensures this function does -** not need reserved stack space when called. (At worst, it generates -** an error with "stack overflow" instead of the given message.) -*/ -LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) { - va_list argp; - va_start(argp, fmt); - luaL_where(L, 1); - lua_pushvfstring(L, fmt, argp); - va_end(argp); - lua_concat(L, 2); - return lua_error(L); -} - - -LUALIB_API int luaL_fileresult (lua_State *L, int stat, const char *fname) { - int en = errno; /* calls to Lua API may change this value */ - if (stat) { - lua_pushboolean(L, 1); - return 1; - } - else { - lua_pushnil(L); - if (fname) - lua_pushfstring(L, "%s: %s", fname, strerror(en)); - else - lua_pushstring(L, strerror(en)); - lua_pushinteger(L, en); - return 3; - } -} - - -#if !defined(l_inspectstat) /* { */ - -#if defined(LUA_USE_POSIX) - -#include - -/* -** use appropriate macros to interpret 'pclose' return status -*/ -#define l_inspectstat(stat,what) \ - if (WIFEXITED(stat)) { stat = WEXITSTATUS(stat); } \ - else if (WIFSIGNALED(stat)) { stat = WTERMSIG(stat); what = "signal"; } - -#else - -#define l_inspectstat(stat,what) /* no op */ - -#endif - -#endif /* } */ - - -LUALIB_API int luaL_execresult (lua_State *L, int stat) { - const char *what = "exit"; /* type of termination */ - if (stat == -1) /* error? */ - return luaL_fileresult(L, 0, NULL); - else { - l_inspectstat(stat, what); /* interpret result */ - if (*what == 'e' && stat == 0) /* successful termination? */ - lua_pushboolean(L, 1); - else - lua_pushnil(L); - lua_pushstring(L, what); - lua_pushinteger(L, stat); - return 3; /* return true/nil,what,code */ - } -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Userdata's metatable manipulation -** ======================================================= -*/ - -LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { - if (luaL_getmetatable(L, tname) != LUA_TNIL) /* name already in use? */ - return 0; /* leave previous value on top, but return 0 */ - lua_pop(L, 1); - lua_createtable(L, 0, 2); /* create metatable */ - lua_pushstring(L, tname); - lua_setfield(L, -2, "__name"); /* metatable.__name = tname */ - lua_pushvalue(L, -1); - lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */ - return 1; -} - - -LUALIB_API void luaL_setmetatable (lua_State *L, const char *tname) { - luaL_getmetatable(L, tname); - lua_setmetatable(L, -2); -} - - -LUALIB_API void *luaL_testudata (lua_State *L, int ud, const char *tname) { - void *p = lua_touserdata(L, ud); - if (p != NULL) { /* value is a userdata? */ - if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ - luaL_getmetatable(L, tname); /* get correct metatable */ - if (!lua_rawequal(L, -1, -2)) /* not the same? */ - p = NULL; /* value is a userdata with wrong metatable */ - lua_pop(L, 2); /* remove both metatables */ - return p; - } - } - return NULL; /* value is not a userdata with a metatable */ -} - - -LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) { - void *p = luaL_testudata(L, ud, tname); - if (p == NULL) typeerror(L, ud, tname); - return p; -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Argument check functions -** ======================================================= -*/ - -LUALIB_API int luaL_checkoption (lua_State *L, int arg, const char *def, - const char *const lst[]) { - const char *name = (def) ? luaL_optstring(L, arg, def) : - luaL_checkstring(L, arg); - int i; - for (i=0; lst[i]; i++) - if (strcmp(lst[i], name) == 0) - return i; - return luaL_argerror(L, arg, - lua_pushfstring(L, "invalid option '%s'", name)); -} - - -/* -** Ensures the stack has at least 'space' extra slots, raising an error -** if it cannot fulfill the request. (The error handling needs a few -** extra slots to format the error message. In case of an error without -** this extra space, Lua will generate the same 'stack overflow' error, -** but without 'msg'.) -*/ -LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *msg) { - if (!lua_checkstack(L, space)) { - if (msg) - luaL_error(L, "stack overflow (%s)", msg); - else - luaL_error(L, "stack overflow"); - } -} - - -LUALIB_API void luaL_checktype (lua_State *L, int arg, int t) { - if (lua_type(L, arg) != t) - tag_error(L, arg, t); -} - - -LUALIB_API void luaL_checkany (lua_State *L, int arg) { - if (lua_type(L, arg) == LUA_TNONE) - luaL_argerror(L, arg, "value expected"); -} - - -LUALIB_API const char *luaL_checklstring (lua_State *L, int arg, size_t *len) { - const char *s = lua_tolstring(L, arg, len); - if (!s) tag_error(L, arg, LUA_TSTRING); - return s; -} - - -LUALIB_API const char *luaL_optlstring (lua_State *L, int arg, - const char *def, size_t *len) { - if (lua_isnoneornil(L, arg)) { - if (len) - *len = (def ? strlen(def) : 0); - return def; - } - else return luaL_checklstring(L, arg, len); -} - - -LUALIB_API lua_Number luaL_checknumber (lua_State *L, int arg) { - int isnum; - lua_Number d = lua_tonumberx(L, arg, &isnum); - if (!isnum) - tag_error(L, arg, LUA_TNUMBER); - return d; -} - - -LUALIB_API lua_Number luaL_optnumber (lua_State *L, int arg, lua_Number def) { - return luaL_opt(L, luaL_checknumber, arg, def); -} - - -static void interror (lua_State *L, int arg) { - if (lua_isnumber(L, arg)) - luaL_argerror(L, arg, "number has no integer representation"); - else - tag_error(L, arg, LUA_TNUMBER); -} - - -LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int arg) { - int isnum; - lua_Integer d = lua_tointegerx(L, arg, &isnum); - if (!isnum) { - interror(L, arg); - } - return d; -} - - -LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int arg, - lua_Integer def) { - return luaL_opt(L, luaL_checkinteger, arg, def); -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Generic Buffer manipulation -** ======================================================= -*/ - -/* userdata to box arbitrary data */ -typedef struct UBox { - void *box; - size_t bsize; -} UBox; - - -static void *resizebox (lua_State *L, int idx, size_t newsize) { - void *ud; - lua_Alloc allocf = lua_getallocf(L, &ud); - UBox *box = (UBox *)lua_touserdata(L, idx); - void *temp = allocf(ud, box->box, box->bsize, newsize); - if (temp == NULL && newsize > 0) { /* allocation error? */ - resizebox(L, idx, 0); /* free buffer */ - luaL_error(L, "not enough memory for buffer allocation"); - } - box->box = temp; - box->bsize = newsize; - return temp; -} - - -static int boxgc (lua_State *L) { - resizebox(L, 1, 0); - return 0; -} - - -static void *newbox (lua_State *L, size_t newsize) { - UBox *box = (UBox *)lua_newuserdata(L, sizeof(UBox)); - box->box = NULL; - box->bsize = 0; - if (luaL_newmetatable(L, "LUABOX")) { /* creating metatable? */ - lua_pushcfunction(L, boxgc); - lua_setfield(L, -2, "__gc"); /* metatable.__gc = boxgc */ - } - lua_setmetatable(L, -2); - return resizebox(L, -1, newsize); -} - - -/* -** check whether buffer is using a userdata on the stack as a temporary -** buffer -*/ -#define buffonstack(B) ((B)->b != (B)->initb) - - -/* -** returns a pointer to a free area with at least 'sz' bytes -*/ -LUALIB_API char *luaL_prepbuffsize (luaL_Buffer *B, size_t sz) { - lua_State *L = B->L; - if (B->size - B->n < sz) { /* not enough space? */ - char *newbuff; - size_t newsize = B->size * 2; /* double buffer size */ - if (newsize - B->n < sz) /* not big enough? */ - newsize = B->n + sz; - if (newsize < B->n || newsize - B->n < sz) - luaL_error(L, "buffer too large"); - /* create larger buffer */ - if (buffonstack(B)) - newbuff = (char *)resizebox(L, -1, newsize); - else { /* no buffer yet */ - newbuff = (char *)newbox(L, newsize); - memcpy(newbuff, B->b, B->n * sizeof(char)); /* copy original content */ - } - B->b = newbuff; - B->size = newsize; - } - return &B->b[B->n]; -} - - -LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) { - if (l > 0) { /* avoid 'memcpy' when 's' can be NULL */ - char *b = luaL_prepbuffsize(B, l); - memcpy(b, s, l * sizeof(char)); - luaL_addsize(B, l); - } -} - - -LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) { - luaL_addlstring(B, s, strlen(s)); -} - - -LUALIB_API void luaL_pushresult (luaL_Buffer *B) { - lua_State *L = B->L; - lua_pushlstring(L, B->b, B->n); - if (buffonstack(B)) { - resizebox(L, -2, 0); /* delete old buffer */ - lua_remove(L, -2); /* remove its header from the stack */ - } -} - - -LUALIB_API void luaL_pushresultsize (luaL_Buffer *B, size_t sz) { - luaL_addsize(B, sz); - luaL_pushresult(B); -} - - -LUALIB_API void luaL_addvalue (luaL_Buffer *B) { - lua_State *L = B->L; - size_t l; - const char *s = lua_tolstring(L, -1, &l); - if (buffonstack(B)) - lua_insert(L, -2); /* put value below buffer */ - luaL_addlstring(B, s, l); - lua_remove(L, (buffonstack(B)) ? -2 : -1); /* remove value */ -} - - -LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { - B->L = L; - B->b = B->initb; - B->n = 0; - B->size = LUAL_BUFFERSIZE; -} - - -LUALIB_API char *luaL_buffinitsize (lua_State *L, luaL_Buffer *B, size_t sz) { - luaL_buffinit(L, B); - return luaL_prepbuffsize(B, sz); -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Reference system -** ======================================================= -*/ - -/* index of free-list header */ -#define freelist 0 - - -LUALIB_API int luaL_ref (lua_State *L, int t) { - int ref; - if (lua_isnil(L, -1)) { - lua_pop(L, 1); /* remove from stack */ - return LUA_REFNIL; /* 'nil' has a unique fixed reference */ - } - t = lua_absindex(L, t); - lua_rawgeti(L, t, freelist); /* get first free element */ - ref = (int)lua_tointeger(L, -1); /* ref = t[freelist] */ - lua_pop(L, 1); /* remove it from stack */ - if (ref != 0) { /* any free element? */ - lua_rawgeti(L, t, ref); /* remove it from list */ - lua_rawseti(L, t, freelist); /* (t[freelist] = t[ref]) */ - } - else /* no free elements */ - ref = (int)lua_rawlen(L, t) + 1; /* get a new reference */ - lua_rawseti(L, t, ref); - return ref; -} - - -LUALIB_API void luaL_unref (lua_State *L, int t, int ref) { - if (ref >= 0) { - t = lua_absindex(L, t); - lua_rawgeti(L, t, freelist); - lua_rawseti(L, t, ref); /* t[ref] = t[freelist] */ - lua_pushinteger(L, ref); - lua_rawseti(L, t, freelist); /* t[freelist] = ref */ - } -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Load functions -** ======================================================= -*/ - -typedef struct LoadF { - int n; /* number of pre-read characters */ - FILE *f; /* file being read */ - char buff[BUFSIZ]; /* area for reading file */ -} LoadF; - - -static const char *getF (lua_State *L, void *ud, size_t *size) { - LoadF *lf = (LoadF *)ud; - (void)L; /* not used */ - if (lf->n > 0) { /* are there pre-read characters to be read? */ - *size = lf->n; /* return them (chars already in buffer) */ - lf->n = 0; /* no more pre-read characters */ - } - else { /* read a block from file */ - /* 'fread' can return > 0 *and* set the EOF flag. If next call to - 'getF' called 'fread', it might still wait for user input. - The next check avoids this problem. */ - if (feof(lf->f)) return NULL; - *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f); /* read block */ - } - return lf->buff; -} - - -static int errfile (lua_State *L, const char *what, int fnameindex) { - const char *serr = strerror(errno); - const char *filename = lua_tostring(L, fnameindex) + 1; - lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr); - lua_remove(L, fnameindex); - return LUA_ERRFILE; -} - - -static int skipBOM (LoadF *lf) { - const char *p = "\xEF\xBB\xBF"; /* UTF-8 BOM mark */ - int c; - lf->n = 0; - do { - c = getc(lf->f); - if (c == EOF || c != *(const unsigned char *)p++) return c; - lf->buff[lf->n++] = c; /* to be read by the parser */ - } while (*p != '\0'); - lf->n = 0; /* prefix matched; discard it */ - return getc(lf->f); /* return next character */ -} - - -/* -** reads the first character of file 'f' and skips an optional BOM mark -** in its beginning plus its first line if it starts with '#'. Returns -** true if it skipped the first line. In any case, '*cp' has the -** first "valid" character of the file (after the optional BOM and -** a first-line comment). -*/ -static int skipcomment (LoadF *lf, int *cp) { - int c = *cp = skipBOM(lf); - if (c == '#') { /* first line is a comment (Unix exec. file)? */ - do { /* skip first line */ - c = getc(lf->f); - } while (c != EOF && c != '\n'); - *cp = getc(lf->f); /* skip end-of-line, if present */ - return 1; /* there was a comment */ - } - else return 0; /* no comment */ -} - - -LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename, - const char *mode) { - LoadF lf; - int status, readstatus; - int c; - int fnameindex = lua_gettop(L) + 1; /* index of filename on the stack */ - if (filename == NULL) { - lua_pushliteral(L, "=stdin"); - lf.f = stdin; - } - else { - lua_pushfstring(L, "@%s", filename); - lf.f = fopen(filename, "r"); - if (lf.f == NULL) return errfile(L, "open", fnameindex); - } - if (skipcomment(&lf, &c)) /* read initial portion */ - lf.buff[lf.n++] = '\n'; /* add line to correct line numbers */ - if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */ - lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */ - if (lf.f == NULL) return errfile(L, "reopen", fnameindex); - skipcomment(&lf, &c); /* re-read initial portion */ - } - if (c != EOF) - lf.buff[lf.n++] = c; /* 'c' is the first character of the stream */ - status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode); - readstatus = ferror(lf.f); - if (filename) fclose(lf.f); /* close file (even in case of errors) */ - if (readstatus) { - lua_settop(L, fnameindex); /* ignore results from 'lua_load' */ - return errfile(L, "read", fnameindex); - } - lua_remove(L, fnameindex); - return status; -} - - -typedef struct LoadS { - const char *s; - size_t size; -} LoadS; - - -static const char *getS (lua_State *L, void *ud, size_t *size) { - LoadS *ls = (LoadS *)ud; - (void)L; /* not used */ - if (ls->size == 0) return NULL; - *size = ls->size; - ls->size = 0; - return ls->s; -} - - -LUALIB_API int luaL_loadbufferx (lua_State *L, const char *buff, size_t size, - const char *name, const char *mode) { - LoadS ls; - ls.s = buff; - ls.size = size; - return lua_load(L, getS, &ls, name, mode); -} - - -LUALIB_API int luaL_loadstring (lua_State *L, const char *s) { - return luaL_loadbuffer(L, s, strlen(s), s); -} - -/* }====================================================== */ - - - -LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { - if (!lua_getmetatable(L, obj)) /* no metatable? */ - return LUA_TNIL; - else { - int tt; - lua_pushstring(L, event); - tt = lua_rawget(L, -2); - if (tt == LUA_TNIL) /* is metafield nil? */ - lua_pop(L, 2); /* remove metatable and metafield */ - else - lua_remove(L, -2); /* remove only metatable */ - return tt; /* return metafield type */ - } -} - - -LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) { - obj = lua_absindex(L, obj); - if (luaL_getmetafield(L, obj, event) == LUA_TNIL) /* no metafield? */ - return 0; - lua_pushvalue(L, obj); - lua_call(L, 1, 1); - return 1; -} - - -LUALIB_API lua_Integer luaL_len (lua_State *L, int idx) { - lua_Integer l; - int isnum; - lua_len(L, idx); - l = lua_tointegerx(L, -1, &isnum); - if (!isnum) - luaL_error(L, "object length is not an integer"); - lua_pop(L, 1); /* remove object */ - return l; -} - - -LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) { - if (luaL_callmeta(L, idx, "__tostring")) { /* metafield? */ - if (!lua_isstring(L, -1)) - luaL_error(L, "'__tostring' must return a string"); - } - else { - switch (lua_type(L, idx)) { - case LUA_TNUMBER: { - if (lua_isinteger(L, idx)) - lua_pushfstring(L, "%I", (LUAI_UACINT)lua_tointeger(L, idx)); - else - lua_pushfstring(L, "%f", (LUAI_UACNUMBER)lua_tonumber(L, idx)); - break; - } - case LUA_TSTRING: - lua_pushvalue(L, idx); - break; - case LUA_TBOOLEAN: - lua_pushstring(L, (lua_toboolean(L, idx) ? "true" : "false")); - break; - case LUA_TNIL: - lua_pushliteral(L, "nil"); - break; - default: { - int tt = luaL_getmetafield(L, idx, "__name"); /* try name */ - const char *kind = (tt == LUA_TSTRING) ? lua_tostring(L, -1) : - luaL_typename(L, idx); - lua_pushfstring(L, "%s: %p", kind, lua_topointer(L, idx)); - if (tt != LUA_TNIL) - lua_remove(L, -2); /* remove '__name' */ - break; - } - } - } - return lua_tolstring(L, -1, len); -} - - -/* -** {====================================================== -** Compatibility with 5.1 module functions -** ======================================================= -*/ -#if defined(LUA_COMPAT_MODULE) - -static const char *luaL_findtable (lua_State *L, int idx, - const char *fname, int szhint) { - const char *e; - if (idx) lua_pushvalue(L, idx); - do { - e = strchr(fname, '.'); - if (e == NULL) e = fname + strlen(fname); - lua_pushlstring(L, fname, e - fname); - if (lua_rawget(L, -2) == LUA_TNIL) { /* no such field? */ - lua_pop(L, 1); /* remove this nil */ - lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */ - lua_pushlstring(L, fname, e - fname); - lua_pushvalue(L, -2); - lua_settable(L, -4); /* set new table into field */ - } - else if (!lua_istable(L, -1)) { /* field has a non-table value? */ - lua_pop(L, 2); /* remove table and value */ - return fname; /* return problematic part of the name */ - } - lua_remove(L, -2); /* remove previous table */ - fname = e + 1; - } while (*e == '.'); - return NULL; -} - - -/* -** Count number of elements in a luaL_Reg list. -*/ -static int libsize (const luaL_Reg *l) { - int size = 0; - for (; l && l->name; l++) size++; - return size; -} - - -/* -** Find or create a module table with a given name. The function -** first looks at the LOADED table and, if that fails, try a -** global variable with that name. In any case, leaves on the stack -** the module table. -*/ -LUALIB_API void luaL_pushmodule (lua_State *L, const char *modname, - int sizehint) { - luaL_findtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE, 1); - if (lua_getfield(L, -1, modname) != LUA_TTABLE) { /* no LOADED[modname]? */ - lua_pop(L, 1); /* remove previous result */ - /* try global variable (and create one if it does not exist) */ - lua_pushglobaltable(L); - if (luaL_findtable(L, 0, modname, sizehint) != NULL) - luaL_error(L, "name conflict for module '%s'", modname); - lua_pushvalue(L, -1); - lua_setfield(L, -3, modname); /* LOADED[modname] = new table */ - } - lua_remove(L, -2); /* remove LOADED table */ -} - - -LUALIB_API void luaL_openlib (lua_State *L, const char *libname, - const luaL_Reg *l, int nup) { - luaL_checkversion(L); - if (libname) { - luaL_pushmodule(L, libname, libsize(l)); /* get/create library table */ - lua_insert(L, -(nup + 1)); /* move library table to below upvalues */ - } - if (l) - luaL_setfuncs(L, l, nup); - else - lua_pop(L, nup); /* remove upvalues */ -} - -#endif -/* }====================================================== */ - -/* -** set functions from list 'l' into table at top - 'nup'; each -** function gets the 'nup' elements at the top as upvalues. -** Returns with only the table at the stack. -*/ -LUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) { - luaL_checkstack(L, nup, "too many upvalues"); - for (; l->name != NULL; l++) { /* fill the table with given functions */ - int i; - for (i = 0; i < nup; i++) /* copy upvalues to the top */ - lua_pushvalue(L, -nup); - lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */ - lua_setfield(L, -(nup + 2), l->name); - } - lua_pop(L, nup); /* remove upvalues */ -} - - -/* -** ensure that stack[idx][fname] has a table and push that table -** into the stack -*/ -LUALIB_API int luaL_getsubtable (lua_State *L, int idx, const char *fname) { - if (lua_getfield(L, idx, fname) == LUA_TTABLE) - return 1; /* table already there */ - else { - lua_pop(L, 1); /* remove previous result */ - idx = lua_absindex(L, idx); - lua_newtable(L); - lua_pushvalue(L, -1); /* copy to be left at top */ - lua_setfield(L, idx, fname); /* assign new table to field */ - return 0; /* false, because did not find table there */ - } -} - - -/* -** Stripped-down 'require': After checking "loaded" table, calls 'openf' -** to open a module, registers the result in 'package.loaded' table and, -** if 'glb' is true, also registers the result in the global table. -** Leaves resulting module on the top. -*/ -LUALIB_API void luaL_requiref (lua_State *L, const char *modname, - lua_CFunction openf, int glb) { - luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); - lua_getfield(L, -1, modname); /* LOADED[modname] */ - if (!lua_toboolean(L, -1)) { /* package not already loaded? */ - lua_pop(L, 1); /* remove field */ - lua_pushcfunction(L, openf); - lua_pushstring(L, modname); /* argument to open function */ - lua_call(L, 1, 1); /* call 'openf' to open module */ - lua_pushvalue(L, -1); /* make copy of module (call result) */ - lua_setfield(L, -3, modname); /* LOADED[modname] = module */ - } - lua_remove(L, -2); /* remove LOADED table */ - if (glb) { - lua_pushvalue(L, -1); /* copy of module */ - lua_setglobal(L, modname); /* _G[modname] = module */ - } -} - - -LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p, - const char *r) { - const char *wild; - size_t l = strlen(p); - luaL_Buffer b; - luaL_buffinit(L, &b); - while ((wild = strstr(s, p)) != NULL) { - luaL_addlstring(&b, s, wild - s); /* push prefix */ - luaL_addstring(&b, r); /* push replacement in place of pattern */ - s = wild + l; /* continue after 'p' */ - } - luaL_addstring(&b, s); /* push last suffix */ - luaL_pushresult(&b); - return lua_tostring(L, -1); -} - - -static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { - (void)ud; (void)osize; /* not used */ - if (nsize == 0) { - free(ptr); - return NULL; - } - else - return realloc(ptr, nsize); -} - - -static int panic (lua_State *L) { - lua_writestringerror("PANIC: unprotected error in call to Lua API (%s)\n", - lua_tostring(L, -1)); - return 0; /* return to Lua to abort */ -} - - -LUALIB_API lua_State *luaL_newstate (void) { - lua_State *L = lua_newstate(l_alloc, NULL); - if (L) lua_atpanic(L, &panic); - return L; -} - - -LUALIB_API void luaL_checkversion_ (lua_State *L, lua_Number ver, size_t sz) { - const lua_Number *v = lua_version(L); - if (sz != LUAL_NUMSIZES) /* check numeric types */ - luaL_error(L, "core and library have incompatible numeric types"); - if (v != lua_version(NULL)) - luaL_error(L, "multiple Lua VMs detected"); - else if (*v != ver) - luaL_error(L, "version mismatch: app. needs %f, Lua core provides %f", - (LUAI_UACNUMBER)ver, (LUAI_UACNUMBER)*v); -} - diff --git a/LuaSkin/lua-5.3.4/src/lbaselib.c b/LuaSkin/lua-5.3.4/src/lbaselib.c deleted file mode 100644 index 08523e6e7..000000000 --- a/LuaSkin/lua-5.3.4/src/lbaselib.c +++ /dev/null @@ -1,498 +0,0 @@ -/* -** $Id: lbaselib.c,v 1.314 2016/09/05 19:06:34 roberto Exp $ -** Basic library -** See Copyright Notice in lua.h -*/ - -#define lbaselib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include -#include -#include -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -static int luaB_print (lua_State *L) { - int n = lua_gettop(L); /* number of arguments */ - int i; - lua_getglobal(L, "tostring"); - for (i=1; i<=n; i++) { - const char *s; - size_t l; - lua_pushvalue(L, -1); /* function to be called */ - lua_pushvalue(L, i); /* value to print */ - lua_call(L, 1, 1); - s = lua_tolstring(L, -1, &l); /* get result */ - if (s == NULL) - return luaL_error(L, "'tostring' must return a string to 'print'"); - if (i>1) lua_writestring("\t", 1); - lua_writestring(s, l); - lua_pop(L, 1); /* pop result */ - } - lua_writeline(); - return 0; -} - - -#define SPACECHARS " \f\n\r\t\v" - -static const char *b_str2int (const char *s, int base, lua_Integer *pn) { - lua_Unsigned n = 0; - int neg = 0; - s += strspn(s, SPACECHARS); /* skip initial spaces */ - if (*s == '-') { s++; neg = 1; } /* handle signal */ - else if (*s == '+') s++; - if (!isalnum((unsigned char)*s)) /* no digit? */ - return NULL; - do { - int digit = (isdigit((unsigned char)*s)) ? *s - '0' - : (toupper((unsigned char)*s) - 'A') + 10; - if (digit >= base) return NULL; /* invalid numeral */ - n = n * base + digit; - s++; - } while (isalnum((unsigned char)*s)); - s += strspn(s, SPACECHARS); /* skip trailing spaces */ - *pn = (lua_Integer)((neg) ? (0u - n) : n); - return s; -} - - -static int luaB_tonumber (lua_State *L) { - if (lua_isnoneornil(L, 2)) { /* standard conversion? */ - luaL_checkany(L, 1); - if (lua_type(L, 1) == LUA_TNUMBER) { /* already a number? */ - lua_settop(L, 1); /* yes; return it */ - return 1; - } - else { - size_t l; - const char *s = lua_tolstring(L, 1, &l); - if (s != NULL && lua_stringtonumber(L, s) == l + 1) - return 1; /* successful conversion to number */ - /* else not a number */ - } - } - else { - size_t l; - const char *s; - lua_Integer n = 0; /* to avoid warnings */ - lua_Integer base = luaL_checkinteger(L, 2); - luaL_checktype(L, 1, LUA_TSTRING); /* no numbers as strings */ - s = lua_tolstring(L, 1, &l); - luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range"); - if (b_str2int(s, (int)base, &n) == s + l) { - lua_pushinteger(L, n); - return 1; - } /* else not a number */ - } /* else not a number */ - lua_pushnil(L); /* not a number */ - return 1; -} - - -static int luaB_error (lua_State *L) { - int level = (int)luaL_optinteger(L, 2, 1); - lua_settop(L, 1); - if (lua_type(L, 1) == LUA_TSTRING && level > 0) { - luaL_where(L, level); /* add extra information */ - lua_pushvalue(L, 1); - lua_concat(L, 2); - } - return lua_error(L); -} - - -static int luaB_getmetatable (lua_State *L) { - luaL_checkany(L, 1); - if (!lua_getmetatable(L, 1)) { - lua_pushnil(L); - return 1; /* no metatable */ - } - luaL_getmetafield(L, 1, "__metatable"); - return 1; /* returns either __metatable field (if present) or metatable */ -} - - -static int luaB_setmetatable (lua_State *L) { - int t = lua_type(L, 2); - luaL_checktype(L, 1, LUA_TTABLE); - luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, - "nil or table expected"); - if (luaL_getmetafield(L, 1, "__metatable") != LUA_TNIL) - return luaL_error(L, "cannot change a protected metatable"); - lua_settop(L, 2); - lua_setmetatable(L, 1); - return 1; -} - - -static int luaB_rawequal (lua_State *L) { - luaL_checkany(L, 1); - luaL_checkany(L, 2); - lua_pushboolean(L, lua_rawequal(L, 1, 2)); - return 1; -} - - -static int luaB_rawlen (lua_State *L) { - int t = lua_type(L, 1); - luaL_argcheck(L, t == LUA_TTABLE || t == LUA_TSTRING, 1, - "table or string expected"); - lua_pushinteger(L, lua_rawlen(L, 1)); - return 1; -} - - -static int luaB_rawget (lua_State *L) { - luaL_checktype(L, 1, LUA_TTABLE); - luaL_checkany(L, 2); - lua_settop(L, 2); - lua_rawget(L, 1); - return 1; -} - -static int luaB_rawset (lua_State *L) { - luaL_checktype(L, 1, LUA_TTABLE); - luaL_checkany(L, 2); - luaL_checkany(L, 3); - lua_settop(L, 3); - lua_rawset(L, 1); - return 1; -} - - -static int luaB_collectgarbage (lua_State *L) { - static const char *const opts[] = {"stop", "restart", "collect", - "count", "step", "setpause", "setstepmul", - "isrunning", NULL}; - static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, - LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL, - LUA_GCISRUNNING}; - int o = optsnum[luaL_checkoption(L, 1, "collect", opts)]; - int ex = (int)luaL_optinteger(L, 2, 0); - int res = lua_gc(L, o, ex); - switch (o) { - case LUA_GCCOUNT: { - int b = lua_gc(L, LUA_GCCOUNTB, 0); - lua_pushnumber(L, (lua_Number)res + ((lua_Number)b/1024)); - return 1; - } - case LUA_GCSTEP: case LUA_GCISRUNNING: { - lua_pushboolean(L, res); - return 1; - } - default: { - lua_pushinteger(L, res); - return 1; - } - } -} - - -static int luaB_type (lua_State *L) { - int t = lua_type(L, 1); - luaL_argcheck(L, t != LUA_TNONE, 1, "value expected"); - lua_pushstring(L, lua_typename(L, t)); - return 1; -} - - -static int pairsmeta (lua_State *L, const char *method, int iszero, - lua_CFunction iter) { - luaL_checkany(L, 1); - if (luaL_getmetafield(L, 1, method) == LUA_TNIL) { /* no metamethod? */ - lua_pushcfunction(L, iter); /* will return generator, */ - lua_pushvalue(L, 1); /* state, */ - if (iszero) lua_pushinteger(L, 0); /* and initial value */ - else lua_pushnil(L); - } - else { - lua_pushvalue(L, 1); /* argument 'self' to metamethod */ - lua_call(L, 1, 3); /* get 3 values from metamethod */ - } - return 3; -} - - -static int luaB_next (lua_State *L) { - luaL_checktype(L, 1, LUA_TTABLE); - lua_settop(L, 2); /* create a 2nd argument if there isn't one */ - if (lua_next(L, 1)) - return 2; - else { - lua_pushnil(L); - return 1; - } -} - - -static int luaB_pairs (lua_State *L) { - return pairsmeta(L, "__pairs", 0, luaB_next); -} - - -/* -** Traversal function for 'ipairs' -*/ -static int ipairsaux (lua_State *L) { - lua_Integer i = luaL_checkinteger(L, 2) + 1; - lua_pushinteger(L, i); - return (lua_geti(L, 1, i) == LUA_TNIL) ? 1 : 2; -} - - -/* -** 'ipairs' function. Returns 'ipairsaux', given "table", 0. -** (The given "table" may not be a table.) -*/ -static int luaB_ipairs (lua_State *L) { -#if defined(LUA_COMPAT_IPAIRS) - return pairsmeta(L, "__ipairs", 1, ipairsaux); -#else - luaL_checkany(L, 1); - lua_pushcfunction(L, ipairsaux); /* iteration function */ - lua_pushvalue(L, 1); /* state */ - lua_pushinteger(L, 0); /* initial value */ - return 3; -#endif -} - - -static int load_aux (lua_State *L, int status, int envidx) { - if (status == LUA_OK) { - if (envidx != 0) { /* 'env' parameter? */ - lua_pushvalue(L, envidx); /* environment for loaded function */ - if (!lua_setupvalue(L, -2, 1)) /* set it as 1st upvalue */ - lua_pop(L, 1); /* remove 'env' if not used by previous call */ - } - return 1; - } - else { /* error (message is on top of the stack) */ - lua_pushnil(L); - lua_insert(L, -2); /* put before error message */ - return 2; /* return nil plus error message */ - } -} - - -static int luaB_loadfile (lua_State *L) { - const char *fname = luaL_optstring(L, 1, NULL); - const char *mode = luaL_optstring(L, 2, NULL); - int env = (!lua_isnone(L, 3) ? 3 : 0); /* 'env' index or 0 if no 'env' */ - int status = luaL_loadfilex(L, fname, mode); - return load_aux(L, status, env); -} - - -/* -** {====================================================== -** Generic Read function -** ======================================================= -*/ - - -/* -** reserved slot, above all arguments, to hold a copy of the returned -** string to avoid it being collected while parsed. 'load' has four -** optional arguments (chunk, source name, mode, and environment). -*/ -#define RESERVEDSLOT 5 - - -/* -** Reader for generic 'load' function: 'lua_load' uses the -** stack for internal stuff, so the reader cannot change the -** stack top. Instead, it keeps its resulting string in a -** reserved slot inside the stack. -*/ -static const char *generic_reader (lua_State *L, void *ud, size_t *size) { - (void)(ud); /* not used */ - luaL_checkstack(L, 2, "too many nested functions"); - lua_pushvalue(L, 1); /* get function */ - lua_call(L, 0, 1); /* call it */ - if (lua_isnil(L, -1)) { - lua_pop(L, 1); /* pop result */ - *size = 0; - return NULL; - } - else if (!lua_isstring(L, -1)) - luaL_error(L, "reader function must return a string"); - lua_replace(L, RESERVEDSLOT); /* save string in reserved slot */ - return lua_tolstring(L, RESERVEDSLOT, size); -} - - -static int luaB_load (lua_State *L) { - int status; - size_t l; - const char *s = lua_tolstring(L, 1, &l); - const char *mode = luaL_optstring(L, 3, "bt"); - int env = (!lua_isnone(L, 4) ? 4 : 0); /* 'env' index or 0 if no 'env' */ - if (s != NULL) { /* loading a string? */ - const char *chunkname = luaL_optstring(L, 2, s); - status = luaL_loadbufferx(L, s, l, chunkname, mode); - } - else { /* loading from a reader function */ - const char *chunkname = luaL_optstring(L, 2, "=(load)"); - luaL_checktype(L, 1, LUA_TFUNCTION); - lua_settop(L, RESERVEDSLOT); /* create reserved slot */ - status = lua_load(L, generic_reader, NULL, chunkname, mode); - } - return load_aux(L, status, env); -} - -/* }====================================================== */ - - -static int dofilecont (lua_State *L, int d1, lua_KContext d2) { - (void)d1; (void)d2; /* only to match 'lua_Kfunction' prototype */ - return lua_gettop(L) - 1; -} - - -static int luaB_dofile (lua_State *L) { - const char *fname = luaL_optstring(L, 1, NULL); - lua_settop(L, 1); - if (luaL_loadfile(L, fname) != LUA_OK) - return lua_error(L); - lua_callk(L, 0, LUA_MULTRET, 0, dofilecont); - return dofilecont(L, 0, 0); -} - - -static int luaB_assert (lua_State *L) { - if (lua_toboolean(L, 1)) /* condition is true? */ - return lua_gettop(L); /* return all arguments */ - else { /* error */ - luaL_checkany(L, 1); /* there must be a condition */ - lua_remove(L, 1); /* remove it */ - lua_pushliteral(L, "assertion failed!"); /* default message */ - lua_settop(L, 1); /* leave only message (default if no other one) */ - return luaB_error(L); /* call 'error' */ - } -} - - -static int luaB_select (lua_State *L) { - int n = lua_gettop(L); - if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') { - lua_pushinteger(L, n-1); - return 1; - } - else { - lua_Integer i = luaL_checkinteger(L, 1); - if (i < 0) i = n + i; - else if (i > n) i = n; - luaL_argcheck(L, 1 <= i, 1, "index out of range"); - return n - (int)i; - } -} - - -/* -** Continuation function for 'pcall' and 'xpcall'. Both functions -** already pushed a 'true' before doing the call, so in case of success -** 'finishpcall' only has to return everything in the stack minus -** 'extra' values (where 'extra' is exactly the number of items to be -** ignored). -*/ -static int finishpcall (lua_State *L, int status, lua_KContext extra) { - if (status != LUA_OK && status != LUA_YIELD) { /* error? */ - lua_pushboolean(L, 0); /* first result (false) */ - lua_pushvalue(L, -2); /* error message */ - return 2; /* return false, msg */ - } - else - return lua_gettop(L) - (int)extra; /* return all results */ -} - - -static int luaB_pcall (lua_State *L) { - int status; - luaL_checkany(L, 1); - lua_pushboolean(L, 1); /* first result if no errors */ - lua_insert(L, 1); /* put it in place */ - status = lua_pcallk(L, lua_gettop(L) - 2, LUA_MULTRET, 0, 0, finishpcall); - return finishpcall(L, status, 0); -} - - -/* -** Do a protected call with error handling. After 'lua_rotate', the -** stack will have ; so, the function passes -** 2 to 'finishpcall' to skip the 2 first values when returning results. -*/ -static int luaB_xpcall (lua_State *L) { - int status; - int n = lua_gettop(L); - luaL_checktype(L, 2, LUA_TFUNCTION); /* check error function */ - lua_pushboolean(L, 1); /* first result */ - lua_pushvalue(L, 1); /* function */ - lua_rotate(L, 3, 2); /* move them below function's arguments */ - status = lua_pcallk(L, n - 2, LUA_MULTRET, 2, 2, finishpcall); - return finishpcall(L, status, 2); -} - - -static int luaB_tostring (lua_State *L) { - luaL_checkany(L, 1); - luaL_tolstring(L, 1, NULL); - return 1; -} - - -static const luaL_Reg base_funcs[] = { - {"assert", luaB_assert}, - {"collectgarbage", luaB_collectgarbage}, - {"dofile", luaB_dofile}, - {"error", luaB_error}, - {"getmetatable", luaB_getmetatable}, - {"ipairs", luaB_ipairs}, - {"loadfile", luaB_loadfile}, - {"load", luaB_load}, -#if defined(LUA_COMPAT_LOADSTRING) - {"loadstring", luaB_load}, -#endif - {"next", luaB_next}, - {"pairs", luaB_pairs}, - {"pcall", luaB_pcall}, - {"print", luaB_print}, - {"rawequal", luaB_rawequal}, - {"rawlen", luaB_rawlen}, - {"rawget", luaB_rawget}, - {"rawset", luaB_rawset}, - {"select", luaB_select}, - {"setmetatable", luaB_setmetatable}, - {"tonumber", luaB_tonumber}, - {"tostring", luaB_tostring}, - {"type", luaB_type}, - {"xpcall", luaB_xpcall}, - /* placeholders */ - {"_G", NULL}, - {"_VERSION", NULL}, - {NULL, NULL} -}; - - -LUAMOD_API int luaopen_base (lua_State *L) { - /* open lib into global table */ - lua_pushglobaltable(L); - luaL_setfuncs(L, base_funcs, 0); - /* set global _G */ - lua_pushvalue(L, -1); - lua_setfield(L, -2, "_G"); - /* set global _VERSION */ - lua_pushliteral(L, LUA_VERSION); - lua_setfield(L, -2, "_VERSION"); - return 1; -} - diff --git a/LuaSkin/lua-5.3.4/src/lbitlib.c b/LuaSkin/lua-5.3.4/src/lbitlib.c deleted file mode 100644 index 1cb1d5b93..000000000 --- a/LuaSkin/lua-5.3.4/src/lbitlib.c +++ /dev/null @@ -1,233 +0,0 @@ -/* -** $Id: lbitlib.c,v 1.30 2015/11/11 19:08:09 roberto Exp $ -** Standard library for bitwise operations -** See Copyright Notice in lua.h -*/ - -#define lbitlib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -#if defined(LUA_COMPAT_BITLIB) /* { */ - - -#define pushunsigned(L,n) lua_pushinteger(L, (lua_Integer)(n)) -#define checkunsigned(L,i) ((lua_Unsigned)luaL_checkinteger(L,i)) - - -/* number of bits to consider in a number */ -#if !defined(LUA_NBITS) -#define LUA_NBITS 32 -#endif - - -/* -** a lua_Unsigned with its first LUA_NBITS bits equal to 1. (Shift must -** be made in two parts to avoid problems when LUA_NBITS is equal to the -** number of bits in a lua_Unsigned.) -*/ -#define ALLONES (~(((~(lua_Unsigned)0) << (LUA_NBITS - 1)) << 1)) - - -/* macro to trim extra bits */ -#define trim(x) ((x) & ALLONES) - - -/* builds a number with 'n' ones (1 <= n <= LUA_NBITS) */ -#define mask(n) (~((ALLONES << 1) << ((n) - 1))) - - - -static lua_Unsigned andaux (lua_State *L) { - int i, n = lua_gettop(L); - lua_Unsigned r = ~(lua_Unsigned)0; - for (i = 1; i <= n; i++) - r &= checkunsigned(L, i); - return trim(r); -} - - -static int b_and (lua_State *L) { - lua_Unsigned r = andaux(L); - pushunsigned(L, r); - return 1; -} - - -static int b_test (lua_State *L) { - lua_Unsigned r = andaux(L); - lua_pushboolean(L, r != 0); - return 1; -} - - -static int b_or (lua_State *L) { - int i, n = lua_gettop(L); - lua_Unsigned r = 0; - for (i = 1; i <= n; i++) - r |= checkunsigned(L, i); - pushunsigned(L, trim(r)); - return 1; -} - - -static int b_xor (lua_State *L) { - int i, n = lua_gettop(L); - lua_Unsigned r = 0; - for (i = 1; i <= n; i++) - r ^= checkunsigned(L, i); - pushunsigned(L, trim(r)); - return 1; -} - - -static int b_not (lua_State *L) { - lua_Unsigned r = ~checkunsigned(L, 1); - pushunsigned(L, trim(r)); - return 1; -} - - -static int b_shift (lua_State *L, lua_Unsigned r, lua_Integer i) { - if (i < 0) { /* shift right? */ - i = -i; - r = trim(r); - if (i >= LUA_NBITS) r = 0; - else r >>= i; - } - else { /* shift left */ - if (i >= LUA_NBITS) r = 0; - else r <<= i; - r = trim(r); - } - pushunsigned(L, r); - return 1; -} - - -static int b_lshift (lua_State *L) { - return b_shift(L, checkunsigned(L, 1), luaL_checkinteger(L, 2)); -} - - -static int b_rshift (lua_State *L) { - return b_shift(L, checkunsigned(L, 1), -luaL_checkinteger(L, 2)); -} - - -static int b_arshift (lua_State *L) { - lua_Unsigned r = checkunsigned(L, 1); - lua_Integer i = luaL_checkinteger(L, 2); - if (i < 0 || !(r & ((lua_Unsigned)1 << (LUA_NBITS - 1)))) - return b_shift(L, r, -i); - else { /* arithmetic shift for 'negative' number */ - if (i >= LUA_NBITS) r = ALLONES; - else - r = trim((r >> i) | ~(trim(~(lua_Unsigned)0) >> i)); /* add signal bit */ - pushunsigned(L, r); - return 1; - } -} - - -static int b_rot (lua_State *L, lua_Integer d) { - lua_Unsigned r = checkunsigned(L, 1); - int i = d & (LUA_NBITS - 1); /* i = d % NBITS */ - r = trim(r); - if (i != 0) /* avoid undefined shift of LUA_NBITS when i == 0 */ - r = (r << i) | (r >> (LUA_NBITS - i)); - pushunsigned(L, trim(r)); - return 1; -} - - -static int b_lrot (lua_State *L) { - return b_rot(L, luaL_checkinteger(L, 2)); -} - - -static int b_rrot (lua_State *L) { - return b_rot(L, -luaL_checkinteger(L, 2)); -} - - -/* -** get field and width arguments for field-manipulation functions, -** checking whether they are valid. -** ('luaL_error' called without 'return' to avoid later warnings about -** 'width' being used uninitialized.) -*/ -static int fieldargs (lua_State *L, int farg, int *width) { - lua_Integer f = luaL_checkinteger(L, farg); - lua_Integer w = luaL_optinteger(L, farg + 1, 1); - luaL_argcheck(L, 0 <= f, farg, "field cannot be negative"); - luaL_argcheck(L, 0 < w, farg + 1, "width must be positive"); - if (f + w > LUA_NBITS) - luaL_error(L, "trying to access non-existent bits"); - *width = (int)w; - return (int)f; -} - - -static int b_extract (lua_State *L) { - int w; - lua_Unsigned r = trim(checkunsigned(L, 1)); - int f = fieldargs(L, 2, &w); - r = (r >> f) & mask(w); - pushunsigned(L, r); - return 1; -} - - -static int b_replace (lua_State *L) { - int w; - lua_Unsigned r = trim(checkunsigned(L, 1)); - lua_Unsigned v = trim(checkunsigned(L, 2)); - int f = fieldargs(L, 3, &w); - lua_Unsigned m = mask(w); - r = (r & ~(m << f)) | ((v & m) << f); - pushunsigned(L, r); - return 1; -} - - -static const luaL_Reg bitlib[] = { - {"arshift", b_arshift}, - {"band", b_and}, - {"bnot", b_not}, - {"bor", b_or}, - {"bxor", b_xor}, - {"btest", b_test}, - {"extract", b_extract}, - {"lrotate", b_lrot}, - {"lshift", b_lshift}, - {"replace", b_replace}, - {"rrotate", b_rrot}, - {"rshift", b_rshift}, - {NULL, NULL} -}; - - - -LUAMOD_API int luaopen_bit32 (lua_State *L) { - luaL_newlib(L, bitlib); - return 1; -} - - -#else /* }{ */ - - -LUAMOD_API int luaopen_bit32 (lua_State *L) { - return luaL_error(L, "library 'bit32' has been deprecated"); -} - -#endif /* } */ diff --git a/LuaSkin/lua-5.3.4/src/lcode.c b/LuaSkin/lua-5.3.4/src/lcode.c deleted file mode 100644 index 0bb414262..000000000 --- a/LuaSkin/lua-5.3.4/src/lcode.c +++ /dev/null @@ -1,1203 +0,0 @@ -/* -** $Id: lcode.c,v 2.112 2016/12/22 13:08:50 roberto Exp $ -** Code generator for Lua -** See Copyright Notice in lua.h -*/ - -#define lcode_c -#define LUA_CORE - -#include "lprefix.h" - - -#include -#include - -#include "lua.h" - -#include "lcode.h" -#include "ldebug.h" -#include "ldo.h" -#include "lgc.h" -#include "llex.h" -#include "lmem.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lparser.h" -#include "lstring.h" -#include "ltable.h" -#include "lvm.h" - - -/* Maximum number of registers in a Lua function (must fit in 8 bits) */ -#define MAXREGS 255 - - -#define hasjumps(e) ((e)->t != (e)->f) - - -/* -** If expression is a numeric constant, fills 'v' with its value -** and returns 1. Otherwise, returns 0. -*/ -static int tonumeral(const expdesc *e, TValue *v) { - if (hasjumps(e)) - return 0; /* not a numeral */ - switch (e->k) { - case VKINT: - if (v) setivalue(v, e->u.ival); - return 1; - case VKFLT: - if (v) setfltvalue(v, e->u.nval); - return 1; - default: return 0; - } -} - - -/* -** Create a OP_LOADNIL instruction, but try to optimize: if the previous -** instruction is also OP_LOADNIL and ranges are compatible, adjust -** range of previous instruction instead of emitting a new one. (For -** instance, 'local a; local b' will generate a single opcode.) -*/ -void luaK_nil (FuncState *fs, int from, int n) { - Instruction *previous; - int l = from + n - 1; /* last register to set nil */ - if (fs->pc > fs->lasttarget) { /* no jumps to current position? */ - previous = &fs->f->code[fs->pc-1]; - if (GET_OPCODE(*previous) == OP_LOADNIL) { /* previous is LOADNIL? */ - int pfrom = GETARG_A(*previous); /* get previous range */ - int pl = pfrom + GETARG_B(*previous); - if ((pfrom <= from && from <= pl + 1) || - (from <= pfrom && pfrom <= l + 1)) { /* can connect both? */ - if (pfrom < from) from = pfrom; /* from = min(from, pfrom) */ - if (pl > l) l = pl; /* l = max(l, pl) */ - SETARG_A(*previous, from); - SETARG_B(*previous, l - from); - return; - } - } /* else go through */ - } - luaK_codeABC(fs, OP_LOADNIL, from, n - 1, 0); /* else no optimization */ -} - - -/* -** Gets the destination address of a jump instruction. Used to traverse -** a list of jumps. -*/ -static int getjump (FuncState *fs, int pc) { - int offset = GETARG_sBx(fs->f->code[pc]); - if (offset == NO_JUMP) /* point to itself represents end of list */ - return NO_JUMP; /* end of list */ - else - return (pc+1)+offset; /* turn offset into absolute position */ -} - - -/* -** Fix jump instruction at position 'pc' to jump to 'dest'. -** (Jump addresses are relative in Lua) -*/ -static void fixjump (FuncState *fs, int pc, int dest) { - Instruction *jmp = &fs->f->code[pc]; - int offset = dest - (pc + 1); - lua_assert(dest != NO_JUMP); - if (abs(offset) > MAXARG_sBx) - luaX_syntaxerror(fs->ls, "control structure too long"); - SETARG_sBx(*jmp, offset); -} - - -/* -** Concatenate jump-list 'l2' into jump-list 'l1' -*/ -void luaK_concat (FuncState *fs, int *l1, int l2) { - if (l2 == NO_JUMP) return; /* nothing to concatenate? */ - else if (*l1 == NO_JUMP) /* no original list? */ - *l1 = l2; /* 'l1' points to 'l2' */ - else { - int list = *l1; - int next; - while ((next = getjump(fs, list)) != NO_JUMP) /* find last element */ - list = next; - fixjump(fs, list, l2); /* last element links to 'l2' */ - } -} - - -/* -** Create a jump instruction and return its position, so its destination -** can be fixed later (with 'fixjump'). If there are jumps to -** this position (kept in 'jpc'), link them all together so that -** 'patchlistaux' will fix all them directly to the final destination. -*/ -int luaK_jump (FuncState *fs) { - int jpc = fs->jpc; /* save list of jumps to here */ - int j; - fs->jpc = NO_JUMP; /* no more jumps to here */ - j = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP); - luaK_concat(fs, &j, jpc); /* keep them on hold */ - return j; -} - - -/* -** Code a 'return' instruction -*/ -void luaK_ret (FuncState *fs, int first, int nret) { - luaK_codeABC(fs, OP_RETURN, first, nret+1, 0); -} - - -/* -** Code a "conditional jump", that is, a test or comparison opcode -** followed by a jump. Return jump position. -*/ -static int condjump (FuncState *fs, OpCode op, int A, int B, int C) { - luaK_codeABC(fs, op, A, B, C); - return luaK_jump(fs); -} - - -/* -** returns current 'pc' and marks it as a jump target (to avoid wrong -** optimizations with consecutive instructions not in the same basic block). -*/ -int luaK_getlabel (FuncState *fs) { - fs->lasttarget = fs->pc; - return fs->pc; -} - - -/* -** Returns the position of the instruction "controlling" a given -** jump (that is, its condition), or the jump itself if it is -** unconditional. -*/ -static Instruction *getjumpcontrol (FuncState *fs, int pc) { - Instruction *pi = &fs->f->code[pc]; - if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1)))) - return pi-1; - else - return pi; -} - - -/* -** Patch destination register for a TESTSET instruction. -** If instruction in position 'node' is not a TESTSET, return 0 ("fails"). -** Otherwise, if 'reg' is not 'NO_REG', set it as the destination -** register. Otherwise, change instruction to a simple 'TEST' (produces -** no register value) -*/ -static int patchtestreg (FuncState *fs, int node, int reg) { - Instruction *i = getjumpcontrol(fs, node); - if (GET_OPCODE(*i) != OP_TESTSET) - return 0; /* cannot patch other instructions */ - if (reg != NO_REG && reg != GETARG_B(*i)) - SETARG_A(*i, reg); - else { - /* no register to put value or register already has the value; - change instruction to simple test */ - *i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i)); - } - return 1; -} - - -/* -** Traverse a list of tests ensuring no one produces a value -*/ -static void removevalues (FuncState *fs, int list) { - for (; list != NO_JUMP; list = getjump(fs, list)) - patchtestreg(fs, list, NO_REG); -} - - -/* -** Traverse a list of tests, patching their destination address and -** registers: tests producing values jump to 'vtarget' (and put their -** values in 'reg'), other tests jump to 'dtarget'. -*/ -static void patchlistaux (FuncState *fs, int list, int vtarget, int reg, - int dtarget) { - while (list != NO_JUMP) { - int next = getjump(fs, list); - if (patchtestreg(fs, list, reg)) - fixjump(fs, list, vtarget); - else - fixjump(fs, list, dtarget); /* jump to default target */ - list = next; - } -} - - -/* -** Ensure all pending jumps to current position are fixed (jumping -** to current position with no values) and reset list of pending -** jumps -*/ -static void dischargejpc (FuncState *fs) { - patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc); - fs->jpc = NO_JUMP; -} - - -/* -** Add elements in 'list' to list of pending jumps to "here" -** (current position) -*/ -void luaK_patchtohere (FuncState *fs, int list) { - luaK_getlabel(fs); /* mark "here" as a jump target */ - luaK_concat(fs, &fs->jpc, list); -} - - -/* -** Path all jumps in 'list' to jump to 'target'. -** (The assert means that we cannot fix a jump to a forward address -** because we only know addresses once code is generated.) -*/ -void luaK_patchlist (FuncState *fs, int list, int target) { - if (target == fs->pc) /* 'target' is current position? */ - luaK_patchtohere(fs, list); /* add list to pending jumps */ - else { - lua_assert(target < fs->pc); - patchlistaux(fs, list, target, NO_REG, target); - } -} - - -/* -** Path all jumps in 'list' to close upvalues up to given 'level' -** (The assertion checks that jumps either were closing nothing -** or were closing higher levels, from inner blocks.) -*/ -void luaK_patchclose (FuncState *fs, int list, int level) { - level++; /* argument is +1 to reserve 0 as non-op */ - for (; list != NO_JUMP; list = getjump(fs, list)) { - lua_assert(GET_OPCODE(fs->f->code[list]) == OP_JMP && - (GETARG_A(fs->f->code[list]) == 0 || - GETARG_A(fs->f->code[list]) >= level)); - SETARG_A(fs->f->code[list], level); - } -} - - -/* -** Emit instruction 'i', checking for array sizes and saving also its -** line information. Return 'i' position. -*/ -static int luaK_code (FuncState *fs, Instruction i) { - Proto *f = fs->f; - dischargejpc(fs); /* 'pc' will change */ - /* put new instruction in code array */ - luaM_growvector(fs->ls->L, f->code, fs->pc, f->sizecode, Instruction, - MAX_INT, "opcodes"); - f->code[fs->pc] = i; - /* save corresponding line information */ - luaM_growvector(fs->ls->L, f->lineinfo, fs->pc, f->sizelineinfo, int, - MAX_INT, "opcodes"); - f->lineinfo[fs->pc] = fs->ls->lastline; - return fs->pc++; -} - - -/* -** Format and emit an 'iABC' instruction. (Assertions check consistency -** of parameters versus opcode.) -*/ -int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) { - lua_assert(getOpMode(o) == iABC); - lua_assert(getBMode(o) != OpArgN || b == 0); - lua_assert(getCMode(o) != OpArgN || c == 0); - lua_assert(a <= MAXARG_A && b <= MAXARG_B && c <= MAXARG_C); - return luaK_code(fs, CREATE_ABC(o, a, b, c)); -} - - -/* -** Format and emit an 'iABx' instruction. -*/ -int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) { - lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx); - lua_assert(getCMode(o) == OpArgN); - lua_assert(a <= MAXARG_A && bc <= MAXARG_Bx); - return luaK_code(fs, CREATE_ABx(o, a, bc)); -} - - -/* -** Emit an "extra argument" instruction (format 'iAx') -*/ -static int codeextraarg (FuncState *fs, int a) { - lua_assert(a <= MAXARG_Ax); - return luaK_code(fs, CREATE_Ax(OP_EXTRAARG, a)); -} - - -/* -** Emit a "load constant" instruction, using either 'OP_LOADK' -** (if constant index 'k' fits in 18 bits) or an 'OP_LOADKX' -** instruction with "extra argument". -*/ -int luaK_codek (FuncState *fs, int reg, int k) { - if (k <= MAXARG_Bx) - return luaK_codeABx(fs, OP_LOADK, reg, k); - else { - int p = luaK_codeABx(fs, OP_LOADKX, reg, 0); - codeextraarg(fs, k); - return p; - } -} - - -/* -** Check register-stack level, keeping track of its maximum size -** in field 'maxstacksize' -*/ -void luaK_checkstack (FuncState *fs, int n) { - int newstack = fs->freereg + n; - if (newstack > fs->f->maxstacksize) { - if (newstack >= MAXREGS) - luaX_syntaxerror(fs->ls, - "function or expression needs too many registers"); - fs->f->maxstacksize = cast_byte(newstack); - } -} - - -/* -** Reserve 'n' registers in register stack -*/ -void luaK_reserveregs (FuncState *fs, int n) { - luaK_checkstack(fs, n); - fs->freereg += n; -} - - -/* -** Free register 'reg', if it is neither a constant index nor -** a local variable. -) -*/ -static void freereg (FuncState *fs, int reg) { - if (!ISK(reg) && reg >= fs->nactvar) { - fs->freereg--; - lua_assert(reg == fs->freereg); - } -} - - -/* -** Free register used by expression 'e' (if any) -*/ -static void freeexp (FuncState *fs, expdesc *e) { - if (e->k == VNONRELOC) - freereg(fs, e->u.info); -} - - -/* -** Free registers used by expressions 'e1' and 'e2' (if any) in proper -** order. -*/ -static void freeexps (FuncState *fs, expdesc *e1, expdesc *e2) { - int r1 = (e1->k == VNONRELOC) ? e1->u.info : -1; - int r2 = (e2->k == VNONRELOC) ? e2->u.info : -1; - if (r1 > r2) { - freereg(fs, r1); - freereg(fs, r2); - } - else { - freereg(fs, r2); - freereg(fs, r1); - } -} - - -/* -** Add constant 'v' to prototype's list of constants (field 'k'). -** Use scanner's table to cache position of constants in constant list -** and try to reuse constants. Because some values should not be used -** as keys (nil cannot be a key, integer keys can collapse with float -** keys), the caller must provide a useful 'key' for indexing the cache. -*/ -static int addk (FuncState *fs, TValue *key, TValue *v) { - lua_State *L = fs->ls->L; - Proto *f = fs->f; - TValue *idx = luaH_set(L, fs->ls->h, key); /* index scanner table */ - int k, oldsize; - if (ttisinteger(idx)) { /* is there an index there? */ - k = cast_int(ivalue(idx)); - /* correct value? (warning: must distinguish floats from integers!) */ - if (k < fs->nk && ttype(&f->k[k]) == ttype(v) && - luaV_rawequalobj(&f->k[k], v)) - return k; /* reuse index */ - } - /* constant not found; create a new entry */ - oldsize = f->sizek; - k = fs->nk; - /* numerical value does not need GC barrier; - table has no metatable, so it does not need to invalidate cache */ - setivalue(idx, k); - luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Ax, "constants"); - while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]); - setobj(L, &f->k[k], v); - fs->nk++; - luaC_barrier(L, f, v); - return k; -} - - -/* -** Add a string to list of constants and return its index. -*/ -int luaK_stringK (FuncState *fs, TString *s) { - TValue o; - setsvalue(fs->ls->L, &o, s); - return addk(fs, &o, &o); /* use string itself as key */ -} - - -/* -** Add an integer to list of constants and return its index. -** Integers use userdata as keys to avoid collision with floats with -** same value; conversion to 'void*' is used only for hashing, so there -** are no "precision" problems. -*/ -int luaK_intK (FuncState *fs, lua_Integer n) { - TValue k, o; - setpvalue(&k, cast(void*, cast(size_t, n))); - setivalue(&o, n); - return addk(fs, &k, &o); -} - -/* -** Add a float to list of constants and return its index. -*/ -static int luaK_numberK (FuncState *fs, lua_Number r) { - TValue o; - setfltvalue(&o, r); - return addk(fs, &o, &o); /* use number itself as key */ -} - - -/* -** Add a boolean to list of constants and return its index. -*/ -static int boolK (FuncState *fs, int b) { - TValue o; - setbvalue(&o, b); - return addk(fs, &o, &o); /* use boolean itself as key */ -} - - -/* -** Add nil to list of constants and return its index. -*/ -static int nilK (FuncState *fs) { - TValue k, v; - setnilvalue(&v); - /* cannot use nil as key; instead use table itself to represent nil */ - sethvalue(fs->ls->L, &k, fs->ls->h); - return addk(fs, &k, &v); -} - - -/* -** Fix an expression to return the number of results 'nresults'. -** Either 'e' is a multi-ret expression (function call or vararg) -** or 'nresults' is LUA_MULTRET (as any expression can satisfy that). -*/ -void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) { - if (e->k == VCALL) { /* expression is an open function call? */ - SETARG_C(getinstruction(fs, e), nresults + 1); - } - else if (e->k == VVARARG) { - Instruction *pc = &getinstruction(fs, e); - SETARG_B(*pc, nresults + 1); - SETARG_A(*pc, fs->freereg); - luaK_reserveregs(fs, 1); - } - else lua_assert(nresults == LUA_MULTRET); -} - - -/* -** Fix an expression to return one result. -** If expression is not a multi-ret expression (function call or -** vararg), it already returns one result, so nothing needs to be done. -** Function calls become VNONRELOC expressions (as its result comes -** fixed in the base register of the call), while vararg expressions -** become VRELOCABLE (as OP_VARARG puts its results where it wants). -** (Calls are created returning one result, so that does not need -** to be fixed.) -*/ -void luaK_setoneret (FuncState *fs, expdesc *e) { - if (e->k == VCALL) { /* expression is an open function call? */ - /* already returns 1 value */ - lua_assert(GETARG_C(getinstruction(fs, e)) == 2); - e->k = VNONRELOC; /* result has fixed position */ - e->u.info = GETARG_A(getinstruction(fs, e)); - } - else if (e->k == VVARARG) { - SETARG_B(getinstruction(fs, e), 2); - e->k = VRELOCABLE; /* can relocate its simple result */ - } -} - - -/* -** Ensure that expression 'e' is not a variable. -*/ -void luaK_dischargevars (FuncState *fs, expdesc *e) { - switch (e->k) { - case VLOCAL: { /* already in a register */ - e->k = VNONRELOC; /* becomes a non-relocatable value */ - break; - } - case VUPVAL: { /* move value to some (pending) register */ - e->u.info = luaK_codeABC(fs, OP_GETUPVAL, 0, e->u.info, 0); - e->k = VRELOCABLE; - break; - } - case VINDEXED: { - OpCode op; - freereg(fs, e->u.ind.idx); - if (e->u.ind.vt == VLOCAL) { /* is 't' in a register? */ - freereg(fs, e->u.ind.t); - op = OP_GETTABLE; - } - else { - lua_assert(e->u.ind.vt == VUPVAL); - op = OP_GETTABUP; /* 't' is in an upvalue */ - } - e->u.info = luaK_codeABC(fs, op, 0, e->u.ind.t, e->u.ind.idx); - e->k = VRELOCABLE; - break; - } - case VVARARG: case VCALL: { - luaK_setoneret(fs, e); - break; - } - default: break; /* there is one value available (somewhere) */ - } -} - - -/* -** Ensures expression value is in register 'reg' (and therefore -** 'e' will become a non-relocatable expression). -*/ -static void discharge2reg (FuncState *fs, expdesc *e, int reg) { - luaK_dischargevars(fs, e); - switch (e->k) { - case VNIL: { - luaK_nil(fs, reg, 1); - break; - } - case VFALSE: case VTRUE: { - luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0); - break; - } - case VK: { - luaK_codek(fs, reg, e->u.info); - break; - } - case VKFLT: { - luaK_codek(fs, reg, luaK_numberK(fs, e->u.nval)); - break; - } - case VKINT: { - luaK_codek(fs, reg, luaK_intK(fs, e->u.ival)); - break; - } - case VRELOCABLE: { - Instruction *pc = &getinstruction(fs, e); - SETARG_A(*pc, reg); /* instruction will put result in 'reg' */ - break; - } - case VNONRELOC: { - if (reg != e->u.info) - luaK_codeABC(fs, OP_MOVE, reg, e->u.info, 0); - break; - } - default: { - lua_assert(e->k == VJMP); - return; /* nothing to do... */ - } - } - e->u.info = reg; - e->k = VNONRELOC; -} - - -/* -** Ensures expression value is in any register. -*/ -static void discharge2anyreg (FuncState *fs, expdesc *e) { - if (e->k != VNONRELOC) { /* no fixed register yet? */ - luaK_reserveregs(fs, 1); /* get a register */ - discharge2reg(fs, e, fs->freereg-1); /* put value there */ - } -} - - -static int code_loadbool (FuncState *fs, int A, int b, int jump) { - luaK_getlabel(fs); /* those instructions may be jump targets */ - return luaK_codeABC(fs, OP_LOADBOOL, A, b, jump); -} - - -/* -** check whether list has any jump that do not produce a value -** or produce an inverted value -*/ -static int need_value (FuncState *fs, int list) { - for (; list != NO_JUMP; list = getjump(fs, list)) { - Instruction i = *getjumpcontrol(fs, list); - if (GET_OPCODE(i) != OP_TESTSET) return 1; - } - return 0; /* not found */ -} - - -/* -** Ensures final expression result (including results from its jump -** lists) is in register 'reg'. -** If expression has jumps, need to patch these jumps either to -** its final position or to "load" instructions (for those tests -** that do not produce values). -*/ -static void exp2reg (FuncState *fs, expdesc *e, int reg) { - discharge2reg(fs, e, reg); - if (e->k == VJMP) /* expression itself is a test? */ - luaK_concat(fs, &e->t, e->u.info); /* put this jump in 't' list */ - if (hasjumps(e)) { - int final; /* position after whole expression */ - int p_f = NO_JUMP; /* position of an eventual LOAD false */ - int p_t = NO_JUMP; /* position of an eventual LOAD true */ - if (need_value(fs, e->t) || need_value(fs, e->f)) { - int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs); - p_f = code_loadbool(fs, reg, 0, 1); - p_t = code_loadbool(fs, reg, 1, 0); - luaK_patchtohere(fs, fj); - } - final = luaK_getlabel(fs); - patchlistaux(fs, e->f, final, reg, p_f); - patchlistaux(fs, e->t, final, reg, p_t); - } - e->f = e->t = NO_JUMP; - e->u.info = reg; - e->k = VNONRELOC; -} - - -/* -** Ensures final expression result (including results from its jump -** lists) is in next available register. -*/ -void luaK_exp2nextreg (FuncState *fs, expdesc *e) { - luaK_dischargevars(fs, e); - freeexp(fs, e); - luaK_reserveregs(fs, 1); - exp2reg(fs, e, fs->freereg - 1); -} - - -/* -** Ensures final expression result (including results from its jump -** lists) is in some (any) register and return that register. -*/ -int luaK_exp2anyreg (FuncState *fs, expdesc *e) { - luaK_dischargevars(fs, e); - if (e->k == VNONRELOC) { /* expression already has a register? */ - if (!hasjumps(e)) /* no jumps? */ - return e->u.info; /* result is already in a register */ - if (e->u.info >= fs->nactvar) { /* reg. is not a local? */ - exp2reg(fs, e, e->u.info); /* put final result in it */ - return e->u.info; - } - } - luaK_exp2nextreg(fs, e); /* otherwise, use next available register */ - return e->u.info; -} - - -/* -** Ensures final expression result is either in a register or in an -** upvalue. -*/ -void luaK_exp2anyregup (FuncState *fs, expdesc *e) { - if (e->k != VUPVAL || hasjumps(e)) - luaK_exp2anyreg(fs, e); -} - - -/* -** Ensures final expression result is either in a register or it is -** a constant. -*/ -void luaK_exp2val (FuncState *fs, expdesc *e) { - if (hasjumps(e)) - luaK_exp2anyreg(fs, e); - else - luaK_dischargevars(fs, e); -} - - -/* -** Ensures final expression result is in a valid R/K index -** (that is, it is either in a register or in 'k' with an index -** in the range of R/K indices). -** Returns R/K index. -*/ -int luaK_exp2RK (FuncState *fs, expdesc *e) { - luaK_exp2val(fs, e); - switch (e->k) { /* move constants to 'k' */ - case VTRUE: e->u.info = boolK(fs, 1); goto vk; - case VFALSE: e->u.info = boolK(fs, 0); goto vk; - case VNIL: e->u.info = nilK(fs); goto vk; - case VKINT: e->u.info = luaK_intK(fs, e->u.ival); goto vk; - case VKFLT: e->u.info = luaK_numberK(fs, e->u.nval); goto vk; - case VK: - vk: - e->k = VK; - if (e->u.info <= MAXINDEXRK) /* constant fits in 'argC'? */ - return RKASK(e->u.info); - else break; - default: break; - } - /* not a constant in the right range: put it in a register */ - return luaK_exp2anyreg(fs, e); -} - - -/* -** Generate code to store result of expression 'ex' into variable 'var'. -*/ -void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) { - switch (var->k) { - case VLOCAL: { - freeexp(fs, ex); - exp2reg(fs, ex, var->u.info); /* compute 'ex' into proper place */ - return; - } - case VUPVAL: { - int e = luaK_exp2anyreg(fs, ex); - luaK_codeABC(fs, OP_SETUPVAL, e, var->u.info, 0); - break; - } - case VINDEXED: { - OpCode op = (var->u.ind.vt == VLOCAL) ? OP_SETTABLE : OP_SETTABUP; - int e = luaK_exp2RK(fs, ex); - luaK_codeABC(fs, op, var->u.ind.t, var->u.ind.idx, e); - break; - } - default: lua_assert(0); /* invalid var kind to store */ - } - freeexp(fs, ex); -} - - -/* -** Emit SELF instruction (convert expression 'e' into 'e:key(e,'). -*/ -void luaK_self (FuncState *fs, expdesc *e, expdesc *key) { - int ereg; - luaK_exp2anyreg(fs, e); - ereg = e->u.info; /* register where 'e' was placed */ - freeexp(fs, e); - e->u.info = fs->freereg; /* base register for op_self */ - e->k = VNONRELOC; /* self expression has a fixed register */ - luaK_reserveregs(fs, 2); /* function and 'self' produced by op_self */ - luaK_codeABC(fs, OP_SELF, e->u.info, ereg, luaK_exp2RK(fs, key)); - freeexp(fs, key); -} - - -/* -** Negate condition 'e' (where 'e' is a comparison). -*/ -static void negatecondition (FuncState *fs, expdesc *e) { - Instruction *pc = getjumpcontrol(fs, e->u.info); - lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET && - GET_OPCODE(*pc) != OP_TEST); - SETARG_A(*pc, !(GETARG_A(*pc))); -} - - -/* -** Emit instruction to jump if 'e' is 'cond' (that is, if 'cond' -** is true, code will jump if 'e' is true.) Return jump position. -** Optimize when 'e' is 'not' something, inverting the condition -** and removing the 'not'. -*/ -static int jumponcond (FuncState *fs, expdesc *e, int cond) { - if (e->k == VRELOCABLE) { - Instruction ie = getinstruction(fs, e); - if (GET_OPCODE(ie) == OP_NOT) { - fs->pc--; /* remove previous OP_NOT */ - return condjump(fs, OP_TEST, GETARG_B(ie), 0, !cond); - } - /* else go through */ - } - discharge2anyreg(fs, e); - freeexp(fs, e); - return condjump(fs, OP_TESTSET, NO_REG, e->u.info, cond); -} - - -/* -** Emit code to go through if 'e' is true, jump otherwise. -*/ -void luaK_goiftrue (FuncState *fs, expdesc *e) { - int pc; /* pc of new jump */ - luaK_dischargevars(fs, e); - switch (e->k) { - case VJMP: { /* condition? */ - negatecondition(fs, e); /* jump when it is false */ - pc = e->u.info; /* save jump position */ - break; - } - case VK: case VKFLT: case VKINT: case VTRUE: { - pc = NO_JUMP; /* always true; do nothing */ - break; - } - default: { - pc = jumponcond(fs, e, 0); /* jump when false */ - break; - } - } - luaK_concat(fs, &e->f, pc); /* insert new jump in false list */ - luaK_patchtohere(fs, e->t); /* true list jumps to here (to go through) */ - e->t = NO_JUMP; -} - - -/* -** Emit code to go through if 'e' is false, jump otherwise. -*/ -void luaK_goiffalse (FuncState *fs, expdesc *e) { - int pc; /* pc of new jump */ - luaK_dischargevars(fs, e); - switch (e->k) { - case VJMP: { - pc = e->u.info; /* already jump if true */ - break; - } - case VNIL: case VFALSE: { - pc = NO_JUMP; /* always false; do nothing */ - break; - } - default: { - pc = jumponcond(fs, e, 1); /* jump if true */ - break; - } - } - luaK_concat(fs, &e->t, pc); /* insert new jump in 't' list */ - luaK_patchtohere(fs, e->f); /* false list jumps to here (to go through) */ - e->f = NO_JUMP; -} - - -/* -** Code 'not e', doing constant folding. -*/ -static void codenot (FuncState *fs, expdesc *e) { - luaK_dischargevars(fs, e); - switch (e->k) { - case VNIL: case VFALSE: { - e->k = VTRUE; /* true == not nil == not false */ - break; - } - case VK: case VKFLT: case VKINT: case VTRUE: { - e->k = VFALSE; /* false == not "x" == not 0.5 == not 1 == not true */ - break; - } - case VJMP: { - negatecondition(fs, e); - break; - } - case VRELOCABLE: - case VNONRELOC: { - discharge2anyreg(fs, e); - freeexp(fs, e); - e->u.info = luaK_codeABC(fs, OP_NOT, 0, e->u.info, 0); - e->k = VRELOCABLE; - break; - } - default: lua_assert(0); /* cannot happen */ - } - /* interchange true and false lists */ - { int temp = e->f; e->f = e->t; e->t = temp; } - removevalues(fs, e->f); /* values are useless when negated */ - removevalues(fs, e->t); -} - - -/* -** Create expression 't[k]'. 't' must have its final result already in a -** register or upvalue. -*/ -void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) { - lua_assert(!hasjumps(t) && (vkisinreg(t->k) || t->k == VUPVAL)); - t->u.ind.t = t->u.info; /* register or upvalue index */ - t->u.ind.idx = luaK_exp2RK(fs, k); /* R/K index for key */ - t->u.ind.vt = (t->k == VUPVAL) ? VUPVAL : VLOCAL; - t->k = VINDEXED; -} - - -/* -** Return false if folding can raise an error. -** Bitwise operations need operands convertible to integers; division -** operations cannot have 0 as divisor. -*/ -static int validop (int op, TValue *v1, TValue *v2) { - switch (op) { - case LUA_OPBAND: case LUA_OPBOR: case LUA_OPBXOR: - case LUA_OPSHL: case LUA_OPSHR: case LUA_OPBNOT: { /* conversion errors */ - lua_Integer i; - return (tointeger(v1, &i) && tointeger(v2, &i)); - } - case LUA_OPDIV: case LUA_OPIDIV: case LUA_OPMOD: /* division by 0 */ - return (nvalue(v2) != 0); - default: return 1; /* everything else is valid */ - } -} - - -/* -** Try to "constant-fold" an operation; return 1 iff successful. -** (In this case, 'e1' has the final result.) -*/ -static int constfolding (FuncState *fs, int op, expdesc *e1, - const expdesc *e2) { - TValue v1, v2, res; - if (!tonumeral(e1, &v1) || !tonumeral(e2, &v2) || !validop(op, &v1, &v2)) - return 0; /* non-numeric operands or not safe to fold */ - luaO_arith(fs->ls->L, op, &v1, &v2, &res); /* does operation */ - if (ttisinteger(&res)) { - e1->k = VKINT; - e1->u.ival = ivalue(&res); - } - else { /* folds neither NaN nor 0.0 (to avoid problems with -0.0) */ - lua_Number n = fltvalue(&res); - if (luai_numisnan(n) || n == 0) - return 0; - e1->k = VKFLT; - e1->u.nval = n; - } - return 1; -} - - -/* -** Emit code for unary expressions that "produce values" -** (everything but 'not'). -** Expression to produce final result will be encoded in 'e'. -*/ -static void codeunexpval (FuncState *fs, OpCode op, expdesc *e, int line) { - int r = luaK_exp2anyreg(fs, e); /* opcodes operate only on registers */ - freeexp(fs, e); - e->u.info = luaK_codeABC(fs, op, 0, r, 0); /* generate opcode */ - e->k = VRELOCABLE; /* all those operations are relocatable */ - luaK_fixline(fs, line); -} - - -/* -** Emit code for binary expressions that "produce values" -** (everything but logical operators 'and'/'or' and comparison -** operators). -** Expression to produce final result will be encoded in 'e1'. -** Because 'luaK_exp2RK' can free registers, its calls must be -** in "stack order" (that is, first on 'e2', which may have more -** recent registers to be released). -*/ -static void codebinexpval (FuncState *fs, OpCode op, - expdesc *e1, expdesc *e2, int line) { - int rk2 = luaK_exp2RK(fs, e2); /* both operands are "RK" */ - int rk1 = luaK_exp2RK(fs, e1); - freeexps(fs, e1, e2); - e1->u.info = luaK_codeABC(fs, op, 0, rk1, rk2); /* generate opcode */ - e1->k = VRELOCABLE; /* all those operations are relocatable */ - luaK_fixline(fs, line); -} - - -/* -** Emit code for comparisons. -** 'e1' was already put in R/K form by 'luaK_infix'. -*/ -static void codecomp (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2) { - int rk1 = (e1->k == VK) ? RKASK(e1->u.info) - : check_exp(e1->k == VNONRELOC, e1->u.info); - int rk2 = luaK_exp2RK(fs, e2); - freeexps(fs, e1, e2); - switch (opr) { - case OPR_NE: { /* '(a ~= b)' ==> 'not (a == b)' */ - e1->u.info = condjump(fs, OP_EQ, 0, rk1, rk2); - break; - } - case OPR_GT: case OPR_GE: { - /* '(a > b)' ==> '(b < a)'; '(a >= b)' ==> '(b <= a)' */ - OpCode op = cast(OpCode, (opr - OPR_NE) + OP_EQ); - e1->u.info = condjump(fs, op, 1, rk2, rk1); /* invert operands */ - break; - } - default: { /* '==', '<', '<=' use their own opcodes */ - OpCode op = cast(OpCode, (opr - OPR_EQ) + OP_EQ); - e1->u.info = condjump(fs, op, 1, rk1, rk2); - break; - } - } - e1->k = VJMP; -} - - -/* -** Aplly prefix operation 'op' to expression 'e'. -*/ -void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e, int line) { - static const expdesc ef = {VKINT, {0}, NO_JUMP, NO_JUMP}; - switch (op) { - case OPR_MINUS: case OPR_BNOT: /* use 'ef' as fake 2nd operand */ - if (constfolding(fs, op + LUA_OPUNM, e, &ef)) - break; - /* FALLTHROUGH */ - case OPR_LEN: - codeunexpval(fs, cast(OpCode, op + OP_UNM), e, line); - break; - case OPR_NOT: codenot(fs, e); break; - default: lua_assert(0); - } -} - - -/* -** Process 1st operand 'v' of binary operation 'op' before reading -** 2nd operand. -*/ -void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { - switch (op) { - case OPR_AND: { - luaK_goiftrue(fs, v); /* go ahead only if 'v' is true */ - break; - } - case OPR_OR: { - luaK_goiffalse(fs, v); /* go ahead only if 'v' is false */ - break; - } - case OPR_CONCAT: { - luaK_exp2nextreg(fs, v); /* operand must be on the 'stack' */ - break; - } - case OPR_ADD: case OPR_SUB: - case OPR_MUL: case OPR_DIV: case OPR_IDIV: - case OPR_MOD: case OPR_POW: - case OPR_BAND: case OPR_BOR: case OPR_BXOR: - case OPR_SHL: case OPR_SHR: { - if (!tonumeral(v, NULL)) - luaK_exp2RK(fs, v); - /* else keep numeral, which may be folded with 2nd operand */ - break; - } - default: { - luaK_exp2RK(fs, v); - break; - } - } -} - - -/* -** Finalize code for binary operation, after reading 2nd operand. -** For '(a .. b .. c)' (which is '(a .. (b .. c))', because -** concatenation is right associative), merge second CONCAT into first -** one. -*/ -void luaK_posfix (FuncState *fs, BinOpr op, - expdesc *e1, expdesc *e2, int line) { - switch (op) { - case OPR_AND: { - lua_assert(e1->t == NO_JUMP); /* list closed by 'luK_infix' */ - luaK_dischargevars(fs, e2); - luaK_concat(fs, &e2->f, e1->f); - *e1 = *e2; - break; - } - case OPR_OR: { - lua_assert(e1->f == NO_JUMP); /* list closed by 'luK_infix' */ - luaK_dischargevars(fs, e2); - luaK_concat(fs, &e2->t, e1->t); - *e1 = *e2; - break; - } - case OPR_CONCAT: { - luaK_exp2val(fs, e2); - if (e2->k == VRELOCABLE && - GET_OPCODE(getinstruction(fs, e2)) == OP_CONCAT) { - lua_assert(e1->u.info == GETARG_B(getinstruction(fs, e2))-1); - freeexp(fs, e1); - SETARG_B(getinstruction(fs, e2), e1->u.info); - e1->k = VRELOCABLE; e1->u.info = e2->u.info; - } - else { - luaK_exp2nextreg(fs, e2); /* operand must be on the 'stack' */ - codebinexpval(fs, OP_CONCAT, e1, e2, line); - } - break; - } - case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV: - case OPR_IDIV: case OPR_MOD: case OPR_POW: - case OPR_BAND: case OPR_BOR: case OPR_BXOR: - case OPR_SHL: case OPR_SHR: { - if (!constfolding(fs, op + LUA_OPADD, e1, e2)) - codebinexpval(fs, cast(OpCode, op + OP_ADD), e1, e2, line); - break; - } - case OPR_EQ: case OPR_LT: case OPR_LE: - case OPR_NE: case OPR_GT: case OPR_GE: { - codecomp(fs, op, e1, e2); - break; - } - default: lua_assert(0); - } -} - - -/* -** Change line information associated with current position. -*/ -void luaK_fixline (FuncState *fs, int line) { - fs->f->lineinfo[fs->pc - 1] = line; -} - - -/* -** Emit a SETLIST instruction. -** 'base' is register that keeps table; -** 'nelems' is #table plus those to be stored now; -** 'tostore' is number of values (in registers 'base + 1',...) to add to -** table (or LUA_MULTRET to add up to stack top). -*/ -void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { - int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1; - int b = (tostore == LUA_MULTRET) ? 0 : tostore; - lua_assert(tostore != 0 && tostore <= LFIELDS_PER_FLUSH); - if (c <= MAXARG_C) - luaK_codeABC(fs, OP_SETLIST, base, b, c); - else if (c <= MAXARG_Ax) { - luaK_codeABC(fs, OP_SETLIST, base, b, 0); - codeextraarg(fs, c); - } - else - luaX_syntaxerror(fs->ls, "constructor too long"); - fs->freereg = base + 1; /* free registers with list values */ -} - diff --git a/LuaSkin/lua-5.3.4/src/lcorolib.c b/LuaSkin/lua-5.3.4/src/lcorolib.c deleted file mode 100644 index 2303429e7..000000000 --- a/LuaSkin/lua-5.3.4/src/lcorolib.c +++ /dev/null @@ -1,168 +0,0 @@ -/* -** $Id: lcorolib.c,v 1.10 2016/04/11 19:19:55 roberto Exp $ -** Coroutine Library -** See Copyright Notice in lua.h -*/ - -#define lcorolib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -static lua_State *getco (lua_State *L) { - lua_State *co = lua_tothread(L, 1); - luaL_argcheck(L, co, 1, "thread expected"); - return co; -} - - -static int auxresume (lua_State *L, lua_State *co, int narg) { - int status; - if (!lua_checkstack(co, narg)) { - lua_pushliteral(L, "too many arguments to resume"); - return -1; /* error flag */ - } - if (lua_status(co) == LUA_OK && lua_gettop(co) == 0) { - lua_pushliteral(L, "cannot resume dead coroutine"); - return -1; /* error flag */ - } - lua_xmove(L, co, narg); - status = lua_resume(co, L, narg); - if (status == LUA_OK || status == LUA_YIELD) { - int nres = lua_gettop(co); - if (!lua_checkstack(L, nres + 1)) { - lua_pop(co, nres); /* remove results anyway */ - lua_pushliteral(L, "too many results to resume"); - return -1; /* error flag */ - } - lua_xmove(co, L, nres); /* move yielded values */ - return nres; - } - else { - lua_xmove(co, L, 1); /* move error message */ - return -1; /* error flag */ - } -} - - -static int luaB_coresume (lua_State *L) { - lua_State *co = getco(L); - int r; - r = auxresume(L, co, lua_gettop(L) - 1); - if (r < 0) { - lua_pushboolean(L, 0); - lua_insert(L, -2); - return 2; /* return false + error message */ - } - else { - lua_pushboolean(L, 1); - lua_insert(L, -(r + 1)); - return r + 1; /* return true + 'resume' returns */ - } -} - - -static int luaB_auxwrap (lua_State *L) { - lua_State *co = lua_tothread(L, lua_upvalueindex(1)); - int r = auxresume(L, co, lua_gettop(L)); - if (r < 0) { - if (lua_type(L, -1) == LUA_TSTRING) { /* error object is a string? */ - luaL_where(L, 1); /* add extra info */ - lua_insert(L, -2); - lua_concat(L, 2); - } - return lua_error(L); /* propagate error */ - } - return r; -} - - -static int luaB_cocreate (lua_State *L) { - lua_State *NL; - luaL_checktype(L, 1, LUA_TFUNCTION); - NL = lua_newthread(L); - lua_pushvalue(L, 1); /* move function to top */ - lua_xmove(L, NL, 1); /* move function from L to NL */ - return 1; -} - - -static int luaB_cowrap (lua_State *L) { - luaB_cocreate(L); - lua_pushcclosure(L, luaB_auxwrap, 1); - return 1; -} - - -static int luaB_yield (lua_State *L) { - return lua_yield(L, lua_gettop(L)); -} - - -static int luaB_costatus (lua_State *L) { - lua_State *co = getco(L); - if (L == co) lua_pushliteral(L, "running"); - else { - switch (lua_status(co)) { - case LUA_YIELD: - lua_pushliteral(L, "suspended"); - break; - case LUA_OK: { - lua_Debug ar; - if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */ - lua_pushliteral(L, "normal"); /* it is running */ - else if (lua_gettop(co) == 0) - lua_pushliteral(L, "dead"); - else - lua_pushliteral(L, "suspended"); /* initial state */ - break; - } - default: /* some error occurred */ - lua_pushliteral(L, "dead"); - break; - } - } - return 1; -} - - -static int luaB_yieldable (lua_State *L) { - lua_pushboolean(L, lua_isyieldable(L)); - return 1; -} - - -static int luaB_corunning (lua_State *L) { - int ismain = lua_pushthread(L); - lua_pushboolean(L, ismain); - return 2; -} - - -static const luaL_Reg co_funcs[] = { - {"create", luaB_cocreate}, - {"resume", luaB_coresume}, - {"running", luaB_corunning}, - {"status", luaB_costatus}, - {"wrap", luaB_cowrap}, - {"yield", luaB_yield}, - {"isyieldable", luaB_yieldable}, - {NULL, NULL} -}; - - - -LUAMOD_API int luaopen_coroutine (lua_State *L) { - luaL_newlib(L, co_funcs); - return 1; -} - diff --git a/LuaSkin/lua-5.3.4/src/lctype.c b/LuaSkin/lua-5.3.4/src/lctype.c deleted file mode 100644 index ae9367e69..000000000 --- a/LuaSkin/lua-5.3.4/src/lctype.c +++ /dev/null @@ -1,55 +0,0 @@ -/* -** $Id: lctype.c,v 1.12 2014/11/02 19:19:04 roberto Exp $ -** 'ctype' functions for Lua -** See Copyright Notice in lua.h -*/ - -#define lctype_c -#define LUA_CORE - -#include "lprefix.h" - - -#include "lctype.h" - -#if !LUA_USE_CTYPE /* { */ - -#include - -LUAI_DDEF const lu_byte luai_ctype_[UCHAR_MAX + 2] = { - 0x00, /* EOZ */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0. */ - 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 1. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, /* 2. */ - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, /* 3. */ - 0x16, 0x16, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 4. */ - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 5. */ - 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x05, - 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 6. */ - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 7. */ - 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 8. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 9. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* a. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* b. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* c. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* d. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* e. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* f. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -#endif /* } */ diff --git a/LuaSkin/lua-5.3.4/src/lctype.h b/LuaSkin/lua-5.3.4/src/lctype.h deleted file mode 100644 index 99c7d1223..000000000 --- a/LuaSkin/lua-5.3.4/src/lctype.h +++ /dev/null @@ -1,95 +0,0 @@ -/* -** $Id: lctype.h,v 1.12 2011/07/15 12:50:29 roberto Exp $ -** 'ctype' functions for Lua -** See Copyright Notice in lua.h -*/ - -#ifndef lctype_h -#define lctype_h - -#include "lua.h" - - -/* -** WARNING: the functions defined here do not necessarily correspond -** to the similar functions in the standard C ctype.h. They are -** optimized for the specific needs of Lua -*/ - -#if !defined(LUA_USE_CTYPE) - -#if 'A' == 65 && '0' == 48 -/* ASCII case: can use its own tables; faster and fixed */ -#define LUA_USE_CTYPE 0 -#else -/* must use standard C ctype */ -#define LUA_USE_CTYPE 1 -#endif - -#endif - - -#if !LUA_USE_CTYPE /* { */ - -#include - -#include "llimits.h" - - -#define ALPHABIT 0 -#define DIGITBIT 1 -#define PRINTBIT 2 -#define SPACEBIT 3 -#define XDIGITBIT 4 - - -#define MASK(B) (1 << (B)) - - -/* -** add 1 to char to allow index -1 (EOZ) -*/ -#define testprop(c,p) (luai_ctype_[(c)+1] & (p)) - -/* -** 'lalpha' (Lua alphabetic) and 'lalnum' (Lua alphanumeric) both include '_' -*/ -#define lislalpha(c) testprop(c, MASK(ALPHABIT)) -#define lislalnum(c) testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))) -#define lisdigit(c) testprop(c, MASK(DIGITBIT)) -#define lisspace(c) testprop(c, MASK(SPACEBIT)) -#define lisprint(c) testprop(c, MASK(PRINTBIT)) -#define lisxdigit(c) testprop(c, MASK(XDIGITBIT)) - -/* -** this 'ltolower' only works for alphabetic characters -*/ -#define ltolower(c) ((c) | ('A' ^ 'a')) - - -/* two more entries for 0 and -1 (EOZ) */ -LUAI_DDEC const lu_byte luai_ctype_[UCHAR_MAX + 2]; - - -#else /* }{ */ - -/* -** use standard C ctypes -*/ - -#include - - -#define lislalpha(c) (isalpha(c) || (c) == '_') -#define lislalnum(c) (isalnum(c) || (c) == '_') -#define lisdigit(c) (isdigit(c)) -#define lisspace(c) (isspace(c)) -#define lisprint(c) (isprint(c)) -#define lisxdigit(c) (isxdigit(c)) - -#define ltolower(c) (tolower(c)) - -#endif /* } */ - -#endif - diff --git a/LuaSkin/lua-5.3.4/src/ldebug.c b/LuaSkin/lua-5.3.4/src/ldebug.c deleted file mode 100644 index 239affb76..000000000 --- a/LuaSkin/lua-5.3.4/src/ldebug.c +++ /dev/null @@ -1,698 +0,0 @@ -/* -** $Id: ldebug.c,v 2.121 2016/10/19 12:32:10 roberto Exp $ -** Debug Interface -** See Copyright Notice in lua.h -*/ - -#define ldebug_c -#define LUA_CORE - -#include "lprefix.h" - - -#include -#include -#include - -#include "lua.h" - -#include "lapi.h" -#include "lcode.h" -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" -#include "lvm.h" - - - -#define noLuaClosure(f) ((f) == NULL || (f)->c.tt == LUA_TCCL) - - -/* Active Lua function (given call info) */ -#define ci_func(ci) (clLvalue((ci)->func)) - - -static const char *funcnamefromcode (lua_State *L, CallInfo *ci, - const char **name); - - -static int currentpc (CallInfo *ci) { - lua_assert(isLua(ci)); - return pcRel(ci->u.l.savedpc, ci_func(ci)->p); -} - - -static int currentline (CallInfo *ci) { - return getfuncline(ci_func(ci)->p, currentpc(ci)); -} - - -/* -** If function yielded, its 'func' can be in the 'extra' field. The -** next function restores 'func' to its correct value for debugging -** purposes. (It exchanges 'func' and 'extra'; so, when called again, -** after debugging, it also "re-restores" ** 'func' to its altered value. -*/ -static void swapextra (lua_State *L) { - if (L->status == LUA_YIELD) { - CallInfo *ci = L->ci; /* get function that yielded */ - StkId temp = ci->func; /* exchange its 'func' and 'extra' values */ - ci->func = restorestack(L, ci->extra); - ci->extra = savestack(L, temp); - } -} - - -/* -** This function can be called asynchronously (e.g. during a signal). -** Fields 'oldpc', 'basehookcount', and 'hookcount' (set by -** 'resethookcount') are for debug only, and it is no problem if they -** get arbitrary values (causes at most one wrong hook call). 'hookmask' -** is an atomic value. We assume that pointers are atomic too (e.g., gcc -** ensures that for all platforms where it runs). Moreover, 'hook' is -** always checked before being called (see 'luaD_hook'). -*/ -LUA_API void lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { - if (func == NULL || mask == 0) { /* turn off hooks? */ - mask = 0; - func = NULL; - } - if (isLua(L->ci)) - L->oldpc = L->ci->u.l.savedpc; - L->hook = func; - L->basehookcount = count; - resethookcount(L); - L->hookmask = cast_byte(mask); -} - - -LUA_API lua_Hook lua_gethook (lua_State *L) { - return L->hook; -} - - -LUA_API int lua_gethookmask (lua_State *L) { - return L->hookmask; -} - - -LUA_API int lua_gethookcount (lua_State *L) { - return L->basehookcount; -} - - -LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { - int status; - CallInfo *ci; - if (level < 0) return 0; /* invalid (negative) level */ - lua_lock(L); - for (ci = L->ci; level > 0 && ci != &L->base_ci; ci = ci->previous) - level--; - if (level == 0 && ci != &L->base_ci) { /* level found? */ - status = 1; - ar->i_ci = ci; - } - else status = 0; /* no such level */ - lua_unlock(L); - return status; -} - - -static const char *upvalname (Proto *p, int uv) { - TString *s = check_exp(uv < p->sizeupvalues, p->upvalues[uv].name); - if (s == NULL) return "?"; - else return getstr(s); -} - - -static const char *findvararg (CallInfo *ci, int n, StkId *pos) { - int nparams = clLvalue(ci->func)->p->numparams; - if (n >= cast_int(ci->u.l.base - ci->func) - nparams) - return NULL; /* no such vararg */ - else { - *pos = ci->func + nparams + n; - return "(*vararg)"; /* generic name for any vararg */ - } -} - - -static const char *findlocal (lua_State *L, CallInfo *ci, int n, - StkId *pos) { - const char *name = NULL; - StkId base; - if (isLua(ci)) { - if (n < 0) /* access to vararg values? */ - return findvararg(ci, -n, pos); - else { - base = ci->u.l.base; - name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci)); - } - } - else - base = ci->func + 1; - if (name == NULL) { /* no 'standard' name? */ - StkId limit = (ci == L->ci) ? L->top : ci->next->func; - if (limit - base >= n && n > 0) /* is 'n' inside 'ci' stack? */ - name = "(*temporary)"; /* generic name for any valid slot */ - else - return NULL; /* no name */ - } - *pos = base + (n - 1); - return name; -} - - -LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { - const char *name; - lua_lock(L); - swapextra(L); - if (ar == NULL) { /* information about non-active function? */ - if (!isLfunction(L->top - 1)) /* not a Lua function? */ - name = NULL; - else /* consider live variables at function start (parameters) */ - name = luaF_getlocalname(clLvalue(L->top - 1)->p, n, 0); - } - else { /* active function; get information through 'ar' */ - StkId pos = NULL; /* to avoid warnings */ - name = findlocal(L, ar->i_ci, n, &pos); - if (name) { - setobj2s(L, L->top, pos); - api_incr_top(L); - } - } - swapextra(L); - lua_unlock(L); - return name; -} - - -LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { - StkId pos = NULL; /* to avoid warnings */ - const char *name; - lua_lock(L); - swapextra(L); - name = findlocal(L, ar->i_ci, n, &pos); - if (name) { - setobjs2s(L, pos, L->top - 1); - L->top--; /* pop value */ - } - swapextra(L); - lua_unlock(L); - return name; -} - - -static void funcinfo (lua_Debug *ar, Closure *cl) { - if (noLuaClosure(cl)) { - ar->source = "=[C]"; - ar->linedefined = -1; - ar->lastlinedefined = -1; - ar->what = "C"; - } - else { - Proto *p = cl->l.p; - ar->source = p->source ? getstr(p->source) : "=?"; - ar->linedefined = p->linedefined; - ar->lastlinedefined = p->lastlinedefined; - ar->what = (ar->linedefined == 0) ? "main" : "Lua"; - } - luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); -} - - -static void collectvalidlines (lua_State *L, Closure *f) { - if (noLuaClosure(f)) { - setnilvalue(L->top); - api_incr_top(L); - } - else { - int i; - TValue v; - int *lineinfo = f->l.p->lineinfo; - Table *t = luaH_new(L); /* new table to store active lines */ - sethvalue(L, L->top, t); /* push it on stack */ - api_incr_top(L); - setbvalue(&v, 1); /* boolean 'true' to be the value of all indices */ - for (i = 0; i < f->l.p->sizelineinfo; i++) /* for all lines with code */ - luaH_setint(L, t, lineinfo[i], &v); /* table[line] = true */ - } -} - - -static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { - if (ci == NULL) /* no 'ci'? */ - return NULL; /* no info */ - else if (ci->callstatus & CIST_FIN) { /* is this a finalizer? */ - *name = "__gc"; - return "metamethod"; /* report it as such */ - } - /* calling function is a known Lua function? */ - else if (!(ci->callstatus & CIST_TAIL) && isLua(ci->previous)) - return funcnamefromcode(L, ci->previous, name); - else return NULL; /* no way to find a name */ -} - - -static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, - Closure *f, CallInfo *ci) { - int status = 1; - for (; *what; what++) { - switch (*what) { - case 'S': { - funcinfo(ar, f); - break; - } - case 'l': { - ar->currentline = (ci && isLua(ci)) ? currentline(ci) : -1; - break; - } - case 'u': { - ar->nups = (f == NULL) ? 0 : f->c.nupvalues; - if (noLuaClosure(f)) { - ar->isvararg = 1; - ar->nparams = 0; - } - else { - ar->isvararg = f->l.p->is_vararg; - ar->nparams = f->l.p->numparams; - } - break; - } - case 't': { - ar->istailcall = (ci) ? ci->callstatus & CIST_TAIL : 0; - break; - } - case 'n': { - ar->namewhat = getfuncname(L, ci, &ar->name); - if (ar->namewhat == NULL) { - ar->namewhat = ""; /* not found */ - ar->name = NULL; - } - break; - } - case 'L': - case 'f': /* handled by lua_getinfo */ - break; - default: status = 0; /* invalid option */ - } - } - return status; -} - - -LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { - int status; - Closure *cl; - CallInfo *ci; - StkId func; - lua_lock(L); - swapextra(L); - if (*what == '>') { - ci = NULL; - func = L->top - 1; - api_check(L, ttisfunction(func), "function expected"); - what++; /* skip the '>' */ - L->top--; /* pop function */ - } - else { - ci = ar->i_ci; - func = ci->func; - lua_assert(ttisfunction(ci->func)); - } - cl = ttisclosure(func) ? clvalue(func) : NULL; - status = auxgetinfo(L, what, ar, cl, ci); - if (strchr(what, 'f')) { - setobjs2s(L, L->top, func); - api_incr_top(L); - } - swapextra(L); /* correct before option 'L', which can raise a mem. error */ - if (strchr(what, 'L')) - collectvalidlines(L, cl); - lua_unlock(L); - return status; -} - - -/* -** {====================================================== -** Symbolic Execution -** ======================================================= -*/ - -static const char *getobjname (Proto *p, int lastpc, int reg, - const char **name); - - -/* -** find a "name" for the RK value 'c' -*/ -static void kname (Proto *p, int pc, int c, const char **name) { - if (ISK(c)) { /* is 'c' a constant? */ - TValue *kvalue = &p->k[INDEXK(c)]; - if (ttisstring(kvalue)) { /* literal constant? */ - *name = svalue(kvalue); /* it is its own name */ - return; - } - /* else no reasonable name found */ - } - else { /* 'c' is a register */ - const char *what = getobjname(p, pc, c, name); /* search for 'c' */ - if (what && *what == 'c') { /* found a constant name? */ - return; /* 'name' already filled */ - } - /* else no reasonable name found */ - } - *name = "?"; /* no reasonable name found */ -} - - -static int filterpc (int pc, int jmptarget) { - if (pc < jmptarget) /* is code conditional (inside a jump)? */ - return -1; /* cannot know who sets that register */ - else return pc; /* current position sets that register */ -} - - -/* -** try to find last instruction before 'lastpc' that modified register 'reg' -*/ -static int findsetreg (Proto *p, int lastpc, int reg) { - int pc; - int setreg = -1; /* keep last instruction that changed 'reg' */ - int jmptarget = 0; /* any code before this address is conditional */ - for (pc = 0; pc < lastpc; pc++) { - Instruction i = p->code[pc]; - OpCode op = GET_OPCODE(i); - int a = GETARG_A(i); - switch (op) { - case OP_LOADNIL: { - int b = GETARG_B(i); - if (a <= reg && reg <= a + b) /* set registers from 'a' to 'a+b' */ - setreg = filterpc(pc, jmptarget); - break; - } - case OP_TFORCALL: { - if (reg >= a + 2) /* affect all regs above its base */ - setreg = filterpc(pc, jmptarget); - break; - } - case OP_CALL: - case OP_TAILCALL: { - if (reg >= a) /* affect all registers above base */ - setreg = filterpc(pc, jmptarget); - break; - } - case OP_JMP: { - int b = GETARG_sBx(i); - int dest = pc + 1 + b; - /* jump is forward and do not skip 'lastpc'? */ - if (pc < dest && dest <= lastpc) { - if (dest > jmptarget) - jmptarget = dest; /* update 'jmptarget' */ - } - break; - } - default: - if (testAMode(op) && reg == a) /* any instruction that set A */ - setreg = filterpc(pc, jmptarget); - break; - } - } - return setreg; -} - - -static const char *getobjname (Proto *p, int lastpc, int reg, - const char **name) { - int pc; - *name = luaF_getlocalname(p, reg + 1, lastpc); - if (*name) /* is a local? */ - return "local"; - /* else try symbolic execution */ - pc = findsetreg(p, lastpc, reg); - if (pc != -1) { /* could find instruction? */ - Instruction i = p->code[pc]; - OpCode op = GET_OPCODE(i); - switch (op) { - case OP_MOVE: { - int b = GETARG_B(i); /* move from 'b' to 'a' */ - if (b < GETARG_A(i)) - return getobjname(p, pc, b, name); /* get name for 'b' */ - break; - } - case OP_GETTABUP: - case OP_GETTABLE: { - int k = GETARG_C(i); /* key index */ - int t = GETARG_B(i); /* table index */ - const char *vn = (op == OP_GETTABLE) /* name of indexed variable */ - ? luaF_getlocalname(p, t + 1, pc) - : upvalname(p, t); - kname(p, pc, k, name); - return (vn && strcmp(vn, LUA_ENV) == 0) ? "global" : "field"; - } - case OP_GETUPVAL: { - *name = upvalname(p, GETARG_B(i)); - return "upvalue"; - } - case OP_LOADK: - case OP_LOADKX: { - int b = (op == OP_LOADK) ? GETARG_Bx(i) - : GETARG_Ax(p->code[pc + 1]); - if (ttisstring(&p->k[b])) { - *name = svalue(&p->k[b]); - return "constant"; - } - break; - } - case OP_SELF: { - int k = GETARG_C(i); /* key index */ - kname(p, pc, k, name); - return "method"; - } - default: break; /* go through to return NULL */ - } - } - return NULL; /* could not find reasonable name */ -} - - -/* -** Try to find a name for a function based on the code that called it. -** (Only works when function was called by a Lua function.) -** Returns what the name is (e.g., "for iterator", "method", -** "metamethod") and sets '*name' to point to the name. -*/ -static const char *funcnamefromcode (lua_State *L, CallInfo *ci, - const char **name) { - TMS tm = (TMS)0; /* (initial value avoids warnings) */ - Proto *p = ci_func(ci)->p; /* calling function */ - int pc = currentpc(ci); /* calling instruction index */ - Instruction i = p->code[pc]; /* calling instruction */ - if (ci->callstatus & CIST_HOOKED) { /* was it called inside a hook? */ - *name = "?"; - return "hook"; - } - switch (GET_OPCODE(i)) { - case OP_CALL: - case OP_TAILCALL: - return getobjname(p, pc, GETARG_A(i), name); /* get function name */ - case OP_TFORCALL: { /* for iterator */ - *name = "for iterator"; - return "for iterator"; - } - /* other instructions can do calls through metamethods */ - case OP_SELF: case OP_GETTABUP: case OP_GETTABLE: - tm = TM_INDEX; - break; - case OP_SETTABUP: case OP_SETTABLE: - tm = TM_NEWINDEX; - break; - case OP_ADD: case OP_SUB: case OP_MUL: case OP_MOD: - case OP_POW: case OP_DIV: case OP_IDIV: case OP_BAND: - case OP_BOR: case OP_BXOR: case OP_SHL: case OP_SHR: { - int offset = cast_int(GET_OPCODE(i)) - cast_int(OP_ADD); /* ORDER OP */ - tm = cast(TMS, offset + cast_int(TM_ADD)); /* ORDER TM */ - break; - } - case OP_UNM: tm = TM_UNM; break; - case OP_BNOT: tm = TM_BNOT; break; - case OP_LEN: tm = TM_LEN; break; - case OP_CONCAT: tm = TM_CONCAT; break; - case OP_EQ: tm = TM_EQ; break; - case OP_LT: tm = TM_LT; break; - case OP_LE: tm = TM_LE; break; - default: - return NULL; /* cannot find a reasonable name */ - } - *name = getstr(G(L)->tmname[tm]); - return "metamethod"; -} - -/* }====================================================== */ - - - -/* -** The subtraction of two potentially unrelated pointers is -** not ISO C, but it should not crash a program; the subsequent -** checks are ISO C and ensure a correct result. -*/ -static int isinstack (CallInfo *ci, const TValue *o) { - ptrdiff_t i = o - ci->u.l.base; - return (0 <= i && i < (ci->top - ci->u.l.base) && ci->u.l.base + i == o); -} - - -/* -** Checks whether value 'o' came from an upvalue. (That can only happen -** with instructions OP_GETTABUP/OP_SETTABUP, which operate directly on -** upvalues.) -*/ -static const char *getupvalname (CallInfo *ci, const TValue *o, - const char **name) { - LClosure *c = ci_func(ci); - int i; - for (i = 0; i < c->nupvalues; i++) { - if (c->upvals[i]->v == o) { - *name = upvalname(c->p, i); - return "upvalue"; - } - } - return NULL; -} - - -static const char *varinfo (lua_State *L, const TValue *o) { - const char *name = NULL; /* to avoid warnings */ - CallInfo *ci = L->ci; - const char *kind = NULL; - if (isLua(ci)) { - kind = getupvalname(ci, o, &name); /* check whether 'o' is an upvalue */ - if (!kind && isinstack(ci, o)) /* no? try a register */ - kind = getobjname(ci_func(ci)->p, currentpc(ci), - cast_int(o - ci->u.l.base), &name); - } - return (kind) ? luaO_pushfstring(L, " (%s '%s')", kind, name) : ""; -} - - -l_noret luaG_typeerror (lua_State *L, const TValue *o, const char *op) { - const char *t = luaT_objtypename(L, o); - luaG_runerror(L, "attempt to %s a %s value%s", op, t, varinfo(L, o)); -} - - -l_noret luaG_concaterror (lua_State *L, const TValue *p1, const TValue *p2) { - if (ttisstring(p1) || cvt2str(p1)) p1 = p2; - luaG_typeerror(L, p1, "concatenate"); -} - - -l_noret luaG_opinterror (lua_State *L, const TValue *p1, - const TValue *p2, const char *msg) { - lua_Number temp; - if (!tonumber(p1, &temp)) /* first operand is wrong? */ - p2 = p1; /* now second is wrong */ - luaG_typeerror(L, p2, msg); -} - - -/* -** Error when both values are convertible to numbers, but not to integers -*/ -l_noret luaG_tointerror (lua_State *L, const TValue *p1, const TValue *p2) { - lua_Integer temp; - if (!tointeger(p1, &temp)) - p2 = p1; - luaG_runerror(L, "number%s has no integer representation", varinfo(L, p2)); -} - - -l_noret luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { - const char *t1 = luaT_objtypename(L, p1); - const char *t2 = luaT_objtypename(L, p2); - if (strcmp(t1, t2) == 0) - luaG_runerror(L, "attempt to compare two %s values", t1); - else - luaG_runerror(L, "attempt to compare %s with %s", t1, t2); -} - - -/* add src:line information to 'msg' */ -const char *luaG_addinfo (lua_State *L, const char *msg, TString *src, - int line) { - char buff[LUA_IDSIZE]; - if (src) - luaO_chunkid(buff, getstr(src), LUA_IDSIZE); - else { /* no source available; use "?" instead */ - buff[0] = '?'; buff[1] = '\0'; - } - return luaO_pushfstring(L, "%s:%d: %s", buff, line, msg); -} - - -l_noret luaG_errormsg (lua_State *L) { - if (L->errfunc != 0) { /* is there an error handling function? */ - StkId errfunc = restorestack(L, L->errfunc); - setobjs2s(L, L->top, L->top - 1); /* move argument */ - setobjs2s(L, L->top - 1, errfunc); /* push function */ - L->top++; /* assume EXTRA_STACK */ - luaD_callnoyield(L, L->top - 2, 1); /* call it */ - } - luaD_throw(L, LUA_ERRRUN); -} - - -l_noret luaG_runerror (lua_State *L, const char *fmt, ...) { - CallInfo *ci = L->ci; - const char *msg; - va_list argp; - va_start(argp, fmt); - msg = luaO_pushvfstring(L, fmt, argp); /* format message */ - va_end(argp); - if (isLua(ci)) /* if Lua function, add source:line information */ - luaG_addinfo(L, msg, ci_func(ci)->p->source, currentline(ci)); - luaG_errormsg(L); -} - - -void luaG_traceexec (lua_State *L) { - CallInfo *ci = L->ci; - lu_byte mask = L->hookmask; - int counthook = (--L->hookcount == 0 && (mask & LUA_MASKCOUNT)); - if (counthook) - resethookcount(L); /* reset count */ - else if (!(mask & LUA_MASKLINE)) - return; /* no line hook and count != 0; nothing to be done */ - if (ci->callstatus & CIST_HOOKYIELD) { /* called hook last time? */ - ci->callstatus &= ~CIST_HOOKYIELD; /* erase mark */ - return; /* do not call hook again (VM yielded, so it did not move) */ - } - if (counthook) - luaD_hook(L, LUA_HOOKCOUNT, -1); /* call count hook */ - if (mask & LUA_MASKLINE) { - Proto *p = ci_func(ci)->p; - int npc = pcRel(ci->u.l.savedpc, p); - int newline = getfuncline(p, npc); - if (npc == 0 || /* call linehook when enter a new function, */ - ci->u.l.savedpc <= L->oldpc || /* when jump back (loop), or when */ - newline != getfuncline(p, pcRel(L->oldpc, p))) /* enter a new line */ - luaD_hook(L, LUA_HOOKLINE, newline); /* call line hook */ - } - L->oldpc = ci->u.l.savedpc; - if (L->status == LUA_YIELD) { /* did hook yield? */ - if (counthook) - L->hookcount = 1; /* undo decrement to zero */ - ci->u.l.savedpc--; /* undo increment (resume will increment it again) */ - ci->callstatus |= CIST_HOOKYIELD; /* mark that it yielded */ - ci->func = L->top - 1; /* protect stack below results */ - luaD_throw(L, LUA_YIELD); - } -} - diff --git a/LuaSkin/lua-5.3.4/src/ldebug.h b/LuaSkin/lua-5.3.4/src/ldebug.h deleted file mode 100644 index 0e31546b1..000000000 --- a/LuaSkin/lua-5.3.4/src/ldebug.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -** $Id: ldebug.h,v 2.14 2015/05/22 17:45:56 roberto Exp $ -** Auxiliary functions from Debug Interface module -** See Copyright Notice in lua.h -*/ - -#ifndef ldebug_h -#define ldebug_h - - -#include "lstate.h" - - -#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) - -#define getfuncline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : -1) - -#define resethookcount(L) (L->hookcount = L->basehookcount) - - -LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o, - const char *opname); -LUAI_FUNC l_noret luaG_concaterror (lua_State *L, const TValue *p1, - const TValue *p2); -LUAI_FUNC l_noret luaG_opinterror (lua_State *L, const TValue *p1, - const TValue *p2, - const char *msg); -LUAI_FUNC l_noret luaG_tointerror (lua_State *L, const TValue *p1, - const TValue *p2); -LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1, - const TValue *p2); -LUAI_FUNC l_noret luaG_runerror (lua_State *L, const char *fmt, ...); -LUAI_FUNC const char *luaG_addinfo (lua_State *L, const char *msg, - TString *src, int line); -LUAI_FUNC l_noret luaG_errormsg (lua_State *L); -LUAI_FUNC void luaG_traceexec (lua_State *L); - - -#endif diff --git a/LuaSkin/lua-5.3.4/src/ldo.c b/LuaSkin/lua-5.3.4/src/ldo.c deleted file mode 100644 index d1e7ca888..000000000 --- a/LuaSkin/lua-5.3.4/src/ldo.c +++ /dev/null @@ -1,819 +0,0 @@ -/* -** $Id: ldo.c,v 2.157 2016/12/13 15:52:21 roberto Exp $ -** Stack and Call structure of Lua -** See Copyright Notice in lua.h -*/ - -#define ldo_c -#define LUA_CORE - -#include "lprefix.h" - - -#include -#include -#include - -#include "lua.h" - -#include "lapi.h" -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lparser.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" -#include "lundump.h" -#include "lvm.h" -#include "lzio.h" - - - -#define errorstatus(s) ((s) > LUA_YIELD) - - -/* -** {====================================================== -** Error-recovery functions -** ======================================================= -*/ - -/* -** LUAI_THROW/LUAI_TRY define how Lua does exception handling. By -** default, Lua handles errors with exceptions when compiling as -** C++ code, with _longjmp/_setjmp when asked to use them, and with -** longjmp/setjmp otherwise. -*/ -#if !defined(LUAI_THROW) /* { */ - -#if defined(LUA_USE_OBJC_EXCEPTIONS) -/* Requires additional Obj-C file to be compiled in to avoid forcing all of Lua to be compiled as Obj-C. - * lobjectivec_exceptions must be compiled as Obj-C. - * It is used to try to shelter Obj-C from the main Lua core. - */ -#include "lobjectivec_exceptions.h" - -#elif defined(__cplusplus) && !defined(LUA_USE_LONGJMP) /* { */ - -/* C++ exceptions */ -#define LUAI_THROW(L,c) throw(c) -#define LUAI_TRY(L,c,a) \ - try { a } catch(...) { if ((c)->status == 0) (c)->status = -1; } -#define luai_jmpbuf int /* dummy variable */ - -#elif defined(LUA_USE_POSIX) /* }{ */ - -/* in POSIX, try _longjmp/_setjmp (more efficient) */ -#define LUAI_THROW(L,c) _longjmp((c)->b, 1) -#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } -#define luai_jmpbuf jmp_buf - -#else /* }{ */ - -/* ISO C handling with long jumps */ -#define LUAI_THROW(L,c) longjmp((c)->b, 1) -#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } -#define luai_jmpbuf jmp_buf - -#endif /* } */ - -#endif /* } */ - - -/* LUA_USE_OBJC_EXCEPTIONS needs to define this struct in its header. - * So avoid redefining for that case, but define for every other case. - */ -#if !defined(LUA_USE_OBJC_EXCEPTIONS) -/* chain list of long jump buffers */ -struct lua_longjmp { - struct lua_longjmp *previous; - luai_jmpbuf b; - volatile int status; /* error code */ -}; -#endif - -static void seterrorobj (lua_State *L, int errcode, StkId oldtop) { - switch (errcode) { - case LUA_ERRMEM: { /* memory error? */ - setsvalue2s(L, oldtop, G(L)->memerrmsg); /* reuse preregistered msg. */ - break; - } - case LUA_ERRERR: { - setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling")); - break; - } - default: { - setobjs2s(L, oldtop, L->top - 1); /* error message on current top */ - break; - } - } - L->top = oldtop + 1; -} - - -l_noret luaD_throw (lua_State *L, int errcode) { - if (L->errorJmp) { /* thread has an error handler? */ - L->errorJmp->status = errcode; /* set status */ - LUAI_THROW(L, L->errorJmp); /* jump to it */ - } - else { /* thread has no error handler */ - global_State *g = G(L); - L->status = cast_byte(errcode); /* mark it as dead */ - if (g->mainthread->errorJmp) { /* main thread has a handler? */ - setobjs2s(L, g->mainthread->top++, L->top - 1); /* copy error obj. */ - luaD_throw(g->mainthread, errcode); /* re-throw in main thread */ - } - else { /* no handler at all; abort */ - if (g->panic) { /* panic function? */ - seterrorobj(L, errcode, L->top); /* assume EXTRA_STACK */ - if (L->ci->top < L->top) - L->ci->top = L->top; /* pushing msg. can break this invariant */ - lua_unlock(L); - g->panic(L); /* call panic function (last chance to jump out) */ - } - abort(); - } - } -} - - -int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { - unsigned short oldnCcalls = L->nCcalls; - struct lua_longjmp lj; - lj.status = LUA_OK; - lj.previous = L->errorJmp; /* chain new error handler */ - L->errorJmp = &lj; -#if defined(LUA_USE_OBJC_EXCEPTIONS) - /* Unfortunately, either the macro signature needed to change or this file has to be compiled as Obj-C. - * I'm not sure which is worse. - */ - LUAI_TRY(L, &lj, f, ud); -#else - LUAI_TRY(L, &lj, - (*f)(L, ud); - ); -#endif - L->errorJmp = lj.previous; /* restore old error handler */ - L->nCcalls = oldnCcalls; - return lj.status; -} - -/* }====================================================== */ - - -/* -** {================================================================== -** Stack reallocation -** =================================================================== -*/ -static void correctstack (lua_State *L, TValue *oldstack) { - CallInfo *ci; - UpVal *up; - L->top = (L->top - oldstack) + L->stack; - for (up = L->openupval; up != NULL; up = up->u.open.next) - up->v = (up->v - oldstack) + L->stack; - for (ci = L->ci; ci != NULL; ci = ci->previous) { - ci->top = (ci->top - oldstack) + L->stack; - ci->func = (ci->func - oldstack) + L->stack; - if (isLua(ci)) - ci->u.l.base = (ci->u.l.base - oldstack) + L->stack; - } -} - - -/* some space for error handling */ -#define ERRORSTACKSIZE (LUAI_MAXSTACK + 200) - - -void luaD_reallocstack (lua_State *L, int newsize) { - TValue *oldstack = L->stack; - int lim = L->stacksize; - lua_assert(newsize <= LUAI_MAXSTACK || newsize == ERRORSTACKSIZE); - lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK); - luaM_reallocvector(L, L->stack, L->stacksize, newsize, TValue); - for (; lim < newsize; lim++) - setnilvalue(L->stack + lim); /* erase new segment */ - L->stacksize = newsize; - L->stack_last = L->stack + newsize - EXTRA_STACK; - correctstack(L, oldstack); -} - - -void luaD_growstack (lua_State *L, int n) { - int size = L->stacksize; - if (size > LUAI_MAXSTACK) /* error after extra size? */ - luaD_throw(L, LUA_ERRERR); - else { - int needed = cast_int(L->top - L->stack) + n + EXTRA_STACK; - int newsize = 2 * size; - if (newsize > LUAI_MAXSTACK) newsize = LUAI_MAXSTACK; - if (newsize < needed) newsize = needed; - if (newsize > LUAI_MAXSTACK) { /* stack overflow? */ - luaD_reallocstack(L, ERRORSTACKSIZE); - luaG_runerror(L, "stack overflow"); - } - else - luaD_reallocstack(L, newsize); - } -} - - -static int stackinuse (lua_State *L) { - CallInfo *ci; - StkId lim = L->top; - for (ci = L->ci; ci != NULL; ci = ci->previous) { - if (lim < ci->top) lim = ci->top; - } - lua_assert(lim <= L->stack_last); - return cast_int(lim - L->stack) + 1; /* part of stack in use */ -} - - -void luaD_shrinkstack (lua_State *L) { - int inuse = stackinuse(L); - int goodsize = inuse + (inuse / 8) + 2*EXTRA_STACK; - if (goodsize > LUAI_MAXSTACK) - goodsize = LUAI_MAXSTACK; /* respect stack limit */ - if (L->stacksize > LUAI_MAXSTACK) /* had been handling stack overflow? */ - luaE_freeCI(L); /* free all CIs (list grew because of an error) */ - else - luaE_shrinkCI(L); /* shrink list */ - /* if thread is currently not handling a stack overflow and its - good size is smaller than current size, shrink its stack */ - if (inuse <= (LUAI_MAXSTACK - EXTRA_STACK) && - goodsize < L->stacksize) - luaD_reallocstack(L, goodsize); - else /* don't change stack */ - condmovestack(L,{},{}); /* (change only for debugging) */ -} - - -void luaD_inctop (lua_State *L) { - luaD_checkstack(L, 1); - L->top++; -} - -/* }================================================================== */ - - -/* -** Call a hook for the given event. Make sure there is a hook to be -** called. (Both 'L->hook' and 'L->hookmask', which triggers this -** function, can be changed asynchronously by signals.) -*/ -void luaD_hook (lua_State *L, int event, int line) { - lua_Hook hook = L->hook; - if (hook && L->allowhook) { /* make sure there is a hook */ - CallInfo *ci = L->ci; - ptrdiff_t top = savestack(L, L->top); - ptrdiff_t ci_top = savestack(L, ci->top); - lua_Debug ar; - ar.event = event; - ar.currentline = line; - ar.i_ci = ci; - luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ - ci->top = L->top + LUA_MINSTACK; - lua_assert(ci->top <= L->stack_last); - L->allowhook = 0; /* cannot call hooks inside a hook */ - ci->callstatus |= CIST_HOOKED; - lua_unlock(L); - (*hook)(L, &ar); - lua_lock(L); - lua_assert(!L->allowhook); - L->allowhook = 1; - ci->top = restorestack(L, ci_top); - L->top = restorestack(L, top); - ci->callstatus &= ~CIST_HOOKED; - } -} - - -static void callhook (lua_State *L, CallInfo *ci) { - int hook = LUA_HOOKCALL; - ci->u.l.savedpc++; /* hooks assume 'pc' is already incremented */ - if (isLua(ci->previous) && - GET_OPCODE(*(ci->previous->u.l.savedpc - 1)) == OP_TAILCALL) { - ci->callstatus |= CIST_TAIL; - hook = LUA_HOOKTAILCALL; - } - luaD_hook(L, hook, -1); - ci->u.l.savedpc--; /* correct 'pc' */ -} - - -static StkId adjust_varargs (lua_State *L, Proto *p, int actual) { - int i; - int nfixargs = p->numparams; - StkId base, fixed; - /* move fixed parameters to final position */ - fixed = L->top - actual; /* first fixed argument */ - base = L->top; /* final position of first argument */ - for (i = 0; i < nfixargs && i < actual; i++) { - setobjs2s(L, L->top++, fixed + i); - setnilvalue(fixed + i); /* erase original copy (for GC) */ - } - for (; i < nfixargs; i++) - setnilvalue(L->top++); /* complete missing arguments */ - return base; -} - - -/* -** Check whether __call metafield of 'func' is a function. If so, put -** it in stack below original 'func' so that 'luaD_precall' can call -** it. Raise an error if __call metafield is not a function. -*/ -static void tryfuncTM (lua_State *L, StkId func) { - const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL); - StkId p; - if (!ttisfunction(tm)) - luaG_typeerror(L, func, "call"); - /* Open a hole inside the stack at 'func' */ - for (p = L->top; p > func; p--) - setobjs2s(L, p, p-1); - L->top++; /* slot ensured by caller */ - setobj2s(L, func, tm); /* tag method is the new function to be called */ -} - - -/* -** Given 'nres' results at 'firstResult', move 'wanted' of them to 'res'. -** Handle most typical cases (zero results for commands, one result for -** expressions, multiple results for tail calls/single parameters) -** separated. -*/ -static int moveresults (lua_State *L, const TValue *firstResult, StkId res, - int nres, int wanted) { - switch (wanted) { /* handle typical cases separately */ - case 0: break; /* nothing to move */ - case 1: { /* one result needed */ - if (nres == 0) /* no results? */ - firstResult = luaO_nilobject; /* adjust with nil */ - setobjs2s(L, res, firstResult); /* move it to proper place */ - break; - } - case LUA_MULTRET: { - int i; - for (i = 0; i < nres; i++) /* move all results to correct place */ - setobjs2s(L, res + i, firstResult + i); - L->top = res + nres; - return 0; /* wanted == LUA_MULTRET */ - } - default: { - int i; - if (wanted <= nres) { /* enough results? */ - for (i = 0; i < wanted; i++) /* move wanted results to correct place */ - setobjs2s(L, res + i, firstResult + i); - } - else { /* not enough results; use all of them plus nils */ - for (i = 0; i < nres; i++) /* move all results to correct place */ - setobjs2s(L, res + i, firstResult + i); - for (; i < wanted; i++) /* complete wanted number of results */ - setnilvalue(res + i); - } - break; - } - } - L->top = res + wanted; /* top points after the last result */ - return 1; -} - - -/* -** Finishes a function call: calls hook if necessary, removes CallInfo, -** moves current number of results to proper place; returns 0 iff call -** wanted multiple (variable number of) results. -*/ -int luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult, int nres) { - StkId res; - int wanted = ci->nresults; - if (L->hookmask & (LUA_MASKRET | LUA_MASKLINE)) { - if (L->hookmask & LUA_MASKRET) { - ptrdiff_t fr = savestack(L, firstResult); /* hook may change stack */ - luaD_hook(L, LUA_HOOKRET, -1); - firstResult = restorestack(L, fr); - } - L->oldpc = ci->previous->u.l.savedpc; /* 'oldpc' for caller function */ - } - res = ci->func; /* res == final position of 1st result */ - L->ci = ci->previous; /* back to caller */ - /* move results to proper place */ - return moveresults(L, firstResult, res, nres, wanted); -} - - - -#define next_ci(L) (L->ci = (L->ci->next ? L->ci->next : luaE_extendCI(L))) - - -/* macro to check stack size, preserving 'p' */ -#define checkstackp(L,n,p) \ - luaD_checkstackaux(L, n, \ - ptrdiff_t t__ = savestack(L, p); /* save 'p' */ \ - luaC_checkGC(L), /* stack grow uses memory */ \ - p = restorestack(L, t__)) /* 'pos' part: restore 'p' */ - - -/* -** Prepares a function call: checks the stack, creates a new CallInfo -** entry, fills in the relevant information, calls hook if needed. -** If function is a C function, does the call, too. (Otherwise, leave -** the execution ('luaV_execute') to the caller, to allow stackless -** calls.) Returns true iff function has been executed (C function). -*/ -int luaD_precall (lua_State *L, StkId func, int nresults) { - lua_CFunction f; - CallInfo *ci; - switch (ttype(func)) { - case LUA_TCCL: /* C closure */ - f = clCvalue(func)->f; - goto Cfunc; - case LUA_TLCF: /* light C function */ - f = fvalue(func); - Cfunc: { - int n; /* number of returns */ - checkstackp(L, LUA_MINSTACK, func); /* ensure minimum stack size */ - ci = next_ci(L); /* now 'enter' new function */ - ci->nresults = nresults; - ci->func = func; - ci->top = L->top + LUA_MINSTACK; - lua_assert(ci->top <= L->stack_last); - ci->callstatus = 0; - if (L->hookmask & LUA_MASKCALL) - luaD_hook(L, LUA_HOOKCALL, -1); - lua_unlock(L); - n = (*f)(L); /* do the actual call */ - lua_lock(L); - api_checknelems(L, n); - luaD_poscall(L, ci, L->top - n, n); - return 1; - } - case LUA_TLCL: { /* Lua function: prepare its call */ - StkId base; - Proto *p = clLvalue(func)->p; - int n = cast_int(L->top - func) - 1; /* number of real arguments */ - int fsize = p->maxstacksize; /* frame size */ - checkstackp(L, fsize, func); - if (p->is_vararg) - base = adjust_varargs(L, p, n); - else { /* non vararg function */ - for (; n < p->numparams; n++) - setnilvalue(L->top++); /* complete missing arguments */ - base = func + 1; - } - ci = next_ci(L); /* now 'enter' new function */ - ci->nresults = nresults; - ci->func = func; - ci->u.l.base = base; - L->top = ci->top = base + fsize; - lua_assert(ci->top <= L->stack_last); - ci->u.l.savedpc = p->code; /* starting point */ - ci->callstatus = CIST_LUA; - if (L->hookmask & LUA_MASKCALL) - callhook(L, ci); - return 0; - } - default: { /* not a function */ - checkstackp(L, 1, func); /* ensure space for metamethod */ - tryfuncTM(L, func); /* try to get '__call' metamethod */ - return luaD_precall(L, func, nresults); /* now it must be a function */ - } - } -} - - -/* -** Check appropriate error for stack overflow ("regular" overflow or -** overflow while handling stack overflow). If 'nCalls' is larger than -** LUAI_MAXCCALLS (which means it is handling a "regular" overflow) but -** smaller than 9/8 of LUAI_MAXCCALLS, does not report an error (to -** allow overflow handling to work) -*/ -static void stackerror (lua_State *L) { - if (L->nCcalls == LUAI_MAXCCALLS) - luaG_runerror(L, "C stack overflow"); - else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3))) - luaD_throw(L, LUA_ERRERR); /* error while handing stack error */ -} - - -/* -** Call a function (C or Lua). The function to be called is at *func. -** The arguments are on the stack, right after the function. -** When returns, all the results are on the stack, starting at the original -** function position. -*/ -void luaD_call (lua_State *L, StkId func, int nResults) { - if (++L->nCcalls >= LUAI_MAXCCALLS) - stackerror(L); - if (!luaD_precall(L, func, nResults)) /* is a Lua function? */ - luaV_execute(L); /* call it */ - L->nCcalls--; -} - - -/* -** Similar to 'luaD_call', but does not allow yields during the call -*/ -void luaD_callnoyield (lua_State *L, StkId func, int nResults) { - L->nny++; - luaD_call(L, func, nResults); - L->nny--; -} - - -/* -** Completes the execution of an interrupted C function, calling its -** continuation function. -*/ -static void finishCcall (lua_State *L, int status) { - CallInfo *ci = L->ci; - int n; - /* must have a continuation and must be able to call it */ - lua_assert(ci->u.c.k != NULL && L->nny == 0); - /* error status can only happen in a protected call */ - lua_assert((ci->callstatus & CIST_YPCALL) || status == LUA_YIELD); - if (ci->callstatus & CIST_YPCALL) { /* was inside a pcall? */ - ci->callstatus &= ~CIST_YPCALL; /* continuation is also inside it */ - L->errfunc = ci->u.c.old_errfunc; /* with the same error function */ - } - /* finish 'lua_callk'/'lua_pcall'; CIST_YPCALL and 'errfunc' already - handled */ - adjustresults(L, ci->nresults); - lua_unlock(L); - n = (*ci->u.c.k)(L, status, ci->u.c.ctx); /* call continuation function */ - lua_lock(L); - api_checknelems(L, n); - luaD_poscall(L, ci, L->top - n, n); /* finish 'luaD_precall' */ -} - - -/* -** Executes "full continuation" (everything in the stack) of a -** previously interrupted coroutine until the stack is empty (or another -** interruption long-jumps out of the loop). If the coroutine is -** recovering from an error, 'ud' points to the error status, which must -** be passed to the first continuation function (otherwise the default -** status is LUA_YIELD). -*/ -static void unroll (lua_State *L, void *ud) { - if (ud != NULL) /* error status? */ - finishCcall(L, *(int *)ud); /* finish 'lua_pcallk' callee */ - while (L->ci != &L->base_ci) { /* something in the stack */ - if (!isLua(L->ci)) /* C function? */ - finishCcall(L, LUA_YIELD); /* complete its execution */ - else { /* Lua function */ - luaV_finishOp(L); /* finish interrupted instruction */ - luaV_execute(L); /* execute down to higher C 'boundary' */ - } - } -} - - -/* -** Try to find a suspended protected call (a "recover point") for the -** given thread. -*/ -static CallInfo *findpcall (lua_State *L) { - CallInfo *ci; - for (ci = L->ci; ci != NULL; ci = ci->previous) { /* search for a pcall */ - if (ci->callstatus & CIST_YPCALL) - return ci; - } - return NULL; /* no pending pcall */ -} - - -/* -** Recovers from an error in a coroutine. Finds a recover point (if -** there is one) and completes the execution of the interrupted -** 'luaD_pcall'. If there is no recover point, returns zero. -*/ -static int recover (lua_State *L, int status) { - StkId oldtop; - CallInfo *ci = findpcall(L); - if (ci == NULL) return 0; /* no recovery point */ - /* "finish" luaD_pcall */ - oldtop = restorestack(L, ci->extra); - luaF_close(L, oldtop); - seterrorobj(L, status, oldtop); - L->ci = ci; - L->allowhook = getoah(ci->callstatus); /* restore original 'allowhook' */ - L->nny = 0; /* should be zero to be yieldable */ - luaD_shrinkstack(L); - L->errfunc = ci->u.c.old_errfunc; - return 1; /* continue running the coroutine */ -} - - -/* -** Signal an error in the call to 'lua_resume', not in the execution -** of the coroutine itself. (Such errors should not be handled by any -** coroutine error handler and should not kill the coroutine.) -*/ -static int resume_error (lua_State *L, const char *msg, int narg) { - L->top -= narg; /* remove args from the stack */ - setsvalue2s(L, L->top, luaS_new(L, msg)); /* push error message */ - api_incr_top(L); - lua_unlock(L); - return LUA_ERRRUN; -} - - -/* -** Do the work for 'lua_resume' in protected mode. Most of the work -** depends on the status of the coroutine: initial state, suspended -** inside a hook, or regularly suspended (optionally with a continuation -** function), plus erroneous cases: non-suspended coroutine or dead -** coroutine. -*/ -static void resume (lua_State *L, void *ud) { - int n = *(cast(int*, ud)); /* number of arguments */ - StkId firstArg = L->top - n; /* first argument */ - CallInfo *ci = L->ci; - if (L->status == LUA_OK) { /* starting a coroutine? */ - if (!luaD_precall(L, firstArg - 1, LUA_MULTRET)) /* Lua function? */ - luaV_execute(L); /* call it */ - } - else { /* resuming from previous yield */ - lua_assert(L->status == LUA_YIELD); - L->status = LUA_OK; /* mark that it is running (again) */ - ci->func = restorestack(L, ci->extra); - if (isLua(ci)) /* yielded inside a hook? */ - luaV_execute(L); /* just continue running Lua code */ - else { /* 'common' yield */ - if (ci->u.c.k != NULL) { /* does it have a continuation function? */ - lua_unlock(L); - n = (*ci->u.c.k)(L, LUA_YIELD, ci->u.c.ctx); /* call continuation */ - lua_lock(L); - api_checknelems(L, n); - firstArg = L->top - n; /* yield results come from continuation */ - } - luaD_poscall(L, ci, firstArg, n); /* finish 'luaD_precall' */ - } - unroll(L, NULL); /* run continuation */ - } -} - - -LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs) { - int status; - unsigned short oldnny = L->nny; /* save "number of non-yieldable" calls */ - lua_lock(L); - if (L->status == LUA_OK) { /* may be starting a coroutine */ - if (L->ci != &L->base_ci) /* not in base level? */ - return resume_error(L, "cannot resume non-suspended coroutine", nargs); - } - else if (L->status != LUA_YIELD) - return resume_error(L, "cannot resume dead coroutine", nargs); - L->nCcalls = (from) ? from->nCcalls + 1 : 1; - if (L->nCcalls >= LUAI_MAXCCALLS) - return resume_error(L, "C stack overflow", nargs); - luai_userstateresume(L, nargs); - L->nny = 0; /* allow yields */ - api_checknelems(L, (L->status == LUA_OK) ? nargs + 1 : nargs); - status = luaD_rawrunprotected(L, resume, &nargs); - if (status == -1) /* error calling 'lua_resume'? */ - status = LUA_ERRRUN; - else { /* continue running after recoverable errors */ - while (errorstatus(status) && recover(L, status)) { - /* unroll continuation */ - status = luaD_rawrunprotected(L, unroll, &status); - } - if (errorstatus(status)) { /* unrecoverable error? */ - L->status = cast_byte(status); /* mark thread as 'dead' */ - seterrorobj(L, status, L->top); /* push error message */ - L->ci->top = L->top; - } - else lua_assert(status == L->status); /* normal end or yield */ - } - L->nny = oldnny; /* restore 'nny' */ - L->nCcalls--; - lua_assert(L->nCcalls == ((from) ? from->nCcalls : 0)); - lua_unlock(L); - return status; -} - - -LUA_API int lua_isyieldable (lua_State *L) { - return (L->nny == 0); -} - - -LUA_API int lua_yieldk (lua_State *L, int nresults, lua_KContext ctx, - lua_KFunction k) { - CallInfo *ci = L->ci; - luai_userstateyield(L, nresults); - lua_lock(L); - api_checknelems(L, nresults); - if (L->nny > 0) { - if (L != G(L)->mainthread) - luaG_runerror(L, "attempt to yield across a C-call boundary"); - else - luaG_runerror(L, "attempt to yield from outside a coroutine"); - } - L->status = LUA_YIELD; - ci->extra = savestack(L, ci->func); /* save current 'func' */ - if (isLua(ci)) { /* inside a hook? */ - api_check(L, k == NULL, "hooks cannot continue after yielding"); - } - else { - if ((ci->u.c.k = k) != NULL) /* is there a continuation? */ - ci->u.c.ctx = ctx; /* save context */ - ci->func = L->top - nresults - 1; /* protect stack below results */ - luaD_throw(L, LUA_YIELD); - } - lua_assert(ci->callstatus & CIST_HOOKED); /* must be inside a hook */ - lua_unlock(L); - return 0; /* return to 'luaD_hook' */ -} - - -int luaD_pcall (lua_State *L, Pfunc func, void *u, - ptrdiff_t old_top, ptrdiff_t ef) { - int status; - CallInfo *old_ci = L->ci; - lu_byte old_allowhooks = L->allowhook; - unsigned short old_nny = L->nny; - ptrdiff_t old_errfunc = L->errfunc; - L->errfunc = ef; - status = luaD_rawrunprotected(L, func, u); - if (status != LUA_OK) { /* an error occurred? */ - StkId oldtop = restorestack(L, old_top); - luaF_close(L, oldtop); /* close possible pending closures */ - seterrorobj(L, status, oldtop); - L->ci = old_ci; - L->allowhook = old_allowhooks; - L->nny = old_nny; - luaD_shrinkstack(L); - } - L->errfunc = old_errfunc; - return status; -} - - - -/* -** Execute a protected parser. -*/ -struct SParser { /* data to 'f_parser' */ - ZIO *z; - Mbuffer buff; /* dynamic structure used by the scanner */ - Dyndata dyd; /* dynamic structures used by the parser */ - const char *mode; - const char *name; -}; - - -static void checkmode (lua_State *L, const char *mode, const char *x) { - if (mode && strchr(mode, x[0]) == NULL) { - luaO_pushfstring(L, - "attempt to load a %s chunk (mode is '%s')", x, mode); - luaD_throw(L, LUA_ERRSYNTAX); - } -} - - -static void f_parser (lua_State *L, void *ud) { - LClosure *cl; - struct SParser *p = cast(struct SParser *, ud); - int c = zgetc(p->z); /* read first character */ - if (c == LUA_SIGNATURE[0]) { - checkmode(L, p->mode, "binary"); - cl = luaU_undump(L, p->z, p->name); - } - else { - checkmode(L, p->mode, "text"); - cl = luaY_parser(L, p->z, &p->buff, &p->dyd, p->name, c); - } - lua_assert(cl->nupvalues == cl->p->sizeupvalues); - luaF_initupvals(L, cl); -} - - -int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, - const char *mode) { - struct SParser p; - int status; - L->nny++; /* cannot yield during parsing */ - p.z = z; p.name = name; p.mode = mode; - p.dyd.actvar.arr = NULL; p.dyd.actvar.size = 0; - p.dyd.gt.arr = NULL; p.dyd.gt.size = 0; - p.dyd.label.arr = NULL; p.dyd.label.size = 0; - luaZ_initbuffer(L, &p.buff); - status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc); - luaZ_freebuffer(L, &p.buff); - luaM_freearray(L, p.dyd.actvar.arr, p.dyd.actvar.size); - luaM_freearray(L, p.dyd.gt.arr, p.dyd.gt.size); - luaM_freearray(L, p.dyd.label.arr, p.dyd.label.size); - L->nny--; - return status; -} - - diff --git a/LuaSkin/lua-5.3.4/src/ldo.h b/LuaSkin/lua-5.3.4/src/ldo.h deleted file mode 100644 index 4f5d51c3c..000000000 --- a/LuaSkin/lua-5.3.4/src/ldo.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -** $Id: ldo.h,v 2.29 2015/12/21 13:02:14 roberto Exp $ -** Stack and Call structure of Lua -** See Copyright Notice in lua.h -*/ - -#ifndef ldo_h -#define ldo_h - - -#include "lobject.h" -#include "lstate.h" -#include "lzio.h" - - -/* -** Macro to check stack size and grow stack if needed. Parameters -** 'pre'/'pos' allow the macro to preserve a pointer into the -** stack across reallocations, doing the work only when needed. -** 'condmovestack' is used in heavy tests to force a stack reallocation -** at every check. -*/ -#define luaD_checkstackaux(L,n,pre,pos) \ - if (L->stack_last - L->top <= (n)) \ - { pre; luaD_growstack(L, n); pos; } else { condmovestack(L,pre,pos); } - -/* In general, 'pre'/'pos' are empty (nothing to save) */ -#define luaD_checkstack(L,n) luaD_checkstackaux(L,n,(void)0,(void)0) - - - -#define savestack(L,p) ((char *)(p) - (char *)L->stack) -#define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) - - -/* type of protected functions, to be ran by 'runprotected' */ -typedef void (*Pfunc) (lua_State *L, void *ud); - -LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, - const char *mode); -LUAI_FUNC void luaD_hook (lua_State *L, int event, int line); -LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); -LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); -LUAI_FUNC void luaD_callnoyield (lua_State *L, StkId func, int nResults); -LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, - ptrdiff_t oldtop, ptrdiff_t ef); -LUAI_FUNC int luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult, - int nres); -LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); -LUAI_FUNC void luaD_growstack (lua_State *L, int n); -LUAI_FUNC void luaD_shrinkstack (lua_State *L); -LUAI_FUNC void luaD_inctop (lua_State *L); - -LUAI_FUNC l_noret luaD_throw (lua_State *L, int errcode); -LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); - -#endif - diff --git a/LuaSkin/lua-5.3.4/src/ldump.c b/LuaSkin/lua-5.3.4/src/ldump.c deleted file mode 100644 index 016e30082..000000000 --- a/LuaSkin/lua-5.3.4/src/ldump.c +++ /dev/null @@ -1,215 +0,0 @@ -/* -** $Id: ldump.c,v 2.37 2015/10/08 15:53:49 roberto Exp $ -** save precompiled Lua chunks -** See Copyright Notice in lua.h -*/ - -#define ldump_c -#define LUA_CORE - -#include "lprefix.h" - - -#include - -#include "lua.h" - -#include "lobject.h" -#include "lstate.h" -#include "lundump.h" - - -typedef struct { - lua_State *L; - lua_Writer writer; - void *data; - int strip; - int status; -} DumpState; - - -/* -** All high-level dumps go through DumpVector; you can change it to -** change the endianness of the result -*/ -#define DumpVector(v,n,D) DumpBlock(v,(n)*sizeof((v)[0]),D) - -#define DumpLiteral(s,D) DumpBlock(s, sizeof(s) - sizeof(char), D) - - -static void DumpBlock (const void *b, size_t size, DumpState *D) { - if (D->status == 0 && size > 0) { - lua_unlock(D->L); - D->status = (*D->writer)(D->L, b, size, D->data); - lua_lock(D->L); - } -} - - -#define DumpVar(x,D) DumpVector(&x,1,D) - - -static void DumpByte (int y, DumpState *D) { - lu_byte x = (lu_byte)y; - DumpVar(x, D); -} - - -static void DumpInt (int x, DumpState *D) { - DumpVar(x, D); -} - - -static void DumpNumber (lua_Number x, DumpState *D) { - DumpVar(x, D); -} - - -static void DumpInteger (lua_Integer x, DumpState *D) { - DumpVar(x, D); -} - - -static void DumpString (const TString *s, DumpState *D) { - if (s == NULL) - DumpByte(0, D); - else { - size_t size = tsslen(s) + 1; /* include trailing '\0' */ - const char *str = getstr(s); - if (size < 0xFF) - DumpByte(cast_int(size), D); - else { - DumpByte(0xFF, D); - DumpVar(size, D); - } - DumpVector(str, size - 1, D); /* no need to save '\0' */ - } -} - - -static void DumpCode (const Proto *f, DumpState *D) { - DumpInt(f->sizecode, D); - DumpVector(f->code, f->sizecode, D); -} - - -static void DumpFunction(const Proto *f, TString *psource, DumpState *D); - -static void DumpConstants (const Proto *f, DumpState *D) { - int i; - int n = f->sizek; - DumpInt(n, D); - for (i = 0; i < n; i++) { - const TValue *o = &f->k[i]; - DumpByte(ttype(o), D); - switch (ttype(o)) { - case LUA_TNIL: - break; - case LUA_TBOOLEAN: - DumpByte(bvalue(o), D); - break; - case LUA_TNUMFLT: - DumpNumber(fltvalue(o), D); - break; - case LUA_TNUMINT: - DumpInteger(ivalue(o), D); - break; - case LUA_TSHRSTR: - case LUA_TLNGSTR: - DumpString(tsvalue(o), D); - break; - default: - lua_assert(0); - } - } -} - - -static void DumpProtos (const Proto *f, DumpState *D) { - int i; - int n = f->sizep; - DumpInt(n, D); - for (i = 0; i < n; i++) - DumpFunction(f->p[i], f->source, D); -} - - -static void DumpUpvalues (const Proto *f, DumpState *D) { - int i, n = f->sizeupvalues; - DumpInt(n, D); - for (i = 0; i < n; i++) { - DumpByte(f->upvalues[i].instack, D); - DumpByte(f->upvalues[i].idx, D); - } -} - - -static void DumpDebug (const Proto *f, DumpState *D) { - int i, n; - n = (D->strip) ? 0 : f->sizelineinfo; - DumpInt(n, D); - DumpVector(f->lineinfo, n, D); - n = (D->strip) ? 0 : f->sizelocvars; - DumpInt(n, D); - for (i = 0; i < n; i++) { - DumpString(f->locvars[i].varname, D); - DumpInt(f->locvars[i].startpc, D); - DumpInt(f->locvars[i].endpc, D); - } - n = (D->strip) ? 0 : f->sizeupvalues; - DumpInt(n, D); - for (i = 0; i < n; i++) - DumpString(f->upvalues[i].name, D); -} - - -static void DumpFunction (const Proto *f, TString *psource, DumpState *D) { - if (D->strip || f->source == psource) - DumpString(NULL, D); /* no debug info or same source as its parent */ - else - DumpString(f->source, D); - DumpInt(f->linedefined, D); - DumpInt(f->lastlinedefined, D); - DumpByte(f->numparams, D); - DumpByte(f->is_vararg, D); - DumpByte(f->maxstacksize, D); - DumpCode(f, D); - DumpConstants(f, D); - DumpUpvalues(f, D); - DumpProtos(f, D); - DumpDebug(f, D); -} - - -static void DumpHeader (DumpState *D) { - DumpLiteral(LUA_SIGNATURE, D); - DumpByte(LUAC_VERSION, D); - DumpByte(LUAC_FORMAT, D); - DumpLiteral(LUAC_DATA, D); - DumpByte(sizeof(int), D); - DumpByte(sizeof(size_t), D); - DumpByte(sizeof(Instruction), D); - DumpByte(sizeof(lua_Integer), D); - DumpByte(sizeof(lua_Number), D); - DumpInteger(LUAC_INT, D); - DumpNumber(LUAC_NUM, D); -} - - -/* -** dump Lua function as precompiled chunk -*/ -int luaU_dump(lua_State *L, const Proto *f, lua_Writer w, void *data, - int strip) { - DumpState D; - D.L = L; - D.writer = w; - D.data = data; - D.strip = strip; - D.status = 0; - DumpHeader(&D); - DumpByte(f->sizeupvalues, &D); - DumpFunction(f, NULL, &D); - return D.status; -} - diff --git a/LuaSkin/lua-5.3.4/src/lfunc.c b/LuaSkin/lua-5.3.4/src/lfunc.c deleted file mode 100644 index 67967dab3..000000000 --- a/LuaSkin/lua-5.3.4/src/lfunc.c +++ /dev/null @@ -1,151 +0,0 @@ -/* -** $Id: lfunc.c,v 2.45 2014/11/02 19:19:04 roberto Exp $ -** Auxiliary functions to manipulate prototypes and closures -** See Copyright Notice in lua.h -*/ - -#define lfunc_c -#define LUA_CORE - -#include "lprefix.h" - - -#include - -#include "lua.h" - -#include "lfunc.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" - - - -CClosure *luaF_newCclosure (lua_State *L, int n) { - GCObject *o = luaC_newobj(L, LUA_TCCL, sizeCclosure(n)); - CClosure *c = gco2ccl(o); - c->nupvalues = cast_byte(n); - return c; -} - - -LClosure *luaF_newLclosure (lua_State *L, int n) { - GCObject *o = luaC_newobj(L, LUA_TLCL, sizeLclosure(n)); - LClosure *c = gco2lcl(o); - c->p = NULL; - c->nupvalues = cast_byte(n); - while (n--) c->upvals[n] = NULL; - return c; -} - -/* -** fill a closure with new closed upvalues -*/ -void luaF_initupvals (lua_State *L, LClosure *cl) { - int i; - for (i = 0; i < cl->nupvalues; i++) { - UpVal *uv = luaM_new(L, UpVal); - uv->refcount = 1; - uv->v = &uv->u.value; /* make it closed */ - setnilvalue(uv->v); - cl->upvals[i] = uv; - } -} - - -UpVal *luaF_findupval (lua_State *L, StkId level) { - UpVal **pp = &L->openupval; - UpVal *p; - UpVal *uv; - lua_assert(isintwups(L) || L->openupval == NULL); - while (*pp != NULL && (p = *pp)->v >= level) { - lua_assert(upisopen(p)); - if (p->v == level) /* found a corresponding upvalue? */ - return p; /* return it */ - pp = &p->u.open.next; - } - /* not found: create a new upvalue */ - uv = luaM_new(L, UpVal); - uv->refcount = 0; - uv->u.open.next = *pp; /* link it to list of open upvalues */ - uv->u.open.touched = 1; - *pp = uv; - uv->v = level; /* current value lives in the stack */ - if (!isintwups(L)) { /* thread not in list of threads with upvalues? */ - L->twups = G(L)->twups; /* link it to the list */ - G(L)->twups = L; - } - return uv; -} - - -void luaF_close (lua_State *L, StkId level) { - UpVal *uv; - while (L->openupval != NULL && (uv = L->openupval)->v >= level) { - lua_assert(upisopen(uv)); - L->openupval = uv->u.open.next; /* remove from 'open' list */ - if (uv->refcount == 0) /* no references? */ - luaM_free(L, uv); /* free upvalue */ - else { - setobj(L, &uv->u.value, uv->v); /* move value to upvalue slot */ - uv->v = &uv->u.value; /* now current value lives here */ - luaC_upvalbarrier(L, uv); - } - } -} - - -Proto *luaF_newproto (lua_State *L) { - GCObject *o = luaC_newobj(L, LUA_TPROTO, sizeof(Proto)); - Proto *f = gco2p(o); - f->k = NULL; - f->sizek = 0; - f->p = NULL; - f->sizep = 0; - f->code = NULL; - f->cache = NULL; - f->sizecode = 0; - f->lineinfo = NULL; - f->sizelineinfo = 0; - f->upvalues = NULL; - f->sizeupvalues = 0; - f->numparams = 0; - f->is_vararg = 0; - f->maxstacksize = 0; - f->locvars = NULL; - f->sizelocvars = 0; - f->linedefined = 0; - f->lastlinedefined = 0; - f->source = NULL; - return f; -} - - -void luaF_freeproto (lua_State *L, Proto *f) { - luaM_freearray(L, f->code, f->sizecode); - luaM_freearray(L, f->p, f->sizep); - luaM_freearray(L, f->k, f->sizek); - luaM_freearray(L, f->lineinfo, f->sizelineinfo); - luaM_freearray(L, f->locvars, f->sizelocvars); - luaM_freearray(L, f->upvalues, f->sizeupvalues); - luaM_free(L, f); -} - - -/* -** Look for n-th local variable at line 'line' in function 'func'. -** Returns NULL if not found. -*/ -const char *luaF_getlocalname (const Proto *f, int local_number, int pc) { - int i; - for (i = 0; isizelocvars && f->locvars[i].startpc <= pc; i++) { - if (pc < f->locvars[i].endpc) { /* is variable active? */ - local_number--; - if (local_number == 0) - return getstr(f->locvars[i].varname); - } - } - return NULL; /* not found */ -} - diff --git a/LuaSkin/lua-5.3.4/src/lfunc.h b/LuaSkin/lua-5.3.4/src/lfunc.h deleted file mode 100644 index 2eeb0d5a4..000000000 --- a/LuaSkin/lua-5.3.4/src/lfunc.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -** $Id: lfunc.h,v 2.15 2015/01/13 15:49:11 roberto Exp $ -** Auxiliary functions to manipulate prototypes and closures -** See Copyright Notice in lua.h -*/ - -#ifndef lfunc_h -#define lfunc_h - - -#include "lobject.h" - - -#define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ - cast(int, sizeof(TValue)*((n)-1))) - -#define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ - cast(int, sizeof(TValue *)*((n)-1))) - - -/* test whether thread is in 'twups' list */ -#define isintwups(L) (L->twups != L) - - -/* -** maximum number of upvalues in a closure (both C and Lua). (Value -** must fit in a VM register.) -*/ -#define MAXUPVAL 255 - - -/* -** Upvalues for Lua closures -*/ -struct UpVal { - TValue *v; /* points to stack or to its own value */ - lu_mem refcount; /* reference counter */ - union { - struct { /* (when open) */ - UpVal *next; /* linked list */ - int touched; /* mark to avoid cycles with dead threads */ - } open; - TValue value; /* the value (when closed) */ - } u; -}; - -#define upisopen(up) ((up)->v != &(up)->u.value) - - -LUAI_FUNC Proto *luaF_newproto (lua_State *L); -LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nelems); -LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nelems); -LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); -LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); -LUAI_FUNC void luaF_close (lua_State *L, StkId level); -LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); -LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, - int pc); - - -#endif diff --git a/LuaSkin/lua-5.3.4/src/lgc.c b/LuaSkin/lua-5.3.4/src/lgc.c deleted file mode 100644 index ba2c19e14..000000000 --- a/LuaSkin/lua-5.3.4/src/lgc.c +++ /dev/null @@ -1,1178 +0,0 @@ -/* -** $Id: lgc.c,v 2.215 2016/12/22 13:08:50 roberto Exp $ -** Garbage Collector -** See Copyright Notice in lua.h -*/ - -#define lgc_c -#define LUA_CORE - -#include "lprefix.h" - - -#include - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" - - -/* -** internal state for collector while inside the atomic phase. The -** collector should never be in this state while running regular code. -*/ -#define GCSinsideatomic (GCSpause + 1) - -/* -** cost of sweeping one element (the size of a small object divided -** by some adjust for the sweep speed) -*/ -#define GCSWEEPCOST ((sizeof(TString) + 4) / 4) - -/* maximum number of elements to sweep in each single step */ -#define GCSWEEPMAX (cast_int((GCSTEPSIZE / GCSWEEPCOST) / 4)) - -/* cost of calling one finalizer */ -#define GCFINALIZECOST GCSWEEPCOST - - -/* -** macro to adjust 'stepmul': 'stepmul' is actually used like -** 'stepmul / STEPMULADJ' (value chosen by tests) -*/ -#define STEPMULADJ 200 - - -/* -** macro to adjust 'pause': 'pause' is actually used like -** 'pause / PAUSEADJ' (value chosen by tests) -*/ -#define PAUSEADJ 100 - - -/* -** 'makewhite' erases all color bits then sets only the current white -** bit -*/ -#define maskcolors (~(bitmask(BLACKBIT) | WHITEBITS)) -#define makewhite(g,x) \ - (x->marked = cast_byte((x->marked & maskcolors) | luaC_white(g))) - -#define white2gray(x) resetbits(x->marked, WHITEBITS) -#define black2gray(x) resetbit(x->marked, BLACKBIT) - - -#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) - -#define checkdeadkey(n) lua_assert(!ttisdeadkey(gkey(n)) || ttisnil(gval(n))) - - -#define checkconsistency(obj) \ - lua_longassert(!iscollectable(obj) || righttt(obj)) - - -#define markvalue(g,o) { checkconsistency(o); \ - if (valiswhite(o)) reallymarkobject(g,gcvalue(o)); } - -#define markobject(g,t) { if (iswhite(t)) reallymarkobject(g, obj2gco(t)); } - -/* -** mark an object that can be NULL (either because it is really optional, -** or it was stripped as debug info, or inside an uncompleted structure) -*/ -#define markobjectN(g,t) { if (t) markobject(g,t); } - -static void reallymarkobject (global_State *g, GCObject *o); - - -/* -** {====================================================== -** Generic functions -** ======================================================= -*/ - - -/* -** one after last element in a hash array -*/ -#define gnodelast(h) gnode(h, cast(size_t, sizenode(h))) - - -/* -** link collectable object 'o' into list pointed by 'p' -*/ -#define linkgclist(o,p) ((o)->gclist = (p), (p) = obj2gco(o)) - - -/* -** If key is not marked, mark its entry as dead. This allows key to be -** collected, but keeps its entry in the table. A dead node is needed -** when Lua looks up for a key (it may be part of a chain) and when -** traversing a weak table (key might be removed from the table during -** traversal). Other places never manipulate dead keys, because its -** associated nil value is enough to signal that the entry is logically -** empty. -*/ -static void removeentry (Node *n) { - lua_assert(ttisnil(gval(n))); - if (valiswhite(gkey(n))) - setdeadvalue(wgkey(n)); /* unused and unmarked key; remove it */ -} - - -/* -** tells whether a key or value can be cleared from a weak -** table. Non-collectable objects are never removed from weak -** tables. Strings behave as 'values', so are never removed too. for -** other objects: if really collected, cannot keep them; for objects -** being finalized, keep them in keys, but not in values -*/ -static int iscleared (global_State *g, const TValue *o) { - if (!iscollectable(o)) return 0; - else if (ttisstring(o)) { - markobject(g, tsvalue(o)); /* strings are 'values', so are never weak */ - return 0; - } - else return iswhite(gcvalue(o)); -} - - -/* -** barrier that moves collector forward, that is, mark the white object -** being pointed by a black object. (If in sweep phase, clear the black -** object to white [sweep it] to avoid other barrier calls for this -** same object.) -*/ -void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v) { - global_State *g = G(L); - lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); - if (keepinvariant(g)) /* must keep invariant? */ - reallymarkobject(g, v); /* restore invariant */ - else { /* sweep phase */ - lua_assert(issweepphase(g)); - makewhite(g, o); /* mark main obj. as white to avoid other barriers */ - } -} - - -/* -** barrier that moves collector backward, that is, mark the black object -** pointing to a white object as gray again. -*/ -void luaC_barrierback_ (lua_State *L, Table *t) { - global_State *g = G(L); - lua_assert(isblack(t) && !isdead(g, t)); - black2gray(t); /* make table gray (again) */ - linkgclist(t, g->grayagain); -} - - -/* -** barrier for assignments to closed upvalues. Because upvalues are -** shared among closures, it is impossible to know the color of all -** closures pointing to it. So, we assume that the object being assigned -** must be marked. -*/ -void luaC_upvalbarrier_ (lua_State *L, UpVal *uv) { - global_State *g = G(L); - GCObject *o = gcvalue(uv->v); - lua_assert(!upisopen(uv)); /* ensured by macro luaC_upvalbarrier */ - if (keepinvariant(g)) - markobject(g, o); -} - - -void luaC_fix (lua_State *L, GCObject *o) { - global_State *g = G(L); - lua_assert(g->allgc == o); /* object must be 1st in 'allgc' list! */ - white2gray(o); /* they will be gray forever */ - g->allgc = o->next; /* remove object from 'allgc' list */ - o->next = g->fixedgc; /* link it to 'fixedgc' list */ - g->fixedgc = o; -} - - -/* -** create a new collectable object (with given type and size) and link -** it to 'allgc' list. -*/ -GCObject *luaC_newobj (lua_State *L, int tt, size_t sz) { - global_State *g = G(L); - GCObject *o = cast(GCObject *, luaM_newobject(L, novariant(tt), sz)); - o->marked = luaC_white(g); - o->tt = tt; - o->next = g->allgc; - g->allgc = o; - return o; -} - -/* }====================================================== */ - - - -/* -** {====================================================== -** Mark functions -** ======================================================= -*/ - - -/* -** mark an object. Userdata, strings, and closed upvalues are visited -** and turned black here. Other objects are marked gray and added -** to appropriate list to be visited (and turned black) later. (Open -** upvalues are already linked in 'headuv' list.) -*/ -static void reallymarkobject (global_State *g, GCObject *o) { - reentry: - white2gray(o); - switch (o->tt) { - case LUA_TSHRSTR: { - gray2black(o); - g->GCmemtrav += sizelstring(gco2ts(o)->shrlen); - break; - } - case LUA_TLNGSTR: { - gray2black(o); - g->GCmemtrav += sizelstring(gco2ts(o)->u.lnglen); - break; - } - case LUA_TUSERDATA: { - TValue uvalue; - markobjectN(g, gco2u(o)->metatable); /* mark its metatable */ - gray2black(o); - g->GCmemtrav += sizeudata(gco2u(o)); - getuservalue(g->mainthread, gco2u(o), &uvalue); - if (valiswhite(&uvalue)) { /* markvalue(g, &uvalue); */ - o = gcvalue(&uvalue); - goto reentry; - } - break; - } - case LUA_TLCL: { - linkgclist(gco2lcl(o), g->gray); - break; - } - case LUA_TCCL: { - linkgclist(gco2ccl(o), g->gray); - break; - } - case LUA_TTABLE: { - linkgclist(gco2t(o), g->gray); - break; - } - case LUA_TTHREAD: { - linkgclist(gco2th(o), g->gray); - break; - } - case LUA_TPROTO: { - linkgclist(gco2p(o), g->gray); - break; - } - default: lua_assert(0); break; - } -} - - -/* -** mark metamethods for basic types -*/ -static void markmt (global_State *g) { - int i; - for (i=0; i < LUA_NUMTAGS; i++) - markobjectN(g, g->mt[i]); -} - - -/* -** mark all objects in list of being-finalized -*/ -static void markbeingfnz (global_State *g) { - GCObject *o; - for (o = g->tobefnz; o != NULL; o = o->next) - markobject(g, o); -} - - -/* -** Mark all values stored in marked open upvalues from non-marked threads. -** (Values from marked threads were already marked when traversing the -** thread.) Remove from the list threads that no longer have upvalues and -** not-marked threads. -*/ -static void remarkupvals (global_State *g) { - lua_State *thread; - lua_State **p = &g->twups; - while ((thread = *p) != NULL) { - lua_assert(!isblack(thread)); /* threads are never black */ - if (isgray(thread) && thread->openupval != NULL) - p = &thread->twups; /* keep marked thread with upvalues in the list */ - else { /* thread is not marked or without upvalues */ - UpVal *uv; - *p = thread->twups; /* remove thread from the list */ - thread->twups = thread; /* mark that it is out of list */ - for (uv = thread->openupval; uv != NULL; uv = uv->u.open.next) { - if (uv->u.open.touched) { - markvalue(g, uv->v); /* remark upvalue's value */ - uv->u.open.touched = 0; - } - } - } - } -} - - -/* -** mark root set and reset all gray lists, to start a new collection -*/ -static void restartcollection (global_State *g) { - g->gray = g->grayagain = NULL; - g->weak = g->allweak = g->ephemeron = NULL; - markobject(g, g->mainthread); - markvalue(g, &g->l_registry); - markmt(g); - markbeingfnz(g); /* mark any finalizing object left from previous cycle */ -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Traverse functions -** ======================================================= -*/ - -/* -** Traverse a table with weak values and link it to proper list. During -** propagate phase, keep it in 'grayagain' list, to be revisited in the -** atomic phase. In the atomic phase, if table has any white value, -** put it in 'weak' list, to be cleared. -*/ -static void traverseweakvalue (global_State *g, Table *h) { - Node *n, *limit = gnodelast(h); - /* if there is array part, assume it may have white values (it is not - worth traversing it now just to check) */ - int hasclears = (h->sizearray > 0); - for (n = gnode(h, 0); n < limit; n++) { /* traverse hash part */ - checkdeadkey(n); - if (ttisnil(gval(n))) /* entry is empty? */ - removeentry(n); /* remove it */ - else { - lua_assert(!ttisnil(gkey(n))); - markvalue(g, gkey(n)); /* mark key */ - if (!hasclears && iscleared(g, gval(n))) /* is there a white value? */ - hasclears = 1; /* table will have to be cleared */ - } - } - if (g->gcstate == GCSpropagate) - linkgclist(h, g->grayagain); /* must retraverse it in atomic phase */ - else if (hasclears) - linkgclist(h, g->weak); /* has to be cleared later */ -} - - -/* -** Traverse an ephemeron table and link it to proper list. Returns true -** iff any object was marked during this traversal (which implies that -** convergence has to continue). During propagation phase, keep table -** in 'grayagain' list, to be visited again in the atomic phase. In -** the atomic phase, if table has any white->white entry, it has to -** be revisited during ephemeron convergence (as that key may turn -** black). Otherwise, if it has any white key, table has to be cleared -** (in the atomic phase). -*/ -static int traverseephemeron (global_State *g, Table *h) { - int marked = 0; /* true if an object is marked in this traversal */ - int hasclears = 0; /* true if table has white keys */ - int hasww = 0; /* true if table has entry "white-key -> white-value" */ - Node *n, *limit = gnodelast(h); - unsigned int i; - /* traverse array part */ - for (i = 0; i < h->sizearray; i++) { - if (valiswhite(&h->array[i])) { - marked = 1; - reallymarkobject(g, gcvalue(&h->array[i])); - } - } - /* traverse hash part */ - for (n = gnode(h, 0); n < limit; n++) { - checkdeadkey(n); - if (ttisnil(gval(n))) /* entry is empty? */ - removeentry(n); /* remove it */ - else if (iscleared(g, gkey(n))) { /* key is not marked (yet)? */ - hasclears = 1; /* table must be cleared */ - if (valiswhite(gval(n))) /* value not marked yet? */ - hasww = 1; /* white-white entry */ - } - else if (valiswhite(gval(n))) { /* value not marked yet? */ - marked = 1; - reallymarkobject(g, gcvalue(gval(n))); /* mark it now */ - } - } - /* link table into proper list */ - if (g->gcstate == GCSpropagate) - linkgclist(h, g->grayagain); /* must retraverse it in atomic phase */ - else if (hasww) /* table has white->white entries? */ - linkgclist(h, g->ephemeron); /* have to propagate again */ - else if (hasclears) /* table has white keys? */ - linkgclist(h, g->allweak); /* may have to clean white keys */ - return marked; -} - - -static void traversestrongtable (global_State *g, Table *h) { - Node *n, *limit = gnodelast(h); - unsigned int i; - for (i = 0; i < h->sizearray; i++) /* traverse array part */ - markvalue(g, &h->array[i]); - for (n = gnode(h, 0); n < limit; n++) { /* traverse hash part */ - checkdeadkey(n); - if (ttisnil(gval(n))) /* entry is empty? */ - removeentry(n); /* remove it */ - else { - lua_assert(!ttisnil(gkey(n))); - markvalue(g, gkey(n)); /* mark key */ - markvalue(g, gval(n)); /* mark value */ - } - } -} - - -static lu_mem traversetable (global_State *g, Table *h) { - const char *weakkey, *weakvalue; - const TValue *mode = gfasttm(g, h->metatable, TM_MODE); - markobjectN(g, h->metatable); - if (mode && ttisstring(mode) && /* is there a weak mode? */ - ((weakkey = strchr(svalue(mode), 'k')), - (weakvalue = strchr(svalue(mode), 'v')), - (weakkey || weakvalue))) { /* is really weak? */ - black2gray(h); /* keep table gray */ - if (!weakkey) /* strong keys? */ - traverseweakvalue(g, h); - else if (!weakvalue) /* strong values? */ - traverseephemeron(g, h); - else /* all weak */ - linkgclist(h, g->allweak); /* nothing to traverse now */ - } - else /* not weak */ - traversestrongtable(g, h); - return sizeof(Table) + sizeof(TValue) * h->sizearray + - sizeof(Node) * cast(size_t, allocsizenode(h)); -} - - -/* -** Traverse a prototype. (While a prototype is being build, its -** arrays can be larger than needed; the extra slots are filled with -** NULL, so the use of 'markobjectN') -*/ -static int traverseproto (global_State *g, Proto *f) { - int i; - if (f->cache && iswhite(f->cache)) - f->cache = NULL; /* allow cache to be collected */ - markobjectN(g, f->source); - for (i = 0; i < f->sizek; i++) /* mark literals */ - markvalue(g, &f->k[i]); - for (i = 0; i < f->sizeupvalues; i++) /* mark upvalue names */ - markobjectN(g, f->upvalues[i].name); - for (i = 0; i < f->sizep; i++) /* mark nested protos */ - markobjectN(g, f->p[i]); - for (i = 0; i < f->sizelocvars; i++) /* mark local-variable names */ - markobjectN(g, f->locvars[i].varname); - return sizeof(Proto) + sizeof(Instruction) * f->sizecode + - sizeof(Proto *) * f->sizep + - sizeof(TValue) * f->sizek + - sizeof(int) * f->sizelineinfo + - sizeof(LocVar) * f->sizelocvars + - sizeof(Upvaldesc) * f->sizeupvalues; -} - - -static lu_mem traverseCclosure (global_State *g, CClosure *cl) { - int i; - for (i = 0; i < cl->nupvalues; i++) /* mark its upvalues */ - markvalue(g, &cl->upvalue[i]); - return sizeCclosure(cl->nupvalues); -} - -/* -** open upvalues point to values in a thread, so those values should -** be marked when the thread is traversed except in the atomic phase -** (because then the value cannot be changed by the thread and the -** thread may not be traversed again) -*/ -static lu_mem traverseLclosure (global_State *g, LClosure *cl) { - int i; - markobjectN(g, cl->p); /* mark its prototype */ - for (i = 0; i < cl->nupvalues; i++) { /* mark its upvalues */ - UpVal *uv = cl->upvals[i]; - if (uv != NULL) { - if (upisopen(uv) && g->gcstate != GCSinsideatomic) - uv->u.open.touched = 1; /* can be marked in 'remarkupvals' */ - else - markvalue(g, uv->v); - } - } - return sizeLclosure(cl->nupvalues); -} - - -static lu_mem traversethread (global_State *g, lua_State *th) { - StkId o = th->stack; - if (o == NULL) - return 1; /* stack not completely built yet */ - lua_assert(g->gcstate == GCSinsideatomic || - th->openupval == NULL || isintwups(th)); - for (; o < th->top; o++) /* mark live elements in the stack */ - markvalue(g, o); - if (g->gcstate == GCSinsideatomic) { /* final traversal? */ - StkId lim = th->stack + th->stacksize; /* real end of stack */ - for (; o < lim; o++) /* clear not-marked stack slice */ - setnilvalue(o); - /* 'remarkupvals' may have removed thread from 'twups' list */ - if (!isintwups(th) && th->openupval != NULL) { - th->twups = g->twups; /* link it back to the list */ - g->twups = th; - } - } - else if (g->gckind != KGC_EMERGENCY) - luaD_shrinkstack(th); /* do not change stack in emergency cycle */ - return (sizeof(lua_State) + sizeof(TValue) * th->stacksize + - sizeof(CallInfo) * th->nci); -} - - -/* -** traverse one gray object, turning it to black (except for threads, -** which are always gray). -*/ -static void propagatemark (global_State *g) { - lu_mem size; - GCObject *o = g->gray; - lua_assert(isgray(o)); - gray2black(o); - switch (o->tt) { - case LUA_TTABLE: { - Table *h = gco2t(o); - g->gray = h->gclist; /* remove from 'gray' list */ - size = traversetable(g, h); - break; - } - case LUA_TLCL: { - LClosure *cl = gco2lcl(o); - g->gray = cl->gclist; /* remove from 'gray' list */ - size = traverseLclosure(g, cl); - break; - } - case LUA_TCCL: { - CClosure *cl = gco2ccl(o); - g->gray = cl->gclist; /* remove from 'gray' list */ - size = traverseCclosure(g, cl); - break; - } - case LUA_TTHREAD: { - lua_State *th = gco2th(o); - g->gray = th->gclist; /* remove from 'gray' list */ - linkgclist(th, g->grayagain); /* insert into 'grayagain' list */ - black2gray(o); - size = traversethread(g, th); - break; - } - case LUA_TPROTO: { - Proto *p = gco2p(o); - g->gray = p->gclist; /* remove from 'gray' list */ - size = traverseproto(g, p); - break; - } - default: lua_assert(0); return; - } - g->GCmemtrav += size; -} - - -static void propagateall (global_State *g) { - while (g->gray) propagatemark(g); -} - - -static void convergeephemerons (global_State *g) { - int changed; - do { - GCObject *w; - GCObject *next = g->ephemeron; /* get ephemeron list */ - g->ephemeron = NULL; /* tables may return to this list when traversed */ - changed = 0; - while ((w = next) != NULL) { - next = gco2t(w)->gclist; - if (traverseephemeron(g, gco2t(w))) { /* traverse marked some value? */ - propagateall(g); /* propagate changes */ - changed = 1; /* will have to revisit all ephemeron tables */ - } - } - } while (changed); -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Sweep Functions -** ======================================================= -*/ - - -/* -** clear entries with unmarked keys from all weaktables in list 'l' up -** to element 'f' -*/ -static void clearkeys (global_State *g, GCObject *l, GCObject *f) { - for (; l != f; l = gco2t(l)->gclist) { - Table *h = gco2t(l); - Node *n, *limit = gnodelast(h); - for (n = gnode(h, 0); n < limit; n++) { - if (!ttisnil(gval(n)) && (iscleared(g, gkey(n)))) { - setnilvalue(gval(n)); /* remove value ... */ - removeentry(n); /* and remove entry from table */ - } - } - } -} - - -/* -** clear entries with unmarked values from all weaktables in list 'l' up -** to element 'f' -*/ -static void clearvalues (global_State *g, GCObject *l, GCObject *f) { - for (; l != f; l = gco2t(l)->gclist) { - Table *h = gco2t(l); - Node *n, *limit = gnodelast(h); - unsigned int i; - for (i = 0; i < h->sizearray; i++) { - TValue *o = &h->array[i]; - if (iscleared(g, o)) /* value was collected? */ - setnilvalue(o); /* remove value */ - } - for (n = gnode(h, 0); n < limit; n++) { - if (!ttisnil(gval(n)) && iscleared(g, gval(n))) { - setnilvalue(gval(n)); /* remove value ... */ - removeentry(n); /* and remove entry from table */ - } - } - } -} - - -void luaC_upvdeccount (lua_State *L, UpVal *uv) { - lua_assert(uv->refcount > 0); - uv->refcount--; - if (uv->refcount == 0 && !upisopen(uv)) - luaM_free(L, uv); -} - - -static void freeLclosure (lua_State *L, LClosure *cl) { - int i; - for (i = 0; i < cl->nupvalues; i++) { - UpVal *uv = cl->upvals[i]; - if (uv) - luaC_upvdeccount(L, uv); - } - luaM_freemem(L, cl, sizeLclosure(cl->nupvalues)); -} - - -static void freeobj (lua_State *L, GCObject *o) { - switch (o->tt) { - case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break; - case LUA_TLCL: { - freeLclosure(L, gco2lcl(o)); - break; - } - case LUA_TCCL: { - luaM_freemem(L, o, sizeCclosure(gco2ccl(o)->nupvalues)); - break; - } - case LUA_TTABLE: luaH_free(L, gco2t(o)); break; - case LUA_TTHREAD: luaE_freethread(L, gco2th(o)); break; - case LUA_TUSERDATA: luaM_freemem(L, o, sizeudata(gco2u(o))); break; - case LUA_TSHRSTR: - luaS_remove(L, gco2ts(o)); /* remove it from hash table */ - luaM_freemem(L, o, sizelstring(gco2ts(o)->shrlen)); - break; - case LUA_TLNGSTR: { - luaM_freemem(L, o, sizelstring(gco2ts(o)->u.lnglen)); - break; - } - default: lua_assert(0); - } -} - - -#define sweepwholelist(L,p) sweeplist(L,p,MAX_LUMEM) -static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count); - - -/* -** sweep at most 'count' elements from a list of GCObjects erasing dead -** objects, where a dead object is one marked with the old (non current) -** white; change all non-dead objects back to white, preparing for next -** collection cycle. Return where to continue the traversal or NULL if -** list is finished. -*/ -static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) { - global_State *g = G(L); - int ow = otherwhite(g); - int white = luaC_white(g); /* current white */ - while (*p != NULL && count-- > 0) { - GCObject *curr = *p; - int marked = curr->marked; - if (isdeadm(ow, marked)) { /* is 'curr' dead? */ - *p = curr->next; /* remove 'curr' from list */ - freeobj(L, curr); /* erase 'curr' */ - } - else { /* change mark to 'white' */ - curr->marked = cast_byte((marked & maskcolors) | white); - p = &curr->next; /* go to next element */ - } - } - return (*p == NULL) ? NULL : p; -} - - -/* -** sweep a list until a live object (or end of list) -*/ -static GCObject **sweeptolive (lua_State *L, GCObject **p) { - GCObject **old = p; - do { - p = sweeplist(L, p, 1); - } while (p == old); - return p; -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Finalization -** ======================================================= -*/ - -/* -** If possible, shrink string table -*/ -static void checkSizes (lua_State *L, global_State *g) { - if (g->gckind != KGC_EMERGENCY) { - l_mem olddebt = g->GCdebt; - if (g->strt.nuse < g->strt.size / 4) /* string table too big? */ - luaS_resize(L, g->strt.size / 2); /* shrink it a little */ - g->GCestimate += g->GCdebt - olddebt; /* update estimate */ - } -} - - -static GCObject *udata2finalize (global_State *g) { - GCObject *o = g->tobefnz; /* get first element */ - lua_assert(tofinalize(o)); - g->tobefnz = o->next; /* remove it from 'tobefnz' list */ - o->next = g->allgc; /* return it to 'allgc' list */ - g->allgc = o; - resetbit(o->marked, FINALIZEDBIT); /* object is "normal" again */ - if (issweepphase(g)) - makewhite(g, o); /* "sweep" object */ - return o; -} - - -static void dothecall (lua_State *L, void *ud) { - UNUSED(ud); - luaD_callnoyield(L, L->top - 2, 0); -} - - -static void GCTM (lua_State *L, int propagateerrors) { - global_State *g = G(L); - const TValue *tm; - TValue v; - setgcovalue(L, &v, udata2finalize(g)); - tm = luaT_gettmbyobj(L, &v, TM_GC); - if (tm != NULL && ttisfunction(tm)) { /* is there a finalizer? */ - int status; - lu_byte oldah = L->allowhook; - int running = g->gcrunning; - L->allowhook = 0; /* stop debug hooks during GC metamethod */ - g->gcrunning = 0; /* avoid GC steps */ - setobj2s(L, L->top, tm); /* push finalizer... */ - setobj2s(L, L->top + 1, &v); /* ... and its argument */ - L->top += 2; /* and (next line) call the finalizer */ - L->ci->callstatus |= CIST_FIN; /* will run a finalizer */ - status = luaD_pcall(L, dothecall, NULL, savestack(L, L->top - 2), 0); - L->ci->callstatus &= ~CIST_FIN; /* not running a finalizer anymore */ - L->allowhook = oldah; /* restore hooks */ - g->gcrunning = running; /* restore state */ - if (status != LUA_OK && propagateerrors) { /* error while running __gc? */ - if (status == LUA_ERRRUN) { /* is there an error object? */ - const char *msg = (ttisstring(L->top - 1)) - ? svalue(L->top - 1) - : "no message"; - luaO_pushfstring(L, "error in __gc metamethod (%s)", msg); - status = LUA_ERRGCMM; /* error in __gc metamethod */ - } - luaD_throw(L, status); /* re-throw error */ - } - } -} - - -/* -** call a few (up to 'g->gcfinnum') finalizers -*/ -static int runafewfinalizers (lua_State *L) { - global_State *g = G(L); - unsigned int i; - lua_assert(!g->tobefnz || g->gcfinnum > 0); - for (i = 0; g->tobefnz && i < g->gcfinnum; i++) - GCTM(L, 1); /* call one finalizer */ - g->gcfinnum = (!g->tobefnz) ? 0 /* nothing more to finalize? */ - : g->gcfinnum * 2; /* else call a few more next time */ - return i; -} - - -/* -** call all pending finalizers -*/ -static void callallpendingfinalizers (lua_State *L) { - global_State *g = G(L); - while (g->tobefnz) - GCTM(L, 0); -} - - -/* -** find last 'next' field in list 'p' list (to add elements in its end) -*/ -static GCObject **findlast (GCObject **p) { - while (*p != NULL) - p = &(*p)->next; - return p; -} - - -/* -** move all unreachable objects (or 'all' objects) that need -** finalization from list 'finobj' to list 'tobefnz' (to be finalized) -*/ -static void separatetobefnz (global_State *g, int all) { - GCObject *curr; - GCObject **p = &g->finobj; - GCObject **lastnext = findlast(&g->tobefnz); - while ((curr = *p) != NULL) { /* traverse all finalizable objects */ - lua_assert(tofinalize(curr)); - if (!(iswhite(curr) || all)) /* not being collected? */ - p = &curr->next; /* don't bother with it */ - else { - *p = curr->next; /* remove 'curr' from 'finobj' list */ - curr->next = *lastnext; /* link at the end of 'tobefnz' list */ - *lastnext = curr; - lastnext = &curr->next; - } - } -} - - -/* -** if object 'o' has a finalizer, remove it from 'allgc' list (must -** search the list to find it) and link it in 'finobj' list. -*/ -void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) { - global_State *g = G(L); - if (tofinalize(o) || /* obj. is already marked... */ - gfasttm(g, mt, TM_GC) == NULL) /* or has no finalizer? */ - return; /* nothing to be done */ - else { /* move 'o' to 'finobj' list */ - GCObject **p; - if (issweepphase(g)) { - makewhite(g, o); /* "sweep" object 'o' */ - if (g->sweepgc == &o->next) /* should not remove 'sweepgc' object */ - g->sweepgc = sweeptolive(L, g->sweepgc); /* change 'sweepgc' */ - } - /* search for pointer pointing to 'o' */ - for (p = &g->allgc; *p != o; p = &(*p)->next) { /* empty */ } - *p = o->next; /* remove 'o' from 'allgc' list */ - o->next = g->finobj; /* link it in 'finobj' list */ - g->finobj = o; - l_setbit(o->marked, FINALIZEDBIT); /* mark it as such */ - } -} - -/* }====================================================== */ - - - -/* -** {====================================================== -** GC control -** ======================================================= -*/ - - -/* -** Set a reasonable "time" to wait before starting a new GC cycle; cycle -** will start when memory use hits threshold. (Division by 'estimate' -** should be OK: it cannot be zero (because Lua cannot even start with -** less than PAUSEADJ bytes). -*/ -static void setpause (global_State *g) { - l_mem threshold, debt; - l_mem estimate = g->GCestimate / PAUSEADJ; /* adjust 'estimate' */ - lua_assert(estimate > 0); - threshold = (g->gcpause < MAX_LMEM / estimate) /* overflow? */ - ? estimate * g->gcpause /* no overflow */ - : MAX_LMEM; /* overflow; truncate to maximum */ - debt = gettotalbytes(g) - threshold; - luaE_setdebt(g, debt); -} - - -/* -** Enter first sweep phase. -** The call to 'sweeplist' tries to make pointer point to an object -** inside the list (instead of to the header), so that the real sweep do -** not need to skip objects created between "now" and the start of the -** real sweep. -*/ -static void entersweep (lua_State *L) { - global_State *g = G(L); - g->gcstate = GCSswpallgc; - lua_assert(g->sweepgc == NULL); - g->sweepgc = sweeplist(L, &g->allgc, 1); -} - - -void luaC_freeallobjects (lua_State *L) { - global_State *g = G(L); - separatetobefnz(g, 1); /* separate all objects with finalizers */ - lua_assert(g->finobj == NULL); - callallpendingfinalizers(L); - lua_assert(g->tobefnz == NULL); - g->currentwhite = WHITEBITS; /* this "white" makes all objects look dead */ - g->gckind = KGC_NORMAL; - sweepwholelist(L, &g->finobj); - sweepwholelist(L, &g->allgc); - sweepwholelist(L, &g->fixedgc); /* collect fixed objects */ - lua_assert(g->strt.nuse == 0); -} - - -static l_mem atomic (lua_State *L) { - global_State *g = G(L); - l_mem work; - GCObject *origweak, *origall; - GCObject *grayagain = g->grayagain; /* save original list */ - lua_assert(g->ephemeron == NULL && g->weak == NULL); - lua_assert(!iswhite(g->mainthread)); - g->gcstate = GCSinsideatomic; - g->GCmemtrav = 0; /* start counting work */ - markobject(g, L); /* mark running thread */ - /* registry and global metatables may be changed by API */ - markvalue(g, &g->l_registry); - markmt(g); /* mark global metatables */ - /* remark occasional upvalues of (maybe) dead threads */ - remarkupvals(g); - propagateall(g); /* propagate changes */ - work = g->GCmemtrav; /* stop counting (do not recount 'grayagain') */ - g->gray = grayagain; - propagateall(g); /* traverse 'grayagain' list */ - g->GCmemtrav = 0; /* restart counting */ - convergeephemerons(g); - /* at this point, all strongly accessible objects are marked. */ - /* Clear values from weak tables, before checking finalizers */ - clearvalues(g, g->weak, NULL); - clearvalues(g, g->allweak, NULL); - origweak = g->weak; origall = g->allweak; - work += g->GCmemtrav; /* stop counting (objects being finalized) */ - separatetobefnz(g, 0); /* separate objects to be finalized */ - g->gcfinnum = 1; /* there may be objects to be finalized */ - markbeingfnz(g); /* mark objects that will be finalized */ - propagateall(g); /* remark, to propagate 'resurrection' */ - g->GCmemtrav = 0; /* restart counting */ - convergeephemerons(g); - /* at this point, all resurrected objects are marked. */ - /* remove dead objects from weak tables */ - clearkeys(g, g->ephemeron, NULL); /* clear keys from all ephemeron tables */ - clearkeys(g, g->allweak, NULL); /* clear keys from all 'allweak' tables */ - /* clear values from resurrected weak tables */ - clearvalues(g, g->weak, origweak); - clearvalues(g, g->allweak, origall); - luaS_clearcache(g); - g->currentwhite = cast_byte(otherwhite(g)); /* flip current white */ - work += g->GCmemtrav; /* complete counting */ - return work; /* estimate of memory marked by 'atomic' */ -} - - -static lu_mem sweepstep (lua_State *L, global_State *g, - int nextstate, GCObject **nextlist) { - if (g->sweepgc) { - l_mem olddebt = g->GCdebt; - g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX); - g->GCestimate += g->GCdebt - olddebt; /* update estimate */ - if (g->sweepgc) /* is there still something to sweep? */ - return (GCSWEEPMAX * GCSWEEPCOST); - } - /* else enter next state */ - g->gcstate = nextstate; - g->sweepgc = nextlist; - return 0; -} - - -static lu_mem singlestep (lua_State *L) { - global_State *g = G(L); - switch (g->gcstate) { - case GCSpause: { - g->GCmemtrav = g->strt.size * sizeof(GCObject*); - restartcollection(g); - g->gcstate = GCSpropagate; - return g->GCmemtrav; - } - case GCSpropagate: { - g->GCmemtrav = 0; - lua_assert(g->gray); - propagatemark(g); - if (g->gray == NULL) /* no more gray objects? */ - g->gcstate = GCSatomic; /* finish propagate phase */ - return g->GCmemtrav; /* memory traversed in this step */ - } - case GCSatomic: { - lu_mem work; - propagateall(g); /* make sure gray list is empty */ - work = atomic(L); /* work is what was traversed by 'atomic' */ - entersweep(L); - g->GCestimate = gettotalbytes(g); /* first estimate */; - return work; - } - case GCSswpallgc: { /* sweep "regular" objects */ - return sweepstep(L, g, GCSswpfinobj, &g->finobj); - } - case GCSswpfinobj: { /* sweep objects with finalizers */ - return sweepstep(L, g, GCSswptobefnz, &g->tobefnz); - } - case GCSswptobefnz: { /* sweep objects to be finalized */ - return sweepstep(L, g, GCSswpend, NULL); - } - case GCSswpend: { /* finish sweeps */ - makewhite(g, g->mainthread); /* sweep main thread */ - checkSizes(L, g); - g->gcstate = GCScallfin; - return 0; - } - case GCScallfin: { /* call remaining finalizers */ - if (g->tobefnz && g->gckind != KGC_EMERGENCY) { - int n = runafewfinalizers(L); - return (n * GCFINALIZECOST); - } - else { /* emergency mode or no more finalizers */ - g->gcstate = GCSpause; /* finish collection */ - return 0; - } - } - default: lua_assert(0); return 0; - } -} - - -/* -** advances the garbage collector until it reaches a state allowed -** by 'statemask' -*/ -void luaC_runtilstate (lua_State *L, int statesmask) { - global_State *g = G(L); - while (!testbit(statesmask, g->gcstate)) - singlestep(L); -} - - -/* -** get GC debt and convert it from Kb to 'work units' (avoid zero debt -** and overflows) -*/ -static l_mem getdebt (global_State *g) { - l_mem debt = g->GCdebt; - int stepmul = g->gcstepmul; - if (debt <= 0) return 0; /* minimal debt */ - else { - debt = (debt / STEPMULADJ) + 1; - debt = (debt < MAX_LMEM / stepmul) ? debt * stepmul : MAX_LMEM; - return debt; - } -} - -/* -** performs a basic GC step when collector is running -*/ -void luaC_step (lua_State *L) { - global_State *g = G(L); - l_mem debt = getdebt(g); /* GC deficit (be paid now) */ - if (!g->gcrunning) { /* not running? */ - luaE_setdebt(g, -GCSTEPSIZE * 10); /* avoid being called too often */ - return; - } - do { /* repeat until pause or enough "credit" (negative debt) */ - lu_mem work = singlestep(L); /* perform one single step */ - debt -= work; - } while (debt > -GCSTEPSIZE && g->gcstate != GCSpause); - if (g->gcstate == GCSpause) - setpause(g); /* pause until next cycle */ - else { - debt = (debt / g->gcstepmul) * STEPMULADJ; /* convert 'work units' to Kb */ - luaE_setdebt(g, debt); - runafewfinalizers(L); - } -} - - -/* -** Performs a full GC cycle; if 'isemergency', set a flag to avoid -** some operations which could change the interpreter state in some -** unexpected ways (running finalizers and shrinking some structures). -** Before running the collection, check 'keepinvariant'; if it is true, -** there may be some objects marked as black, so the collector has -** to sweep all objects to turn them back to white (as white has not -** changed, nothing will be collected). -*/ -void luaC_fullgc (lua_State *L, int isemergency) { - global_State *g = G(L); - lua_assert(g->gckind == KGC_NORMAL); - if (isemergency) g->gckind = KGC_EMERGENCY; /* set flag */ - if (keepinvariant(g)) { /* black objects? */ - entersweep(L); /* sweep everything to turn them back to white */ - } - /* finish any pending sweep phase to start a new cycle */ - luaC_runtilstate(L, bitmask(GCSpause)); - luaC_runtilstate(L, ~bitmask(GCSpause)); /* start new collection */ - luaC_runtilstate(L, bitmask(GCScallfin)); /* run up to finalizers */ - /* estimate must be correct after a full GC cycle */ - lua_assert(g->GCestimate == gettotalbytes(g)); - luaC_runtilstate(L, bitmask(GCSpause)); /* finish collection */ - g->gckind = KGC_NORMAL; - setpause(g); -} - -/* }====================================================== */ - - diff --git a/LuaSkin/lua-5.3.4/src/lgc.h b/LuaSkin/lua-5.3.4/src/lgc.h deleted file mode 100644 index aed3e18a5..000000000 --- a/LuaSkin/lua-5.3.4/src/lgc.h +++ /dev/null @@ -1,147 +0,0 @@ -/* -** $Id: lgc.h,v 2.91 2015/12/21 13:02:14 roberto Exp $ -** Garbage Collector -** See Copyright Notice in lua.h -*/ - -#ifndef lgc_h -#define lgc_h - - -#include "lobject.h" -#include "lstate.h" - -/* -** Collectable objects may have one of three colors: white, which -** means the object is not marked; gray, which means the -** object is marked, but its references may be not marked; and -** black, which means that the object and all its references are marked. -** The main invariant of the garbage collector, while marking objects, -** is that a black object can never point to a white one. Moreover, -** any gray object must be in a "gray list" (gray, grayagain, weak, -** allweak, ephemeron) so that it can be visited again before finishing -** the collection cycle. These lists have no meaning when the invariant -** is not being enforced (e.g., sweep phase). -*/ - - - -/* how much to allocate before next GC step */ -#if !defined(GCSTEPSIZE) -/* ~100 small strings */ -#define GCSTEPSIZE (cast_int(100 * sizeof(TString))) -#endif - - -/* -** Possible states of the Garbage Collector -*/ -#define GCSpropagate 0 -#define GCSatomic 1 -#define GCSswpallgc 2 -#define GCSswpfinobj 3 -#define GCSswptobefnz 4 -#define GCSswpend 5 -#define GCScallfin 6 -#define GCSpause 7 - - -#define issweepphase(g) \ - (GCSswpallgc <= (g)->gcstate && (g)->gcstate <= GCSswpend) - - -/* -** macro to tell when main invariant (white objects cannot point to black -** ones) must be kept. During a collection, the sweep -** phase may break the invariant, as objects turned white may point to -** still-black objects. The invariant is restored when sweep ends and -** all objects are white again. -*/ - -#define keepinvariant(g) ((g)->gcstate <= GCSatomic) - - -/* -** some useful bit tricks -*/ -#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) -#define setbits(x,m) ((x) |= (m)) -#define testbits(x,m) ((x) & (m)) -#define bitmask(b) (1<<(b)) -#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) -#define l_setbit(x,b) setbits(x, bitmask(b)) -#define resetbit(x,b) resetbits(x, bitmask(b)) -#define testbit(x,b) testbits(x, bitmask(b)) - - -/* Layout for bit use in 'marked' field: */ -#define WHITE0BIT 0 /* object is white (type 0) */ -#define WHITE1BIT 1 /* object is white (type 1) */ -#define BLACKBIT 2 /* object is black */ -#define FINALIZEDBIT 3 /* object has been marked for finalization */ -/* bit 7 is currently used by tests (luaL_checkmemory) */ - -#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) - - -#define iswhite(x) testbits((x)->marked, WHITEBITS) -#define isblack(x) testbit((x)->marked, BLACKBIT) -#define isgray(x) /* neither white nor black */ \ - (!testbits((x)->marked, WHITEBITS | bitmask(BLACKBIT))) - -#define tofinalize(x) testbit((x)->marked, FINALIZEDBIT) - -#define otherwhite(g) ((g)->currentwhite ^ WHITEBITS) -#define isdeadm(ow,m) (!(((m) ^ WHITEBITS) & (ow))) -#define isdead(g,v) isdeadm(otherwhite(g), (v)->marked) - -#define changewhite(x) ((x)->marked ^= WHITEBITS) -#define gray2black(x) l_setbit((x)->marked, BLACKBIT) - -#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) - - -/* -** Does one step of collection when debt becomes positive. 'pre'/'pos' -** allows some adjustments to be done only when needed. macro -** 'condchangemem' is used only for heavy tests (forcing a full -** GC cycle on every opportunity) -*/ -#define luaC_condGC(L,pre,pos) \ - { if (G(L)->GCdebt > 0) { pre; luaC_step(L); pos;}; \ - condchangemem(L,pre,pos); } - -/* more often than not, 'pre'/'pos' are empty */ -#define luaC_checkGC(L) luaC_condGC(L,(void)0,(void)0) - - -#define luaC_barrier(L,p,v) ( \ - (iscollectable(v) && isblack(p) && iswhite(gcvalue(v))) ? \ - luaC_barrier_(L,obj2gco(p),gcvalue(v)) : cast_void(0)) - -#define luaC_barrierback(L,p,v) ( \ - (iscollectable(v) && isblack(p) && iswhite(gcvalue(v))) ? \ - luaC_barrierback_(L,p) : cast_void(0)) - -#define luaC_objbarrier(L,p,o) ( \ - (isblack(p) && iswhite(o)) ? \ - luaC_barrier_(L,obj2gco(p),obj2gco(o)) : cast_void(0)) - -#define luaC_upvalbarrier(L,uv) ( \ - (iscollectable((uv)->v) && !upisopen(uv)) ? \ - luaC_upvalbarrier_(L,uv) : cast_void(0)) - -LUAI_FUNC void luaC_fix (lua_State *L, GCObject *o); -LUAI_FUNC void luaC_freeallobjects (lua_State *L); -LUAI_FUNC void luaC_step (lua_State *L); -LUAI_FUNC void luaC_runtilstate (lua_State *L, int statesmask); -LUAI_FUNC void luaC_fullgc (lua_State *L, int isemergency); -LUAI_FUNC GCObject *luaC_newobj (lua_State *L, int tt, size_t sz); -LUAI_FUNC void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v); -LUAI_FUNC void luaC_barrierback_ (lua_State *L, Table *o); -LUAI_FUNC void luaC_upvalbarrier_ (lua_State *L, UpVal *uv); -LUAI_FUNC void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt); -LUAI_FUNC void luaC_upvdeccount (lua_State *L, UpVal *uv); - - -#endif diff --git a/LuaSkin/lua-5.3.4/src/llimits.h b/LuaSkin/lua-5.3.4/src/llimits.h deleted file mode 100644 index f21377fef..000000000 --- a/LuaSkin/lua-5.3.4/src/llimits.h +++ /dev/null @@ -1,323 +0,0 @@ -/* -** $Id: llimits.h,v 1.141 2015/11/19 19:16:22 roberto Exp $ -** Limits, basic types, and some other 'installation-dependent' definitions -** See Copyright Notice in lua.h -*/ - -#ifndef llimits_h -#define llimits_h - - -#include -#include - - -#include "lua.h" - -/* -** 'lu_mem' and 'l_mem' are unsigned/signed integers big enough to count -** the total memory used by Lua (in bytes). Usually, 'size_t' and -** 'ptrdiff_t' should work, but we use 'long' for 16-bit machines. -*/ -#if defined(LUAI_MEM) /* { external definitions? */ -typedef LUAI_UMEM lu_mem; -typedef LUAI_MEM l_mem; -#elif LUAI_BITSINT >= 32 /* }{ */ -typedef size_t lu_mem; -typedef ptrdiff_t l_mem; -#else /* 16-bit ints */ /* }{ */ -typedef unsigned long lu_mem; -typedef long l_mem; -#endif /* } */ - - -/* chars used as small naturals (so that 'char' is reserved for characters) */ -typedef unsigned char lu_byte; - - -/* maximum value for size_t */ -#define MAX_SIZET ((size_t)(~(size_t)0)) - -/* maximum size visible for Lua (must be representable in a lua_Integer */ -#define MAX_SIZE (sizeof(size_t) < sizeof(lua_Integer) ? MAX_SIZET \ - : (size_t)(LUA_MAXINTEGER)) - - -#define MAX_LUMEM ((lu_mem)(~(lu_mem)0)) - -#define MAX_LMEM ((l_mem)(MAX_LUMEM >> 1)) - - -#define MAX_INT INT_MAX /* maximum value of an int */ - - -/* -** conversion of pointer to unsigned integer: -** this is for hashing only; there is no problem if the integer -** cannot hold the whole pointer value -*/ -#define point2uint(p) ((unsigned int)((size_t)(p) & UINT_MAX)) - - - -/* type to ensure maximum alignment */ -#if defined(LUAI_USER_ALIGNMENT_T) -typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; -#else -typedef union { - lua_Number n; - double u; - void *s; - lua_Integer i; - long l; -} L_Umaxalign; -#endif - - - -/* types of 'usual argument conversions' for lua_Number and lua_Integer */ -typedef LUAI_UACNUMBER l_uacNumber; -typedef LUAI_UACINT l_uacInt; - - -/* internal assertions for in-house debugging */ -#if defined(lua_assert) -#define check_exp(c,e) (lua_assert(c), (e)) -/* to avoid problems with conditions too long */ -#define lua_longassert(c) ((c) ? (void)0 : lua_assert(0)) -#else -#define lua_assert(c) ((void)0) -#define check_exp(c,e) (e) -#define lua_longassert(c) ((void)0) -#endif - -/* -** assertion for checking API calls -*/ -#if !defined(luai_apicheck) -#define luai_apicheck(l,e) lua_assert(e) -#endif - -#define api_check(l,e,msg) luai_apicheck(l,(e) && msg) - - -/* macro to avoid warnings about unused variables */ -#if !defined(UNUSED) -#define UNUSED(x) ((void)(x)) -#endif - - -/* type casts (a macro highlights casts in the code) */ -#define cast(t, exp) ((t)(exp)) - -#define cast_void(i) cast(void, (i)) -#define cast_byte(i) cast(lu_byte, (i)) -#define cast_num(i) cast(lua_Number, (i)) -#define cast_int(i) cast(int, (i)) -#define cast_uchar(i) cast(unsigned char, (i)) - - -/* cast a signed lua_Integer to lua_Unsigned */ -#if !defined(l_castS2U) -#define l_castS2U(i) ((lua_Unsigned)(i)) -#endif - -/* -** cast a lua_Unsigned to a signed lua_Integer; this cast is -** not strict ISO C, but two-complement architectures should -** work fine. -*/ -#if !defined(l_castU2S) -#define l_castU2S(i) ((lua_Integer)(i)) -#endif - - -/* -** non-return type -*/ -#if defined(__GNUC__) -#define l_noret void __attribute__((noreturn)) -#elif defined(_MSC_VER) && _MSC_VER >= 1200 -#define l_noret void __declspec(noreturn) -#else -#define l_noret void -#endif - - - -/* -** maximum depth for nested C calls and syntactical nested non-terminals -** in a program. (Value must fit in an unsigned short int.) -*/ -#if !defined(LUAI_MAXCCALLS) -#define LUAI_MAXCCALLS 200 -#endif - - - -/* -** type for virtual-machine instructions; -** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) -*/ -#if LUAI_BITSINT >= 32 -typedef unsigned int Instruction; -#else -typedef unsigned long Instruction; -#endif - - - -/* -** Maximum length for short strings, that is, strings that are -** internalized. (Cannot be smaller than reserved words or tags for -** metamethods, as these strings must be internalized; -** #("function") = 8, #("__newindex") = 10.) -*/ -#if !defined(LUAI_MAXSHORTLEN) -#define LUAI_MAXSHORTLEN 40 -#endif - - -/* -** Initial size for the string table (must be power of 2). -** The Lua core alone registers ~50 strings (reserved words + -** metaevent keys + a few others). Libraries would typically add -** a few dozens more. -*/ -#if !defined(MINSTRTABSIZE) -#define MINSTRTABSIZE 128 -#endif - - -/* -** Size of cache for strings in the API. 'N' is the number of -** sets (better be a prime) and "M" is the size of each set (M == 1 -** makes a direct cache.) -*/ -#if !defined(STRCACHE_N) -#define STRCACHE_N 53 -#define STRCACHE_M 2 -#endif - - -/* minimum size for string buffer */ -#if !defined(LUA_MINBUFFER) -#define LUA_MINBUFFER 32 -#endif - - -/* -** macros that are executed whenever program enters the Lua core -** ('lua_lock') and leaves the core ('lua_unlock') -*/ -#if !defined(lua_lock) -#define lua_lock(L) ((void) 0) -#define lua_unlock(L) ((void) 0) -#endif - -/* -** macro executed during Lua functions at points where the -** function can yield. -*/ -#if !defined(luai_threadyield) -#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} -#endif - - -/* -** these macros allow user-specific actions on threads when you defined -** LUAI_EXTRASPACE and need to do something extra when a thread is -** created/deleted/resumed/yielded. -*/ -#if !defined(luai_userstateopen) -#define luai_userstateopen(L) ((void)L) -#endif - -#if !defined(luai_userstateclose) -#define luai_userstateclose(L) ((void)L) -#endif - -#if !defined(luai_userstatethread) -#define luai_userstatethread(L,L1) ((void)L) -#endif - -#if !defined(luai_userstatefree) -#define luai_userstatefree(L,L1) ((void)L) -#endif - -#if !defined(luai_userstateresume) -#define luai_userstateresume(L,n) ((void)L) -#endif - -#if !defined(luai_userstateyield) -#define luai_userstateyield(L,n) ((void)L) -#endif - - - -/* -** The luai_num* macros define the primitive operations over numbers. -*/ - -/* floor division (defined as 'floor(a/b)') */ -#if !defined(luai_numidiv) -#define luai_numidiv(L,a,b) ((void)L, l_floor(luai_numdiv(L,a,b))) -#endif - -/* float division */ -#if !defined(luai_numdiv) -#define luai_numdiv(L,a,b) ((a)/(b)) -#endif - -/* -** modulo: defined as 'a - floor(a/b)*b'; this definition gives NaN when -** 'b' is huge, but the result should be 'a'. 'fmod' gives the result of -** 'a - trunc(a/b)*b', and therefore must be corrected when 'trunc(a/b) -** ~= floor(a/b)'. That happens when the division has a non-integer -** negative result, which is equivalent to the test below. -*/ -#if !defined(luai_nummod) -#define luai_nummod(L,a,b,m) \ - { (m) = l_mathop(fmod)(a,b); if ((m)*(b) < 0) (m) += (b); } -#endif - -/* exponentiation */ -#if !defined(luai_numpow) -#define luai_numpow(L,a,b) ((void)L, l_mathop(pow)(a,b)) -#endif - -/* the others are quite standard operations */ -#if !defined(luai_numadd) -#define luai_numadd(L,a,b) ((a)+(b)) -#define luai_numsub(L,a,b) ((a)-(b)) -#define luai_nummul(L,a,b) ((a)*(b)) -#define luai_numunm(L,a) (-(a)) -#define luai_numeq(a,b) ((a)==(b)) -#define luai_numlt(a,b) ((a)<(b)) -#define luai_numle(a,b) ((a)<=(b)) -#define luai_numisnan(a) (!luai_numeq((a), (a))) -#endif - - - - - -/* -** macro to control inclusion of some hard tests on stack reallocation -*/ -#if !defined(HARDSTACKTESTS) -#define condmovestack(L,pre,pos) ((void)0) -#else -/* realloc stack keeping its size */ -#define condmovestack(L,pre,pos) \ - { int sz_ = (L)->stacksize; pre; luaD_reallocstack((L), sz_); pos; } -#endif - -#if !defined(HARDMEMTESTS) -#define condchangemem(L,pre,pos) ((void)0) -#else -#define condchangemem(L,pre,pos) \ - { if (G(L)->gcrunning) { pre; luaC_fullgc(L, 0); pos; } } -#endif - -#endif diff --git a/LuaSkin/lua-5.3.4/src/lmathlib.c b/LuaSkin/lua-5.3.4/src/lmathlib.c deleted file mode 100644 index b7f8baee0..000000000 --- a/LuaSkin/lua-5.3.4/src/lmathlib.c +++ /dev/null @@ -1,410 +0,0 @@ -/* -** $Id: lmathlib.c,v 1.119 2016/12/22 13:08:50 roberto Exp $ -** Standard mathematical library -** See Copyright Notice in lua.h -*/ - -#define lmathlib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -#undef PI -#define PI (l_mathop(3.141592653589793238462643383279502884)) - - -#if !defined(l_rand) /* { */ -#if defined(LUA_USE_POSIX) -#define l_rand() random() -#define l_srand(x) srandom(x) -#define L_RANDMAX 2147483647 /* (2^31 - 1), following POSIX */ -#else -#define l_rand() rand() -#define l_srand(x) srand(x) -#define L_RANDMAX RAND_MAX -#endif -#endif /* } */ - - -static int math_abs (lua_State *L) { - if (lua_isinteger(L, 1)) { - lua_Integer n = lua_tointeger(L, 1); - if (n < 0) n = (lua_Integer)(0u - (lua_Unsigned)n); - lua_pushinteger(L, n); - } - else - lua_pushnumber(L, l_mathop(fabs)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_sin (lua_State *L) { - lua_pushnumber(L, l_mathop(sin)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_cos (lua_State *L) { - lua_pushnumber(L, l_mathop(cos)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_tan (lua_State *L) { - lua_pushnumber(L, l_mathop(tan)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_asin (lua_State *L) { - lua_pushnumber(L, l_mathop(asin)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_acos (lua_State *L) { - lua_pushnumber(L, l_mathop(acos)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_atan (lua_State *L) { - lua_Number y = luaL_checknumber(L, 1); - lua_Number x = luaL_optnumber(L, 2, 1); - lua_pushnumber(L, l_mathop(atan2)(y, x)); - return 1; -} - - -static int math_toint (lua_State *L) { - int valid; - lua_Integer n = lua_tointegerx(L, 1, &valid); - if (valid) - lua_pushinteger(L, n); - else { - luaL_checkany(L, 1); - lua_pushnil(L); /* value is not convertible to integer */ - } - return 1; -} - - -static void pushnumint (lua_State *L, lua_Number d) { - lua_Integer n; - if (lua_numbertointeger(d, &n)) /* does 'd' fit in an integer? */ - lua_pushinteger(L, n); /* result is integer */ - else - lua_pushnumber(L, d); /* result is float */ -} - - -static int math_floor (lua_State *L) { - if (lua_isinteger(L, 1)) - lua_settop(L, 1); /* integer is its own floor */ - else { - lua_Number d = l_mathop(floor)(luaL_checknumber(L, 1)); - pushnumint(L, d); - } - return 1; -} - - -static int math_ceil (lua_State *L) { - if (lua_isinteger(L, 1)) - lua_settop(L, 1); /* integer is its own ceil */ - else { - lua_Number d = l_mathop(ceil)(luaL_checknumber(L, 1)); - pushnumint(L, d); - } - return 1; -} - - -static int math_fmod (lua_State *L) { - if (lua_isinteger(L, 1) && lua_isinteger(L, 2)) { - lua_Integer d = lua_tointeger(L, 2); - if ((lua_Unsigned)d + 1u <= 1u) { /* special cases: -1 or 0 */ - luaL_argcheck(L, d != 0, 2, "zero"); - lua_pushinteger(L, 0); /* avoid overflow with 0x80000... / -1 */ - } - else - lua_pushinteger(L, lua_tointeger(L, 1) % d); - } - else - lua_pushnumber(L, l_mathop(fmod)(luaL_checknumber(L, 1), - luaL_checknumber(L, 2))); - return 1; -} - - -/* -** next function does not use 'modf', avoiding problems with 'double*' -** (which is not compatible with 'float*') when lua_Number is not -** 'double'. -*/ -static int math_modf (lua_State *L) { - if (lua_isinteger(L ,1)) { - lua_settop(L, 1); /* number is its own integer part */ - lua_pushnumber(L, 0); /* no fractional part */ - } - else { - lua_Number n = luaL_checknumber(L, 1); - /* integer part (rounds toward zero) */ - lua_Number ip = (n < 0) ? l_mathop(ceil)(n) : l_mathop(floor)(n); - pushnumint(L, ip); - /* fractional part (test needed for inf/-inf) */ - lua_pushnumber(L, (n == ip) ? l_mathop(0.0) : (n - ip)); - } - return 2; -} - - -static int math_sqrt (lua_State *L) { - lua_pushnumber(L, l_mathop(sqrt)(luaL_checknumber(L, 1))); - return 1; -} - - -static int math_ult (lua_State *L) { - lua_Integer a = luaL_checkinteger(L, 1); - lua_Integer b = luaL_checkinteger(L, 2); - lua_pushboolean(L, (lua_Unsigned)a < (lua_Unsigned)b); - return 1; -} - -static int math_log (lua_State *L) { - lua_Number x = luaL_checknumber(L, 1); - lua_Number res; - if (lua_isnoneornil(L, 2)) - res = l_mathop(log)(x); - else { - lua_Number base = luaL_checknumber(L, 2); -#if !defined(LUA_USE_C89) - if (base == l_mathop(2.0)) - res = l_mathop(log2)(x); else -#endif - if (base == l_mathop(10.0)) - res = l_mathop(log10)(x); - else - res = l_mathop(log)(x)/l_mathop(log)(base); - } - lua_pushnumber(L, res); - return 1; -} - -static int math_exp (lua_State *L) { - lua_pushnumber(L, l_mathop(exp)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_deg (lua_State *L) { - lua_pushnumber(L, luaL_checknumber(L, 1) * (l_mathop(180.0) / PI)); - return 1; -} - -static int math_rad (lua_State *L) { - lua_pushnumber(L, luaL_checknumber(L, 1) * (PI / l_mathop(180.0))); - return 1; -} - - -static int math_min (lua_State *L) { - int n = lua_gettop(L); /* number of arguments */ - int imin = 1; /* index of current minimum value */ - int i; - luaL_argcheck(L, n >= 1, 1, "value expected"); - for (i = 2; i <= n; i++) { - if (lua_compare(L, i, imin, LUA_OPLT)) - imin = i; - } - lua_pushvalue(L, imin); - return 1; -} - - -static int math_max (lua_State *L) { - int n = lua_gettop(L); /* number of arguments */ - int imax = 1; /* index of current maximum value */ - int i; - luaL_argcheck(L, n >= 1, 1, "value expected"); - for (i = 2; i <= n; i++) { - if (lua_compare(L, imax, i, LUA_OPLT)) - imax = i; - } - lua_pushvalue(L, imax); - return 1; -} - -/* -** This function uses 'double' (instead of 'lua_Number') to ensure that -** all bits from 'l_rand' can be represented, and that 'RANDMAX + 1.0' -** will keep full precision (ensuring that 'r' is always less than 1.0.) -*/ -static int math_random (lua_State *L) { - lua_Integer low, up; - double r = (double)l_rand() * (1.0 / ((double)L_RANDMAX + 1.0)); - switch (lua_gettop(L)) { /* check number of arguments */ - case 0: { /* no arguments */ - lua_pushnumber(L, (lua_Number)r); /* Number between 0 and 1 */ - return 1; - } - case 1: { /* only upper limit */ - low = 1; - up = luaL_checkinteger(L, 1); - break; - } - case 2: { /* lower and upper limits */ - low = luaL_checkinteger(L, 1); - up = luaL_checkinteger(L, 2); - break; - } - default: return luaL_error(L, "wrong number of arguments"); - } - /* random integer in the interval [low, up] */ - luaL_argcheck(L, low <= up, 1, "interval is empty"); - luaL_argcheck(L, low >= 0 || up <= LUA_MAXINTEGER + low, 1, - "interval too large"); - r *= (double)(up - low) + 1.0; - lua_pushinteger(L, (lua_Integer)r + low); - return 1; -} - - -static int math_randomseed (lua_State *L) { - l_srand((unsigned int)(lua_Integer)luaL_checknumber(L, 1)); - (void)l_rand(); /* discard first value to avoid undesirable correlations */ - return 0; -} - - -static int math_type (lua_State *L) { - if (lua_type(L, 1) == LUA_TNUMBER) { - if (lua_isinteger(L, 1)) - lua_pushliteral(L, "integer"); - else - lua_pushliteral(L, "float"); - } - else { - luaL_checkany(L, 1); - lua_pushnil(L); - } - return 1; -} - - -/* -** {================================================================== -** Deprecated functions (for compatibility only) -** =================================================================== -*/ -#if defined(LUA_COMPAT_MATHLIB) - -static int math_cosh (lua_State *L) { - lua_pushnumber(L, l_mathop(cosh)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_sinh (lua_State *L) { - lua_pushnumber(L, l_mathop(sinh)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_tanh (lua_State *L) { - lua_pushnumber(L, l_mathop(tanh)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_pow (lua_State *L) { - lua_Number x = luaL_checknumber(L, 1); - lua_Number y = luaL_checknumber(L, 2); - lua_pushnumber(L, l_mathop(pow)(x, y)); - return 1; -} - -static int math_frexp (lua_State *L) { - int e; - lua_pushnumber(L, l_mathop(frexp)(luaL_checknumber(L, 1), &e)); - lua_pushinteger(L, e); - return 2; -} - -static int math_ldexp (lua_State *L) { - lua_Number x = luaL_checknumber(L, 1); - int ep = (int)luaL_checkinteger(L, 2); - lua_pushnumber(L, l_mathop(ldexp)(x, ep)); - return 1; -} - -static int math_log10 (lua_State *L) { - lua_pushnumber(L, l_mathop(log10)(luaL_checknumber(L, 1))); - return 1; -} - -#endif -/* }================================================================== */ - - - -static const luaL_Reg mathlib[] = { - {"abs", math_abs}, - {"acos", math_acos}, - {"asin", math_asin}, - {"atan", math_atan}, - {"ceil", math_ceil}, - {"cos", math_cos}, - {"deg", math_deg}, - {"exp", math_exp}, - {"tointeger", math_toint}, - {"floor", math_floor}, - {"fmod", math_fmod}, - {"ult", math_ult}, - {"log", math_log}, - {"max", math_max}, - {"min", math_min}, - {"modf", math_modf}, - {"rad", math_rad}, - {"random", math_random}, - {"randomseed", math_randomseed}, - {"sin", math_sin}, - {"sqrt", math_sqrt}, - {"tan", math_tan}, - {"type", math_type}, -#if defined(LUA_COMPAT_MATHLIB) - {"atan2", math_atan}, - {"cosh", math_cosh}, - {"sinh", math_sinh}, - {"tanh", math_tanh}, - {"pow", math_pow}, - {"frexp", math_frexp}, - {"ldexp", math_ldexp}, - {"log10", math_log10}, -#endif - /* placeholders */ - {"pi", NULL}, - {"huge", NULL}, - {"maxinteger", NULL}, - {"mininteger", NULL}, - {NULL, NULL} -}; - - -/* -** Open math library -*/ -LUAMOD_API int luaopen_math (lua_State *L) { - luaL_newlib(L, mathlib); - lua_pushnumber(L, PI); - lua_setfield(L, -2, "pi"); - lua_pushnumber(L, (lua_Number)HUGE_VAL); - lua_setfield(L, -2, "huge"); - lua_pushinteger(L, LUA_MAXINTEGER); - lua_setfield(L, -2, "maxinteger"); - lua_pushinteger(L, LUA_MININTEGER); - lua_setfield(L, -2, "mininteger"); - return 1; -} - diff --git a/LuaSkin/lua-5.3.4/src/lmem.c b/LuaSkin/lua-5.3.4/src/lmem.c deleted file mode 100644 index 0a0476cc7..000000000 --- a/LuaSkin/lua-5.3.4/src/lmem.c +++ /dev/null @@ -1,100 +0,0 @@ -/* -** $Id: lmem.c,v 1.91 2015/03/06 19:45:54 roberto Exp $ -** Interface to Memory Manager -** See Copyright Notice in lua.h -*/ - -#define lmem_c -#define LUA_CORE - -#include "lprefix.h" - - -#include - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" - - - -/* -** About the realloc function: -** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize); -** ('osize' is the old size, 'nsize' is the new size) -** -** * frealloc(ud, NULL, x, s) creates a new block of size 's' (no -** matter 'x'). -** -** * frealloc(ud, p, x, 0) frees the block 'p' -** (in this specific case, frealloc must return NULL); -** particularly, frealloc(ud, NULL, 0, 0) does nothing -** (which is equivalent to free(NULL) in ISO C) -** -** frealloc returns NULL if it cannot create or reallocate the area -** (any reallocation to an equal or smaller size cannot fail!) -*/ - - - -#define MINSIZEARRAY 4 - - -void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems, - int limit, const char *what) { - void *newblock; - int newsize; - if (*size >= limit/2) { /* cannot double it? */ - if (*size >= limit) /* cannot grow even a little? */ - luaG_runerror(L, "too many %s (limit is %d)", what, limit); - newsize = limit; /* still have at least one free place */ - } - else { - newsize = (*size)*2; - if (newsize < MINSIZEARRAY) - newsize = MINSIZEARRAY; /* minimum size */ - } - newblock = luaM_reallocv(L, block, *size, newsize, size_elems); - *size = newsize; /* update only when everything else is OK */ - return newblock; -} - - -l_noret luaM_toobig (lua_State *L) { - luaG_runerror(L, "memory allocation error: block too big"); -} - - - -/* -** generic allocation routine. -*/ -void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { - void *newblock; - global_State *g = G(L); - size_t realosize = (block) ? osize : 0; - lua_assert((realosize == 0) == (block == NULL)); -#if defined(HARDMEMTESTS) - if (nsize > realosize && g->gcrunning) - luaC_fullgc(L, 1); /* force a GC whenever possible */ -#endif - newblock = (*g->frealloc)(g->ud, block, osize, nsize); - if (newblock == NULL && nsize > 0) { - lua_assert(nsize > realosize); /* cannot fail when shrinking a block */ - if (g->version) { /* is state fully built? */ - luaC_fullgc(L, 1); /* try to free some memory... */ - newblock = (*g->frealloc)(g->ud, block, osize, nsize); /* try again */ - } - if (newblock == NULL) - luaD_throw(L, LUA_ERRMEM); - } - lua_assert((nsize == 0) == (newblock == NULL)); - g->GCdebt = (g->GCdebt + nsize) - realosize; - return newblock; -} - diff --git a/LuaSkin/lua-5.3.4/src/lmem.h b/LuaSkin/lua-5.3.4/src/lmem.h deleted file mode 100644 index 30f484895..000000000 --- a/LuaSkin/lua-5.3.4/src/lmem.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -** $Id: lmem.h,v 1.43 2014/12/19 17:26:14 roberto Exp $ -** Interface to Memory Manager -** See Copyright Notice in lua.h -*/ - -#ifndef lmem_h -#define lmem_h - - -#include - -#include "llimits.h" -#include "lua.h" - - -/* -** This macro reallocs a vector 'b' from 'on' to 'n' elements, where -** each element has size 'e'. In case of arithmetic overflow of the -** product 'n'*'e', it raises an error (calling 'luaM_toobig'). Because -** 'e' is always constant, it avoids the runtime division MAX_SIZET/(e). -** -** (The macro is somewhat complex to avoid warnings: The 'sizeof' -** comparison avoids a runtime comparison when overflow cannot occur. -** The compiler should be able to optimize the real test by itself, but -** when it does it, it may give a warning about "comparison is always -** false due to limited range of data type"; the +1 tricks the compiler, -** avoiding this warning but also this optimization.) -*/ -#define luaM_reallocv(L,b,on,n,e) \ - (((sizeof(n) >= sizeof(size_t) && cast(size_t, (n)) + 1 > MAX_SIZET/(e)) \ - ? luaM_toobig(L) : cast_void(0)) , \ - luaM_realloc_(L, (b), (on)*(e), (n)*(e))) - -/* -** Arrays of chars do not need any test -*/ -#define luaM_reallocvchar(L,b,on,n) \ - cast(char *, luaM_realloc_(L, (b), (on)*sizeof(char), (n)*sizeof(char))) - -#define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) -#define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) -#define luaM_freearray(L, b, n) luaM_realloc_(L, (b), (n)*sizeof(*(b)), 0) - -#define luaM_malloc(L,s) luaM_realloc_(L, NULL, 0, (s)) -#define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) -#define luaM_newvector(L,n,t) \ - cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) - -#define luaM_newobject(L,tag,s) luaM_realloc_(L, NULL, tag, (s)) - -#define luaM_growvector(L,v,nelems,size,t,limit,e) \ - if ((nelems)+1 > (size)) \ - ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) - -#define luaM_reallocvector(L, v,oldn,n,t) \ - ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) - -LUAI_FUNC l_noret luaM_toobig (lua_State *L); - -/* not to be called directly */ -LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, - size_t size); -LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, - size_t size_elem, int limit, - const char *what); - -#endif - diff --git a/LuaSkin/lua-5.3.4/src/lobject.c b/LuaSkin/lua-5.3.4/src/lobject.c deleted file mode 100644 index 2da76899a..000000000 --- a/LuaSkin/lua-5.3.4/src/lobject.c +++ /dev/null @@ -1,521 +0,0 @@ -/* -** $Id: lobject.c,v 2.113 2016/12/22 13:08:50 roberto Exp $ -** Some generic functions over Lua objects -** See Copyright Notice in lua.h -*/ - -#define lobject_c -#define LUA_CORE - -#include "lprefix.h" - - -#include -#include -#include -#include -#include -#include - -#include "lua.h" - -#include "lctype.h" -#include "ldebug.h" -#include "ldo.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" -#include "lvm.h" - - - -LUAI_DDEF const TValue luaO_nilobject_ = {NILCONSTANT}; - - -/* -** converts an integer to a "floating point byte", represented as -** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if -** eeeee != 0 and (xxx) otherwise. -*/ -int luaO_int2fb (unsigned int x) { - int e = 0; /* exponent */ - if (x < 8) return x; - while (x >= (8 << 4)) { /* coarse steps */ - x = (x + 0xf) >> 4; /* x = ceil(x / 16) */ - e += 4; - } - while (x >= (8 << 1)) { /* fine steps */ - x = (x + 1) >> 1; /* x = ceil(x / 2) */ - e++; - } - return ((e+1) << 3) | (cast_int(x) - 8); -} - - -/* converts back */ -int luaO_fb2int (int x) { - return (x < 8) ? x : ((x & 7) + 8) << ((x >> 3) - 1); -} - - -/* -** Computes ceil(log2(x)) -*/ -int luaO_ceillog2 (unsigned int x) { - static const lu_byte log_2[256] = { /* log_2[i] = ceil(log2(i - 1)) */ - 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 - }; - int l = 0; - x--; - while (x >= 256) { l += 8; x >>= 8; } - return l + log_2[x]; -} - - -static lua_Integer intarith (lua_State *L, int op, lua_Integer v1, - lua_Integer v2) { - switch (op) { - case LUA_OPADD: return intop(+, v1, v2); - case LUA_OPSUB:return intop(-, v1, v2); - case LUA_OPMUL:return intop(*, v1, v2); - case LUA_OPMOD: return luaV_mod(L, v1, v2); - case LUA_OPIDIV: return luaV_div(L, v1, v2); - case LUA_OPBAND: return intop(&, v1, v2); - case LUA_OPBOR: return intop(|, v1, v2); - case LUA_OPBXOR: return intop(^, v1, v2); - case LUA_OPSHL: return luaV_shiftl(v1, v2); - case LUA_OPSHR: return luaV_shiftl(v1, -v2); - case LUA_OPUNM: return intop(-, 0, v1); - case LUA_OPBNOT: return intop(^, ~l_castS2U(0), v1); - default: lua_assert(0); return 0; - } -} - - -static lua_Number numarith (lua_State *L, int op, lua_Number v1, - lua_Number v2) { - switch (op) { - case LUA_OPADD: return luai_numadd(L, v1, v2); - case LUA_OPSUB: return luai_numsub(L, v1, v2); - case LUA_OPMUL: return luai_nummul(L, v1, v2); - case LUA_OPDIV: return luai_numdiv(L, v1, v2); - case LUA_OPPOW: return luai_numpow(L, v1, v2); - case LUA_OPIDIV: return luai_numidiv(L, v1, v2); - case LUA_OPUNM: return luai_numunm(L, v1); - case LUA_OPMOD: { - lua_Number m; - luai_nummod(L, v1, v2, m); - return m; - } - default: lua_assert(0); return 0; - } -} - - -void luaO_arith (lua_State *L, int op, const TValue *p1, const TValue *p2, - TValue *res) { - switch (op) { - case LUA_OPBAND: case LUA_OPBOR: case LUA_OPBXOR: - case LUA_OPSHL: case LUA_OPSHR: - case LUA_OPBNOT: { /* operate only on integers */ - lua_Integer i1; lua_Integer i2; - if (tointeger(p1, &i1) && tointeger(p2, &i2)) { - setivalue(res, intarith(L, op, i1, i2)); - return; - } - else break; /* go to the end */ - } - case LUA_OPDIV: case LUA_OPPOW: { /* operate only on floats */ - lua_Number n1; lua_Number n2; - if (tonumber(p1, &n1) && tonumber(p2, &n2)) { - setfltvalue(res, numarith(L, op, n1, n2)); - return; - } - else break; /* go to the end */ - } - default: { /* other operations */ - lua_Number n1; lua_Number n2; - if (ttisinteger(p1) && ttisinteger(p2)) { - setivalue(res, intarith(L, op, ivalue(p1), ivalue(p2))); - return; - } - else if (tonumber(p1, &n1) && tonumber(p2, &n2)) { - setfltvalue(res, numarith(L, op, n1, n2)); - return; - } - else break; /* go to the end */ - } - } - /* could not perform raw operation; try metamethod */ - lua_assert(L != NULL); /* should not fail when folding (compile time) */ - luaT_trybinTM(L, p1, p2, res, cast(TMS, (op - LUA_OPADD) + TM_ADD)); -} - - -int luaO_hexavalue (int c) { - if (lisdigit(c)) return c - '0'; - else return (ltolower(c) - 'a') + 10; -} - - -static int isneg (const char **s) { - if (**s == '-') { (*s)++; return 1; } - else if (**s == '+') (*s)++; - return 0; -} - - - -/* -** {================================================================== -** Lua's implementation for 'lua_strx2number' -** =================================================================== -*/ - -#if !defined(lua_strx2number) - -/* maximum number of significant digits to read (to avoid overflows - even with single floats) */ -#define MAXSIGDIG 30 - -/* -** convert an hexadecimal numeric string to a number, following -** C99 specification for 'strtod' -*/ -static lua_Number lua_strx2number (const char *s, char **endptr) { - int dot = lua_getlocaledecpoint(); - lua_Number r = 0.0; /* result (accumulator) */ - int sigdig = 0; /* number of significant digits */ - int nosigdig = 0; /* number of non-significant digits */ - int e = 0; /* exponent correction */ - int neg; /* 1 if number is negative */ - int hasdot = 0; /* true after seen a dot */ - *endptr = cast(char *, s); /* nothing is valid yet */ - while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */ - neg = isneg(&s); /* check signal */ - if (!(*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))) /* check '0x' */ - return 0.0; /* invalid format (no '0x') */ - for (s += 2; ; s++) { /* skip '0x' and read numeral */ - if (*s == dot) { - if (hasdot) break; /* second dot? stop loop */ - else hasdot = 1; - } - else if (lisxdigit(cast_uchar(*s))) { - if (sigdig == 0 && *s == '0') /* non-significant digit (zero)? */ - nosigdig++; - else if (++sigdig <= MAXSIGDIG) /* can read it without overflow? */ - r = (r * cast_num(16.0)) + luaO_hexavalue(*s); - else e++; /* too many digits; ignore, but still count for exponent */ - if (hasdot) e--; /* decimal digit? correct exponent */ - } - else break; /* neither a dot nor a digit */ - } - if (nosigdig + sigdig == 0) /* no digits? */ - return 0.0; /* invalid format */ - *endptr = cast(char *, s); /* valid up to here */ - e *= 4; /* each digit multiplies/divides value by 2^4 */ - if (*s == 'p' || *s == 'P') { /* exponent part? */ - int exp1 = 0; /* exponent value */ - int neg1; /* exponent signal */ - s++; /* skip 'p' */ - neg1 = isneg(&s); /* signal */ - if (!lisdigit(cast_uchar(*s))) - return 0.0; /* invalid; must have at least one digit */ - while (lisdigit(cast_uchar(*s))) /* read exponent */ - exp1 = exp1 * 10 + *(s++) - '0'; - if (neg1) exp1 = -exp1; - e += exp1; - *endptr = cast(char *, s); /* valid up to here */ - } - if (neg) r = -r; - return l_mathop(ldexp)(r, e); -} - -#endif -/* }====================================================== */ - - -/* maximum length of a numeral */ -#if !defined (L_MAXLENNUM) -#define L_MAXLENNUM 200 -#endif - -static const char *l_str2dloc (const char *s, lua_Number *result, int mode) { - char *endptr; - *result = (mode == 'x') ? lua_strx2number(s, &endptr) /* try to convert */ - : lua_str2number(s, &endptr); - if (endptr == s) return NULL; /* nothing recognized? */ - while (lisspace(cast_uchar(*endptr))) endptr++; /* skip trailing spaces */ - return (*endptr == '\0') ? endptr : NULL; /* OK if no trailing characters */ -} - - -/* -** Convert string 's' to a Lua number (put in 'result'). Return NULL -** on fail or the address of the ending '\0' on success. -** 'pmode' points to (and 'mode' contains) special things in the string: -** - 'x'/'X' means an hexadecimal numeral -** - 'n'/'N' means 'inf' or 'nan' (which should be rejected) -** - '.' just optimizes the search for the common case (nothing special) -** This function accepts both the current locale or a dot as the radix -** mark. If the convertion fails, it may mean number has a dot but -** locale accepts something else. In that case, the code copies 's' -** to a buffer (because 's' is read-only), changes the dot to the -** current locale radix mark, and tries to convert again. -*/ -static const char *l_str2d (const char *s, lua_Number *result) { - const char *endptr; - const char *pmode = strpbrk(s, ".xXnN"); - int mode = pmode ? ltolower(cast_uchar(*pmode)) : 0; - if (mode == 'n') /* reject 'inf' and 'nan' */ - return NULL; - endptr = l_str2dloc(s, result, mode); /* try to convert */ - if (endptr == NULL) { /* failed? may be a different locale */ - char buff[L_MAXLENNUM + 1]; - const char *pdot = strchr(s, '.'); - if (strlen(s) > L_MAXLENNUM || pdot == NULL) - return NULL; /* string too long or no dot; fail */ - strcpy(buff, s); /* copy string to buffer */ - buff[pdot - s] = lua_getlocaledecpoint(); /* correct decimal point */ - endptr = l_str2dloc(buff, result, mode); /* try again */ - if (endptr != NULL) - endptr = s + (endptr - buff); /* make relative to 's' */ - } - return endptr; -} - - -#define MAXBY10 cast(lua_Unsigned, LUA_MAXINTEGER / 10) -#define MAXLASTD cast_int(LUA_MAXINTEGER % 10) - -static const char *l_str2int (const char *s, lua_Integer *result) { - lua_Unsigned a = 0; - int empty = 1; - int neg; - while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */ - neg = isneg(&s); - if (s[0] == '0' && - (s[1] == 'x' || s[1] == 'X')) { /* hex? */ - s += 2; /* skip '0x' */ - for (; lisxdigit(cast_uchar(*s)); s++) { - a = a * 16 + luaO_hexavalue(*s); - empty = 0; - } - } - else { /* decimal */ - for (; lisdigit(cast_uchar(*s)); s++) { - int d = *s - '0'; - if (a >= MAXBY10 && (a > MAXBY10 || d > MAXLASTD + neg)) /* overflow? */ - return NULL; /* do not accept it (as integer) */ - a = a * 10 + d; - empty = 0; - } - } - while (lisspace(cast_uchar(*s))) s++; /* skip trailing spaces */ - if (empty || *s != '\0') return NULL; /* something wrong in the numeral */ - else { - *result = l_castU2S((neg) ? 0u - a : a); - return s; - } -} - - -size_t luaO_str2num (const char *s, TValue *o) { - lua_Integer i; lua_Number n; - const char *e; - if ((e = l_str2int(s, &i)) != NULL) { /* try as an integer */ - setivalue(o, i); - } - else if ((e = l_str2d(s, &n)) != NULL) { /* else try as a float */ - setfltvalue(o, n); - } - else - return 0; /* conversion failed */ - return (e - s) + 1; /* success; return string size */ -} - - -int luaO_utf8esc (char *buff, unsigned long x) { - int n = 1; /* number of bytes put in buffer (backwards) */ - lua_assert(x <= 0x10FFFF); - if (x < 0x80) /* ascii? */ - buff[UTF8BUFFSZ - 1] = cast(char, x); - else { /* need continuation bytes */ - unsigned int mfb = 0x3f; /* maximum that fits in first byte */ - do { /* add continuation bytes */ - buff[UTF8BUFFSZ - (n++)] = cast(char, 0x80 | (x & 0x3f)); - x >>= 6; /* remove added bits */ - mfb >>= 1; /* now there is one less bit available in first byte */ - } while (x > mfb); /* still needs continuation byte? */ - buff[UTF8BUFFSZ - n] = cast(char, (~mfb << 1) | x); /* add first byte */ - } - return n; -} - - -/* maximum length of the conversion of a number to a string */ -#define MAXNUMBER2STR 50 - - -/* -** Convert a number object to a string -*/ -void luaO_tostring (lua_State *L, StkId obj) { - char buff[MAXNUMBER2STR]; - size_t len; - lua_assert(ttisnumber(obj)); - if (ttisinteger(obj)) - len = lua_integer2str(buff, sizeof(buff), ivalue(obj)); - else { - len = lua_number2str(buff, sizeof(buff), fltvalue(obj)); -#if !defined(LUA_COMPAT_FLOATSTRING) - if (buff[strspn(buff, "-0123456789")] == '\0') { /* looks like an int? */ - buff[len++] = lua_getlocaledecpoint(); - buff[len++] = '0'; /* adds '.0' to result */ - } -#endif - } - setsvalue2s(L, obj, luaS_newlstr(L, buff, len)); -} - - -static void pushstr (lua_State *L, const char *str, size_t l) { - setsvalue2s(L, L->top, luaS_newlstr(L, str, l)); - luaD_inctop(L); -} - - -/* -** this function handles only '%d', '%c', '%f', '%p', and '%s' - conventional formats, plus Lua-specific '%I' and '%U' -*/ -const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { - int n = 0; - for (;;) { - const char *e = strchr(fmt, '%'); - if (e == NULL) break; - pushstr(L, fmt, e - fmt); - switch (*(e+1)) { - case 's': { /* zero-terminated string */ - const char *s = va_arg(argp, char *); - if (s == NULL) s = "(null)"; - pushstr(L, s, strlen(s)); - break; - } - case 'c': { /* an 'int' as a character */ - char buff = cast(char, va_arg(argp, int)); - if (lisprint(cast_uchar(buff))) - pushstr(L, &buff, 1); - else /* non-printable character; print its code */ - luaO_pushfstring(L, "<\\%d>", cast_uchar(buff)); - break; - } - case 'd': { /* an 'int' */ - setivalue(L->top, va_arg(argp, int)); - goto top2str; - } - case 'I': { /* a 'lua_Integer' */ - setivalue(L->top, cast(lua_Integer, va_arg(argp, l_uacInt))); - goto top2str; - } - case 'f': { /* a 'lua_Number' */ - setfltvalue(L->top, cast_num(va_arg(argp, l_uacNumber))); - top2str: /* convert the top element to a string */ - luaD_inctop(L); - luaO_tostring(L, L->top - 1); - break; - } - case 'p': { /* a pointer */ - char buff[4*sizeof(void *) + 8]; /* should be enough space for a '%p' */ - int l = l_sprintf(buff, sizeof(buff), "%p", va_arg(argp, void *)); - pushstr(L, buff, l); - break; - } - case 'U': { /* an 'int' as a UTF-8 sequence */ - char buff[UTF8BUFFSZ]; - int l = luaO_utf8esc(buff, cast(long, va_arg(argp, long))); - pushstr(L, buff + UTF8BUFFSZ - l, l); - break; - } - case '%': { - pushstr(L, "%", 1); - break; - } - default: { - luaG_runerror(L, "invalid option '%%%c' to 'lua_pushfstring'", - *(e + 1)); - } - } - n += 2; - fmt = e+2; - } - luaD_checkstack(L, 1); - pushstr(L, fmt, strlen(fmt)); - if (n > 0) luaV_concat(L, n + 1); - return svalue(L->top - 1); -} - - -const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) { - const char *msg; - va_list argp; - va_start(argp, fmt); - msg = luaO_pushvfstring(L, fmt, argp); - va_end(argp); - return msg; -} - - -/* number of chars of a literal string without the ending \0 */ -#define LL(x) (sizeof(x)/sizeof(char) - 1) - -#define RETS "..." -#define PRE "[string \"" -#define POS "\"]" - -#define addstr(a,b,l) ( memcpy(a,b,(l) * sizeof(char)), a += (l) ) - -void luaO_chunkid (char *out, const char *source, size_t bufflen) { - size_t l = strlen(source); - if (*source == '=') { /* 'literal' source */ - if (l <= bufflen) /* small enough? */ - memcpy(out, source + 1, l * sizeof(char)); - else { /* truncate it */ - addstr(out, source + 1, bufflen - 1); - *out = '\0'; - } - } - else if (*source == '@') { /* file name */ - if (l <= bufflen) /* small enough? */ - memcpy(out, source + 1, l * sizeof(char)); - else { /* add '...' before rest of name */ - addstr(out, RETS, LL(RETS)); - bufflen -= LL(RETS); - memcpy(out, source + 1 + l - bufflen, bufflen * sizeof(char)); - } - } - else { /* string; format as [string "source"] */ - const char *nl = strchr(source, '\n'); /* find first new line (if any) */ - addstr(out, PRE, LL(PRE)); /* add prefix */ - bufflen -= LL(PRE RETS POS) + 1; /* save space for prefix+suffix+'\0' */ - if (l < bufflen && nl == NULL) { /* small one-line source? */ - addstr(out, source, l); /* keep it */ - } - else { - if (nl != NULL) l = nl - source; /* stop at first newline */ - if (l > bufflen) l = bufflen; - addstr(out, source, l); - addstr(out, RETS, LL(RETS)); - } - memcpy(out, POS, (LL(POS) + 1) * sizeof(char)); - } -} - diff --git a/LuaSkin/lua-5.3.4/src/lobject.h b/LuaSkin/lua-5.3.4/src/lobject.h deleted file mode 100644 index 3c0422894..000000000 --- a/LuaSkin/lua-5.3.4/src/lobject.h +++ /dev/null @@ -1,549 +0,0 @@ -/* -** $Id: lobject.h,v 2.117 2016/08/01 19:51:24 roberto Exp $ -** Type definitions for Lua objects -** See Copyright Notice in lua.h -*/ - - -#ifndef lobject_h -#define lobject_h - - -#include - - -#include "llimits.h" -#include "lua.h" - - -/* -** Extra tags for non-values -*/ -#define LUA_TPROTO LUA_NUMTAGS /* function prototypes */ -#define LUA_TDEADKEY (LUA_NUMTAGS+1) /* removed keys in tables */ - -/* -** number of all possible tags (including LUA_TNONE but excluding DEADKEY) -*/ -#define LUA_TOTALTAGS (LUA_TPROTO + 2) - - -/* -** tags for Tagged Values have the following use of bits: -** bits 0-3: actual tag (a LUA_T* value) -** bits 4-5: variant bits -** bit 6: whether value is collectable -*/ - - -/* -** LUA_TFUNCTION variants: -** 0 - Lua function -** 1 - light C function -** 2 - regular C function (closure) -*/ - -/* Variant tags for functions */ -#define LUA_TLCL (LUA_TFUNCTION | (0 << 4)) /* Lua closure */ -#define LUA_TLCF (LUA_TFUNCTION | (1 << 4)) /* light C function */ -#define LUA_TCCL (LUA_TFUNCTION | (2 << 4)) /* C closure */ - - -/* Variant tags for strings */ -#define LUA_TSHRSTR (LUA_TSTRING | (0 << 4)) /* short strings */ -#define LUA_TLNGSTR (LUA_TSTRING | (1 << 4)) /* long strings */ - - -/* Variant tags for numbers */ -#define LUA_TNUMFLT (LUA_TNUMBER | (0 << 4)) /* float numbers */ -#define LUA_TNUMINT (LUA_TNUMBER | (1 << 4)) /* integer numbers */ - - -/* Bit mark for collectable types */ -#define BIT_ISCOLLECTABLE (1 << 6) - -/* mark a tag as collectable */ -#define ctb(t) ((t) | BIT_ISCOLLECTABLE) - - -/* -** Common type for all collectable objects -*/ -typedef struct GCObject GCObject; - - -/* -** Common Header for all collectable objects (in macro form, to be -** included in other objects) -*/ -#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked - - -/* -** Common type has only the common header -*/ -struct GCObject { - CommonHeader; -}; - - - - -/* -** Tagged Values. This is the basic representation of values in Lua, -** an actual value plus a tag with its type. -*/ - -/* -** Union of all Lua values -*/ -typedef union Value { - GCObject *gc; /* collectable objects */ - void *p; /* light userdata */ - int b; /* booleans */ - lua_CFunction f; /* light C functions */ - lua_Integer i; /* integer numbers */ - lua_Number n; /* float numbers */ -} Value; - - -#define TValuefields Value value_; int tt_ - - -typedef struct lua_TValue { - TValuefields; -} TValue; - - - -/* macro defining a nil value */ -#define NILCONSTANT {NULL}, LUA_TNIL - - -#define val_(o) ((o)->value_) - - -/* raw type tag of a TValue */ -#define rttype(o) ((o)->tt_) - -/* tag with no variants (bits 0-3) */ -#define novariant(x) ((x) & 0x0F) - -/* type tag of a TValue (bits 0-3 for tags + variant bits 4-5) */ -#define ttype(o) (rttype(o) & 0x3F) - -/* type tag of a TValue with no variants (bits 0-3) */ -#define ttnov(o) (novariant(rttype(o))) - - -/* Macros to test type */ -#define checktag(o,t) (rttype(o) == (t)) -#define checktype(o,t) (ttnov(o) == (t)) -#define ttisnumber(o) checktype((o), LUA_TNUMBER) -#define ttisfloat(o) checktag((o), LUA_TNUMFLT) -#define ttisinteger(o) checktag((o), LUA_TNUMINT) -#define ttisnil(o) checktag((o), LUA_TNIL) -#define ttisboolean(o) checktag((o), LUA_TBOOLEAN) -#define ttislightuserdata(o) checktag((o), LUA_TLIGHTUSERDATA) -#define ttisstring(o) checktype((o), LUA_TSTRING) -#define ttisshrstring(o) checktag((o), ctb(LUA_TSHRSTR)) -#define ttislngstring(o) checktag((o), ctb(LUA_TLNGSTR)) -#define ttistable(o) checktag((o), ctb(LUA_TTABLE)) -#define ttisfunction(o) checktype(o, LUA_TFUNCTION) -#define ttisclosure(o) ((rttype(o) & 0x1F) == LUA_TFUNCTION) -#define ttisCclosure(o) checktag((o), ctb(LUA_TCCL)) -#define ttisLclosure(o) checktag((o), ctb(LUA_TLCL)) -#define ttislcf(o) checktag((o), LUA_TLCF) -#define ttisfulluserdata(o) checktag((o), ctb(LUA_TUSERDATA)) -#define ttisthread(o) checktag((o), ctb(LUA_TTHREAD)) -#define ttisdeadkey(o) checktag((o), LUA_TDEADKEY) - - -/* Macros to access values */ -#define ivalue(o) check_exp(ttisinteger(o), val_(o).i) -#define fltvalue(o) check_exp(ttisfloat(o), val_(o).n) -#define nvalue(o) check_exp(ttisnumber(o), \ - (ttisinteger(o) ? cast_num(ivalue(o)) : fltvalue(o))) -#define gcvalue(o) check_exp(iscollectable(o), val_(o).gc) -#define pvalue(o) check_exp(ttislightuserdata(o), val_(o).p) -#define tsvalue(o) check_exp(ttisstring(o), gco2ts(val_(o).gc)) -#define uvalue(o) check_exp(ttisfulluserdata(o), gco2u(val_(o).gc)) -#define clvalue(o) check_exp(ttisclosure(o), gco2cl(val_(o).gc)) -#define clLvalue(o) check_exp(ttisLclosure(o), gco2lcl(val_(o).gc)) -#define clCvalue(o) check_exp(ttisCclosure(o), gco2ccl(val_(o).gc)) -#define fvalue(o) check_exp(ttislcf(o), val_(o).f) -#define hvalue(o) check_exp(ttistable(o), gco2t(val_(o).gc)) -#define bvalue(o) check_exp(ttisboolean(o), val_(o).b) -#define thvalue(o) check_exp(ttisthread(o), gco2th(val_(o).gc)) -/* a dead value may get the 'gc' field, but cannot access its contents */ -#define deadvalue(o) check_exp(ttisdeadkey(o), cast(void *, val_(o).gc)) - -#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) - - -#define iscollectable(o) (rttype(o) & BIT_ISCOLLECTABLE) - - -/* Macros for internal tests */ -#define righttt(obj) (ttype(obj) == gcvalue(obj)->tt) - -#define checkliveness(L,obj) \ - lua_longassert(!iscollectable(obj) || \ - (righttt(obj) && (L == NULL || !isdead(G(L),gcvalue(obj))))) - - -/* Macros to set values */ -#define settt_(o,t) ((o)->tt_=(t)) - -#define setfltvalue(obj,x) \ - { TValue *io=(obj); val_(io).n=(x); settt_(io, LUA_TNUMFLT); } - -#define chgfltvalue(obj,x) \ - { TValue *io=(obj); lua_assert(ttisfloat(io)); val_(io).n=(x); } - -#define setivalue(obj,x) \ - { TValue *io=(obj); val_(io).i=(x); settt_(io, LUA_TNUMINT); } - -#define chgivalue(obj,x) \ - { TValue *io=(obj); lua_assert(ttisinteger(io)); val_(io).i=(x); } - -#define setnilvalue(obj) settt_(obj, LUA_TNIL) - -#define setfvalue(obj,x) \ - { TValue *io=(obj); val_(io).f=(x); settt_(io, LUA_TLCF); } - -#define setpvalue(obj,x) \ - { TValue *io=(obj); val_(io).p=(x); settt_(io, LUA_TLIGHTUSERDATA); } - -#define setbvalue(obj,x) \ - { TValue *io=(obj); val_(io).b=(x); settt_(io, LUA_TBOOLEAN); } - -#define setgcovalue(L,obj,x) \ - { TValue *io = (obj); GCObject *i_g=(x); \ - val_(io).gc = i_g; settt_(io, ctb(i_g->tt)); } - -#define setsvalue(L,obj,x) \ - { TValue *io = (obj); TString *x_ = (x); \ - val_(io).gc = obj2gco(x_); settt_(io, ctb(x_->tt)); \ - checkliveness(L,io); } - -#define setuvalue(L,obj,x) \ - { TValue *io = (obj); Udata *x_ = (x); \ - val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TUSERDATA)); \ - checkliveness(L,io); } - -#define setthvalue(L,obj,x) \ - { TValue *io = (obj); lua_State *x_ = (x); \ - val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TTHREAD)); \ - checkliveness(L,io); } - -#define setclLvalue(L,obj,x) \ - { TValue *io = (obj); LClosure *x_ = (x); \ - val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TLCL)); \ - checkliveness(L,io); } - -#define setclCvalue(L,obj,x) \ - { TValue *io = (obj); CClosure *x_ = (x); \ - val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TCCL)); \ - checkliveness(L,io); } - -#define sethvalue(L,obj,x) \ - { TValue *io = (obj); Table *x_ = (x); \ - val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TTABLE)); \ - checkliveness(L,io); } - -#define setdeadvalue(obj) settt_(obj, LUA_TDEADKEY) - - - -#define setobj(L,obj1,obj2) \ - { TValue *io1=(obj1); *io1 = *(obj2); \ - (void)L; checkliveness(L,io1); } - - -/* -** different types of assignments, according to destination -*/ - -/* from stack to (same) stack */ -#define setobjs2s setobj -/* to stack (not from same stack) */ -#define setobj2s setobj -#define setsvalue2s setsvalue -#define sethvalue2s sethvalue -#define setptvalue2s setptvalue -/* from table to same table */ -#define setobjt2t setobj -/* to new object */ -#define setobj2n setobj -#define setsvalue2n setsvalue - -/* to table (define it as an expression to be used in macros) */ -#define setobj2t(L,o1,o2) ((void)L, *(o1)=*(o2), checkliveness(L,(o1))) - - - - -/* -** {====================================================== -** types and prototypes -** ======================================================= -*/ - - -typedef TValue *StkId; /* index to stack elements */ - - - - -/* -** Header for string value; string bytes follow the end of this structure -** (aligned according to 'UTString'; see next). -*/ -typedef struct TString { - CommonHeader; - lu_byte extra; /* reserved words for short strings; "has hash" for longs */ - lu_byte shrlen; /* length for short strings */ - unsigned int hash; - union { - size_t lnglen; /* length for long strings */ - struct TString *hnext; /* linked list for hash table */ - } u; -} TString; - - -/* -** Ensures that address after this type is always fully aligned. -*/ -typedef union UTString { - L_Umaxalign dummy; /* ensures maximum alignment for strings */ - TString tsv; -} UTString; - - -/* -** Get the actual string (array of bytes) from a 'TString'. -** (Access to 'extra' ensures that value is really a 'TString'.) -*/ -#define getstr(ts) \ - check_exp(sizeof((ts)->extra), cast(char *, (ts)) + sizeof(UTString)) - - -/* get the actual string (array of bytes) from a Lua value */ -#define svalue(o) getstr(tsvalue(o)) - -/* get string length from 'TString *s' */ -#define tsslen(s) ((s)->tt == LUA_TSHRSTR ? (s)->shrlen : (s)->u.lnglen) - -/* get string length from 'TValue *o' */ -#define vslen(o) tsslen(tsvalue(o)) - - -/* -** Header for userdata; memory area follows the end of this structure -** (aligned according to 'UUdata'; see next). -*/ -typedef struct Udata { - CommonHeader; - lu_byte ttuv_; /* user value's tag */ - struct Table *metatable; - size_t len; /* number of bytes */ - union Value user_; /* user value */ -} Udata; - - -/* -** Ensures that address after this type is always fully aligned. -*/ -typedef union UUdata { - L_Umaxalign dummy; /* ensures maximum alignment for 'local' udata */ - Udata uv; -} UUdata; - - -/* -** Get the address of memory block inside 'Udata'. -** (Access to 'ttuv_' ensures that value is really a 'Udata'.) -*/ -#define getudatamem(u) \ - check_exp(sizeof((u)->ttuv_), (cast(char*, (u)) + sizeof(UUdata))) - -#define setuservalue(L,u,o) \ - { const TValue *io=(o); Udata *iu = (u); \ - iu->user_ = io->value_; iu->ttuv_ = rttype(io); \ - checkliveness(L,io); } - - -#define getuservalue(L,u,o) \ - { TValue *io=(o); const Udata *iu = (u); \ - io->value_ = iu->user_; settt_(io, iu->ttuv_); \ - checkliveness(L,io); } - - -/* -** Description of an upvalue for function prototypes -*/ -typedef struct Upvaldesc { - TString *name; /* upvalue name (for debug information) */ - lu_byte instack; /* whether it is in stack (register) */ - lu_byte idx; /* index of upvalue (in stack or in outer function's list) */ -} Upvaldesc; - - -/* -** Description of a local variable for function prototypes -** (used for debug information) -*/ -typedef struct LocVar { - TString *varname; - int startpc; /* first point where variable is active */ - int endpc; /* first point where variable is dead */ -} LocVar; - - -/* -** Function Prototypes -*/ -typedef struct Proto { - CommonHeader; - lu_byte numparams; /* number of fixed parameters */ - lu_byte is_vararg; - lu_byte maxstacksize; /* number of registers needed by this function */ - int sizeupvalues; /* size of 'upvalues' */ - int sizek; /* size of 'k' */ - int sizecode; - int sizelineinfo; - int sizep; /* size of 'p' */ - int sizelocvars; - int linedefined; /* debug information */ - int lastlinedefined; /* debug information */ - TValue *k; /* constants used by the function */ - Instruction *code; /* opcodes */ - struct Proto **p; /* functions defined inside the function */ - int *lineinfo; /* map from opcodes to source lines (debug information) */ - LocVar *locvars; /* information about local variables (debug information) */ - Upvaldesc *upvalues; /* upvalue information */ - struct LClosure *cache; /* last-created closure with this prototype */ - TString *source; /* used for debug information */ - GCObject *gclist; -} Proto; - - - -/* -** Lua Upvalues -*/ -typedef struct UpVal UpVal; - - -/* -** Closures -*/ - -#define ClosureHeader \ - CommonHeader; lu_byte nupvalues; GCObject *gclist - -typedef struct CClosure { - ClosureHeader; - lua_CFunction f; - TValue upvalue[1]; /* list of upvalues */ -} CClosure; - - -typedef struct LClosure { - ClosureHeader; - struct Proto *p; - UpVal *upvals[1]; /* list of upvalues */ -} LClosure; - - -typedef union Closure { - CClosure c; - LClosure l; -} Closure; - - -#define isLfunction(o) ttisLclosure(o) - -#define getproto(o) (clLvalue(o)->p) - - -/* -** Tables -*/ - -typedef union TKey { - struct { - TValuefields; - int next; /* for chaining (offset for next node) */ - } nk; - TValue tvk; -} TKey; - - -/* copy a value into a key without messing up field 'next' */ -#define setnodekey(L,key,obj) \ - { TKey *k_=(key); const TValue *io_=(obj); \ - k_->nk.value_ = io_->value_; k_->nk.tt_ = io_->tt_; \ - (void)L; checkliveness(L,io_); } - - -typedef struct Node { - TValue i_val; - TKey i_key; -} Node; - - -typedef struct Table { - CommonHeader; - lu_byte flags; /* 1<

lsizenode)) - - -/* -** (address of) a fixed nil value -*/ -#define luaO_nilobject (&luaO_nilobject_) - - -LUAI_DDEC const TValue luaO_nilobject_; - -/* size of buffer for 'luaO_utf8esc' function */ -#define UTF8BUFFSZ 8 - -LUAI_FUNC int luaO_int2fb (unsigned int x); -LUAI_FUNC int luaO_fb2int (int x); -LUAI_FUNC int luaO_utf8esc (char *buff, unsigned long x); -LUAI_FUNC int luaO_ceillog2 (unsigned int x); -LUAI_FUNC void luaO_arith (lua_State *L, int op, const TValue *p1, - const TValue *p2, TValue *res); -LUAI_FUNC size_t luaO_str2num (const char *s, TValue *o); -LUAI_FUNC int luaO_hexavalue (int c); -LUAI_FUNC void luaO_tostring (lua_State *L, StkId obj); -LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, - va_list argp); -LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...); -LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len); - - -#endif - diff --git a/LuaSkin/lua-5.3.4/src/lopcodes.c b/LuaSkin/lua-5.3.4/src/lopcodes.c deleted file mode 100644 index a1cbef857..000000000 --- a/LuaSkin/lua-5.3.4/src/lopcodes.c +++ /dev/null @@ -1,124 +0,0 @@ -/* -** $Id: lopcodes.c,v 1.55 2015/01/05 13:48:33 roberto Exp $ -** Opcodes for Lua virtual machine -** See Copyright Notice in lua.h -*/ - -#define lopcodes_c -#define LUA_CORE - -#include "lprefix.h" - - -#include - -#include "lopcodes.h" - - -/* ORDER OP */ - -LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = { - "MOVE", - "LOADK", - "LOADKX", - "LOADBOOL", - "LOADNIL", - "GETUPVAL", - "GETTABUP", - "GETTABLE", - "SETTABUP", - "SETUPVAL", - "SETTABLE", - "NEWTABLE", - "SELF", - "ADD", - "SUB", - "MUL", - "MOD", - "POW", - "DIV", - "IDIV", - "BAND", - "BOR", - "BXOR", - "SHL", - "SHR", - "UNM", - "BNOT", - "NOT", - "LEN", - "CONCAT", - "JMP", - "EQ", - "LT", - "LE", - "TEST", - "TESTSET", - "CALL", - "TAILCALL", - "RETURN", - "FORLOOP", - "FORPREP", - "TFORCALL", - "TFORLOOP", - "SETLIST", - "CLOSURE", - "VARARG", - "EXTRAARG", - NULL -}; - - -#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m)) - -LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { -/* T A B C mode opcode */ - opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */ - ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */ - ,opmode(0, 1, OpArgN, OpArgN, iABx) /* OP_LOADKX */ - ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_LOADBOOL */ - ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_LOADNIL */ - ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_GETUPVAL */ - ,opmode(0, 1, OpArgU, OpArgK, iABC) /* OP_GETTABUP */ - ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_GETTABLE */ - ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABUP */ - ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_SETUPVAL */ - ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABLE */ - ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_NEWTABLE */ - ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_SELF */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_ADD */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SUB */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MUL */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MOD */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_POW */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_DIV */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_IDIV */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BAND */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BOR */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BXOR */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SHL */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SHR */ - ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */ - ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_BNOT */ - ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */ - ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LEN */ - ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_CONCAT */ - ,opmode(0, 0, OpArgR, OpArgN, iAsBx) /* OP_JMP */ - ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_EQ */ - ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LT */ - ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LE */ - ,opmode(1, 0, OpArgN, OpArgU, iABC) /* OP_TEST */ - ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TESTSET */ - ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_CALL */ - ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_TAILCALL */ - ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_RETURN */ - ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */ - ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */ - ,opmode(0, 0, OpArgN, OpArgU, iABC) /* OP_TFORCALL */ - ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_TFORLOOP */ - ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */ - ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */ - ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */ - ,opmode(0, 0, OpArgU, OpArgU, iAx) /* OP_EXTRAARG */ -}; - diff --git a/LuaSkin/lua-5.3.4/src/lopcodes.h b/LuaSkin/lua-5.3.4/src/lopcodes.h deleted file mode 100644 index bbc4b6196..000000000 --- a/LuaSkin/lua-5.3.4/src/lopcodes.h +++ /dev/null @@ -1,297 +0,0 @@ -/* -** $Id: lopcodes.h,v 1.149 2016/07/19 17:12:21 roberto Exp $ -** Opcodes for Lua virtual machine -** See Copyright Notice in lua.h -*/ - -#ifndef lopcodes_h -#define lopcodes_h - -#include "llimits.h" - - -/*=========================================================================== - We assume that instructions are unsigned numbers. - All instructions have an opcode in the first 6 bits. - Instructions can have the following fields: - 'A' : 8 bits - 'B' : 9 bits - 'C' : 9 bits - 'Ax' : 26 bits ('A', 'B', and 'C' together) - 'Bx' : 18 bits ('B' and 'C' together) - 'sBx' : signed Bx - - A signed argument is represented in excess K; that is, the number - value is the unsigned value minus K. K is exactly the maximum value - for that argument (so that -max is represented by 0, and +max is - represented by 2*max), which is half the maximum for the corresponding - unsigned argument. -===========================================================================*/ - - -enum OpMode {iABC, iABx, iAsBx, iAx}; /* basic instruction format */ - - -/* -** size and position of opcode arguments. -*/ -#define SIZE_C 9 -#define SIZE_B 9 -#define SIZE_Bx (SIZE_C + SIZE_B) -#define SIZE_A 8 -#define SIZE_Ax (SIZE_C + SIZE_B + SIZE_A) - -#define SIZE_OP 6 - -#define POS_OP 0 -#define POS_A (POS_OP + SIZE_OP) -#define POS_C (POS_A + SIZE_A) -#define POS_B (POS_C + SIZE_C) -#define POS_Bx POS_C -#define POS_Ax POS_A - - -/* -** limits for opcode arguments. -** we use (signed) int to manipulate most arguments, -** so they must fit in LUAI_BITSINT-1 bits (-1 for sign) -*/ -#if SIZE_Bx < LUAI_BITSINT-1 -#define MAXARG_Bx ((1<>1) /* 'sBx' is signed */ -#else -#define MAXARG_Bx MAX_INT -#define MAXARG_sBx MAX_INT -#endif - -#if SIZE_Ax < LUAI_BITSINT-1 -#define MAXARG_Ax ((1<>POS_OP) & MASK1(SIZE_OP,0))) -#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \ - ((cast(Instruction, o)<>pos) & MASK1(size,0))) -#define setarg(i,v,pos,size) ((i) = (((i)&MASK0(size,pos)) | \ - ((cast(Instruction, v)<> RK(C) */ -OP_UNM,/* A B R(A) := -R(B) */ -OP_BNOT,/* A B R(A) := ~R(B) */ -OP_NOT,/* A B R(A) := not R(B) */ -OP_LEN,/* A B R(A) := length of R(B) */ - -OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */ - -OP_JMP,/* A sBx pc+=sBx; if (A) close all upvalues >= R(A - 1) */ -OP_EQ,/* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */ -OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */ -OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */ - -OP_TEST,/* A C if not (R(A) <=> C) then pc++ */ -OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ - -OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */ -OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ -OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */ - -OP_FORLOOP,/* A sBx R(A)+=R(A+2); - if R(A) > 4) & 3)) -#define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3)) -#define testAMode(m) (luaP_opmodes[m] & (1 << 6)) -#define testTMode(m) (luaP_opmodes[m] & (1 << 7)) - - -LUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */ - - -/* number of list items to accumulate before a SETLIST instruction */ -#define LFIELDS_PER_FLUSH 50 - - -#endif diff --git a/LuaSkin/lua-5.3.4/src/lparser.c b/LuaSkin/lua-5.3.4/src/lparser.c deleted file mode 100644 index cd4512d4d..000000000 --- a/LuaSkin/lua-5.3.4/src/lparser.c +++ /dev/null @@ -1,1650 +0,0 @@ -/* -** $Id: lparser.c,v 2.155 2016/08/01 19:51:24 roberto Exp $ -** Lua Parser -** See Copyright Notice in lua.h -*/ - -#define lparser_c -#define LUA_CORE - -#include "lprefix.h" - - -#include - -#include "lua.h" - -#include "lcode.h" -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "llex.h" -#include "lmem.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lparser.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" - - - -/* maximum number of local variables per function (must be smaller - than 250, due to the bytecode format) */ -#define MAXVARS 200 - - -#define hasmultret(k) ((k) == VCALL || (k) == VVARARG) - - -/* because all strings are unified by the scanner, the parser - can use pointer equality for string equality */ -#define eqstr(a,b) ((a) == (b)) - - -/* -** nodes for block list (list of active blocks) -*/ -typedef struct BlockCnt { - struct BlockCnt *previous; /* chain */ - int firstlabel; /* index of first label in this block */ - int firstgoto; /* index of first pending goto in this block */ - lu_byte nactvar; /* # active locals outside the block */ - lu_byte upval; /* true if some variable in the block is an upvalue */ - lu_byte isloop; /* true if 'block' is a loop */ -} BlockCnt; - - - -/* -** prototypes for recursive non-terminal functions -*/ -static void statement (LexState *ls); -static void expr (LexState *ls, expdesc *v); - - -/* semantic error */ -static l_noret semerror (LexState *ls, const char *msg) { - ls->t.token = 0; /* remove "near " from final message */ - luaX_syntaxerror(ls, msg); -} - - -static l_noret error_expected (LexState *ls, int token) { - luaX_syntaxerror(ls, - luaO_pushfstring(ls->L, "%s expected", luaX_token2str(ls, token))); -} - - -static l_noret errorlimit (FuncState *fs, int limit, const char *what) { - lua_State *L = fs->ls->L; - const char *msg; - int line = fs->f->linedefined; - const char *where = (line == 0) - ? "main function" - : luaO_pushfstring(L, "function at line %d", line); - msg = luaO_pushfstring(L, "too many %s (limit is %d) in %s", - what, limit, where); - luaX_syntaxerror(fs->ls, msg); -} - - -static void checklimit (FuncState *fs, int v, int l, const char *what) { - if (v > l) errorlimit(fs, l, what); -} - - -static int testnext (LexState *ls, int c) { - if (ls->t.token == c) { - luaX_next(ls); - return 1; - } - else return 0; -} - - -static void check (LexState *ls, int c) { - if (ls->t.token != c) - error_expected(ls, c); -} - - -static void checknext (LexState *ls, int c) { - check(ls, c); - luaX_next(ls); -} - - -#define check_condition(ls,c,msg) { if (!(c)) luaX_syntaxerror(ls, msg); } - - - -static void check_match (LexState *ls, int what, int who, int where) { - if (!testnext(ls, what)) { - if (where == ls->linenumber) - error_expected(ls, what); - else { - luaX_syntaxerror(ls, luaO_pushfstring(ls->L, - "%s expected (to close %s at line %d)", - luaX_token2str(ls, what), luaX_token2str(ls, who), where)); - } - } -} - - -static TString *str_checkname (LexState *ls) { - TString *ts; - check(ls, TK_NAME); - ts = ls->t.seminfo.ts; - luaX_next(ls); - return ts; -} - - -static void init_exp (expdesc *e, expkind k, int i) { - e->f = e->t = NO_JUMP; - e->k = k; - e->u.info = i; -} - - -static void codestring (LexState *ls, expdesc *e, TString *s) { - init_exp(e, VK, luaK_stringK(ls->fs, s)); -} - - -static void checkname (LexState *ls, expdesc *e) { - codestring(ls, e, str_checkname(ls)); -} - - -static int registerlocalvar (LexState *ls, TString *varname) { - FuncState *fs = ls->fs; - Proto *f = fs->f; - int oldsize = f->sizelocvars; - luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars, - LocVar, SHRT_MAX, "local variables"); - while (oldsize < f->sizelocvars) - f->locvars[oldsize++].varname = NULL; - f->locvars[fs->nlocvars].varname = varname; - luaC_objbarrier(ls->L, f, varname); - return fs->nlocvars++; -} - - -static void new_localvar (LexState *ls, TString *name) { - FuncState *fs = ls->fs; - Dyndata *dyd = ls->dyd; - int reg = registerlocalvar(ls, name); - checklimit(fs, dyd->actvar.n + 1 - fs->firstlocal, - MAXVARS, "local variables"); - luaM_growvector(ls->L, dyd->actvar.arr, dyd->actvar.n + 1, - dyd->actvar.size, Vardesc, MAX_INT, "local variables"); - dyd->actvar.arr[dyd->actvar.n++].idx = cast(short, reg); -} - - -static void new_localvarliteral_ (LexState *ls, const char *name, size_t sz) { - new_localvar(ls, luaX_newstring(ls, name, sz)); -} - -#define new_localvarliteral(ls,v) \ - new_localvarliteral_(ls, "" v, (sizeof(v)/sizeof(char))-1) - - -static LocVar *getlocvar (FuncState *fs, int i) { - int idx = fs->ls->dyd->actvar.arr[fs->firstlocal + i].idx; - lua_assert(idx < fs->nlocvars); - return &fs->f->locvars[idx]; -} - - -static void adjustlocalvars (LexState *ls, int nvars) { - FuncState *fs = ls->fs; - fs->nactvar = cast_byte(fs->nactvar + nvars); - for (; nvars; nvars--) { - getlocvar(fs, fs->nactvar - nvars)->startpc = fs->pc; - } -} - - -static void removevars (FuncState *fs, int tolevel) { - fs->ls->dyd->actvar.n -= (fs->nactvar - tolevel); - while (fs->nactvar > tolevel) - getlocvar(fs, --fs->nactvar)->endpc = fs->pc; -} - - -static int searchupvalue (FuncState *fs, TString *name) { - int i; - Upvaldesc *up = fs->f->upvalues; - for (i = 0; i < fs->nups; i++) { - if (eqstr(up[i].name, name)) return i; - } - return -1; /* not found */ -} - - -static int newupvalue (FuncState *fs, TString *name, expdesc *v) { - Proto *f = fs->f; - int oldsize = f->sizeupvalues; - checklimit(fs, fs->nups + 1, MAXUPVAL, "upvalues"); - luaM_growvector(fs->ls->L, f->upvalues, fs->nups, f->sizeupvalues, - Upvaldesc, MAXUPVAL, "upvalues"); - while (oldsize < f->sizeupvalues) - f->upvalues[oldsize++].name = NULL; - f->upvalues[fs->nups].instack = (v->k == VLOCAL); - f->upvalues[fs->nups].idx = cast_byte(v->u.info); - f->upvalues[fs->nups].name = name; - luaC_objbarrier(fs->ls->L, f, name); - return fs->nups++; -} - - -static int searchvar (FuncState *fs, TString *n) { - int i; - for (i = cast_int(fs->nactvar) - 1; i >= 0; i--) { - if (eqstr(n, getlocvar(fs, i)->varname)) - return i; - } - return -1; /* not found */ -} - - -/* - Mark block where variable at given level was defined - (to emit close instructions later). -*/ -static void markupval (FuncState *fs, int level) { - BlockCnt *bl = fs->bl; - while (bl->nactvar > level) - bl = bl->previous; - bl->upval = 1; -} - - -/* - Find variable with given name 'n'. If it is an upvalue, add this - upvalue into all intermediate functions. -*/ -static void singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) { - if (fs == NULL) /* no more levels? */ - init_exp(var, VVOID, 0); /* default is global */ - else { - int v = searchvar(fs, n); /* look up locals at current level */ - if (v >= 0) { /* found? */ - init_exp(var, VLOCAL, v); /* variable is local */ - if (!base) - markupval(fs, v); /* local will be used as an upval */ - } - else { /* not found as local at current level; try upvalues */ - int idx = searchupvalue(fs, n); /* try existing upvalues */ - if (idx < 0) { /* not found? */ - singlevaraux(fs->prev, n, var, 0); /* try upper levels */ - if (var->k == VVOID) /* not found? */ - return; /* it is a global */ - /* else was LOCAL or UPVAL */ - idx = newupvalue(fs, n, var); /* will be a new upvalue */ - } - init_exp(var, VUPVAL, idx); /* new or old upvalue */ - } - } -} - - -static void singlevar (LexState *ls, expdesc *var) { - TString *varname = str_checkname(ls); - FuncState *fs = ls->fs; - singlevaraux(fs, varname, var, 1); - if (var->k == VVOID) { /* global name? */ - expdesc key; - singlevaraux(fs, ls->envn, var, 1); /* get environment variable */ - lua_assert(var->k != VVOID); /* this one must exist */ - codestring(ls, &key, varname); /* key is variable name */ - luaK_indexed(fs, var, &key); /* env[varname] */ - } -} - - -static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) { - FuncState *fs = ls->fs; - int extra = nvars - nexps; - if (hasmultret(e->k)) { - extra++; /* includes call itself */ - if (extra < 0) extra = 0; - luaK_setreturns(fs, e, extra); /* last exp. provides the difference */ - if (extra > 1) luaK_reserveregs(fs, extra-1); - } - else { - if (e->k != VVOID) luaK_exp2nextreg(fs, e); /* close last expression */ - if (extra > 0) { - int reg = fs->freereg; - luaK_reserveregs(fs, extra); - luaK_nil(fs, reg, extra); - } - } - if (nexps > nvars) - ls->fs->freereg -= nexps - nvars; /* remove extra values */ -} - - -static void enterlevel (LexState *ls) { - lua_State *L = ls->L; - ++L->nCcalls; - checklimit(ls->fs, L->nCcalls, LUAI_MAXCCALLS, "C levels"); -} - - -#define leavelevel(ls) ((ls)->L->nCcalls--) - - -static void closegoto (LexState *ls, int g, Labeldesc *label) { - int i; - FuncState *fs = ls->fs; - Labellist *gl = &ls->dyd->gt; - Labeldesc *gt = &gl->arr[g]; - lua_assert(eqstr(gt->name, label->name)); - if (gt->nactvar < label->nactvar) { - TString *vname = getlocvar(fs, gt->nactvar)->varname; - const char *msg = luaO_pushfstring(ls->L, - " at line %d jumps into the scope of local '%s'", - getstr(gt->name), gt->line, getstr(vname)); - semerror(ls, msg); - } - luaK_patchlist(fs, gt->pc, label->pc); - /* remove goto from pending list */ - for (i = g; i < gl->n - 1; i++) - gl->arr[i] = gl->arr[i + 1]; - gl->n--; -} - - -/* -** try to close a goto with existing labels; this solves backward jumps -*/ -static int findlabel (LexState *ls, int g) { - int i; - BlockCnt *bl = ls->fs->bl; - Dyndata *dyd = ls->dyd; - Labeldesc *gt = &dyd->gt.arr[g]; - /* check labels in current block for a match */ - for (i = bl->firstlabel; i < dyd->label.n; i++) { - Labeldesc *lb = &dyd->label.arr[i]; - if (eqstr(lb->name, gt->name)) { /* correct label? */ - if (gt->nactvar > lb->nactvar && - (bl->upval || dyd->label.n > bl->firstlabel)) - luaK_patchclose(ls->fs, gt->pc, lb->nactvar); - closegoto(ls, g, lb); /* close it */ - return 1; - } - } - return 0; /* label not found; cannot close goto */ -} - - -static int newlabelentry (LexState *ls, Labellist *l, TString *name, - int line, int pc) { - int n = l->n; - luaM_growvector(ls->L, l->arr, n, l->size, - Labeldesc, SHRT_MAX, "labels/gotos"); - l->arr[n].name = name; - l->arr[n].line = line; - l->arr[n].nactvar = ls->fs->nactvar; - l->arr[n].pc = pc; - l->n = n + 1; - return n; -} - - -/* -** check whether new label 'lb' matches any pending gotos in current -** block; solves forward jumps -*/ -static void findgotos (LexState *ls, Labeldesc *lb) { - Labellist *gl = &ls->dyd->gt; - int i = ls->fs->bl->firstgoto; - while (i < gl->n) { - if (eqstr(gl->arr[i].name, lb->name)) - closegoto(ls, i, lb); - else - i++; - } -} - - -/* -** export pending gotos to outer level, to check them against -** outer labels; if the block being exited has upvalues, and -** the goto exits the scope of any variable (which can be the -** upvalue), close those variables being exited. -*/ -static void movegotosout (FuncState *fs, BlockCnt *bl) { - int i = bl->firstgoto; - Labellist *gl = &fs->ls->dyd->gt; - /* correct pending gotos to current block and try to close it - with visible labels */ - while (i < gl->n) { - Labeldesc *gt = &gl->arr[i]; - if (gt->nactvar > bl->nactvar) { - if (bl->upval) - luaK_patchclose(fs, gt->pc, bl->nactvar); - gt->nactvar = bl->nactvar; - } - if (!findlabel(fs->ls, i)) - i++; /* move to next one */ - } -} - - -static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isloop) { - bl->isloop = isloop; - bl->nactvar = fs->nactvar; - bl->firstlabel = fs->ls->dyd->label.n; - bl->firstgoto = fs->ls->dyd->gt.n; - bl->upval = 0; - bl->previous = fs->bl; - fs->bl = bl; - lua_assert(fs->freereg == fs->nactvar); -} - - -/* -** create a label named 'break' to resolve break statements -*/ -static void breaklabel (LexState *ls) { - TString *n = luaS_new(ls->L, "break"); - int l = newlabelentry(ls, &ls->dyd->label, n, 0, ls->fs->pc); - findgotos(ls, &ls->dyd->label.arr[l]); -} - -/* -** generates an error for an undefined 'goto'; choose appropriate -** message when label name is a reserved word (which can only be 'break') -*/ -static l_noret undefgoto (LexState *ls, Labeldesc *gt) { - const char *msg = isreserved(gt->name) - ? "<%s> at line %d not inside a loop" - : "no visible label '%s' for at line %d"; - msg = luaO_pushfstring(ls->L, msg, getstr(gt->name), gt->line); - semerror(ls, msg); -} - - -static void leaveblock (FuncState *fs) { - BlockCnt *bl = fs->bl; - LexState *ls = fs->ls; - if (bl->previous && bl->upval) { - /* create a 'jump to here' to close upvalues */ - int j = luaK_jump(fs); - luaK_patchclose(fs, j, bl->nactvar); - luaK_patchtohere(fs, j); - } - if (bl->isloop) - breaklabel(ls); /* close pending breaks */ - fs->bl = bl->previous; - removevars(fs, bl->nactvar); - lua_assert(bl->nactvar == fs->nactvar); - fs->freereg = fs->nactvar; /* free registers */ - ls->dyd->label.n = bl->firstlabel; /* remove local labels */ - if (bl->previous) /* inner block? */ - movegotosout(fs, bl); /* update pending gotos to outer block */ - else if (bl->firstgoto < ls->dyd->gt.n) /* pending gotos in outer block? */ - undefgoto(ls, &ls->dyd->gt.arr[bl->firstgoto]); /* error */ -} - - -/* -** adds a new prototype into list of prototypes -*/ -static Proto *addprototype (LexState *ls) { - Proto *clp; - lua_State *L = ls->L; - FuncState *fs = ls->fs; - Proto *f = fs->f; /* prototype of current function */ - if (fs->np >= f->sizep) { - int oldsize = f->sizep; - luaM_growvector(L, f->p, fs->np, f->sizep, Proto *, MAXARG_Bx, "functions"); - while (oldsize < f->sizep) - f->p[oldsize++] = NULL; - } - f->p[fs->np++] = clp = luaF_newproto(L); - luaC_objbarrier(L, f, clp); - return clp; -} - - -/* -** codes instruction to create new closure in parent function. -** The OP_CLOSURE instruction must use the last available register, -** so that, if it invokes the GC, the GC knows which registers -** are in use at that time. -*/ -static void codeclosure (LexState *ls, expdesc *v) { - FuncState *fs = ls->fs->prev; - init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np - 1)); - luaK_exp2nextreg(fs, v); /* fix it at the last register */ -} - - -static void open_func (LexState *ls, FuncState *fs, BlockCnt *bl) { - Proto *f; - fs->prev = ls->fs; /* linked list of funcstates */ - fs->ls = ls; - ls->fs = fs; - fs->pc = 0; - fs->lasttarget = 0; - fs->jpc = NO_JUMP; - fs->freereg = 0; - fs->nk = 0; - fs->np = 0; - fs->nups = 0; - fs->nlocvars = 0; - fs->nactvar = 0; - fs->firstlocal = ls->dyd->actvar.n; - fs->bl = NULL; - f = fs->f; - f->source = ls->source; - f->maxstacksize = 2; /* registers 0/1 are always valid */ - enterblock(fs, bl, 0); -} - - -static void close_func (LexState *ls) { - lua_State *L = ls->L; - FuncState *fs = ls->fs; - Proto *f = fs->f; - luaK_ret(fs, 0, 0); /* final return */ - leaveblock(fs); - luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction); - f->sizecode = fs->pc; - luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int); - f->sizelineinfo = fs->pc; - luaM_reallocvector(L, f->k, f->sizek, fs->nk, TValue); - f->sizek = fs->nk; - luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *); - f->sizep = fs->np; - luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar); - f->sizelocvars = fs->nlocvars; - luaM_reallocvector(L, f->upvalues, f->sizeupvalues, fs->nups, Upvaldesc); - f->sizeupvalues = fs->nups; - lua_assert(fs->bl == NULL); - ls->fs = fs->prev; - luaC_checkGC(L); -} - - - -/*============================================================*/ -/* GRAMMAR RULES */ -/*============================================================*/ - - -/* -** check whether current token is in the follow set of a block. -** 'until' closes syntactical blocks, but do not close scope, -** so it is handled in separate. -*/ -static int block_follow (LexState *ls, int withuntil) { - switch (ls->t.token) { - case TK_ELSE: case TK_ELSEIF: - case TK_END: case TK_EOS: - return 1; - case TK_UNTIL: return withuntil; - default: return 0; - } -} - - -static void statlist (LexState *ls) { - /* statlist -> { stat [';'] } */ - while (!block_follow(ls, 1)) { - if (ls->t.token == TK_RETURN) { - statement(ls); - return; /* 'return' must be last statement */ - } - statement(ls); - } -} - - -static void fieldsel (LexState *ls, expdesc *v) { - /* fieldsel -> ['.' | ':'] NAME */ - FuncState *fs = ls->fs; - expdesc key; - luaK_exp2anyregup(fs, v); - luaX_next(ls); /* skip the dot or colon */ - checkname(ls, &key); - luaK_indexed(fs, v, &key); -} - - -static void yindex (LexState *ls, expdesc *v) { - /* index -> '[' expr ']' */ - luaX_next(ls); /* skip the '[' */ - expr(ls, v); - luaK_exp2val(ls->fs, v); - checknext(ls, ']'); -} - - -/* -** {====================================================================== -** Rules for Constructors -** ======================================================================= -*/ - - -struct ConsControl { - expdesc v; /* last list item read */ - expdesc *t; /* table descriptor */ - int nh; /* total number of 'record' elements */ - int na; /* total number of array elements */ - int tostore; /* number of array elements pending to be stored */ -}; - - -static void recfield (LexState *ls, struct ConsControl *cc) { - /* recfield -> (NAME | '['exp1']') = exp1 */ - FuncState *fs = ls->fs; - int reg = ls->fs->freereg; - expdesc key, val; - int rkkey; - if (ls->t.token == TK_NAME) { - checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); - checkname(ls, &key); - } - else /* ls->t.token == '[' */ - yindex(ls, &key); - cc->nh++; - checknext(ls, '='); - rkkey = luaK_exp2RK(fs, &key); - expr(ls, &val); - luaK_codeABC(fs, OP_SETTABLE, cc->t->u.info, rkkey, luaK_exp2RK(fs, &val)); - fs->freereg = reg; /* free registers */ -} - - -static void closelistfield (FuncState *fs, struct ConsControl *cc) { - if (cc->v.k == VVOID) return; /* there is no list item */ - luaK_exp2nextreg(fs, &cc->v); - cc->v.k = VVOID; - if (cc->tostore == LFIELDS_PER_FLUSH) { - luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore); /* flush */ - cc->tostore = 0; /* no more items pending */ - } -} - - -static void lastlistfield (FuncState *fs, struct ConsControl *cc) { - if (cc->tostore == 0) return; - if (hasmultret(cc->v.k)) { - luaK_setmultret(fs, &cc->v); - luaK_setlist(fs, cc->t->u.info, cc->na, LUA_MULTRET); - cc->na--; /* do not count last expression (unknown number of elements) */ - } - else { - if (cc->v.k != VVOID) - luaK_exp2nextreg(fs, &cc->v); - luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore); - } -} - - -static void listfield (LexState *ls, struct ConsControl *cc) { - /* listfield -> exp */ - expr(ls, &cc->v); - checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor"); - cc->na++; - cc->tostore++; -} - - -static void field (LexState *ls, struct ConsControl *cc) { - /* field -> listfield | recfield */ - switch(ls->t.token) { - case TK_NAME: { /* may be 'listfield' or 'recfield' */ - if (luaX_lookahead(ls) != '=') /* expression? */ - listfield(ls, cc); - else - recfield(ls, cc); - break; - } - case '[': { - recfield(ls, cc); - break; - } - default: { - listfield(ls, cc); - break; - } - } -} - - -static void constructor (LexState *ls, expdesc *t) { - /* constructor -> '{' [ field { sep field } [sep] ] '}' - sep -> ',' | ';' */ - FuncState *fs = ls->fs; - int line = ls->linenumber; - int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0); - struct ConsControl cc; - cc.na = cc.nh = cc.tostore = 0; - cc.t = t; - init_exp(t, VRELOCABLE, pc); - init_exp(&cc.v, VVOID, 0); /* no value (yet) */ - luaK_exp2nextreg(ls->fs, t); /* fix it at stack top */ - checknext(ls, '{'); - do { - lua_assert(cc.v.k == VVOID || cc.tostore > 0); - if (ls->t.token == '}') break; - closelistfield(fs, &cc); - field(ls, &cc); - } while (testnext(ls, ',') || testnext(ls, ';')); - check_match(ls, '}', '{', line); - lastlistfield(fs, &cc); - SETARG_B(fs->f->code[pc], luaO_int2fb(cc.na)); /* set initial array size */ - SETARG_C(fs->f->code[pc], luaO_int2fb(cc.nh)); /* set initial table size */ -} - -/* }====================================================================== */ - - - -static void parlist (LexState *ls) { - /* parlist -> [ param { ',' param } ] */ - FuncState *fs = ls->fs; - Proto *f = fs->f; - int nparams = 0; - f->is_vararg = 0; - if (ls->t.token != ')') { /* is 'parlist' not empty? */ - do { - switch (ls->t.token) { - case TK_NAME: { /* param -> NAME */ - new_localvar(ls, str_checkname(ls)); - nparams++; - break; - } - case TK_DOTS: { /* param -> '...' */ - luaX_next(ls); - f->is_vararg = 1; /* declared vararg */ - break; - } - default: luaX_syntaxerror(ls, " or '...' expected"); - } - } while (!f->is_vararg && testnext(ls, ',')); - } - adjustlocalvars(ls, nparams); - f->numparams = cast_byte(fs->nactvar); - luaK_reserveregs(fs, fs->nactvar); /* reserve register for parameters */ -} - - -static void body (LexState *ls, expdesc *e, int ismethod, int line) { - /* body -> '(' parlist ')' block END */ - FuncState new_fs; - BlockCnt bl; - new_fs.f = addprototype(ls); - new_fs.f->linedefined = line; - open_func(ls, &new_fs, &bl); - checknext(ls, '('); - if (ismethod) { - new_localvarliteral(ls, "self"); /* create 'self' parameter */ - adjustlocalvars(ls, 1); - } - parlist(ls); - checknext(ls, ')'); - statlist(ls); - new_fs.f->lastlinedefined = ls->linenumber; - check_match(ls, TK_END, TK_FUNCTION, line); - codeclosure(ls, e); - close_func(ls); -} - - -static int explist (LexState *ls, expdesc *v) { - /* explist -> expr { ',' expr } */ - int n = 1; /* at least one expression */ - expr(ls, v); - while (testnext(ls, ',')) { - luaK_exp2nextreg(ls->fs, v); - expr(ls, v); - n++; - } - return n; -} - - -static void funcargs (LexState *ls, expdesc *f, int line) { - FuncState *fs = ls->fs; - expdesc args; - int base, nparams; - switch (ls->t.token) { - case '(': { /* funcargs -> '(' [ explist ] ')' */ - luaX_next(ls); - if (ls->t.token == ')') /* arg list is empty? */ - args.k = VVOID; - else { - explist(ls, &args); - luaK_setmultret(fs, &args); - } - check_match(ls, ')', '(', line); - break; - } - case '{': { /* funcargs -> constructor */ - constructor(ls, &args); - break; - } - case TK_STRING: { /* funcargs -> STRING */ - codestring(ls, &args, ls->t.seminfo.ts); - luaX_next(ls); /* must use 'seminfo' before 'next' */ - break; - } - default: { - luaX_syntaxerror(ls, "function arguments expected"); - } - } - lua_assert(f->k == VNONRELOC); - base = f->u.info; /* base register for call */ - if (hasmultret(args.k)) - nparams = LUA_MULTRET; /* open call */ - else { - if (args.k != VVOID) - luaK_exp2nextreg(fs, &args); /* close last argument */ - nparams = fs->freereg - (base+1); - } - init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2)); - luaK_fixline(fs, line); - fs->freereg = base+1; /* call remove function and arguments and leaves - (unless changed) one result */ -} - - - - -/* -** {====================================================================== -** Expression parsing -** ======================================================================= -*/ - - -static void primaryexp (LexState *ls, expdesc *v) { - /* primaryexp -> NAME | '(' expr ')' */ - switch (ls->t.token) { - case '(': { - int line = ls->linenumber; - luaX_next(ls); - expr(ls, v); - check_match(ls, ')', '(', line); - luaK_dischargevars(ls->fs, v); - return; - } - case TK_NAME: { - singlevar(ls, v); - return; - } - default: { - luaX_syntaxerror(ls, "unexpected symbol"); - } - } -} - - -static void suffixedexp (LexState *ls, expdesc *v) { - /* suffixedexp -> - primaryexp { '.' NAME | '[' exp ']' | ':' NAME funcargs | funcargs } */ - FuncState *fs = ls->fs; - int line = ls->linenumber; - primaryexp(ls, v); - for (;;) { - switch (ls->t.token) { - case '.': { /* fieldsel */ - fieldsel(ls, v); - break; - } - case '[': { /* '[' exp1 ']' */ - expdesc key; - luaK_exp2anyregup(fs, v); - yindex(ls, &key); - luaK_indexed(fs, v, &key); - break; - } - case ':': { /* ':' NAME funcargs */ - expdesc key; - luaX_next(ls); - checkname(ls, &key); - luaK_self(fs, v, &key); - funcargs(ls, v, line); - break; - } - case '(': case TK_STRING: case '{': { /* funcargs */ - luaK_exp2nextreg(fs, v); - funcargs(ls, v, line); - break; - } - default: return; - } - } -} - - -static void simpleexp (LexState *ls, expdesc *v) { - /* simpleexp -> FLT | INT | STRING | NIL | TRUE | FALSE | ... | - constructor | FUNCTION body | suffixedexp */ - switch (ls->t.token) { - case TK_FLT: { - init_exp(v, VKFLT, 0); - v->u.nval = ls->t.seminfo.r; - break; - } - case TK_INT: { - init_exp(v, VKINT, 0); - v->u.ival = ls->t.seminfo.i; - break; - } - case TK_STRING: { - codestring(ls, v, ls->t.seminfo.ts); - break; - } - case TK_NIL: { - init_exp(v, VNIL, 0); - break; - } - case TK_TRUE: { - init_exp(v, VTRUE, 0); - break; - } - case TK_FALSE: { - init_exp(v, VFALSE, 0); - break; - } - case TK_DOTS: { /* vararg */ - FuncState *fs = ls->fs; - check_condition(ls, fs->f->is_vararg, - "cannot use '...' outside a vararg function"); - init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0)); - break; - } - case '{': { /* constructor */ - constructor(ls, v); - return; - } - case TK_FUNCTION: { - luaX_next(ls); - body(ls, v, 0, ls->linenumber); - return; - } - default: { - suffixedexp(ls, v); - return; - } - } - luaX_next(ls); -} - - -static UnOpr getunopr (int op) { - switch (op) { - case TK_NOT: return OPR_NOT; - case '-': return OPR_MINUS; - case '~': return OPR_BNOT; - case '#': return OPR_LEN; - default: return OPR_NOUNOPR; - } -} - - -static BinOpr getbinopr (int op) { - switch (op) { - case '+': return OPR_ADD; - case '-': return OPR_SUB; - case '*': return OPR_MUL; - case '%': return OPR_MOD; - case '^': return OPR_POW; - case '/': return OPR_DIV; - case TK_IDIV: return OPR_IDIV; - case '&': return OPR_BAND; - case '|': return OPR_BOR; - case '~': return OPR_BXOR; - case TK_SHL: return OPR_SHL; - case TK_SHR: return OPR_SHR; - case TK_CONCAT: return OPR_CONCAT; - case TK_NE: return OPR_NE; - case TK_EQ: return OPR_EQ; - case '<': return OPR_LT; - case TK_LE: return OPR_LE; - case '>': return OPR_GT; - case TK_GE: return OPR_GE; - case TK_AND: return OPR_AND; - case TK_OR: return OPR_OR; - default: return OPR_NOBINOPR; - } -} - - -static const struct { - lu_byte left; /* left priority for each binary operator */ - lu_byte right; /* right priority */ -} priority[] = { /* ORDER OPR */ - {10, 10}, {10, 10}, /* '+' '-' */ - {11, 11}, {11, 11}, /* '*' '%' */ - {14, 13}, /* '^' (right associative) */ - {11, 11}, {11, 11}, /* '/' '//' */ - {6, 6}, {4, 4}, {5, 5}, /* '&' '|' '~' */ - {7, 7}, {7, 7}, /* '<<' '>>' */ - {9, 8}, /* '..' (right associative) */ - {3, 3}, {3, 3}, {3, 3}, /* ==, <, <= */ - {3, 3}, {3, 3}, {3, 3}, /* ~=, >, >= */ - {2, 2}, {1, 1} /* and, or */ -}; - -#define UNARY_PRIORITY 12 /* priority for unary operators */ - - -/* -** subexpr -> (simpleexp | unop subexpr) { binop subexpr } -** where 'binop' is any binary operator with a priority higher than 'limit' -*/ -static BinOpr subexpr (LexState *ls, expdesc *v, int limit) { - BinOpr op; - UnOpr uop; - enterlevel(ls); - uop = getunopr(ls->t.token); - if (uop != OPR_NOUNOPR) { - int line = ls->linenumber; - luaX_next(ls); - subexpr(ls, v, UNARY_PRIORITY); - luaK_prefix(ls->fs, uop, v, line); - } - else simpleexp(ls, v); - /* expand while operators have priorities higher than 'limit' */ - op = getbinopr(ls->t.token); - while (op != OPR_NOBINOPR && priority[op].left > limit) { - expdesc v2; - BinOpr nextop; - int line = ls->linenumber; - luaX_next(ls); - luaK_infix(ls->fs, op, v); - /* read sub-expression with higher priority */ - nextop = subexpr(ls, &v2, priority[op].right); - luaK_posfix(ls->fs, op, v, &v2, line); - op = nextop; - } - leavelevel(ls); - return op; /* return first untreated operator */ -} - - -static void expr (LexState *ls, expdesc *v) { - subexpr(ls, v, 0); -} - -/* }==================================================================== */ - - - -/* -** {====================================================================== -** Rules for Statements -** ======================================================================= -*/ - - -static void block (LexState *ls) { - /* block -> statlist */ - FuncState *fs = ls->fs; - BlockCnt bl; - enterblock(fs, &bl, 0); - statlist(ls); - leaveblock(fs); -} - - -/* -** structure to chain all variables in the left-hand side of an -** assignment -*/ -struct LHS_assign { - struct LHS_assign *prev; - expdesc v; /* variable (global, local, upvalue, or indexed) */ -}; - - -/* -** check whether, in an assignment to an upvalue/local variable, the -** upvalue/local variable is begin used in a previous assignment to a -** table. If so, save original upvalue/local value in a safe place and -** use this safe copy in the previous assignment. -*/ -static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) { - FuncState *fs = ls->fs; - int extra = fs->freereg; /* eventual position to save local variable */ - int conflict = 0; - for (; lh; lh = lh->prev) { /* check all previous assignments */ - if (lh->v.k == VINDEXED) { /* assigning to a table? */ - /* table is the upvalue/local being assigned now? */ - if (lh->v.u.ind.vt == v->k && lh->v.u.ind.t == v->u.info) { - conflict = 1; - lh->v.u.ind.vt = VLOCAL; - lh->v.u.ind.t = extra; /* previous assignment will use safe copy */ - } - /* index is the local being assigned? (index cannot be upvalue) */ - if (v->k == VLOCAL && lh->v.u.ind.idx == v->u.info) { - conflict = 1; - lh->v.u.ind.idx = extra; /* previous assignment will use safe copy */ - } - } - } - if (conflict) { - /* copy upvalue/local value to a temporary (in position 'extra') */ - OpCode op = (v->k == VLOCAL) ? OP_MOVE : OP_GETUPVAL; - luaK_codeABC(fs, op, extra, v->u.info, 0); - luaK_reserveregs(fs, 1); - } -} - - -static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) { - expdesc e; - check_condition(ls, vkisvar(lh->v.k), "syntax error"); - if (testnext(ls, ',')) { /* assignment -> ',' suffixedexp assignment */ - struct LHS_assign nv; - nv.prev = lh; - suffixedexp(ls, &nv.v); - if (nv.v.k != VINDEXED) - check_conflict(ls, lh, &nv.v); - checklimit(ls->fs, nvars + ls->L->nCcalls, LUAI_MAXCCALLS, - "C levels"); - assignment(ls, &nv, nvars+1); - } - else { /* assignment -> '=' explist */ - int nexps; - checknext(ls, '='); - nexps = explist(ls, &e); - if (nexps != nvars) - adjust_assign(ls, nvars, nexps, &e); - else { - luaK_setoneret(ls->fs, &e); /* close last expression */ - luaK_storevar(ls->fs, &lh->v, &e); - return; /* avoid default */ - } - } - init_exp(&e, VNONRELOC, ls->fs->freereg-1); /* default assignment */ - luaK_storevar(ls->fs, &lh->v, &e); -} - - -static int cond (LexState *ls) { - /* cond -> exp */ - expdesc v; - expr(ls, &v); /* read condition */ - if (v.k == VNIL) v.k = VFALSE; /* 'falses' are all equal here */ - luaK_goiftrue(ls->fs, &v); - return v.f; -} - - -static void gotostat (LexState *ls, int pc) { - int line = ls->linenumber; - TString *label; - int g; - if (testnext(ls, TK_GOTO)) - label = str_checkname(ls); - else { - luaX_next(ls); /* skip break */ - label = luaS_new(ls->L, "break"); - } - g = newlabelentry(ls, &ls->dyd->gt, label, line, pc); - findlabel(ls, g); /* close it if label already defined */ -} - - -/* check for repeated labels on the same block */ -static void checkrepeated (FuncState *fs, Labellist *ll, TString *label) { - int i; - for (i = fs->bl->firstlabel; i < ll->n; i++) { - if (eqstr(label, ll->arr[i].name)) { - const char *msg = luaO_pushfstring(fs->ls->L, - "label '%s' already defined on line %d", - getstr(label), ll->arr[i].line); - semerror(fs->ls, msg); - } - } -} - - -/* skip no-op statements */ -static void skipnoopstat (LexState *ls) { - while (ls->t.token == ';' || ls->t.token == TK_DBCOLON) - statement(ls); -} - - -static void labelstat (LexState *ls, TString *label, int line) { - /* label -> '::' NAME '::' */ - FuncState *fs = ls->fs; - Labellist *ll = &ls->dyd->label; - int l; /* index of new label being created */ - checkrepeated(fs, ll, label); /* check for repeated labels */ - checknext(ls, TK_DBCOLON); /* skip double colon */ - /* create new entry for this label */ - l = newlabelentry(ls, ll, label, line, luaK_getlabel(fs)); - skipnoopstat(ls); /* skip other no-op statements */ - if (block_follow(ls, 0)) { /* label is last no-op statement in the block? */ - /* assume that locals are already out of scope */ - ll->arr[l].nactvar = fs->bl->nactvar; - } - findgotos(ls, &ll->arr[l]); -} - - -static void whilestat (LexState *ls, int line) { - /* whilestat -> WHILE cond DO block END */ - FuncState *fs = ls->fs; - int whileinit; - int condexit; - BlockCnt bl; - luaX_next(ls); /* skip WHILE */ - whileinit = luaK_getlabel(fs); - condexit = cond(ls); - enterblock(fs, &bl, 1); - checknext(ls, TK_DO); - block(ls); - luaK_jumpto(fs, whileinit); - check_match(ls, TK_END, TK_WHILE, line); - leaveblock(fs); - luaK_patchtohere(fs, condexit); /* false conditions finish the loop */ -} - - -static void repeatstat (LexState *ls, int line) { - /* repeatstat -> REPEAT block UNTIL cond */ - int condexit; - FuncState *fs = ls->fs; - int repeat_init = luaK_getlabel(fs); - BlockCnt bl1, bl2; - enterblock(fs, &bl1, 1); /* loop block */ - enterblock(fs, &bl2, 0); /* scope block */ - luaX_next(ls); /* skip REPEAT */ - statlist(ls); - check_match(ls, TK_UNTIL, TK_REPEAT, line); - condexit = cond(ls); /* read condition (inside scope block) */ - if (bl2.upval) /* upvalues? */ - luaK_patchclose(fs, condexit, bl2.nactvar); - leaveblock(fs); /* finish scope */ - luaK_patchlist(fs, condexit, repeat_init); /* close the loop */ - leaveblock(fs); /* finish loop */ -} - - -static int exp1 (LexState *ls) { - expdesc e; - int reg; - expr(ls, &e); - luaK_exp2nextreg(ls->fs, &e); - lua_assert(e.k == VNONRELOC); - reg = e.u.info; - return reg; -} - - -static void forbody (LexState *ls, int base, int line, int nvars, int isnum) { - /* forbody -> DO block */ - BlockCnt bl; - FuncState *fs = ls->fs; - int prep, endfor; - adjustlocalvars(ls, 3); /* control variables */ - checknext(ls, TK_DO); - prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs); - enterblock(fs, &bl, 0); /* scope for declared variables */ - adjustlocalvars(ls, nvars); - luaK_reserveregs(fs, nvars); - block(ls); - leaveblock(fs); /* end of scope for declared variables */ - luaK_patchtohere(fs, prep); - if (isnum) /* numeric for? */ - endfor = luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP); - else { /* generic for */ - luaK_codeABC(fs, OP_TFORCALL, base, 0, nvars); - luaK_fixline(fs, line); - endfor = luaK_codeAsBx(fs, OP_TFORLOOP, base + 2, NO_JUMP); - } - luaK_patchlist(fs, endfor, prep + 1); - luaK_fixline(fs, line); -} - - -static void fornum (LexState *ls, TString *varname, int line) { - /* fornum -> NAME = exp1,exp1[,exp1] forbody */ - FuncState *fs = ls->fs; - int base = fs->freereg; - new_localvarliteral(ls, "(for index)"); - new_localvarliteral(ls, "(for limit)"); - new_localvarliteral(ls, "(for step)"); - new_localvar(ls, varname); - checknext(ls, '='); - exp1(ls); /* initial value */ - checknext(ls, ','); - exp1(ls); /* limit */ - if (testnext(ls, ',')) - exp1(ls); /* optional step */ - else { /* default step = 1 */ - luaK_codek(fs, fs->freereg, luaK_intK(fs, 1)); - luaK_reserveregs(fs, 1); - } - forbody(ls, base, line, 1, 1); -} - - -static void forlist (LexState *ls, TString *indexname) { - /* forlist -> NAME {,NAME} IN explist forbody */ - FuncState *fs = ls->fs; - expdesc e; - int nvars = 4; /* gen, state, control, plus at least one declared var */ - int line; - int base = fs->freereg; - /* create control variables */ - new_localvarliteral(ls, "(for generator)"); - new_localvarliteral(ls, "(for state)"); - new_localvarliteral(ls, "(for control)"); - /* create declared variables */ - new_localvar(ls, indexname); - while (testnext(ls, ',')) { - new_localvar(ls, str_checkname(ls)); - nvars++; - } - checknext(ls, TK_IN); - line = ls->linenumber; - adjust_assign(ls, 3, explist(ls, &e), &e); - luaK_checkstack(fs, 3); /* extra space to call generator */ - forbody(ls, base, line, nvars - 3, 0); -} - - -static void forstat (LexState *ls, int line) { - /* forstat -> FOR (fornum | forlist) END */ - FuncState *fs = ls->fs; - TString *varname; - BlockCnt bl; - enterblock(fs, &bl, 1); /* scope for loop and control variables */ - luaX_next(ls); /* skip 'for' */ - varname = str_checkname(ls); /* first variable name */ - switch (ls->t.token) { - case '=': fornum(ls, varname, line); break; - case ',': case TK_IN: forlist(ls, varname); break; - default: luaX_syntaxerror(ls, "'=' or 'in' expected"); - } - check_match(ls, TK_END, TK_FOR, line); - leaveblock(fs); /* loop scope ('break' jumps to this point) */ -} - - -static void test_then_block (LexState *ls, int *escapelist) { - /* test_then_block -> [IF | ELSEIF] cond THEN block */ - BlockCnt bl; - FuncState *fs = ls->fs; - expdesc v; - int jf; /* instruction to skip 'then' code (if condition is false) */ - luaX_next(ls); /* skip IF or ELSEIF */ - expr(ls, &v); /* read condition */ - checknext(ls, TK_THEN); - if (ls->t.token == TK_GOTO || ls->t.token == TK_BREAK) { - luaK_goiffalse(ls->fs, &v); /* will jump to label if condition is true */ - enterblock(fs, &bl, 0); /* must enter block before 'goto' */ - gotostat(ls, v.t); /* handle goto/break */ - skipnoopstat(ls); /* skip other no-op statements */ - if (block_follow(ls, 0)) { /* 'goto' is the entire block? */ - leaveblock(fs); - return; /* and that is it */ - } - else /* must skip over 'then' part if condition is false */ - jf = luaK_jump(fs); - } - else { /* regular case (not goto/break) */ - luaK_goiftrue(ls->fs, &v); /* skip over block if condition is false */ - enterblock(fs, &bl, 0); - jf = v.f; - } - statlist(ls); /* 'then' part */ - leaveblock(fs); - if (ls->t.token == TK_ELSE || - ls->t.token == TK_ELSEIF) /* followed by 'else'/'elseif'? */ - luaK_concat(fs, escapelist, luaK_jump(fs)); /* must jump over it */ - luaK_patchtohere(fs, jf); -} - - -static void ifstat (LexState *ls, int line) { - /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */ - FuncState *fs = ls->fs; - int escapelist = NO_JUMP; /* exit list for finished parts */ - test_then_block(ls, &escapelist); /* IF cond THEN block */ - while (ls->t.token == TK_ELSEIF) - test_then_block(ls, &escapelist); /* ELSEIF cond THEN block */ - if (testnext(ls, TK_ELSE)) - block(ls); /* 'else' part */ - check_match(ls, TK_END, TK_IF, line); - luaK_patchtohere(fs, escapelist); /* patch escape list to 'if' end */ -} - - -static void localfunc (LexState *ls) { - expdesc b; - FuncState *fs = ls->fs; - new_localvar(ls, str_checkname(ls)); /* new local variable */ - adjustlocalvars(ls, 1); /* enter its scope */ - body(ls, &b, 0, ls->linenumber); /* function created in next register */ - /* debug information will only see the variable after this point! */ - getlocvar(fs, b.u.info)->startpc = fs->pc; -} - - -static void localstat (LexState *ls) { - /* stat -> LOCAL NAME {',' NAME} ['=' explist] */ - int nvars = 0; - int nexps; - expdesc e; - do { - new_localvar(ls, str_checkname(ls)); - nvars++; - } while (testnext(ls, ',')); - if (testnext(ls, '=')) - nexps = explist(ls, &e); - else { - e.k = VVOID; - nexps = 0; - } - adjust_assign(ls, nvars, nexps, &e); - adjustlocalvars(ls, nvars); -} - - -static int funcname (LexState *ls, expdesc *v) { - /* funcname -> NAME {fieldsel} [':' NAME] */ - int ismethod = 0; - singlevar(ls, v); - while (ls->t.token == '.') - fieldsel(ls, v); - if (ls->t.token == ':') { - ismethod = 1; - fieldsel(ls, v); - } - return ismethod; -} - - -static void funcstat (LexState *ls, int line) { - /* funcstat -> FUNCTION funcname body */ - int ismethod; - expdesc v, b; - luaX_next(ls); /* skip FUNCTION */ - ismethod = funcname(ls, &v); - body(ls, &b, ismethod, line); - luaK_storevar(ls->fs, &v, &b); - luaK_fixline(ls->fs, line); /* definition "happens" in the first line */ -} - - -static void exprstat (LexState *ls) { - /* stat -> func | assignment */ - FuncState *fs = ls->fs; - struct LHS_assign v; - suffixedexp(ls, &v.v); - if (ls->t.token == '=' || ls->t.token == ',') { /* stat -> assignment ? */ - v.prev = NULL; - assignment(ls, &v, 1); - } - else { /* stat -> func */ - check_condition(ls, v.v.k == VCALL, "syntax error"); - SETARG_C(getinstruction(fs, &v.v), 1); /* call statement uses no results */ - } -} - - -static void retstat (LexState *ls) { - /* stat -> RETURN [explist] [';'] */ - FuncState *fs = ls->fs; - expdesc e; - int first, nret; /* registers with returned values */ - if (block_follow(ls, 1) || ls->t.token == ';') - first = nret = 0; /* return no values */ - else { - nret = explist(ls, &e); /* optional return values */ - if (hasmultret(e.k)) { - luaK_setmultret(fs, &e); - if (e.k == VCALL && nret == 1) { /* tail call? */ - SET_OPCODE(getinstruction(fs,&e), OP_TAILCALL); - lua_assert(GETARG_A(getinstruction(fs,&e)) == fs->nactvar); - } - first = fs->nactvar; - nret = LUA_MULTRET; /* return all values */ - } - else { - if (nret == 1) /* only one single value? */ - first = luaK_exp2anyreg(fs, &e); - else { - luaK_exp2nextreg(fs, &e); /* values must go to the stack */ - first = fs->nactvar; /* return all active values */ - lua_assert(nret == fs->freereg - first); - } - } - } - luaK_ret(fs, first, nret); - testnext(ls, ';'); /* skip optional semicolon */ -} - - -static void statement (LexState *ls) { - int line = ls->linenumber; /* may be needed for error messages */ - enterlevel(ls); - switch (ls->t.token) { - case ';': { /* stat -> ';' (empty statement) */ - luaX_next(ls); /* skip ';' */ - break; - } - case TK_IF: { /* stat -> ifstat */ - ifstat(ls, line); - break; - } - case TK_WHILE: { /* stat -> whilestat */ - whilestat(ls, line); - break; - } - case TK_DO: { /* stat -> DO block END */ - luaX_next(ls); /* skip DO */ - block(ls); - check_match(ls, TK_END, TK_DO, line); - break; - } - case TK_FOR: { /* stat -> forstat */ - forstat(ls, line); - break; - } - case TK_REPEAT: { /* stat -> repeatstat */ - repeatstat(ls, line); - break; - } - case TK_FUNCTION: { /* stat -> funcstat */ - funcstat(ls, line); - break; - } - case TK_LOCAL: { /* stat -> localstat */ - luaX_next(ls); /* skip LOCAL */ - if (testnext(ls, TK_FUNCTION)) /* local function? */ - localfunc(ls); - else - localstat(ls); - break; - } - case TK_DBCOLON: { /* stat -> label */ - luaX_next(ls); /* skip double colon */ - labelstat(ls, str_checkname(ls), line); - break; - } - case TK_RETURN: { /* stat -> retstat */ - luaX_next(ls); /* skip RETURN */ - retstat(ls); - break; - } - case TK_BREAK: /* stat -> breakstat */ - case TK_GOTO: { /* stat -> 'goto' NAME */ - gotostat(ls, luaK_jump(ls->fs)); - break; - } - default: { /* stat -> func | assignment */ - exprstat(ls); - break; - } - } - lua_assert(ls->fs->f->maxstacksize >= ls->fs->freereg && - ls->fs->freereg >= ls->fs->nactvar); - ls->fs->freereg = ls->fs->nactvar; /* free registers */ - leavelevel(ls); -} - -/* }====================================================================== */ - - -/* -** compiles the main function, which is a regular vararg function with an -** upvalue named LUA_ENV -*/ -static void mainfunc (LexState *ls, FuncState *fs) { - BlockCnt bl; - expdesc v; - open_func(ls, fs, &bl); - fs->f->is_vararg = 1; /* main function is always declared vararg */ - init_exp(&v, VLOCAL, 0); /* create and... */ - newupvalue(fs, ls->envn, &v); /* ...set environment upvalue */ - luaX_next(ls); /* read first token */ - statlist(ls); /* parse main body */ - check(ls, TK_EOS); - close_func(ls); -} - - -LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, - Dyndata *dyd, const char *name, int firstchar) { - LexState lexstate; - FuncState funcstate; - LClosure *cl = luaF_newLclosure(L, 1); /* create main closure */ - setclLvalue(L, L->top, cl); /* anchor it (to avoid being collected) */ - luaD_inctop(L); - lexstate.h = luaH_new(L); /* create table for scanner */ - sethvalue(L, L->top, lexstate.h); /* anchor it */ - luaD_inctop(L); - funcstate.f = cl->p = luaF_newproto(L); - funcstate.f->source = luaS_new(L, name); /* create and anchor TString */ - lua_assert(iswhite(funcstate.f)); /* do not need barrier here */ - lexstate.buff = buff; - lexstate.dyd = dyd; - dyd->actvar.n = dyd->gt.n = dyd->label.n = 0; - luaX_setinput(L, &lexstate, z, funcstate.f->source, firstchar); - mainfunc(&lexstate, &funcstate); - lua_assert(!funcstate.prev && funcstate.nups == 1 && !lexstate.fs); - /* all scopes should be correctly finished */ - lua_assert(dyd->actvar.n == 0 && dyd->gt.n == 0 && dyd->label.n == 0); - L->top--; /* remove scanner's table */ - return cl; /* closure is on the stack, too */ -} - diff --git a/LuaSkin/lua-5.3.4/src/lparser.h b/LuaSkin/lua-5.3.4/src/lparser.h deleted file mode 100644 index 02e9b03ae..000000000 --- a/LuaSkin/lua-5.3.4/src/lparser.h +++ /dev/null @@ -1,133 +0,0 @@ -/* -** $Id: lparser.h,v 1.76 2015/12/30 18:16:13 roberto Exp $ -** Lua Parser -** See Copyright Notice in lua.h -*/ - -#ifndef lparser_h -#define lparser_h - -#include "llimits.h" -#include "lobject.h" -#include "lzio.h" - - -/* -** Expression and variable descriptor. -** Code generation for variables and expressions can be delayed to allow -** optimizations; An 'expdesc' structure describes a potentially-delayed -** variable/expression. It has a description of its "main" value plus a -** list of conditional jumps that can also produce its value (generated -** by short-circuit operators 'and'/'or'). -*/ - -/* kinds of variables/expressions */ -typedef enum { - VVOID, /* when 'expdesc' describes the last expression a list, - this kind means an empty list (so, no expression) */ - VNIL, /* constant nil */ - VTRUE, /* constant true */ - VFALSE, /* constant false */ - VK, /* constant in 'k'; info = index of constant in 'k' */ - VKFLT, /* floating constant; nval = numerical float value */ - VKINT, /* integer constant; nval = numerical integer value */ - VNONRELOC, /* expression has its value in a fixed register; - info = result register */ - VLOCAL, /* local variable; info = local register */ - VUPVAL, /* upvalue variable; info = index of upvalue in 'upvalues' */ - VINDEXED, /* indexed variable; - ind.vt = whether 't' is register or upvalue; - ind.t = table register or upvalue; - ind.idx = key's R/K index */ - VJMP, /* expression is a test/comparison; - info = pc of corresponding jump instruction */ - VRELOCABLE, /* expression can put result in any register; - info = instruction pc */ - VCALL, /* expression is a function call; info = instruction pc */ - VVARARG /* vararg expression; info = instruction pc */ -} expkind; - - -#define vkisvar(k) (VLOCAL <= (k) && (k) <= VINDEXED) -#define vkisinreg(k) ((k) == VNONRELOC || (k) == VLOCAL) - -typedef struct expdesc { - expkind k; - union { - lua_Integer ival; /* for VKINT */ - lua_Number nval; /* for VKFLT */ - int info; /* for generic use */ - struct { /* for indexed variables (VINDEXED) */ - short idx; /* index (R/K) */ - lu_byte t; /* table (register or upvalue) */ - lu_byte vt; /* whether 't' is register (VLOCAL) or upvalue (VUPVAL) */ - } ind; - } u; - int t; /* patch list of 'exit when true' */ - int f; /* patch list of 'exit when false' */ -} expdesc; - - -/* description of active local variable */ -typedef struct Vardesc { - short idx; /* variable index in stack */ -} Vardesc; - - -/* description of pending goto statements and label statements */ -typedef struct Labeldesc { - TString *name; /* label identifier */ - int pc; /* position in code */ - int line; /* line where it appeared */ - lu_byte nactvar; /* local level where it appears in current block */ -} Labeldesc; - - -/* list of labels or gotos */ -typedef struct Labellist { - Labeldesc *arr; /* array */ - int n; /* number of entries in use */ - int size; /* array size */ -} Labellist; - - -/* dynamic structures used by the parser */ -typedef struct Dyndata { - struct { /* list of active local variables */ - Vardesc *arr; - int n; - int size; - } actvar; - Labellist gt; /* list of pending gotos */ - Labellist label; /* list of active labels */ -} Dyndata; - - -/* control of blocks */ -struct BlockCnt; /* defined in lparser.c */ - - -/* state needed to generate code for a given function */ -typedef struct FuncState { - Proto *f; /* current function header */ - struct FuncState *prev; /* enclosing function */ - struct LexState *ls; /* lexical state */ - struct BlockCnt *bl; /* chain of current blocks */ - int pc; /* next position to code (equivalent to 'ncode') */ - int lasttarget; /* 'label' of last 'jump label' */ - int jpc; /* list of pending jumps to 'pc' */ - int nk; /* number of elements in 'k' */ - int np; /* number of elements in 'p' */ - int firstlocal; /* index of first local var (in Dyndata array) */ - short nlocvars; /* number of elements in 'f->locvars' */ - lu_byte nactvar; /* number of active local variables */ - lu_byte nups; /* number of upvalues */ - lu_byte freereg; /* first free register */ -} FuncState; - - -LUAI_FUNC LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, - Dyndata *dyd, const char *name, int firstchar); - - -#endif diff --git a/LuaSkin/lua-5.3.4/src/lstate.c b/LuaSkin/lua-5.3.4/src/lstate.c deleted file mode 100644 index 9194ac341..000000000 --- a/LuaSkin/lua-5.3.4/src/lstate.c +++ /dev/null @@ -1,347 +0,0 @@ -/* -** $Id: lstate.c,v 2.133 2015/11/13 12:16:51 roberto Exp $ -** Global State -** See Copyright Notice in lua.h -*/ - -#define lstate_c -#define LUA_CORE - -#include "lprefix.h" - - -#include -#include - -#include "lua.h" - -#include "lapi.h" -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lgc.h" -#include "llex.h" -#include "lmem.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" - - -#if !defined(LUAI_GCPAUSE) -#define LUAI_GCPAUSE 200 /* 200% */ -#endif - -#if !defined(LUAI_GCMUL) -#define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ -#endif - - -/* -** a macro to help the creation of a unique random seed when a state is -** created; the seed is used to randomize hashes. -*/ -#if !defined(luai_makeseed) -#include -#define luai_makeseed() cast(unsigned int, time(NULL)) -#endif - - - -/* -** thread state + extra space -*/ -typedef struct LX { - lu_byte extra_[LUA_EXTRASPACE]; - lua_State l; -} LX; - - -/* -** Main thread combines a thread state and the global state -*/ -typedef struct LG { - LX l; - global_State g; -} LG; - - - -#define fromstate(L) (cast(LX *, cast(lu_byte *, (L)) - offsetof(LX, l))) - - -/* -** Compute an initial seed as random as possible. Rely on Address Space -** Layout Randomization (if present) to increase randomness.. -*/ -#define addbuff(b,p,e) \ - { size_t t = cast(size_t, e); \ - memcpy(b + p, &t, sizeof(t)); p += sizeof(t); } - -static unsigned int makeseed (lua_State *L) { - char buff[4 * sizeof(size_t)]; - unsigned int h = luai_makeseed(); - int p = 0; - addbuff(buff, p, L); /* heap variable */ - addbuff(buff, p, &h); /* local variable */ - addbuff(buff, p, luaO_nilobject); /* global variable */ - addbuff(buff, p, &lua_newstate); /* public function */ - lua_assert(p == sizeof(buff)); - return luaS_hash(buff, p, h); -} - - -/* -** set GCdebt to a new value keeping the value (totalbytes + GCdebt) -** invariant (and avoiding underflows in 'totalbytes') -*/ -void luaE_setdebt (global_State *g, l_mem debt) { - l_mem tb = gettotalbytes(g); - lua_assert(tb > 0); - if (debt < tb - MAX_LMEM) - debt = tb - MAX_LMEM; /* will make 'totalbytes == MAX_LMEM' */ - g->totalbytes = tb - debt; - g->GCdebt = debt; -} - - -CallInfo *luaE_extendCI (lua_State *L) { - CallInfo *ci = luaM_new(L, CallInfo); - lua_assert(L->ci->next == NULL); - L->ci->next = ci; - ci->previous = L->ci; - ci->next = NULL; - L->nci++; - return ci; -} - - -/* -** free all CallInfo structures not in use by a thread -*/ -void luaE_freeCI (lua_State *L) { - CallInfo *ci = L->ci; - CallInfo *next = ci->next; - ci->next = NULL; - while ((ci = next) != NULL) { - next = ci->next; - luaM_free(L, ci); - L->nci--; - } -} - - -/* -** free half of the CallInfo structures not in use by a thread -*/ -void luaE_shrinkCI (lua_State *L) { - CallInfo *ci = L->ci; - CallInfo *next2; /* next's next */ - /* while there are two nexts */ - while (ci->next != NULL && (next2 = ci->next->next) != NULL) { - luaM_free(L, ci->next); /* free next */ - L->nci--; - ci->next = next2; /* remove 'next' from the list */ - next2->previous = ci; - ci = next2; /* keep next's next */ - } -} - - -static void stack_init (lua_State *L1, lua_State *L) { - int i; CallInfo *ci; - /* initialize stack array */ - L1->stack = luaM_newvector(L, BASIC_STACK_SIZE, TValue); - L1->stacksize = BASIC_STACK_SIZE; - for (i = 0; i < BASIC_STACK_SIZE; i++) - setnilvalue(L1->stack + i); /* erase new stack */ - L1->top = L1->stack; - L1->stack_last = L1->stack + L1->stacksize - EXTRA_STACK; - /* initialize first ci */ - ci = &L1->base_ci; - ci->next = ci->previous = NULL; - ci->callstatus = 0; - ci->func = L1->top; - setnilvalue(L1->top++); /* 'function' entry for this 'ci' */ - ci->top = L1->top + LUA_MINSTACK; - L1->ci = ci; -} - - -static void freestack (lua_State *L) { - if (L->stack == NULL) - return; /* stack not completely built yet */ - L->ci = &L->base_ci; /* free the entire 'ci' list */ - luaE_freeCI(L); - lua_assert(L->nci == 0); - luaM_freearray(L, L->stack, L->stacksize); /* free stack array */ -} - - -/* -** Create registry table and its predefined values -*/ -static void init_registry (lua_State *L, global_State *g) { - TValue temp; - /* create registry */ - Table *registry = luaH_new(L); - sethvalue(L, &g->l_registry, registry); - luaH_resize(L, registry, LUA_RIDX_LAST, 0); - /* registry[LUA_RIDX_MAINTHREAD] = L */ - setthvalue(L, &temp, L); /* temp = L */ - luaH_setint(L, registry, LUA_RIDX_MAINTHREAD, &temp); - /* registry[LUA_RIDX_GLOBALS] = table of globals */ - sethvalue(L, &temp, luaH_new(L)); /* temp = new table (global table) */ - luaH_setint(L, registry, LUA_RIDX_GLOBALS, &temp); -} - - -/* -** open parts of the state that may cause memory-allocation errors. -** ('g->version' != NULL flags that the state was completely build) -*/ -static void f_luaopen (lua_State *L, void *ud) { - global_State *g = G(L); - UNUSED(ud); - stack_init(L, L); /* init stack */ - init_registry(L, g); - luaS_init(L); - luaT_init(L); - luaX_init(L); - g->gcrunning = 1; /* allow gc */ - g->version = lua_version(NULL); - luai_userstateopen(L); -} - - -/* -** preinitialize a thread with consistent values without allocating -** any memory (to avoid errors) -*/ -static void preinit_thread (lua_State *L, global_State *g) { - G(L) = g; - L->stack = NULL; - L->ci = NULL; - L->nci = 0; - L->stacksize = 0; - L->twups = L; /* thread has no upvalues */ - L->errorJmp = NULL; - L->nCcalls = 0; - L->hook = NULL; - L->hookmask = 0; - L->basehookcount = 0; - L->allowhook = 1; - resethookcount(L); - L->openupval = NULL; - L->nny = 1; - L->status = LUA_OK; - L->errfunc = 0; -} - - -static void close_state (lua_State *L) { - global_State *g = G(L); - luaF_close(L, L->stack); /* close all upvalues for this thread */ - luaC_freeallobjects(L); /* collect all objects */ - if (g->version) /* closing a fully built state? */ - luai_userstateclose(L); - luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size); - freestack(L); - lua_assert(gettotalbytes(g) == sizeof(LG)); - (*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0); /* free main block */ -} - - -LUA_API lua_State *lua_newthread (lua_State *L) { - global_State *g = G(L); - lua_State *L1; - lua_lock(L); - luaC_checkGC(L); - /* create new thread */ - L1 = &cast(LX *, luaM_newobject(L, LUA_TTHREAD, sizeof(LX)))->l; - L1->marked = luaC_white(g); - L1->tt = LUA_TTHREAD; - /* link it on list 'allgc' */ - L1->next = g->allgc; - g->allgc = obj2gco(L1); - /* anchor it on L stack */ - setthvalue(L, L->top, L1); - api_incr_top(L); - preinit_thread(L1, g); - L1->hookmask = L->hookmask; - L1->basehookcount = L->basehookcount; - L1->hook = L->hook; - resethookcount(L1); - /* initialize L1 extra space */ - memcpy(lua_getextraspace(L1), lua_getextraspace(g->mainthread), - LUA_EXTRASPACE); - luai_userstatethread(L, L1); - stack_init(L1, L); /* init stack */ - lua_unlock(L); - return L1; -} - - -void luaE_freethread (lua_State *L, lua_State *L1) { - LX *l = fromstate(L1); - luaF_close(L1, L1->stack); /* close all upvalues for this thread */ - lua_assert(L1->openupval == NULL); - luai_userstatefree(L, L1); - freestack(L1); - luaM_free(L, l); -} - - -LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { - int i; - lua_State *L; - global_State *g; - LG *l = cast(LG *, (*f)(ud, NULL, LUA_TTHREAD, sizeof(LG))); - if (l == NULL) return NULL; - L = &l->l.l; - g = &l->g; - L->next = NULL; - L->tt = LUA_TTHREAD; - g->currentwhite = bitmask(WHITE0BIT); - L->marked = luaC_white(g); - preinit_thread(L, g); - g->frealloc = f; - g->ud = ud; - g->mainthread = L; - g->seed = makeseed(L); - g->gcrunning = 0; /* no GC while building state */ - g->GCestimate = 0; - g->strt.size = g->strt.nuse = 0; - g->strt.hash = NULL; - setnilvalue(&g->l_registry); - g->panic = NULL; - g->version = NULL; - g->gcstate = GCSpause; - g->gckind = KGC_NORMAL; - g->allgc = g->finobj = g->tobefnz = g->fixedgc = NULL; - g->sweepgc = NULL; - g->gray = g->grayagain = NULL; - g->weak = g->ephemeron = g->allweak = NULL; - g->twups = NULL; - g->totalbytes = sizeof(LG); - g->GCdebt = 0; - g->gcfinnum = 0; - g->gcpause = LUAI_GCPAUSE; - g->gcstepmul = LUAI_GCMUL; - for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL; - if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) { - /* memory allocation error: free partial state */ - close_state(L); - L = NULL; - } - return L; -} - - -LUA_API void lua_close (lua_State *L) { - L = G(L)->mainthread; /* only the main thread can be closed */ - lua_lock(L); - close_state(L); -} - - diff --git a/LuaSkin/lua-5.3.4/src/lstate.h b/LuaSkin/lua-5.3.4/src/lstate.h deleted file mode 100644 index a469466c4..000000000 --- a/LuaSkin/lua-5.3.4/src/lstate.h +++ /dev/null @@ -1,235 +0,0 @@ -/* -** $Id: lstate.h,v 2.133 2016/12/22 13:08:50 roberto Exp $ -** Global State -** See Copyright Notice in lua.h -*/ - -#ifndef lstate_h -#define lstate_h - -#include "lua.h" - -#include "lobject.h" -#include "ltm.h" -#include "lzio.h" - - -/* - -** Some notes about garbage-collected objects: All objects in Lua must -** be kept somehow accessible until being freed, so all objects always -** belong to one (and only one) of these lists, using field 'next' of -** the 'CommonHeader' for the link: -** -** 'allgc': all objects not marked for finalization; -** 'finobj': all objects marked for finalization; -** 'tobefnz': all objects ready to be finalized; -** 'fixedgc': all objects that are not to be collected (currently -** only small strings, such as reserved words). - -*/ - - -struct lua_longjmp; /* defined in ldo.c */ - - -/* -** Atomic type (relative to signals) to better ensure that 'lua_sethook' -** is thread safe -*/ -#if !defined(l_signalT) -#include -#define l_signalT sig_atomic_t -#endif - - -/* extra stack space to handle TM calls and some other extras */ -#define EXTRA_STACK 5 - - -#define BASIC_STACK_SIZE (2*LUA_MINSTACK) - - -/* kinds of Garbage Collection */ -#define KGC_NORMAL 0 -#define KGC_EMERGENCY 1 /* gc was forced by an allocation failure */ - - -typedef struct stringtable { - TString **hash; - int nuse; /* number of elements */ - int size; -} stringtable; - - -/* -** Information about a call. -** When a thread yields, 'func' is adjusted to pretend that the -** top function has only the yielded values in its stack; in that -** case, the actual 'func' value is saved in field 'extra'. -** When a function calls another with a continuation, 'extra' keeps -** the function index so that, in case of errors, the continuation -** function can be called with the correct top. -*/ -typedef struct CallInfo { - StkId func; /* function index in the stack */ - StkId top; /* top for this function */ - struct CallInfo *previous, *next; /* dynamic call link */ - union { - struct { /* only for Lua functions */ - StkId base; /* base for this function */ - const Instruction *savedpc; - } l; - struct { /* only for C functions */ - lua_KFunction k; /* continuation in case of yields */ - ptrdiff_t old_errfunc; - lua_KContext ctx; /* context info. in case of yields */ - } c; - } u; - ptrdiff_t extra; - short nresults; /* expected number of results from this function */ - unsigned short callstatus; -} CallInfo; - - -/* -** Bits in CallInfo status -*/ -#define CIST_OAH (1<<0) /* original value of 'allowhook' */ -#define CIST_LUA (1<<1) /* call is running a Lua function */ -#define CIST_HOOKED (1<<2) /* call is running a debug hook */ -#define CIST_FRESH (1<<3) /* call is running on a fresh invocation - of luaV_execute */ -#define CIST_YPCALL (1<<4) /* call is a yieldable protected call */ -#define CIST_TAIL (1<<5) /* call was tail called */ -#define CIST_HOOKYIELD (1<<6) /* last hook called yielded */ -#define CIST_LEQ (1<<7) /* using __lt for __le */ -#define CIST_FIN (1<<8) /* call is running a finalizer */ - -#define isLua(ci) ((ci)->callstatus & CIST_LUA) - -/* assume that CIST_OAH has offset 0 and that 'v' is strictly 0/1 */ -#define setoah(st,v) ((st) = ((st) & ~CIST_OAH) | (v)) -#define getoah(st) ((st) & CIST_OAH) - - -/* -** 'global state', shared by all threads of this state -*/ -typedef struct global_State { - lua_Alloc frealloc; /* function to reallocate memory */ - void *ud; /* auxiliary data to 'frealloc' */ - l_mem totalbytes; /* number of bytes currently allocated - GCdebt */ - l_mem GCdebt; /* bytes allocated not yet compensated by the collector */ - lu_mem GCmemtrav; /* memory traversed by the GC */ - lu_mem GCestimate; /* an estimate of the non-garbage memory in use */ - stringtable strt; /* hash table for strings */ - TValue l_registry; - unsigned int seed; /* randomized seed for hashes */ - lu_byte currentwhite; - lu_byte gcstate; /* state of garbage collector */ - lu_byte gckind; /* kind of GC running */ - lu_byte gcrunning; /* true if GC is running */ - GCObject *allgc; /* list of all collectable objects */ - GCObject **sweepgc; /* current position of sweep in list */ - GCObject *finobj; /* list of collectable objects with finalizers */ - GCObject *gray; /* list of gray objects */ - GCObject *grayagain; /* list of objects to be traversed atomically */ - GCObject *weak; /* list of tables with weak values */ - GCObject *ephemeron; /* list of ephemeron tables (weak keys) */ - GCObject *allweak; /* list of all-weak tables */ - GCObject *tobefnz; /* list of userdata to be GC */ - GCObject *fixedgc; /* list of objects not to be collected */ - struct lua_State *twups; /* list of threads with open upvalues */ - unsigned int gcfinnum; /* number of finalizers to call in each GC step */ - int gcpause; /* size of pause between successive GCs */ - int gcstepmul; /* GC 'granularity' */ - lua_CFunction panic; /* to be called in unprotected errors */ - struct lua_State *mainthread; - const lua_Number *version; /* pointer to version number */ - TString *memerrmsg; /* memory-error message */ - TString *tmname[TM_N]; /* array with tag-method names */ - struct Table *mt[LUA_NUMTAGS]; /* metatables for basic types */ - TString *strcache[STRCACHE_N][STRCACHE_M]; /* cache for strings in API */ -} global_State; - - -/* -** 'per thread' state -*/ -struct lua_State { - CommonHeader; - unsigned short nci; /* number of items in 'ci' list */ - lu_byte status; - StkId top; /* first free slot in the stack */ - global_State *l_G; - CallInfo *ci; /* call info for current function */ - const Instruction *oldpc; /* last pc traced */ - StkId stack_last; /* last free slot in the stack */ - StkId stack; /* stack base */ - UpVal *openupval; /* list of open upvalues in this stack */ - GCObject *gclist; - struct lua_State *twups; /* list of threads with open upvalues */ - struct lua_longjmp *errorJmp; /* current error recover point */ - CallInfo base_ci; /* CallInfo for first level (C calling Lua) */ - volatile lua_Hook hook; - ptrdiff_t errfunc; /* current error handling function (stack index) */ - int stacksize; - int basehookcount; - int hookcount; - unsigned short nny; /* number of non-yieldable calls in stack */ - unsigned short nCcalls; /* number of nested C calls */ - l_signalT hookmask; - lu_byte allowhook; -}; - - -#define G(L) (L->l_G) - - -/* -** Union of all collectable objects (only for conversions) -*/ -union GCUnion { - GCObject gc; /* common header */ - struct TString ts; - struct Udata u; - union Closure cl; - struct Table h; - struct Proto p; - struct lua_State th; /* thread */ -}; - - -#define cast_u(o) cast(union GCUnion *, (o)) - -/* macros to convert a GCObject into a specific value */ -#define gco2ts(o) \ - check_exp(novariant((o)->tt) == LUA_TSTRING, &((cast_u(o))->ts)) -#define gco2u(o) check_exp((o)->tt == LUA_TUSERDATA, &((cast_u(o))->u)) -#define gco2lcl(o) check_exp((o)->tt == LUA_TLCL, &((cast_u(o))->cl.l)) -#define gco2ccl(o) check_exp((o)->tt == LUA_TCCL, &((cast_u(o))->cl.c)) -#define gco2cl(o) \ - check_exp(novariant((o)->tt) == LUA_TFUNCTION, &((cast_u(o))->cl)) -#define gco2t(o) check_exp((o)->tt == LUA_TTABLE, &((cast_u(o))->h)) -#define gco2p(o) check_exp((o)->tt == LUA_TPROTO, &((cast_u(o))->p)) -#define gco2th(o) check_exp((o)->tt == LUA_TTHREAD, &((cast_u(o))->th)) - - -/* macro to convert a Lua object into a GCObject */ -#define obj2gco(v) \ - check_exp(novariant((v)->tt) < LUA_TDEADKEY, (&(cast_u(v)->gc))) - - -/* actual number of total bytes allocated */ -#define gettotalbytes(g) cast(lu_mem, (g)->totalbytes + (g)->GCdebt) - -LUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt); -LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); -LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L); -LUAI_FUNC void luaE_freeCI (lua_State *L); -LUAI_FUNC void luaE_shrinkCI (lua_State *L); - - -#endif - diff --git a/LuaSkin/lua-5.3.4/src/lstring.c b/LuaSkin/lua-5.3.4/src/lstring.c deleted file mode 100644 index 9351766fd..000000000 --- a/LuaSkin/lua-5.3.4/src/lstring.c +++ /dev/null @@ -1,248 +0,0 @@ -/* -** $Id: lstring.c,v 2.56 2015/11/23 11:32:51 roberto Exp $ -** String table (keeps all strings handled by Lua) -** See Copyright Notice in lua.h -*/ - -#define lstring_c -#define LUA_CORE - -#include "lprefix.h" - - -#include - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" - - -#define MEMERRMSG "not enough memory" - - -/* -** Lua will use at most ~(2^LUAI_HASHLIMIT) bytes from a string to -** compute its hash -*/ -#if !defined(LUAI_HASHLIMIT) -#define LUAI_HASHLIMIT 5 -#endif - - -/* -** equality for long strings -*/ -int luaS_eqlngstr (TString *a, TString *b) { - size_t len = a->u.lnglen; - lua_assert(a->tt == LUA_TLNGSTR && b->tt == LUA_TLNGSTR); - return (a == b) || /* same instance or... */ - ((len == b->u.lnglen) && /* equal length and ... */ - (memcmp(getstr(a), getstr(b), len) == 0)); /* equal contents */ -} - - -unsigned int luaS_hash (const char *str, size_t l, unsigned int seed) { - unsigned int h = seed ^ cast(unsigned int, l); - size_t step = (l >> LUAI_HASHLIMIT) + 1; - for (; l >= step; l -= step) - h ^= ((h<<5) + (h>>2) + cast_byte(str[l - 1])); - return h; -} - - -unsigned int luaS_hashlongstr (TString *ts) { - lua_assert(ts->tt == LUA_TLNGSTR); - if (ts->extra == 0) { /* no hash? */ - ts->hash = luaS_hash(getstr(ts), ts->u.lnglen, ts->hash); - ts->extra = 1; /* now it has its hash */ - } - return ts->hash; -} - - -/* -** resizes the string table -*/ -void luaS_resize (lua_State *L, int newsize) { - int i; - stringtable *tb = &G(L)->strt; - if (newsize > tb->size) { /* grow table if needed */ - luaM_reallocvector(L, tb->hash, tb->size, newsize, TString *); - for (i = tb->size; i < newsize; i++) - tb->hash[i] = NULL; - } - for (i = 0; i < tb->size; i++) { /* rehash */ - TString *p = tb->hash[i]; - tb->hash[i] = NULL; - while (p) { /* for each node in the list */ - TString *hnext = p->u.hnext; /* save next */ - unsigned int h = lmod(p->hash, newsize); /* new position */ - p->u.hnext = tb->hash[h]; /* chain it */ - tb->hash[h] = p; - p = hnext; - } - } - if (newsize < tb->size) { /* shrink table if needed */ - /* vanishing slice should be empty */ - lua_assert(tb->hash[newsize] == NULL && tb->hash[tb->size - 1] == NULL); - luaM_reallocvector(L, tb->hash, tb->size, newsize, TString *); - } - tb->size = newsize; -} - - -/* -** Clear API string cache. (Entries cannot be empty, so fill them with -** a non-collectable string.) -*/ -void luaS_clearcache (global_State *g) { - int i, j; - for (i = 0; i < STRCACHE_N; i++) - for (j = 0; j < STRCACHE_M; j++) { - if (iswhite(g->strcache[i][j])) /* will entry be collected? */ - g->strcache[i][j] = g->memerrmsg; /* replace it with something fixed */ - } -} - - -/* -** Initialize the string table and the string cache -*/ -void luaS_init (lua_State *L) { - global_State *g = G(L); - int i, j; - luaS_resize(L, MINSTRTABSIZE); /* initial size of string table */ - /* pre-create memory-error message */ - g->memerrmsg = luaS_newliteral(L, MEMERRMSG); - luaC_fix(L, obj2gco(g->memerrmsg)); /* it should never be collected */ - for (i = 0; i < STRCACHE_N; i++) /* fill cache with valid strings */ - for (j = 0; j < STRCACHE_M; j++) - g->strcache[i][j] = g->memerrmsg; -} - - - -/* -** creates a new string object -*/ -static TString *createstrobj (lua_State *L, size_t l, int tag, unsigned int h) { - TString *ts; - GCObject *o; - size_t totalsize; /* total size of TString object */ - totalsize = sizelstring(l); - o = luaC_newobj(L, tag, totalsize); - ts = gco2ts(o); - ts->hash = h; - ts->extra = 0; - getstr(ts)[l] = '\0'; /* ending 0 */ - return ts; -} - - -TString *luaS_createlngstrobj (lua_State *L, size_t l) { - TString *ts = createstrobj(L, l, LUA_TLNGSTR, G(L)->seed); - ts->u.lnglen = l; - return ts; -} - - -void luaS_remove (lua_State *L, TString *ts) { - stringtable *tb = &G(L)->strt; - TString **p = &tb->hash[lmod(ts->hash, tb->size)]; - while (*p != ts) /* find previous element */ - p = &(*p)->u.hnext; - *p = (*p)->u.hnext; /* remove element from its list */ - tb->nuse--; -} - - -/* -** checks whether short string exists and reuses it or creates a new one -*/ -static TString *internshrstr (lua_State *L, const char *str, size_t l) { - TString *ts; - global_State *g = G(L); - unsigned int h = luaS_hash(str, l, g->seed); - TString **list = &g->strt.hash[lmod(h, g->strt.size)]; - lua_assert(str != NULL); /* otherwise 'memcmp'/'memcpy' are undefined */ - for (ts = *list; ts != NULL; ts = ts->u.hnext) { - if (l == ts->shrlen && - (memcmp(str, getstr(ts), l * sizeof(char)) == 0)) { - /* found! */ - if (isdead(g, ts)) /* dead (but not collected yet)? */ - changewhite(ts); /* resurrect it */ - return ts; - } - } - if (g->strt.nuse >= g->strt.size && g->strt.size <= MAX_INT/2) { - luaS_resize(L, g->strt.size * 2); - list = &g->strt.hash[lmod(h, g->strt.size)]; /* recompute with new size */ - } - ts = createstrobj(L, l, LUA_TSHRSTR, h); - memcpy(getstr(ts), str, l * sizeof(char)); - ts->shrlen = cast_byte(l); - ts->u.hnext = *list; - *list = ts; - g->strt.nuse++; - return ts; -} - - -/* -** new string (with explicit length) -*/ -TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { - if (l <= LUAI_MAXSHORTLEN) /* short string? */ - return internshrstr(L, str, l); - else { - TString *ts; - if (l >= (MAX_SIZE - sizeof(TString))/sizeof(char)) - luaM_toobig(L); - ts = luaS_createlngstrobj(L, l); - memcpy(getstr(ts), str, l * sizeof(char)); - return ts; - } -} - - -/* -** Create or reuse a zero-terminated string, first checking in the -** cache (using the string address as a key). The cache can contain -** only zero-terminated strings, so it is safe to use 'strcmp' to -** check hits. -*/ -TString *luaS_new (lua_State *L, const char *str) { - unsigned int i = point2uint(str) % STRCACHE_N; /* hash */ - int j; - TString **p = G(L)->strcache[i]; - for (j = 0; j < STRCACHE_M; j++) { - if (strcmp(str, getstr(p[j])) == 0) /* hit? */ - return p[j]; /* that is it */ - } - /* normal route */ - for (j = STRCACHE_M - 1; j > 0; j--) - p[j] = p[j - 1]; /* move out last element */ - /* new element is first in the list */ - p[0] = luaS_newlstr(L, str, strlen(str)); - return p[0]; -} - - -Udata *luaS_newudata (lua_State *L, size_t s) { - Udata *u; - GCObject *o; - if (s > MAX_SIZE - sizeof(Udata)) - luaM_toobig(L); - o = luaC_newobj(L, LUA_TUSERDATA, sizeludata(s)); - u = gco2u(o); - u->len = s; - u->metatable = NULL; - setuservalue(L, u, luaO_nilobject); - return u; -} - diff --git a/LuaSkin/lua-5.3.4/src/lstring.h b/LuaSkin/lua-5.3.4/src/lstring.h deleted file mode 100644 index 27efd2077..000000000 --- a/LuaSkin/lua-5.3.4/src/lstring.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -** $Id: lstring.h,v 1.61 2015/11/03 15:36:01 roberto Exp $ -** String table (keep all strings handled by Lua) -** See Copyright Notice in lua.h -*/ - -#ifndef lstring_h -#define lstring_h - -#include "lgc.h" -#include "lobject.h" -#include "lstate.h" - - -#define sizelstring(l) (sizeof(union UTString) + ((l) + 1) * sizeof(char)) - -#define sizeludata(l) (sizeof(union UUdata) + (l)) -#define sizeudata(u) sizeludata((u)->len) - -#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ - (sizeof(s)/sizeof(char))-1)) - - -/* -** test whether a string is a reserved word -*/ -#define isreserved(s) ((s)->tt == LUA_TSHRSTR && (s)->extra > 0) - - -/* -** equality for short strings, which are always internalized -*/ -#define eqshrstr(a,b) check_exp((a)->tt == LUA_TSHRSTR, (a) == (b)) - - -LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed); -LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts); -LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b); -LUAI_FUNC void luaS_resize (lua_State *L, int newsize); -LUAI_FUNC void luaS_clearcache (global_State *g); -LUAI_FUNC void luaS_init (lua_State *L); -LUAI_FUNC void luaS_remove (lua_State *L, TString *ts); -LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s); -LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); -LUAI_FUNC TString *luaS_new (lua_State *L, const char *str); -LUAI_FUNC TString *luaS_createlngstrobj (lua_State *L, size_t l); - - -#endif diff --git a/LuaSkin/lua-5.3.4/src/lstrlib.c b/LuaSkin/lua-5.3.4/src/lstrlib.c deleted file mode 100644 index c7aa755fa..000000000 --- a/LuaSkin/lua-5.3.4/src/lstrlib.c +++ /dev/null @@ -1,1584 +0,0 @@ -/* -** $Id: lstrlib.c,v 1.254 2016/12/22 13:08:50 roberto Exp $ -** Standard library for string operations and pattern-matching -** See Copyright Notice in lua.h -*/ - -#define lstrlib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -/* -** maximum number of captures that a pattern can do during -** pattern-matching. This limit is arbitrary, but must fit in -** an unsigned char. -*/ -#if !defined(LUA_MAXCAPTURES) -#define LUA_MAXCAPTURES 32 -#endif - - -/* macro to 'unsign' a character */ -#define uchar(c) ((unsigned char)(c)) - - -/* -** Some sizes are better limited to fit in 'int', but must also fit in -** 'size_t'. (We assume that 'lua_Integer' cannot be smaller than 'int'.) -*/ -#define MAX_SIZET ((size_t)(~(size_t)0)) - -#define MAXSIZE \ - (sizeof(size_t) < sizeof(int) ? MAX_SIZET : (size_t)(INT_MAX)) - - - - -static int str_len (lua_State *L) { - size_t l; - luaL_checklstring(L, 1, &l); - lua_pushinteger(L, (lua_Integer)l); - return 1; -} - - -/* translate a relative string position: negative means back from end */ -static lua_Integer posrelat (lua_Integer pos, size_t len) { - if (pos >= 0) return pos; - else if (0u - (size_t)pos > len) return 0; - else return (lua_Integer)len + pos + 1; -} - - -static int str_sub (lua_State *L) { - size_t l; - const char *s = luaL_checklstring(L, 1, &l); - lua_Integer start = posrelat(luaL_checkinteger(L, 2), l); - lua_Integer end = posrelat(luaL_optinteger(L, 3, -1), l); - if (start < 1) start = 1; - if (end > (lua_Integer)l) end = l; - if (start <= end) - lua_pushlstring(L, s + start - 1, (size_t)(end - start) + 1); - else lua_pushliteral(L, ""); - return 1; -} - - -static int str_reverse (lua_State *L) { - size_t l, i; - luaL_Buffer b; - const char *s = luaL_checklstring(L, 1, &l); - char *p = luaL_buffinitsize(L, &b, l); - for (i = 0; i < l; i++) - p[i] = s[l - i - 1]; - luaL_pushresultsize(&b, l); - return 1; -} - - -static int str_lower (lua_State *L) { - size_t l; - size_t i; - luaL_Buffer b; - const char *s = luaL_checklstring(L, 1, &l); - char *p = luaL_buffinitsize(L, &b, l); - for (i=0; i MAXSIZE / n) /* may overflow? */ - return luaL_error(L, "resulting string too large"); - else { - size_t totallen = (size_t)n * l + (size_t)(n - 1) * lsep; - luaL_Buffer b; - char *p = luaL_buffinitsize(L, &b, totallen); - while (n-- > 1) { /* first n-1 copies (followed by separator) */ - memcpy(p, s, l * sizeof(char)); p += l; - if (lsep > 0) { /* empty 'memcpy' is not that cheap */ - memcpy(p, sep, lsep * sizeof(char)); - p += lsep; - } - } - memcpy(p, s, l * sizeof(char)); /* last copy (not followed by separator) */ - luaL_pushresultsize(&b, totallen); - } - return 1; -} - - -static int str_byte (lua_State *L) { - size_t l; - const char *s = luaL_checklstring(L, 1, &l); - lua_Integer posi = posrelat(luaL_optinteger(L, 2, 1), l); - lua_Integer pose = posrelat(luaL_optinteger(L, 3, posi), l); - int n, i; - if (posi < 1) posi = 1; - if (pose > (lua_Integer)l) pose = l; - if (posi > pose) return 0; /* empty interval; return no values */ - if (pose - posi >= INT_MAX) /* arithmetic overflow? */ - return luaL_error(L, "string slice too long"); - n = (int)(pose - posi) + 1; - luaL_checkstack(L, n, "string slice too long"); - for (i=0; i= ms->level || ms->capture[l].len == CAP_UNFINISHED) - return luaL_error(ms->L, "invalid capture index %%%d", l + 1); - return l; -} - - -static int capture_to_close (MatchState *ms) { - int level = ms->level; - for (level--; level>=0; level--) - if (ms->capture[level].len == CAP_UNFINISHED) return level; - return luaL_error(ms->L, "invalid pattern capture"); -} - - -static const char *classend (MatchState *ms, const char *p) { - switch (*p++) { - case L_ESC: { - if (p == ms->p_end) - luaL_error(ms->L, "malformed pattern (ends with '%%')"); - return p+1; - } - case '[': { - if (*p == '^') p++; - do { /* look for a ']' */ - if (p == ms->p_end) - luaL_error(ms->L, "malformed pattern (missing ']')"); - if (*(p++) == L_ESC && p < ms->p_end) - p++; /* skip escapes (e.g. '%]') */ - } while (*p != ']'); - return p+1; - } - default: { - return p; - } - } -} - - -static int match_class (int c, int cl) { - int res; - switch (tolower(cl)) { - case 'a' : res = isalpha(c); break; - case 'c' : res = iscntrl(c); break; - case 'd' : res = isdigit(c); break; - case 'g' : res = isgraph(c); break; - case 'l' : res = islower(c); break; - case 'p' : res = ispunct(c); break; - case 's' : res = isspace(c); break; - case 'u' : res = isupper(c); break; - case 'w' : res = isalnum(c); break; - case 'x' : res = isxdigit(c); break; - case 'z' : res = (c == 0); break; /* deprecated option */ - default: return (cl == c); - } - return (islower(cl) ? res : !res); -} - - -static int matchbracketclass (int c, const char *p, const char *ec) { - int sig = 1; - if (*(p+1) == '^') { - sig = 0; - p++; /* skip the '^' */ - } - while (++p < ec) { - if (*p == L_ESC) { - p++; - if (match_class(c, uchar(*p))) - return sig; - } - else if ((*(p+1) == '-') && (p+2 < ec)) { - p+=2; - if (uchar(*(p-2)) <= c && c <= uchar(*p)) - return sig; - } - else if (uchar(*p) == c) return sig; - } - return !sig; -} - - -static int singlematch (MatchState *ms, const char *s, const char *p, - const char *ep) { - if (s >= ms->src_end) - return 0; - else { - int c = uchar(*s); - switch (*p) { - case '.': return 1; /* matches any char */ - case L_ESC: return match_class(c, uchar(*(p+1))); - case '[': return matchbracketclass(c, p, ep-1); - default: return (uchar(*p) == c); - } - } -} - - -static const char *matchbalance (MatchState *ms, const char *s, - const char *p) { - if (p >= ms->p_end - 1) - luaL_error(ms->L, "malformed pattern (missing arguments to '%%b')"); - if (*s != *p) return NULL; - else { - int b = *p; - int e = *(p+1); - int cont = 1; - while (++s < ms->src_end) { - if (*s == e) { - if (--cont == 0) return s+1; - } - else if (*s == b) cont++; - } - } - return NULL; /* string ends out of balance */ -} - - -static const char *max_expand (MatchState *ms, const char *s, - const char *p, const char *ep) { - ptrdiff_t i = 0; /* counts maximum expand for item */ - while (singlematch(ms, s + i, p, ep)) - i++; - /* keeps trying to match with the maximum repetitions */ - while (i>=0) { - const char *res = match(ms, (s+i), ep+1); - if (res) return res; - i--; /* else didn't match; reduce 1 repetition to try again */ - } - return NULL; -} - - -static const char *min_expand (MatchState *ms, const char *s, - const char *p, const char *ep) { - for (;;) { - const char *res = match(ms, s, ep+1); - if (res != NULL) - return res; - else if (singlematch(ms, s, p, ep)) - s++; /* try with one more repetition */ - else return NULL; - } -} - - -static const char *start_capture (MatchState *ms, const char *s, - const char *p, int what) { - const char *res; - int level = ms->level; - if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures"); - ms->capture[level].init = s; - ms->capture[level].len = what; - ms->level = level+1; - if ((res=match(ms, s, p)) == NULL) /* match failed? */ - ms->level--; /* undo capture */ - return res; -} - - -static const char *end_capture (MatchState *ms, const char *s, - const char *p) { - int l = capture_to_close(ms); - const char *res; - ms->capture[l].len = s - ms->capture[l].init; /* close capture */ - if ((res = match(ms, s, p)) == NULL) /* match failed? */ - ms->capture[l].len = CAP_UNFINISHED; /* undo capture */ - return res; -} - - -static const char *match_capture (MatchState *ms, const char *s, int l) { - size_t len; - l = check_capture(ms, l); - len = ms->capture[l].len; - if ((size_t)(ms->src_end-s) >= len && - memcmp(ms->capture[l].init, s, len) == 0) - return s+len; - else return NULL; -} - - -static const char *match (MatchState *ms, const char *s, const char *p) { - if (ms->matchdepth-- == 0) - luaL_error(ms->L, "pattern too complex"); - init: /* using goto's to optimize tail recursion */ - if (p != ms->p_end) { /* end of pattern? */ - switch (*p) { - case '(': { /* start capture */ - if (*(p + 1) == ')') /* position capture? */ - s = start_capture(ms, s, p + 2, CAP_POSITION); - else - s = start_capture(ms, s, p + 1, CAP_UNFINISHED); - break; - } - case ')': { /* end capture */ - s = end_capture(ms, s, p + 1); - break; - } - case '$': { - if ((p + 1) != ms->p_end) /* is the '$' the last char in pattern? */ - goto dflt; /* no; go to default */ - s = (s == ms->src_end) ? s : NULL; /* check end of string */ - break; - } - case L_ESC: { /* escaped sequences not in the format class[*+?-]? */ - switch (*(p + 1)) { - case 'b': { /* balanced string? */ - s = matchbalance(ms, s, p + 2); - if (s != NULL) { - p += 4; goto init; /* return match(ms, s, p + 4); */ - } /* else fail (s == NULL) */ - break; - } - case 'f': { /* frontier? */ - const char *ep; char previous; - p += 2; - if (*p != '[') - luaL_error(ms->L, "missing '[' after '%%f' in pattern"); - ep = classend(ms, p); /* points to what is next */ - previous = (s == ms->src_init) ? '\0' : *(s - 1); - if (!matchbracketclass(uchar(previous), p, ep - 1) && - matchbracketclass(uchar(*s), p, ep - 1)) { - p = ep; goto init; /* return match(ms, s, ep); */ - } - s = NULL; /* match failed */ - break; - } - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - case '8': case '9': { /* capture results (%0-%9)? */ - s = match_capture(ms, s, uchar(*(p + 1))); - if (s != NULL) { - p += 2; goto init; /* return match(ms, s, p + 2) */ - } - break; - } - default: goto dflt; - } - break; - } - default: dflt: { /* pattern class plus optional suffix */ - const char *ep = classend(ms, p); /* points to optional suffix */ - /* does not match at least once? */ - if (!singlematch(ms, s, p, ep)) { - if (*ep == '*' || *ep == '?' || *ep == '-') { /* accept empty? */ - p = ep + 1; goto init; /* return match(ms, s, ep + 1); */ - } - else /* '+' or no suffix */ - s = NULL; /* fail */ - } - else { /* matched once */ - switch (*ep) { /* handle optional suffix */ - case '?': { /* optional */ - const char *res; - if ((res = match(ms, s + 1, ep + 1)) != NULL) - s = res; - else { - p = ep + 1; goto init; /* else return match(ms, s, ep + 1); */ - } - break; - } - case '+': /* 1 or more repetitions */ - s++; /* 1 match already done */ - /* FALLTHROUGH */ - case '*': /* 0 or more repetitions */ - s = max_expand(ms, s, p, ep); - break; - case '-': /* 0 or more repetitions (minimum) */ - s = min_expand(ms, s, p, ep); - break; - default: /* no suffix */ - s++; p = ep; goto init; /* return match(ms, s + 1, ep); */ - } - } - break; - } - } - } - ms->matchdepth++; - return s; -} - - - -static const char *lmemfind (const char *s1, size_t l1, - const char *s2, size_t l2) { - if (l2 == 0) return s1; /* empty strings are everywhere */ - else if (l2 > l1) return NULL; /* avoids a negative 'l1' */ - else { - const char *init; /* to search for a '*s2' inside 's1' */ - l2--; /* 1st char will be checked by 'memchr' */ - l1 = l1-l2; /* 's2' cannot be found after that */ - while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) { - init++; /* 1st char is already checked */ - if (memcmp(init, s2+1, l2) == 0) - return init-1; - else { /* correct 'l1' and 's1' to try again */ - l1 -= init-s1; - s1 = init; - } - } - return NULL; /* not found */ - } -} - - -static void push_onecapture (MatchState *ms, int i, const char *s, - const char *e) { - if (i >= ms->level) { - if (i == 0) /* ms->level == 0, too */ - lua_pushlstring(ms->L, s, e - s); /* add whole match */ - else - luaL_error(ms->L, "invalid capture index %%%d", i + 1); - } - else { - ptrdiff_t l = ms->capture[i].len; - if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture"); - if (l == CAP_POSITION) - lua_pushinteger(ms->L, (ms->capture[i].init - ms->src_init) + 1); - else - lua_pushlstring(ms->L, ms->capture[i].init, l); - } -} - - -static int push_captures (MatchState *ms, const char *s, const char *e) { - int i; - int nlevels = (ms->level == 0 && s) ? 1 : ms->level; - luaL_checkstack(ms->L, nlevels, "too many captures"); - for (i = 0; i < nlevels; i++) - push_onecapture(ms, i, s, e); - return nlevels; /* number of strings pushed */ -} - - -/* check whether pattern has no special characters */ -static int nospecials (const char *p, size_t l) { - size_t upto = 0; - do { - if (strpbrk(p + upto, SPECIALS)) - return 0; /* pattern has a special character */ - upto += strlen(p + upto) + 1; /* may have more after \0 */ - } while (upto <= l); - return 1; /* no special chars found */ -} - - -static void prepstate (MatchState *ms, lua_State *L, - const char *s, size_t ls, const char *p, size_t lp) { - ms->L = L; - ms->matchdepth = MAXCCALLS; - ms->src_init = s; - ms->src_end = s + ls; - ms->p_end = p + lp; -} - - -static void reprepstate (MatchState *ms) { - ms->level = 0; - lua_assert(ms->matchdepth == MAXCCALLS); -} - - -static int str_find_aux (lua_State *L, int find) { - size_t ls, lp; - const char *s = luaL_checklstring(L, 1, &ls); - const char *p = luaL_checklstring(L, 2, &lp); - lua_Integer init = posrelat(luaL_optinteger(L, 3, 1), ls); - if (init < 1) init = 1; - else if (init > (lua_Integer)ls + 1) { /* start after string's end? */ - lua_pushnil(L); /* cannot find anything */ - return 1; - } - /* explicit request or no special characters? */ - if (find && (lua_toboolean(L, 4) || nospecials(p, lp))) { - /* do a plain search */ - const char *s2 = lmemfind(s + init - 1, ls - (size_t)init + 1, p, lp); - if (s2) { - lua_pushinteger(L, (s2 - s) + 1); - lua_pushinteger(L, (s2 - s) + lp); - return 2; - } - } - else { - MatchState ms; - const char *s1 = s + init - 1; - int anchor = (*p == '^'); - if (anchor) { - p++; lp--; /* skip anchor character */ - } - prepstate(&ms, L, s, ls, p, lp); - do { - const char *res; - reprepstate(&ms); - if ((res=match(&ms, s1, p)) != NULL) { - if (find) { - lua_pushinteger(L, (s1 - s) + 1); /* start */ - lua_pushinteger(L, res - s); /* end */ - return push_captures(&ms, NULL, 0) + 2; - } - else - return push_captures(&ms, s1, res); - } - } while (s1++ < ms.src_end && !anchor); - } - lua_pushnil(L); /* not found */ - return 1; -} - - -static int str_find (lua_State *L) { - return str_find_aux(L, 1); -} - - -static int str_match (lua_State *L) { - return str_find_aux(L, 0); -} - - -/* state for 'gmatch' */ -typedef struct GMatchState { - const char *src; /* current position */ - const char *p; /* pattern */ - const char *lastmatch; /* end of last match */ - MatchState ms; /* match state */ -} GMatchState; - - -static int gmatch_aux (lua_State *L) { - GMatchState *gm = (GMatchState *)lua_touserdata(L, lua_upvalueindex(3)); - const char *src; - gm->ms.L = L; - for (src = gm->src; src <= gm->ms.src_end; src++) { - const char *e; - reprepstate(&gm->ms); - if ((e = match(&gm->ms, src, gm->p)) != NULL && e != gm->lastmatch) { - gm->src = gm->lastmatch = e; - return push_captures(&gm->ms, src, e); - } - } - return 0; /* not found */ -} - - -static int gmatch (lua_State *L) { - size_t ls, lp; - const char *s = luaL_checklstring(L, 1, &ls); - const char *p = luaL_checklstring(L, 2, &lp); - GMatchState *gm; - lua_settop(L, 2); /* keep them on closure to avoid being collected */ - gm = (GMatchState *)lua_newuserdata(L, sizeof(GMatchState)); - prepstate(&gm->ms, L, s, ls, p, lp); - gm->src = s; gm->p = p; gm->lastmatch = NULL; - lua_pushcclosure(L, gmatch_aux, 3); - return 1; -} - - -static void add_s (MatchState *ms, luaL_Buffer *b, const char *s, - const char *e) { - size_t l, i; - lua_State *L = ms->L; - const char *news = lua_tolstring(L, 3, &l); - for (i = 0; i < l; i++) { - if (news[i] != L_ESC) - luaL_addchar(b, news[i]); - else { - i++; /* skip ESC */ - if (!isdigit(uchar(news[i]))) { - if (news[i] != L_ESC) - luaL_error(L, "invalid use of '%c' in replacement string", L_ESC); - luaL_addchar(b, news[i]); - } - else if (news[i] == '0') - luaL_addlstring(b, s, e - s); - else { - push_onecapture(ms, news[i] - '1', s, e); - luaL_tolstring(L, -1, NULL); /* if number, convert it to string */ - lua_remove(L, -2); /* remove original value */ - luaL_addvalue(b); /* add capture to accumulated result */ - } - } - } -} - - -static void add_value (MatchState *ms, luaL_Buffer *b, const char *s, - const char *e, int tr) { - lua_State *L = ms->L; - switch (tr) { - case LUA_TFUNCTION: { - int n; - lua_pushvalue(L, 3); - n = push_captures(ms, s, e); - lua_call(L, n, 1); - break; - } - case LUA_TTABLE: { - push_onecapture(ms, 0, s, e); - lua_gettable(L, 3); - break; - } - default: { /* LUA_TNUMBER or LUA_TSTRING */ - add_s(ms, b, s, e); - return; - } - } - if (!lua_toboolean(L, -1)) { /* nil or false? */ - lua_pop(L, 1); - lua_pushlstring(L, s, e - s); /* keep original text */ - } - else if (!lua_isstring(L, -1)) - luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1)); - luaL_addvalue(b); /* add result to accumulator */ -} - - -static int str_gsub (lua_State *L) { - size_t srcl, lp; - const char *src = luaL_checklstring(L, 1, &srcl); /* subject */ - const char *p = luaL_checklstring(L, 2, &lp); /* pattern */ - const char *lastmatch = NULL; /* end of last match */ - int tr = lua_type(L, 3); /* replacement type */ - lua_Integer max_s = luaL_optinteger(L, 4, srcl + 1); /* max replacements */ - int anchor = (*p == '^'); - lua_Integer n = 0; /* replacement count */ - MatchState ms; - luaL_Buffer b; - luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING || - tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3, - "string/function/table expected"); - luaL_buffinit(L, &b); - if (anchor) { - p++; lp--; /* skip anchor character */ - } - prepstate(&ms, L, src, srcl, p, lp); - while (n < max_s) { - const char *e; - reprepstate(&ms); /* (re)prepare state for new match */ - if ((e = match(&ms, src, p)) != NULL && e != lastmatch) { /* match? */ - n++; - add_value(&ms, &b, src, e, tr); /* add replacement to buffer */ - src = lastmatch = e; - } - else if (src < ms.src_end) /* otherwise, skip one character */ - luaL_addchar(&b, *src++); - else break; /* end of subject */ - if (anchor) break; - } - luaL_addlstring(&b, src, ms.src_end-src); - luaL_pushresult(&b); - lua_pushinteger(L, n); /* number of substitutions */ - return 2; -} - -/* }====================================================== */ - - - -/* -** {====================================================== -** STRING FORMAT -** ======================================================= -*/ - -#if !defined(lua_number2strx) /* { */ - -/* -** Hexadecimal floating-point formatter -*/ - -#include - -#define SIZELENMOD (sizeof(LUA_NUMBER_FRMLEN)/sizeof(char)) - - -/* -** Number of bits that goes into the first digit. It can be any value -** between 1 and 4; the following definition tries to align the number -** to nibble boundaries by making what is left after that first digit a -** multiple of 4. -*/ -#define L_NBFD ((l_mathlim(MANT_DIG) - 1)%4 + 1) - - -/* -** Add integer part of 'x' to buffer and return new 'x' -*/ -static lua_Number adddigit (char *buff, int n, lua_Number x) { - lua_Number dd = l_mathop(floor)(x); /* get integer part from 'x' */ - int d = (int)dd; - buff[n] = (d < 10 ? d + '0' : d - 10 + 'a'); /* add to buffer */ - return x - dd; /* return what is left */ -} - - -static int num2straux (char *buff, int sz, lua_Number x) { - /* if 'inf' or 'NaN', format it like '%g' */ - if (x != x || x == (lua_Number)HUGE_VAL || x == -(lua_Number)HUGE_VAL) - return l_sprintf(buff, sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)x); - else if (x == 0) { /* can be -0... */ - /* create "0" or "-0" followed by exponent */ - return l_sprintf(buff, sz, LUA_NUMBER_FMT "x0p+0", (LUAI_UACNUMBER)x); - } - else { - int e; - lua_Number m = l_mathop(frexp)(x, &e); /* 'x' fraction and exponent */ - int n = 0; /* character count */ - if (m < 0) { /* is number negative? */ - buff[n++] = '-'; /* add signal */ - m = -m; /* make it positive */ - } - buff[n++] = '0'; buff[n++] = 'x'; /* add "0x" */ - m = adddigit(buff, n++, m * (1 << L_NBFD)); /* add first digit */ - e -= L_NBFD; /* this digit goes before the radix point */ - if (m > 0) { /* more digits? */ - buff[n++] = lua_getlocaledecpoint(); /* add radix point */ - do { /* add as many digits as needed */ - m = adddigit(buff, n++, m * 16); - } while (m > 0); - } - n += l_sprintf(buff + n, sz - n, "p%+d", e); /* add exponent */ - lua_assert(n < sz); - return n; - } -} - - -static int lua_number2strx (lua_State *L, char *buff, int sz, - const char *fmt, lua_Number x) { - int n = num2straux(buff, sz, x); - if (fmt[SIZELENMOD] == 'A') { - int i; - for (i = 0; i < n; i++) - buff[i] = toupper(uchar(buff[i])); - } - else if (fmt[SIZELENMOD] != 'a') - luaL_error(L, "modifiers for format '%%a'/'%%A' not implemented"); - return n; -} - -#endif /* } */ - - -/* -** Maximum size of each formatted item. This maximum size is produced -** by format('%.99f', -maxfloat), and is equal to 99 + 3 ('-', '.', -** and '\0') + number of decimal digits to represent maxfloat (which -** is maximum exponent + 1). (99+3+1 then rounded to 120 for "extra -** expenses", such as locale-dependent stuff) -*/ -#define MAX_ITEM (120 + l_mathlim(MAX_10_EXP)) - - -/* valid flags in a format specification */ -#define FLAGS "-+ #0" - -/* -** maximum size of each format specification (such as "%-099.99d") -*/ -#define MAX_FORMAT 32 - - -static void addquoted (luaL_Buffer *b, const char *s, size_t len) { - luaL_addchar(b, '"'); - while (len--) { - if (*s == '"' || *s == '\\' || *s == '\n') { - luaL_addchar(b, '\\'); - luaL_addchar(b, *s); - } - else if (iscntrl(uchar(*s))) { - char buff[10]; - if (!isdigit(uchar(*(s+1)))) - l_sprintf(buff, sizeof(buff), "\\%d", (int)uchar(*s)); - else - l_sprintf(buff, sizeof(buff), "\\%03d", (int)uchar(*s)); - luaL_addstring(b, buff); - } - else - luaL_addchar(b, *s); - s++; - } - luaL_addchar(b, '"'); -} - - -/* -** Ensures the 'buff' string uses a dot as the radix character. -*/ -static void checkdp (char *buff, int nb) { - if (memchr(buff, '.', nb) == NULL) { /* no dot? */ - char point = lua_getlocaledecpoint(); /* try locale point */ - char *ppoint = (char *)memchr(buff, point, nb); - if (ppoint) *ppoint = '.'; /* change it to a dot */ - } -} - - -static void addliteral (lua_State *L, luaL_Buffer *b, int arg) { - switch (lua_type(L, arg)) { - case LUA_TSTRING: { - size_t len; - const char *s = lua_tolstring(L, arg, &len); - addquoted(b, s, len); - break; - } - case LUA_TNUMBER: { - char *buff = luaL_prepbuffsize(b, MAX_ITEM); - int nb; - if (!lua_isinteger(L, arg)) { /* float? */ - lua_Number n = lua_tonumber(L, arg); /* write as hexa ('%a') */ - nb = lua_number2strx(L, buff, MAX_ITEM, "%" LUA_NUMBER_FRMLEN "a", n); - checkdp(buff, nb); /* ensure it uses a dot */ - } - else { /* integers */ - lua_Integer n = lua_tointeger(L, arg); - const char *format = (n == LUA_MININTEGER) /* corner case? */ - ? "0x%" LUA_INTEGER_FRMLEN "x" /* use hexa */ - : LUA_INTEGER_FMT; /* else use default format */ - nb = l_sprintf(buff, MAX_ITEM, format, (LUAI_UACINT)n); - } - luaL_addsize(b, nb); - break; - } - case LUA_TNIL: case LUA_TBOOLEAN: { - luaL_tolstring(L, arg, NULL); - luaL_addvalue(b); - break; - } - default: { - luaL_argerror(L, arg, "value has no literal form"); - } - } -} - - -static const char *scanformat (lua_State *L, const char *strfrmt, char *form) { - const char *p = strfrmt; - while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++; /* skip flags */ - if ((size_t)(p - strfrmt) >= sizeof(FLAGS)/sizeof(char)) - luaL_error(L, "invalid format (repeated flags)"); - if (isdigit(uchar(*p))) p++; /* skip width */ - if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ - if (*p == '.') { - p++; - if (isdigit(uchar(*p))) p++; /* skip precision */ - if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ - } - if (isdigit(uchar(*p))) - luaL_error(L, "invalid format (width or precision too long)"); - *(form++) = '%'; - memcpy(form, strfrmt, ((p - strfrmt) + 1) * sizeof(char)); - form += (p - strfrmt) + 1; - *form = '\0'; - return p; -} - - -/* -** add length modifier into formats -*/ -static void addlenmod (char *form, const char *lenmod) { - size_t l = strlen(form); - size_t lm = strlen(lenmod); - char spec = form[l - 1]; - strcpy(form + l - 1, lenmod); - form[l + lm - 1] = spec; - form[l + lm] = '\0'; -} - - -static int str_format (lua_State *L) { - int top = lua_gettop(L); - int arg = 1; - size_t sfl; - const char *strfrmt = luaL_checklstring(L, arg, &sfl); - const char *strfrmt_end = strfrmt+sfl; - luaL_Buffer b; - luaL_buffinit(L, &b); - while (strfrmt < strfrmt_end) { - if (*strfrmt != L_ESC) - luaL_addchar(&b, *strfrmt++); - else if (*++strfrmt == L_ESC) - luaL_addchar(&b, *strfrmt++); /* %% */ - else { /* format item */ - char form[MAX_FORMAT]; /* to store the format ('%...') */ - char *buff = luaL_prepbuffsize(&b, MAX_ITEM); /* to put formatted item */ - int nb = 0; /* number of bytes in added item */ - if (++arg > top) - luaL_argerror(L, arg, "no value"); - strfrmt = scanformat(L, strfrmt, form); - switch (*strfrmt++) { - case 'c': { - nb = l_sprintf(buff, MAX_ITEM, form, (int)luaL_checkinteger(L, arg)); - break; - } - case 'd': case 'i': - case 'o': case 'u': case 'x': case 'X': { - lua_Integer n = luaL_checkinteger(L, arg); - addlenmod(form, LUA_INTEGER_FRMLEN); - nb = l_sprintf(buff, MAX_ITEM, form, (LUAI_UACINT)n); - break; - } - case 'a': case 'A': - addlenmod(form, LUA_NUMBER_FRMLEN); - nb = lua_number2strx(L, buff, MAX_ITEM, form, - luaL_checknumber(L, arg)); - break; - case 'e': case 'E': case 'f': - case 'g': case 'G': { - lua_Number n = luaL_checknumber(L, arg); - addlenmod(form, LUA_NUMBER_FRMLEN); - nb = l_sprintf(buff, MAX_ITEM, form, (LUAI_UACNUMBER)n); - break; - } - case 'q': { - addliteral(L, &b, arg); - break; - } - case 's': { - size_t l; - const char *s = luaL_tolstring(L, arg, &l); - if (form[2] == '\0') /* no modifiers? */ - luaL_addvalue(&b); /* keep entire string */ - else { - luaL_argcheck(L, l == strlen(s), arg, "string contains zeros"); - if (!strchr(form, '.') && l >= 100) { - /* no precision and string is too long to be formatted */ - luaL_addvalue(&b); /* keep entire string */ - } - else { /* format the string into 'buff' */ - nb = l_sprintf(buff, MAX_ITEM, form, s); - lua_pop(L, 1); /* remove result from 'luaL_tolstring' */ - } - } - break; - } - default: { /* also treat cases 'pnLlh' */ - return luaL_error(L, "invalid option '%%%c' to 'format'", - *(strfrmt - 1)); - } - } - lua_assert(nb < MAX_ITEM); - luaL_addsize(&b, nb); - } - } - luaL_pushresult(&b); - return 1; -} - -/* }====================================================== */ - - -/* -** {====================================================== -** PACK/UNPACK -** ======================================================= -*/ - - -/* value used for padding */ -#if !defined(LUAL_PACKPADBYTE) -#define LUAL_PACKPADBYTE 0x00 -#endif - -/* maximum size for the binary representation of an integer */ -#define MAXINTSIZE 16 - -/* number of bits in a character */ -#define NB CHAR_BIT - -/* mask for one character (NB 1's) */ -#define MC ((1 << NB) - 1) - -/* size of a lua_Integer */ -#define SZINT ((int)sizeof(lua_Integer)) - - -/* dummy union to get native endianness */ -static const union { - int dummy; - char little; /* true iff machine is little endian */ -} nativeendian = {1}; - - -/* dummy structure to get native alignment requirements */ -struct cD { - char c; - union { double d; void *p; lua_Integer i; lua_Number n; } u; -}; - -#define MAXALIGN (offsetof(struct cD, u)) - - -/* -** Union for serializing floats -*/ -typedef union Ftypes { - float f; - double d; - lua_Number n; - char buff[5 * sizeof(lua_Number)]; /* enough for any float type */ -} Ftypes; - - -/* -** information to pack/unpack stuff -*/ -typedef struct Header { - lua_State *L; - int islittle; - int maxalign; -} Header; - - -/* -** options for pack/unpack -*/ -typedef enum KOption { - Kint, /* signed integers */ - Kuint, /* unsigned integers */ - Kfloat, /* floating-point numbers */ - Kchar, /* fixed-length strings */ - Kstring, /* strings with prefixed length */ - Kzstr, /* zero-terminated strings */ - Kpadding, /* padding */ - Kpaddalign, /* padding for alignment */ - Knop /* no-op (configuration or spaces) */ -} KOption; - - -/* -** Read an integer numeral from string 'fmt' or return 'df' if -** there is no numeral -*/ -static int digit (int c) { return '0' <= c && c <= '9'; } - -static int getnum (const char **fmt, int df) { - if (!digit(**fmt)) /* no number? */ - return df; /* return default value */ - else { - int a = 0; - do { - a = a*10 + (*((*fmt)++) - '0'); - } while (digit(**fmt) && a <= ((int)MAXSIZE - 9)/10); - return a; - } -} - - -/* -** Read an integer numeral and raises an error if it is larger -** than the maximum size for integers. -*/ -static int getnumlimit (Header *h, const char **fmt, int df) { - int sz = getnum(fmt, df); - if (sz > MAXINTSIZE || sz <= 0) - luaL_error(h->L, "integral size (%d) out of limits [1,%d]", - sz, MAXINTSIZE); - return sz; -} - - -/* -** Initialize Header -*/ -static void initheader (lua_State *L, Header *h) { - h->L = L; - h->islittle = nativeendian.little; - h->maxalign = 1; -} - - -/* -** Read and classify next option. 'size' is filled with option's size. -*/ -static KOption getoption (Header *h, const char **fmt, int *size) { - int opt = *((*fmt)++); - *size = 0; /* default */ - switch (opt) { - case 'b': *size = sizeof(char); return Kint; - case 'B': *size = sizeof(char); return Kuint; - case 'h': *size = sizeof(short); return Kint; - case 'H': *size = sizeof(short); return Kuint; - case 'l': *size = sizeof(long); return Kint; - case 'L': *size = sizeof(long); return Kuint; - case 'j': *size = sizeof(lua_Integer); return Kint; - case 'J': *size = sizeof(lua_Integer); return Kuint; - case 'T': *size = sizeof(size_t); return Kuint; - case 'f': *size = sizeof(float); return Kfloat; - case 'd': *size = sizeof(double); return Kfloat; - case 'n': *size = sizeof(lua_Number); return Kfloat; - case 'i': *size = getnumlimit(h, fmt, sizeof(int)); return Kint; - case 'I': *size = getnumlimit(h, fmt, sizeof(int)); return Kuint; - case 's': *size = getnumlimit(h, fmt, sizeof(size_t)); return Kstring; - case 'c': - *size = getnum(fmt, -1); - if (*size == -1) - luaL_error(h->L, "missing size for format option 'c'"); - return Kchar; - case 'z': return Kzstr; - case 'x': *size = 1; return Kpadding; - case 'X': return Kpaddalign; - case ' ': break; - case '<': h->islittle = 1; break; - case '>': h->islittle = 0; break; - case '=': h->islittle = nativeendian.little; break; - case '!': h->maxalign = getnumlimit(h, fmt, MAXALIGN); break; - default: luaL_error(h->L, "invalid format option '%c'", opt); - } - return Knop; -} - - -/* -** Read, classify, and fill other details about the next option. -** 'psize' is filled with option's size, 'notoalign' with its -** alignment requirements. -** Local variable 'size' gets the size to be aligned. (Kpadal option -** always gets its full alignment, other options are limited by -** the maximum alignment ('maxalign'). Kchar option needs no alignment -** despite its size. -*/ -static KOption getdetails (Header *h, size_t totalsize, - const char **fmt, int *psize, int *ntoalign) { - KOption opt = getoption(h, fmt, psize); - int align = *psize; /* usually, alignment follows size */ - if (opt == Kpaddalign) { /* 'X' gets alignment from following option */ - if (**fmt == '\0' || getoption(h, fmt, &align) == Kchar || align == 0) - luaL_argerror(h->L, 1, "invalid next option for option 'X'"); - } - if (align <= 1 || opt == Kchar) /* need no alignment? */ - *ntoalign = 0; - else { - if (align > h->maxalign) /* enforce maximum alignment */ - align = h->maxalign; - if ((align & (align - 1)) != 0) /* is 'align' not a power of 2? */ - luaL_argerror(h->L, 1, "format asks for alignment not power of 2"); - *ntoalign = (align - (int)(totalsize & (align - 1))) & (align - 1); - } - return opt; -} - - -/* -** Pack integer 'n' with 'size' bytes and 'islittle' endianness. -** The final 'if' handles the case when 'size' is larger than -** the size of a Lua integer, correcting the extra sign-extension -** bytes if necessary (by default they would be zeros). -*/ -static void packint (luaL_Buffer *b, lua_Unsigned n, - int islittle, int size, int neg) { - char *buff = luaL_prepbuffsize(b, size); - int i; - buff[islittle ? 0 : size - 1] = (char)(n & MC); /* first byte */ - for (i = 1; i < size; i++) { - n >>= NB; - buff[islittle ? i : size - 1 - i] = (char)(n & MC); - } - if (neg && size > SZINT) { /* negative number need sign extension? */ - for (i = SZINT; i < size; i++) /* correct extra bytes */ - buff[islittle ? i : size - 1 - i] = (char)MC; - } - luaL_addsize(b, size); /* add result to buffer */ -} - - -/* -** Copy 'size' bytes from 'src' to 'dest', correcting endianness if -** given 'islittle' is different from native endianness. -*/ -static void copywithendian (volatile char *dest, volatile const char *src, - int size, int islittle) { - if (islittle == nativeendian.little) { - while (size-- != 0) - *(dest++) = *(src++); - } - else { - dest += size - 1; - while (size-- != 0) - *(dest--) = *(src++); - } -} - - -static int str_pack (lua_State *L) { - luaL_Buffer b; - Header h; - const char *fmt = luaL_checkstring(L, 1); /* format string */ - int arg = 1; /* current argument to pack */ - size_t totalsize = 0; /* accumulate total size of result */ - initheader(L, &h); - lua_pushnil(L); /* mark to separate arguments from string buffer */ - luaL_buffinit(L, &b); - while (*fmt != '\0') { - int size, ntoalign; - KOption opt = getdetails(&h, totalsize, &fmt, &size, &ntoalign); - totalsize += ntoalign + size; - while (ntoalign-- > 0) - luaL_addchar(&b, LUAL_PACKPADBYTE); /* fill alignment */ - arg++; - switch (opt) { - case Kint: { /* signed integers */ - lua_Integer n = luaL_checkinteger(L, arg); - if (size < SZINT) { /* need overflow check? */ - lua_Integer lim = (lua_Integer)1 << ((size * NB) - 1); - luaL_argcheck(L, -lim <= n && n < lim, arg, "integer overflow"); - } - packint(&b, (lua_Unsigned)n, h.islittle, size, (n < 0)); - break; - } - case Kuint: { /* unsigned integers */ - lua_Integer n = luaL_checkinteger(L, arg); - if (size < SZINT) /* need overflow check? */ - luaL_argcheck(L, (lua_Unsigned)n < ((lua_Unsigned)1 << (size * NB)), - arg, "unsigned overflow"); - packint(&b, (lua_Unsigned)n, h.islittle, size, 0); - break; - } - case Kfloat: { /* floating-point options */ - volatile Ftypes u; - char *buff = luaL_prepbuffsize(&b, size); - lua_Number n = luaL_checknumber(L, arg); /* get argument */ - if (size == sizeof(u.f)) u.f = (float)n; /* copy it into 'u' */ - else if (size == sizeof(u.d)) u.d = (double)n; - else u.n = n; - /* move 'u' to final result, correcting endianness if needed */ - copywithendian(buff, u.buff, size, h.islittle); - luaL_addsize(&b, size); - break; - } - case Kchar: { /* fixed-size string */ - size_t len; - const char *s = luaL_checklstring(L, arg, &len); - luaL_argcheck(L, len <= (size_t)size, arg, - "string longer than given size"); - luaL_addlstring(&b, s, len); /* add string */ - while (len++ < (size_t)size) /* pad extra space */ - luaL_addchar(&b, LUAL_PACKPADBYTE); - break; - } - case Kstring: { /* strings with length count */ - size_t len; - const char *s = luaL_checklstring(L, arg, &len); - luaL_argcheck(L, size >= (int)sizeof(size_t) || - len < ((size_t)1 << (size * NB)), - arg, "string length does not fit in given size"); - packint(&b, (lua_Unsigned)len, h.islittle, size, 0); /* pack length */ - luaL_addlstring(&b, s, len); - totalsize += len; - break; - } - case Kzstr: { /* zero-terminated string */ - size_t len; - const char *s = luaL_checklstring(L, arg, &len); - luaL_argcheck(L, strlen(s) == len, arg, "string contains zeros"); - luaL_addlstring(&b, s, len); - luaL_addchar(&b, '\0'); /* add zero at the end */ - totalsize += len + 1; - break; - } - case Kpadding: luaL_addchar(&b, LUAL_PACKPADBYTE); /* FALLTHROUGH */ - case Kpaddalign: case Knop: - arg--; /* undo increment */ - break; - } - } - luaL_pushresult(&b); - return 1; -} - - -static int str_packsize (lua_State *L) { - Header h; - const char *fmt = luaL_checkstring(L, 1); /* format string */ - size_t totalsize = 0; /* accumulate total size of result */ - initheader(L, &h); - while (*fmt != '\0') { - int size, ntoalign; - KOption opt = getdetails(&h, totalsize, &fmt, &size, &ntoalign); - size += ntoalign; /* total space used by option */ - luaL_argcheck(L, totalsize <= MAXSIZE - size, 1, - "format result too large"); - totalsize += size; - switch (opt) { - case Kstring: /* strings with length count */ - case Kzstr: /* zero-terminated string */ - luaL_argerror(L, 1, "variable-length format"); - /* call never return, but to avoid warnings: *//* FALLTHROUGH */ - default: break; - } - } - lua_pushinteger(L, (lua_Integer)totalsize); - return 1; -} - - -/* -** Unpack an integer with 'size' bytes and 'islittle' endianness. -** If size is smaller than the size of a Lua integer and integer -** is signed, must do sign extension (propagating the sign to the -** higher bits); if size is larger than the size of a Lua integer, -** it must check the unread bytes to see whether they do not cause an -** overflow. -*/ -static lua_Integer unpackint (lua_State *L, const char *str, - int islittle, int size, int issigned) { - lua_Unsigned res = 0; - int i; - int limit = (size <= SZINT) ? size : SZINT; - for (i = limit - 1; i >= 0; i--) { - res <<= NB; - res |= (lua_Unsigned)(unsigned char)str[islittle ? i : size - 1 - i]; - } - if (size < SZINT) { /* real size smaller than lua_Integer? */ - if (issigned) { /* needs sign extension? */ - lua_Unsigned mask = (lua_Unsigned)1 << (size*NB - 1); - res = ((res ^ mask) - mask); /* do sign extension */ - } - } - else if (size > SZINT) { /* must check unread bytes */ - int mask = (!issigned || (lua_Integer)res >= 0) ? 0 : MC; - for (i = limit; i < size; i++) { - if ((unsigned char)str[islittle ? i : size - 1 - i] != mask) - luaL_error(L, "%d-byte integer does not fit into Lua Integer", size); - } - } - return (lua_Integer)res; -} - - -static int str_unpack (lua_State *L) { - Header h; - const char *fmt = luaL_checkstring(L, 1); - size_t ld; - const char *data = luaL_checklstring(L, 2, &ld); - size_t pos = (size_t)posrelat(luaL_optinteger(L, 3, 1), ld) - 1; - int n = 0; /* number of results */ - luaL_argcheck(L, pos <= ld, 3, "initial position out of string"); - initheader(L, &h); - while (*fmt != '\0') { - int size, ntoalign; - KOption opt = getdetails(&h, pos, &fmt, &size, &ntoalign); - if ((size_t)ntoalign + size > ~pos || pos + ntoalign + size > ld) - luaL_argerror(L, 2, "data string too short"); - pos += ntoalign; /* skip alignment */ - /* stack space for item + next position */ - luaL_checkstack(L, 2, "too many results"); - n++; - switch (opt) { - case Kint: - case Kuint: { - lua_Integer res = unpackint(L, data + pos, h.islittle, size, - (opt == Kint)); - lua_pushinteger(L, res); - break; - } - case Kfloat: { - volatile Ftypes u; - lua_Number num; - copywithendian(u.buff, data + pos, size, h.islittle); - if (size == sizeof(u.f)) num = (lua_Number)u.f; - else if (size == sizeof(u.d)) num = (lua_Number)u.d; - else num = u.n; - lua_pushnumber(L, num); - break; - } - case Kchar: { - lua_pushlstring(L, data + pos, size); - break; - } - case Kstring: { - size_t len = (size_t)unpackint(L, data + pos, h.islittle, size, 0); - luaL_argcheck(L, pos + len + size <= ld, 2, "data string too short"); - lua_pushlstring(L, data + pos + size, len); - pos += len; /* skip string */ - break; - } - case Kzstr: { - size_t len = (int)strlen(data + pos); - lua_pushlstring(L, data + pos, len); - pos += len + 1; /* skip string plus final '\0' */ - break; - } - case Kpaddalign: case Kpadding: case Knop: - n--; /* undo increment */ - break; - } - pos += size; - } - lua_pushinteger(L, pos + 1); /* next position */ - return n + 1; -} - -/* }====================================================== */ - - -static const luaL_Reg strlib[] = { - {"byte", str_byte}, - {"char", str_char}, - {"dump", str_dump}, - {"find", str_find}, - {"format", str_format}, - {"gmatch", gmatch}, - {"gsub", str_gsub}, - {"len", str_len}, - {"lower", str_lower}, - {"match", str_match}, - {"rep", str_rep}, - {"reverse", str_reverse}, - {"sub", str_sub}, - {"upper", str_upper}, - {"pack", str_pack}, - {"packsize", str_packsize}, - {"unpack", str_unpack}, - {NULL, NULL} -}; - - -static void createmetatable (lua_State *L) { - lua_createtable(L, 0, 1); /* table to be metatable for strings */ - lua_pushliteral(L, ""); /* dummy string */ - lua_pushvalue(L, -2); /* copy table */ - lua_setmetatable(L, -2); /* set table as metatable for strings */ - lua_pop(L, 1); /* pop dummy string */ - lua_pushvalue(L, -2); /* get string library */ - lua_setfield(L, -2, "__index"); /* metatable.__index = string */ - lua_pop(L, 1); /* pop metatable */ -} - - -/* -** Open string library -*/ -LUAMOD_API int luaopen_string (lua_State *L) { - luaL_newlib(L, strlib); - createmetatable(L); - return 1; -} - diff --git a/LuaSkin/lua-5.3.4/src/ltable.c b/LuaSkin/lua-5.3.4/src/ltable.c deleted file mode 100644 index d080189f2..000000000 --- a/LuaSkin/lua-5.3.4/src/ltable.c +++ /dev/null @@ -1,669 +0,0 @@ -/* -** $Id: ltable.c,v 2.118 2016/11/07 12:38:35 roberto Exp $ -** Lua tables (hash) -** See Copyright Notice in lua.h -*/ - -#define ltable_c -#define LUA_CORE - -#include "lprefix.h" - - -/* -** Implementation of tables (aka arrays, objects, or hash tables). -** Tables keep its elements in two parts: an array part and a hash part. -** Non-negative integer keys are all candidates to be kept in the array -** part. The actual size of the array is the largest 'n' such that -** more than half the slots between 1 and n are in use. -** Hash uses a mix of chained scatter table with Brent's variation. -** A main invariant of these tables is that, if an element is not -** in its main position (i.e. the 'original' position that its hash gives -** to it), then the colliding element is in its own main position. -** Hence even when the load factor reaches 100%, performance remains good. -*/ - -#include -#include - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "lvm.h" - - -/* -** Maximum size of array part (MAXASIZE) is 2^MAXABITS. MAXABITS is -** the largest integer such that MAXASIZE fits in an unsigned int. -*/ -#define MAXABITS cast_int(sizeof(int) * CHAR_BIT - 1) -#define MAXASIZE (1u << MAXABITS) - -/* -** Maximum size of hash part is 2^MAXHBITS. MAXHBITS is the largest -** integer such that 2^MAXHBITS fits in a signed int. (Note that the -** maximum number of elements in a table, 2^MAXABITS + 2^MAXHBITS, still -** fits comfortably in an unsigned int.) -*/ -#define MAXHBITS (MAXABITS - 1) - - -#define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t)))) - -#define hashstr(t,str) hashpow2(t, (str)->hash) -#define hashboolean(t,p) hashpow2(t, p) -#define hashint(t,i) hashpow2(t, i) - - -/* -** for some types, it is better to avoid modulus by power of 2, as -** they tend to have many 2 factors. -*/ -#define hashmod(t,n) (gnode(t, ((n) % ((sizenode(t)-1)|1)))) - - -#define hashpointer(t,p) hashmod(t, point2uint(p)) - - -#define dummynode (&dummynode_) - -static const Node dummynode_ = { - {NILCONSTANT}, /* value */ - {{NILCONSTANT, 0}} /* key */ -}; - - -/* -** Hash for floating-point numbers. -** The main computation should be just -** n = frexp(n, &i); return (n * INT_MAX) + i -** but there are some numerical subtleties. -** In a two-complement representation, INT_MAX does not has an exact -** representation as a float, but INT_MIN does; because the absolute -** value of 'frexp' is smaller than 1 (unless 'n' is inf/NaN), the -** absolute value of the product 'frexp * -INT_MIN' is smaller or equal -** to INT_MAX. Next, the use of 'unsigned int' avoids overflows when -** adding 'i'; the use of '~u' (instead of '-u') avoids problems with -** INT_MIN. -*/ -#if !defined(l_hashfloat) -static int l_hashfloat (lua_Number n) { - int i; - lua_Integer ni; - n = l_mathop(frexp)(n, &i) * -cast_num(INT_MIN); - if (!lua_numbertointeger(n, &ni)) { /* is 'n' inf/-inf/NaN? */ - lua_assert(luai_numisnan(n) || l_mathop(fabs)(n) == cast_num(HUGE_VAL)); - return 0; - } - else { /* normal case */ - unsigned int u = cast(unsigned int, i) + cast(unsigned int, ni); - return cast_int(u <= cast(unsigned int, INT_MAX) ? u : ~u); - } -} -#endif - - -/* -** returns the 'main' position of an element in a table (that is, the index -** of its hash value) -*/ -static Node *mainposition (const Table *t, const TValue *key) { - switch (ttype(key)) { - case LUA_TNUMINT: - return hashint(t, ivalue(key)); - case LUA_TNUMFLT: - return hashmod(t, l_hashfloat(fltvalue(key))); - case LUA_TSHRSTR: - return hashstr(t, tsvalue(key)); - case LUA_TLNGSTR: - return hashpow2(t, luaS_hashlongstr(tsvalue(key))); - case LUA_TBOOLEAN: - return hashboolean(t, bvalue(key)); - case LUA_TLIGHTUSERDATA: - return hashpointer(t, pvalue(key)); - case LUA_TLCF: - return hashpointer(t, fvalue(key)); - default: - lua_assert(!ttisdeadkey(key)); - return hashpointer(t, gcvalue(key)); - } -} - - -/* -** returns the index for 'key' if 'key' is an appropriate key to live in -** the array part of the table, 0 otherwise. -*/ -static unsigned int arrayindex (const TValue *key) { - if (ttisinteger(key)) { - lua_Integer k = ivalue(key); - if (0 < k && (lua_Unsigned)k <= MAXASIZE) - return cast(unsigned int, k); /* 'key' is an appropriate array index */ - } - return 0; /* 'key' did not match some condition */ -} - - -/* -** returns the index of a 'key' for table traversals. First goes all -** elements in the array part, then elements in the hash part. The -** beginning of a traversal is signaled by 0. -*/ -static unsigned int findindex (lua_State *L, Table *t, StkId key) { - unsigned int i; - if (ttisnil(key)) return 0; /* first iteration */ - i = arrayindex(key); - if (i != 0 && i <= t->sizearray) /* is 'key' inside array part? */ - return i; /* yes; that's the index */ - else { - int nx; - Node *n = mainposition(t, key); - for (;;) { /* check whether 'key' is somewhere in the chain */ - /* key may be dead already, but it is ok to use it in 'next' */ - if (luaV_rawequalobj(gkey(n), key) || - (ttisdeadkey(gkey(n)) && iscollectable(key) && - deadvalue(gkey(n)) == gcvalue(key))) { - i = cast_int(n - gnode(t, 0)); /* key index in hash table */ - /* hash elements are numbered after array ones */ - return (i + 1) + t->sizearray; - } - nx = gnext(n); - if (nx == 0) - luaG_runerror(L, "invalid key to 'next'"); /* key not found */ - else n += nx; - } - } -} - - -int luaH_next (lua_State *L, Table *t, StkId key) { - unsigned int i = findindex(L, t, key); /* find original element */ - for (; i < t->sizearray; i++) { /* try first array part */ - if (!ttisnil(&t->array[i])) { /* a non-nil value? */ - setivalue(key, i + 1); - setobj2s(L, key+1, &t->array[i]); - return 1; - } - } - for (i -= t->sizearray; cast_int(i) < sizenode(t); i++) { /* hash part */ - if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */ - setobj2s(L, key, gkey(gnode(t, i))); - setobj2s(L, key+1, gval(gnode(t, i))); - return 1; - } - } - return 0; /* no more elements */ -} - - -/* -** {============================================================= -** Rehash -** ============================================================== -*/ - -/* -** Compute the optimal size for the array part of table 't'. 'nums' is a -** "count array" where 'nums[i]' is the number of integers in the table -** between 2^(i - 1) + 1 and 2^i. 'pna' enters with the total number of -** integer keys in the table and leaves with the number of keys that -** will go to the array part; return the optimal size. -*/ -static unsigned int computesizes (unsigned int nums[], unsigned int *pna) { - int i; - unsigned int twotoi; /* 2^i (candidate for optimal size) */ - unsigned int a = 0; /* number of elements smaller than 2^i */ - unsigned int na = 0; /* number of elements to go to array part */ - unsigned int optimal = 0; /* optimal size for array part */ - /* loop while keys can fill more than half of total size */ - for (i = 0, twotoi = 1; *pna > twotoi / 2; i++, twotoi *= 2) { - if (nums[i] > 0) { - a += nums[i]; - if (a > twotoi/2) { /* more than half elements present? */ - optimal = twotoi; /* optimal size (till now) */ - na = a; /* all elements up to 'optimal' will go to array part */ - } - } - } - lua_assert((optimal == 0 || optimal / 2 < na) && na <= optimal); - *pna = na; - return optimal; -} - - -static int countint (const TValue *key, unsigned int *nums) { - unsigned int k = arrayindex(key); - if (k != 0) { /* is 'key' an appropriate array index? */ - nums[luaO_ceillog2(k)]++; /* count as such */ - return 1; - } - else - return 0; -} - - -/* -** Count keys in array part of table 't': Fill 'nums[i]' with -** number of keys that will go into corresponding slice and return -** total number of non-nil keys. -*/ -static unsigned int numusearray (const Table *t, unsigned int *nums) { - int lg; - unsigned int ttlg; /* 2^lg */ - unsigned int ause = 0; /* summation of 'nums' */ - unsigned int i = 1; /* count to traverse all array keys */ - /* traverse each slice */ - for (lg = 0, ttlg = 1; lg <= MAXABITS; lg++, ttlg *= 2) { - unsigned int lc = 0; /* counter */ - unsigned int lim = ttlg; - if (lim > t->sizearray) { - lim = t->sizearray; /* adjust upper limit */ - if (i > lim) - break; /* no more elements to count */ - } - /* count elements in range (2^(lg - 1), 2^lg] */ - for (; i <= lim; i++) { - if (!ttisnil(&t->array[i-1])) - lc++; - } - nums[lg] += lc; - ause += lc; - } - return ause; -} - - -static int numusehash (const Table *t, unsigned int *nums, unsigned int *pna) { - int totaluse = 0; /* total number of elements */ - int ause = 0; /* elements added to 'nums' (can go to array part) */ - int i = sizenode(t); - while (i--) { - Node *n = &t->node[i]; - if (!ttisnil(gval(n))) { - ause += countint(gkey(n), nums); - totaluse++; - } - } - *pna += ause; - return totaluse; -} - - -static void setarrayvector (lua_State *L, Table *t, unsigned int size) { - unsigned int i; - luaM_reallocvector(L, t->array, t->sizearray, size, TValue); - for (i=t->sizearray; iarray[i]); - t->sizearray = size; -} - - -static void setnodevector (lua_State *L, Table *t, unsigned int size) { - if (size == 0) { /* no elements to hash part? */ - t->node = cast(Node *, dummynode); /* use common 'dummynode' */ - t->lsizenode = 0; - t->lastfree = NULL; /* signal that it is using dummy node */ - } - else { - int i; - int lsize = luaO_ceillog2(size); - if (lsize > MAXHBITS) - luaG_runerror(L, "table overflow"); - size = twoto(lsize); - t->node = luaM_newvector(L, size, Node); - for (i = 0; i < (int)size; i++) { - Node *n = gnode(t, i); - gnext(n) = 0; - setnilvalue(wgkey(n)); - setnilvalue(gval(n)); - } - t->lsizenode = cast_byte(lsize); - t->lastfree = gnode(t, size); /* all positions are free */ - } -} - - -void luaH_resize (lua_State *L, Table *t, unsigned int nasize, - unsigned int nhsize) { - unsigned int i; - int j; - unsigned int oldasize = t->sizearray; - int oldhsize = allocsizenode(t); - Node *nold = t->node; /* save old hash ... */ - if (nasize > oldasize) /* array part must grow? */ - setarrayvector(L, t, nasize); - /* create new hash part with appropriate size */ - setnodevector(L, t, nhsize); - if (nasize < oldasize) { /* array part must shrink? */ - t->sizearray = nasize; - /* re-insert elements from vanishing slice */ - for (i=nasize; iarray[i])) - luaH_setint(L, t, i + 1, &t->array[i]); - } - /* shrink array */ - luaM_reallocvector(L, t->array, oldasize, nasize, TValue); - } - /* re-insert elements from hash part */ - for (j = oldhsize - 1; j >= 0; j--) { - Node *old = nold + j; - if (!ttisnil(gval(old))) { - /* doesn't need barrier/invalidate cache, as entry was - already present in the table */ - setobjt2t(L, luaH_set(L, t, gkey(old)), gval(old)); - } - } - if (oldhsize > 0) /* not the dummy node? */ - luaM_freearray(L, nold, cast(size_t, oldhsize)); /* free old hash */ -} - - -void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize) { - int nsize = allocsizenode(t); - luaH_resize(L, t, nasize, nsize); -} - -/* -** nums[i] = number of keys 'k' where 2^(i - 1) < k <= 2^i -*/ -static void rehash (lua_State *L, Table *t, const TValue *ek) { - unsigned int asize; /* optimal size for array part */ - unsigned int na; /* number of keys in the array part */ - unsigned int nums[MAXABITS + 1]; - int i; - int totaluse; - for (i = 0; i <= MAXABITS; i++) nums[i] = 0; /* reset counts */ - na = numusearray(t, nums); /* count keys in array part */ - totaluse = na; /* all those keys are integer keys */ - totaluse += numusehash(t, nums, &na); /* count keys in hash part */ - /* count extra key */ - na += countint(ek, nums); - totaluse++; - /* compute new size for array part */ - asize = computesizes(nums, &na); - /* resize the table to new computed sizes */ - luaH_resize(L, t, asize, totaluse - na); -} - - - -/* -** }============================================================= -*/ - - -Table *luaH_new (lua_State *L) { - GCObject *o = luaC_newobj(L, LUA_TTABLE, sizeof(Table)); - Table *t = gco2t(o); - t->metatable = NULL; - t->flags = cast_byte(~0); - t->array = NULL; - t->sizearray = 0; - setnodevector(L, t, 0); - return t; -} - - -void luaH_free (lua_State *L, Table *t) { - if (!isdummy(t)) - luaM_freearray(L, t->node, cast(size_t, sizenode(t))); - luaM_freearray(L, t->array, t->sizearray); - luaM_free(L, t); -} - - -static Node *getfreepos (Table *t) { - if (!isdummy(t)) { - while (t->lastfree > t->node) { - t->lastfree--; - if (ttisnil(gkey(t->lastfree))) - return t->lastfree; - } - } - return NULL; /* could not find a free place */ -} - - - -/* -** inserts a new key into a hash table; first, check whether key's main -** position is free. If not, check whether colliding node is in its main -** position or not: if it is not, move colliding node to an empty place and -** put new key in its main position; otherwise (colliding node is in its main -** position), new key goes to an empty position. -*/ -TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) { - Node *mp; - TValue aux; - if (ttisnil(key)) luaG_runerror(L, "table index is nil"); - else if (ttisfloat(key)) { - lua_Integer k; - if (luaV_tointeger(key, &k, 0)) { /* does index fit in an integer? */ - setivalue(&aux, k); - key = &aux; /* insert it as an integer */ - } - else if (luai_numisnan(fltvalue(key))) - luaG_runerror(L, "table index is NaN"); - } - mp = mainposition(t, key); - if (!ttisnil(gval(mp)) || isdummy(t)) { /* main position is taken? */ - Node *othern; - Node *f = getfreepos(t); /* get a free place */ - if (f == NULL) { /* cannot find a free place? */ - rehash(L, t, key); /* grow table */ - /* whatever called 'newkey' takes care of TM cache */ - return luaH_set(L, t, key); /* insert key into grown table */ - } - lua_assert(!isdummy(t)); - othern = mainposition(t, gkey(mp)); - if (othern != mp) { /* is colliding node out of its main position? */ - /* yes; move colliding node into free position */ - while (othern + gnext(othern) != mp) /* find previous */ - othern += gnext(othern); - gnext(othern) = cast_int(f - othern); /* rechain to point to 'f' */ - *f = *mp; /* copy colliding node into free pos. (mp->next also goes) */ - if (gnext(mp) != 0) { - gnext(f) += cast_int(mp - f); /* correct 'next' */ - gnext(mp) = 0; /* now 'mp' is free */ - } - setnilvalue(gval(mp)); - } - else { /* colliding node is in its own main position */ - /* new node will go into free position */ - if (gnext(mp) != 0) - gnext(f) = cast_int((mp + gnext(mp)) - f); /* chain new position */ - else lua_assert(gnext(f) == 0); - gnext(mp) = cast_int(f - mp); - mp = f; - } - } - setnodekey(L, &mp->i_key, key); - luaC_barrierback(L, t, key); - lua_assert(ttisnil(gval(mp))); - return gval(mp); -} - - -/* -** search function for integers -*/ -const TValue *luaH_getint (Table *t, lua_Integer key) { - /* (1 <= key && key <= t->sizearray) */ - if (l_castS2U(key) - 1 < t->sizearray) - return &t->array[key - 1]; - else { - Node *n = hashint(t, key); - for (;;) { /* check whether 'key' is somewhere in the chain */ - if (ttisinteger(gkey(n)) && ivalue(gkey(n)) == key) - return gval(n); /* that's it */ - else { - int nx = gnext(n); - if (nx == 0) break; - n += nx; - } - } - return luaO_nilobject; - } -} - - -/* -** search function for short strings -*/ -const TValue *luaH_getshortstr (Table *t, TString *key) { - Node *n = hashstr(t, key); - lua_assert(key->tt == LUA_TSHRSTR); - for (;;) { /* check whether 'key' is somewhere in the chain */ - const TValue *k = gkey(n); - if (ttisshrstring(k) && eqshrstr(tsvalue(k), key)) - return gval(n); /* that's it */ - else { - int nx = gnext(n); - if (nx == 0) - return luaO_nilobject; /* not found */ - n += nx; - } - } -} - - -/* -** "Generic" get version. (Not that generic: not valid for integers, -** which may be in array part, nor for floats with integral values.) -*/ -static const TValue *getgeneric (Table *t, const TValue *key) { - Node *n = mainposition(t, key); - for (;;) { /* check whether 'key' is somewhere in the chain */ - if (luaV_rawequalobj(gkey(n), key)) - return gval(n); /* that's it */ - else { - int nx = gnext(n); - if (nx == 0) - return luaO_nilobject; /* not found */ - n += nx; - } - } -} - - -const TValue *luaH_getstr (Table *t, TString *key) { - if (key->tt == LUA_TSHRSTR) - return luaH_getshortstr(t, key); - else { /* for long strings, use generic case */ - TValue ko; - setsvalue(cast(lua_State *, NULL), &ko, key); - return getgeneric(t, &ko); - } -} - - -/* -** main search function -*/ -const TValue *luaH_get (Table *t, const TValue *key) { - switch (ttype(key)) { - case LUA_TSHRSTR: return luaH_getshortstr(t, tsvalue(key)); - case LUA_TNUMINT: return luaH_getint(t, ivalue(key)); - case LUA_TNIL: return luaO_nilobject; - case LUA_TNUMFLT: { - lua_Integer k; - if (luaV_tointeger(key, &k, 0)) /* index is int? */ - return luaH_getint(t, k); /* use specialized version */ - /* else... */ - } /* FALLTHROUGH */ - default: - return getgeneric(t, key); - } -} - - -/* -** beware: when using this function you probably need to check a GC -** barrier and invalidate the TM cache. -*/ -TValue *luaH_set (lua_State *L, Table *t, const TValue *key) { - const TValue *p = luaH_get(t, key); - if (p != luaO_nilobject) - return cast(TValue *, p); - else return luaH_newkey(L, t, key); -} - - -void luaH_setint (lua_State *L, Table *t, lua_Integer key, TValue *value) { - const TValue *p = luaH_getint(t, key); - TValue *cell; - if (p != luaO_nilobject) - cell = cast(TValue *, p); - else { - TValue k; - setivalue(&k, key); - cell = luaH_newkey(L, t, &k); - } - setobj2t(L, cell, value); -} - - -static int unbound_search (Table *t, unsigned int j) { - unsigned int i = j; /* i is zero or a present index */ - j++; - /* find 'i' and 'j' such that i is present and j is not */ - while (!ttisnil(luaH_getint(t, j))) { - i = j; - if (j > cast(unsigned int, MAX_INT)/2) { /* overflow? */ - /* table was built with bad purposes: resort to linear search */ - i = 1; - while (!ttisnil(luaH_getint(t, i))) i++; - return i - 1; - } - j *= 2; - } - /* now do a binary search between them */ - while (j - i > 1) { - unsigned int m = (i+j)/2; - if (ttisnil(luaH_getint(t, m))) j = m; - else i = m; - } - return i; -} - - -/* -** Try to find a boundary in table 't'. A 'boundary' is an integer index -** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil). -*/ -int luaH_getn (Table *t) { - unsigned int j = t->sizearray; - if (j > 0 && ttisnil(&t->array[j - 1])) { - /* there is a boundary in the array part: (binary) search for it */ - unsigned int i = 0; - while (j - i > 1) { - unsigned int m = (i+j)/2; - if (ttisnil(&t->array[m - 1])) j = m; - else i = m; - } - return i; - } - /* else must find a boundary in hash part */ - else if (isdummy(t)) /* hash part is empty? */ - return j; /* that is easy... */ - else return unbound_search(t, j); -} - - - -#if defined(LUA_DEBUG) - -Node *luaH_mainposition (const Table *t, const TValue *key) { - return mainposition(t, key); -} - -int luaH_isdummy (const Table *t) { return isdummy(t); } - -#endif diff --git a/LuaSkin/lua-5.3.4/src/ltable.h b/LuaSkin/lua-5.3.4/src/ltable.h deleted file mode 100644 index 6da9024fe..000000000 --- a/LuaSkin/lua-5.3.4/src/ltable.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -** $Id: ltable.h,v 2.23 2016/12/22 13:08:50 roberto Exp $ -** Lua tables (hash) -** See Copyright Notice in lua.h -*/ - -#ifndef ltable_h -#define ltable_h - -#include "lobject.h" - - -#define gnode(t,i) (&(t)->node[i]) -#define gval(n) (&(n)->i_val) -#define gnext(n) ((n)->i_key.nk.next) - - -/* 'const' to avoid wrong writings that can mess up field 'next' */ -#define gkey(n) cast(const TValue*, (&(n)->i_key.tvk)) - -/* -** writable version of 'gkey'; allows updates to individual fields, -** but not to the whole (which has incompatible type) -*/ -#define wgkey(n) (&(n)->i_key.nk) - -#define invalidateTMcache(t) ((t)->flags = 0) - - -/* true when 't' is using 'dummynode' as its hash part */ -#define isdummy(t) ((t)->lastfree == NULL) - - -/* allocated size for hash nodes */ -#define allocsizenode(t) (isdummy(t) ? 0 : sizenode(t)) - - -/* returns the key, given the value of a table entry */ -#define keyfromval(v) \ - (gkey(cast(Node *, cast(char *, (v)) - offsetof(Node, i_val)))) - - -LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key); -LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key, - TValue *value); -LUAI_FUNC const TValue *luaH_getshortstr (Table *t, TString *key); -LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); -LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); -LUAI_FUNC TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key); -LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); -LUAI_FUNC Table *luaH_new (lua_State *L); -LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize, - unsigned int nhsize); -LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize); -LUAI_FUNC void luaH_free (lua_State *L, Table *t); -LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); -LUAI_FUNC int luaH_getn (Table *t); - - -#if defined(LUA_DEBUG) -LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); -LUAI_FUNC int luaH_isdummy (const Table *t); -#endif - - -#endif diff --git a/LuaSkin/lua-5.3.4/src/ltm.c b/LuaSkin/lua-5.3.4/src/ltm.c deleted file mode 100644 index 14e525788..000000000 --- a/LuaSkin/lua-5.3.4/src/ltm.c +++ /dev/null @@ -1,165 +0,0 @@ -/* -** $Id: ltm.c,v 2.38 2016/12/22 13:08:50 roberto Exp $ -** Tag methods -** See Copyright Notice in lua.h -*/ - -#define ltm_c -#define LUA_CORE - -#include "lprefix.h" - - -#include - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" -#include "lvm.h" - - -static const char udatatypename[] = "userdata"; - -LUAI_DDEF const char *const luaT_typenames_[LUA_TOTALTAGS] = { - "no value", - "nil", "boolean", udatatypename, "number", - "string", "table", "function", udatatypename, "thread", - "proto" /* this last case is used for tests only */ -}; - - -void luaT_init (lua_State *L) { - static const char *const luaT_eventname[] = { /* ORDER TM */ - "__index", "__newindex", - "__gc", "__mode", "__len", "__eq", - "__add", "__sub", "__mul", "__mod", "__pow", - "__div", "__idiv", - "__band", "__bor", "__bxor", "__shl", "__shr", - "__unm", "__bnot", "__lt", "__le", - "__concat", "__call" - }; - int i; - for (i=0; itmname[i] = luaS_new(L, luaT_eventname[i]); - luaC_fix(L, obj2gco(G(L)->tmname[i])); /* never collect these names */ - } -} - - -/* -** function to be used with macro "fasttm": optimized for absence of -** tag methods -*/ -const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { - const TValue *tm = luaH_getshortstr(events, ename); - lua_assert(event <= TM_EQ); - if (ttisnil(tm)) { /* no tag method? */ - events->flags |= cast_byte(1u<metatable; - break; - case LUA_TUSERDATA: - mt = uvalue(o)->metatable; - break; - default: - mt = G(L)->mt[ttnov(o)]; - } - return (mt ? luaH_getshortstr(mt, G(L)->tmname[event]) : luaO_nilobject); -} - - -/* -** Return the name of the type of an object. For tables and userdata -** with metatable, use their '__name' metafield, if present. -*/ -const char *luaT_objtypename (lua_State *L, const TValue *o) { - Table *mt; - if ((ttistable(o) && (mt = hvalue(o)->metatable) != NULL) || - (ttisfulluserdata(o) && (mt = uvalue(o)->metatable) != NULL)) { - const TValue *name = luaH_getshortstr(mt, luaS_new(L, "__name")); - if (ttisstring(name)) /* is '__name' a string? */ - return getstr(tsvalue(name)); /* use it as type name */ - } - return ttypename(ttnov(o)); /* else use standard type name */ -} - - -void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1, - const TValue *p2, TValue *p3, int hasres) { - ptrdiff_t result = savestack(L, p3); - StkId func = L->top; - setobj2s(L, func, f); /* push function (assume EXTRA_STACK) */ - setobj2s(L, func + 1, p1); /* 1st argument */ - setobj2s(L, func + 2, p2); /* 2nd argument */ - L->top += 3; - if (!hasres) /* no result? 'p3' is third argument */ - setobj2s(L, L->top++, p3); /* 3rd argument */ - /* metamethod may yield only when called from Lua code */ - if (isLua(L->ci)) - luaD_call(L, func, hasres); - else - luaD_callnoyield(L, func, hasres); - if (hasres) { /* if has result, move it to its place */ - p3 = restorestack(L, result); - setobjs2s(L, p3, --L->top); - } -} - - -int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2, - StkId res, TMS event) { - const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */ - if (ttisnil(tm)) - tm = luaT_gettmbyobj(L, p2, event); /* try second operand */ - if (ttisnil(tm)) return 0; - luaT_callTM(L, tm, p1, p2, res, 1); - return 1; -} - - -void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, - StkId res, TMS event) { - if (!luaT_callbinTM(L, p1, p2, res, event)) { - switch (event) { - case TM_CONCAT: - luaG_concaterror(L, p1, p2); - /* call never returns, but to avoid warnings: *//* FALLTHROUGH */ - case TM_BAND: case TM_BOR: case TM_BXOR: - case TM_SHL: case TM_SHR: case TM_BNOT: { - lua_Number dummy; - if (tonumber(p1, &dummy) && tonumber(p2, &dummy)) - luaG_tointerror(L, p1, p2); - else - luaG_opinterror(L, p1, p2, "perform bitwise operation on"); - } - /* calls never return, but to avoid warnings: *//* FALLTHROUGH */ - default: - luaG_opinterror(L, p1, p2, "perform arithmetic on"); - } - } -} - - -int luaT_callorderTM (lua_State *L, const TValue *p1, const TValue *p2, - TMS event) { - if (!luaT_callbinTM(L, p1, p2, L->top, event)) - return -1; /* no metamethod */ - else - return !l_isfalse(L->top); -} - diff --git a/LuaSkin/lua-5.3.4/src/ltm.h b/LuaSkin/lua-5.3.4/src/ltm.h deleted file mode 100644 index 63db7269b..000000000 --- a/LuaSkin/lua-5.3.4/src/ltm.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -** $Id: ltm.h,v 2.22 2016/02/26 19:20:15 roberto Exp $ -** Tag methods -** See Copyright Notice in lua.h -*/ - -#ifndef ltm_h -#define ltm_h - - -#include "lobject.h" - - -/* -* WARNING: if you change the order of this enumeration, -* grep "ORDER TM" and "ORDER OP" -*/ -typedef enum { - TM_INDEX, - TM_NEWINDEX, - TM_GC, - TM_MODE, - TM_LEN, - TM_EQ, /* last tag method with fast access */ - TM_ADD, - TM_SUB, - TM_MUL, - TM_MOD, - TM_POW, - TM_DIV, - TM_IDIV, - TM_BAND, - TM_BOR, - TM_BXOR, - TM_SHL, - TM_SHR, - TM_UNM, - TM_BNOT, - TM_LT, - TM_LE, - TM_CONCAT, - TM_CALL, - TM_N /* number of elements in the enum */ -} TMS; - - - -#define gfasttm(g,et,e) ((et) == NULL ? NULL : \ - ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) - -#define fasttm(l,et,e) gfasttm(G(l), et, e) - -#define ttypename(x) luaT_typenames_[(x) + 1] - -LUAI_DDEC const char *const luaT_typenames_[LUA_TOTALTAGS]; - - -LUAI_FUNC const char *luaT_objtypename (lua_State *L, const TValue *o); - -LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); -LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, - TMS event); -LUAI_FUNC void luaT_init (lua_State *L); - -LUAI_FUNC void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1, - const TValue *p2, TValue *p3, int hasres); -LUAI_FUNC int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2, - StkId res, TMS event); -LUAI_FUNC void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, - StkId res, TMS event); -LUAI_FUNC int luaT_callorderTM (lua_State *L, const TValue *p1, - const TValue *p2, TMS event); - - - -#endif diff --git a/LuaSkin/lua-5.3.4/src/luac.c b/LuaSkin/lua-5.3.4/src/luac.c deleted file mode 100644 index c0c91d017..000000000 --- a/LuaSkin/lua-5.3.4/src/luac.c +++ /dev/null @@ -1,449 +0,0 @@ -/* -** $Id: luac.c,v 1.75 2015/03/12 01:58:27 lhf Exp $ -** Lua compiler (saves bytecodes to files; also lists bytecodes) -** See Copyright Notice in lua.h -*/ - -#define luac_c -#define LUA_CORE - -#include "lprefix.h" - -#include -#include -#include -#include -#include - -#include "lua.h" -#include "lauxlib.h" - -#include "lobject.h" -#include "lstate.h" -#include "lundump.h" - -static void PrintFunction(const Proto* f, int full); -#define luaU_print PrintFunction - -#define PROGNAME "luac" /* default program name */ -#define OUTPUT PROGNAME ".out" /* default output file */ - -static int listing=0; /* list bytecodes? */ -static int dumping=1; /* dump bytecodes? */ -static int stripping=0; /* strip debug information? */ -static char Output[]={ OUTPUT }; /* default output file name */ -static const char* output=Output; /* actual output file name */ -static const char* progname=PROGNAME; /* actual program name */ - -static void fatal(const char* message) -{ - fprintf(stderr,"%s: %s\n",progname,message); - exit(EXIT_FAILURE); -} - -static void cannot(const char* what) -{ - fprintf(stderr,"%s: cannot %s %s: %s\n",progname,what,output,strerror(errno)); - exit(EXIT_FAILURE); -} - -static void usage(const char* message) -{ - if (*message=='-') - fprintf(stderr,"%s: unrecognized option '%s'\n",progname,message); - else - fprintf(stderr,"%s: %s\n",progname,message); - fprintf(stderr, - "usage: %s [options] [filenames]\n" - "Available options are:\n" - " -l list (use -l -l for full listing)\n" - " -o name output to file 'name' (default is \"%s\")\n" - " -p parse only\n" - " -s strip debug information\n" - " -v show version information\n" - " -- stop handling options\n" - " - stop handling options and process stdin\n" - ,progname,Output); - exit(EXIT_FAILURE); -} - -#define IS(s) (strcmp(argv[i],s)==0) - -static int doargs(int argc, char* argv[]) -{ - int i; - int version=0; - if (argv[0]!=NULL && *argv[0]!=0) progname=argv[0]; - for (i=1; itop+(i)) - -static const Proto* combine(lua_State* L, int n) -{ - if (n==1) - return toproto(L,-1); - else - { - Proto* f; - int i=n; - if (lua_load(L,reader,&i,"=(" PROGNAME ")",NULL)!=LUA_OK) fatal(lua_tostring(L,-1)); - f=toproto(L,-1); - for (i=0; ip[i]=toproto(L,i-n-1); - if (f->p[i]->sizeupvalues>0) f->p[i]->upvalues[0].instack=0; - } - f->sizelineinfo=0; - return f; - } -} - -static int writer(lua_State* L, const void* p, size_t size, void* u) -{ - UNUSED(L); - return (fwrite(p,size,1,(FILE*)u)!=1) && (size!=0); -} - -static int pmain(lua_State* L) -{ - int argc=(int)lua_tointeger(L,1); - char** argv=(char**)lua_touserdata(L,2); - const Proto* f; - int i; - if (!lua_checkstack(L,argc)) fatal("too many input files"); - for (i=0; i1); - if (dumping) - { - FILE* D= (output==NULL) ? stdout : fopen(output,"wb"); - if (D==NULL) cannot("open"); - lua_lock(L); - luaU_dump(L,f,writer,D,stripping); - lua_unlock(L); - if (ferror(D)) cannot("write"); - if (fclose(D)) cannot("close"); - } - return 0; -} - -int main(int argc, char* argv[]) -{ - lua_State* L; - int i=doargs(argc,argv); - argc-=i; argv+=i; - if (argc<=0) usage("no input files given"); - L=luaL_newstate(); - if (L==NULL) fatal("cannot create state: not enough memory"); - lua_pushcfunction(L,&pmain); - lua_pushinteger(L,argc); - lua_pushlightuserdata(L,argv); - if (lua_pcall(L,2,0,0)!=LUA_OK) fatal(lua_tostring(L,-1)); - lua_close(L); - return EXIT_SUCCESS; -} - -/* -** $Id: luac.c,v 1.75 2015/03/12 01:58:27 lhf Exp $ -** print bytecodes -** See Copyright Notice in lua.h -*/ - -#include -#include - -#define luac_c -#define LUA_CORE - -#include "ldebug.h" -#include "lobject.h" -#include "lopcodes.h" - -#define VOID(p) ((const void*)(p)) - -static void PrintString(const TString* ts) -{ - const char* s=getstr(ts); - size_t i,n=tsslen(ts); - printf("%c",'"'); - for (i=0; ik[i]; - switch (ttype(o)) - { - case LUA_TNIL: - printf("nil"); - break; - case LUA_TBOOLEAN: - printf(bvalue(o) ? "true" : "false"); - break; - case LUA_TNUMFLT: - { - char buff[100]; - sprintf(buff,LUA_NUMBER_FMT,fltvalue(o)); - printf("%s",buff); - if (buff[strspn(buff,"-0123456789")]=='\0') printf(".0"); - break; - } - case LUA_TNUMINT: - printf(LUA_INTEGER_FMT,ivalue(o)); - break; - case LUA_TSHRSTR: case LUA_TLNGSTR: - PrintString(tsvalue(o)); - break; - default: /* cannot happen */ - printf("? type=%d",ttype(o)); - break; - } -} - -#define UPVALNAME(x) ((f->upvalues[x].name) ? getstr(f->upvalues[x].name) : "-") -#define MYK(x) (-1-(x)) - -static void PrintCode(const Proto* f) -{ - const Instruction* code=f->code; - int pc,n=f->sizecode; - for (pc=0; pc0) printf("[%d]\t",line); else printf("[-]\t"); - printf("%-9s\t",luaP_opnames[o]); - switch (getOpMode(o)) - { - case iABC: - printf("%d",a); - if (getBMode(o)!=OpArgN) printf(" %d",ISK(b) ? (MYK(INDEXK(b))) : b); - if (getCMode(o)!=OpArgN) printf(" %d",ISK(c) ? (MYK(INDEXK(c))) : c); - break; - case iABx: - printf("%d",a); - if (getBMode(o)==OpArgK) printf(" %d",MYK(bx)); - if (getBMode(o)==OpArgU) printf(" %d",bx); - break; - case iAsBx: - printf("%d %d",a,sbx); - break; - case iAx: - printf("%d",MYK(ax)); - break; - } - switch (o) - { - case OP_LOADK: - printf("\t; "); PrintConstant(f,bx); - break; - case OP_GETUPVAL: - case OP_SETUPVAL: - printf("\t; %s",UPVALNAME(b)); - break; - case OP_GETTABUP: - printf("\t; %s",UPVALNAME(b)); - if (ISK(c)) { printf(" "); PrintConstant(f,INDEXK(c)); } - break; - case OP_SETTABUP: - printf("\t; %s",UPVALNAME(a)); - if (ISK(b)) { printf(" "); PrintConstant(f,INDEXK(b)); } - if (ISK(c)) { printf(" "); PrintConstant(f,INDEXK(c)); } - break; - case OP_GETTABLE: - case OP_SELF: - if (ISK(c)) { printf("\t; "); PrintConstant(f,INDEXK(c)); } - break; - case OP_SETTABLE: - case OP_ADD: - case OP_SUB: - case OP_MUL: - case OP_POW: - case OP_DIV: - case OP_IDIV: - case OP_BAND: - case OP_BOR: - case OP_BXOR: - case OP_SHL: - case OP_SHR: - case OP_EQ: - case OP_LT: - case OP_LE: - if (ISK(b) || ISK(c)) - { - printf("\t; "); - if (ISK(b)) PrintConstant(f,INDEXK(b)); else printf("-"); - printf(" "); - if (ISK(c)) PrintConstant(f,INDEXK(c)); else printf("-"); - } - break; - case OP_JMP: - case OP_FORLOOP: - case OP_FORPREP: - case OP_TFORLOOP: - printf("\t; to %d",sbx+pc+2); - break; - case OP_CLOSURE: - printf("\t; %p",VOID(f->p[bx])); - break; - case OP_SETLIST: - if (c==0) printf("\t; %d",(int)code[++pc]); else printf("\t; %d",c); - break; - case OP_EXTRAARG: - printf("\t; "); PrintConstant(f,ax); - break; - default: - break; - } - printf("\n"); - } -} - -#define SS(x) ((x==1)?"":"s") -#define S(x) (int)(x),SS(x) - -static void PrintHeader(const Proto* f) -{ - const char* s=f->source ? getstr(f->source) : "=?"; - if (*s=='@' || *s=='=') - s++; - else if (*s==LUA_SIGNATURE[0]) - s="(bstring)"; - else - s="(string)"; - printf("\n%s <%s:%d,%d> (%d instruction%s at %p)\n", - (f->linedefined==0)?"main":"function",s, - f->linedefined,f->lastlinedefined, - S(f->sizecode),VOID(f)); - printf("%d%s param%s, %d slot%s, %d upvalue%s, ", - (int)(f->numparams),f->is_vararg?"+":"",SS(f->numparams), - S(f->maxstacksize),S(f->sizeupvalues)); - printf("%d local%s, %d constant%s, %d function%s\n", - S(f->sizelocvars),S(f->sizek),S(f->sizep)); -} - -static void PrintDebug(const Proto* f) -{ - int i,n; - n=f->sizek; - printf("constants (%d) for %p:\n",n,VOID(f)); - for (i=0; isizelocvars; - printf("locals (%d) for %p:\n",n,VOID(f)); - for (i=0; ilocvars[i].varname),f->locvars[i].startpc+1,f->locvars[i].endpc+1); - } - n=f->sizeupvalues; - printf("upvalues (%d) for %p:\n",n,VOID(f)); - for (i=0; iupvalues[i].instack,f->upvalues[i].idx); - } -} - -static void PrintFunction(const Proto* f, int full) -{ - int i,n=f->sizep; - PrintHeader(f); - PrintCode(f); - if (full) PrintDebug(f); - for (i=0; ip[i],full); -} diff --git a/LuaSkin/lua-5.3.4/src/luaconf.h b/LuaSkin/lua-5.3.4/src/luaconf.h deleted file mode 100644 index 8d8297c22..000000000 --- a/LuaSkin/lua-5.3.4/src/luaconf.h +++ /dev/null @@ -1,784 +0,0 @@ -/* -** $Id: luaconf.h,v 1.259 2016/12/22 13:08:50 roberto Exp $ -** Configuration file for Lua -** See Copyright Notice in lua.h -*/ - - -#ifndef luaconf_h -#define luaconf_h - -#include -#include - - -/* -** =================================================================== -** Search for "@@" to find all configurable definitions. -** =================================================================== -*/ - - -/* -** {==================================================================== -** System Configuration: macros to adapt (if needed) Lua to some -** particular platform, for instance compiling it with 32-bit numbers or -** restricting it to C89. -** ===================================================================== -*/ - -/* -@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. You -** can also define LUA_32BITS in the make file, but changing here you -** ensure that all software connected to Lua will be compiled with the -** same configuration. -*/ -/* #define LUA_32BITS */ - - -/* -@@ LUA_USE_C89 controls the use of non-ISO-C89 features. -** Define it if you want Lua to avoid the use of a few C99 features -** or Windows-specific features on Windows. -*/ -/* #define LUA_USE_C89 */ - - -/* -** By default, Lua on Windows use (some) specific Windows features -*/ -#if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE) -#define LUA_USE_WINDOWS /* enable goodies for regular Windows */ -#endif - - -#if defined(LUA_USE_WINDOWS) -#define LUA_DL_DLL /* enable support for DLL */ -#define LUA_USE_C89 /* broadly, Windows is C89 */ -#endif - - -#if defined(LUA_USE_LINUX) -#define LUA_USE_POSIX -#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ -#define LUA_USE_READLINE /* needs some extra libraries */ -#endif - - -#if defined(LUA_USE_MACOSX) -#define LUA_USE_POSIX -#define LUA_USE_DLOPEN /* MacOS does not need -ldl */ -#define LUA_USE_READLINE /* needs an extra library: -lreadline */ -#define LUA_USE_OBJC_EXCEPTIONS /* Instead of ULONGJMP or C++ */ -#endif - - -/* -@@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for -** C89 ('long' and 'double'); Windows always has '__int64', so it does -** not need to use this case. -*/ -#if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) -#define LUA_C89_NUMBERS -#endif - - - -/* -@@ LUAI_BITSINT defines the (minimum) number of bits in an 'int'. -*/ -/* avoid undefined shifts */ -#if ((INT_MAX >> 15) >> 15) >= 1 -#define LUAI_BITSINT 32 -#else -/* 'int' always must have at least 16 bits */ -#define LUAI_BITSINT 16 -#endif - - -/* -@@ LUA_INT_TYPE defines the type for Lua integers. -@@ LUA_FLOAT_TYPE defines the type for Lua floats. -** Lua should work fine with any mix of these options (if supported -** by your C compiler). The usual configurations are 64-bit integers -** and 'double' (the default), 32-bit integers and 'float' (for -** restricted platforms), and 'long'/'double' (for C compilers not -** compliant with C99, which may not have support for 'long long'). -*/ - -/* predefined options for LUA_INT_TYPE */ -#define LUA_INT_INT 1 -#define LUA_INT_LONG 2 -#define LUA_INT_LONGLONG 3 - -/* predefined options for LUA_FLOAT_TYPE */ -#define LUA_FLOAT_FLOAT 1 -#define LUA_FLOAT_DOUBLE 2 -#define LUA_FLOAT_LONGDOUBLE 3 - -#if defined(LUA_32BITS) /* { */ -/* -** 32-bit integers and 'float' -*/ -#if LUAI_BITSINT >= 32 /* use 'int' if big enough */ -#define LUA_INT_TYPE LUA_INT_INT -#else /* otherwise use 'long' */ -#define LUA_INT_TYPE LUA_INT_LONG -#endif -#define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT - -#elif defined(LUA_C89_NUMBERS) /* }{ */ -/* -** largest types available for C89 ('long' and 'double') -*/ -#define LUA_INT_TYPE LUA_INT_LONG -#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE - -#endif /* } */ - - -/* -** default configuration for 64-bit Lua ('long long' and 'double') -*/ -#if !defined(LUA_INT_TYPE) -#define LUA_INT_TYPE LUA_INT_LONGLONG -#endif - -#if !defined(LUA_FLOAT_TYPE) -#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE -#endif - -/* }================================================================== */ - - - - -/* -** {================================================================== -** Configuration for Paths. -** =================================================================== -*/ - -/* -** LUA_PATH_SEP is the character that separates templates in a path. -** LUA_PATH_MARK is the string that marks the substitution points in a -** template. -** LUA_EXEC_DIR in a Windows path is replaced by the executable's -** directory. -*/ -#define LUA_PATH_SEP ";" -#define LUA_PATH_MARK "?" -#define LUA_EXEC_DIR "!" - - -/* -@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for -** Lua libraries. -@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for -** C libraries. -** CHANGE them if your machine has a non-conventional directory -** hierarchy or if you want to install your libraries in -** non-conventional directories. -*/ -#define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR -#if defined(_WIN32) /* { */ -/* -** In Windows, any exclamation mark ('!') in the path is replaced by the -** path of the directory of the executable file of the current process. -*/ -#define LUA_LDIR "!\\lua\\" -#define LUA_CDIR "!\\" -#define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\" -#define LUA_PATH_DEFAULT \ - LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ - LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \ - LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \ - ".\\?.lua;" ".\\?\\init.lua" -#define LUA_CPATH_DEFAULT \ - LUA_CDIR"?.dll;" \ - LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \ - LUA_CDIR"loadall.dll;" ".\\?.dll" - -#else /* }{ */ - -#define LUA_ROOT "/usr/local/" -#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" -#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" -#define LUA_PATH_DEFAULT \ - LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ - LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ - "./?.lua;" "./?/init.lua" -#define LUA_CPATH_DEFAULT \ - LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so" -#endif /* } */ - - -/* -@@ LUA_DIRSEP is the directory separator (for submodules). -** CHANGE it if your machine does not use "/" as the directory separator -** and is not Windows. (On Windows Lua automatically uses "\".) -*/ -#if defined(_WIN32) -#define LUA_DIRSEP "\\" -#else -#define LUA_DIRSEP "/" -#endif - -/* }================================================================== */ - - -/* -** {================================================================== -** Marks for exported symbols in the C code -** =================================================================== -*/ - -/* -@@ LUA_API is a mark for all core API functions. -@@ LUALIB_API is a mark for all auxiliary library functions. -@@ LUAMOD_API is a mark for all standard library opening functions. -** CHANGE them if you need to define those functions in some special way. -** For instance, if you want to create one Windows DLL with the core and -** the libraries, you may want to use the following definition (define -** LUA_BUILD_AS_DLL to get it). -*/ -#if defined(LUA_BUILD_AS_DLL) /* { */ - -#if defined(LUA_CORE) || defined(LUA_LIB) /* { */ -#define LUA_API __declspec(dllexport) -#else /* }{ */ -#define LUA_API __declspec(dllimport) -#endif /* } */ - -#else /* }{ */ - -#define LUA_API extern - -#endif /* } */ - - -/* more often than not the libs go together with the core */ -#define LUALIB_API LUA_API -#define LUAMOD_API LUALIB_API - - -/* -@@ LUAI_FUNC is a mark for all extern functions that are not to be -** exported to outside modules. -@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables -** that are not to be exported to outside modules (LUAI_DDEF for -** definitions and LUAI_DDEC for declarations). -** CHANGE them if you need to mark them in some special way. Elf/gcc -** (versions 3.2 and later) mark them as "hidden" to optimize access -** when Lua is compiled as a shared library. Not all elf targets support -** this attribute. Unfortunately, gcc does not offer a way to check -** whether the target offers that support, and those without support -** give a warning about it. To avoid these warnings, change to the -** default definition. -*/ -#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ - defined(__ELF__) /* { */ -#define LUAI_FUNC __attribute__((visibility("hidden"))) extern -#else /* }{ */ -#define LUAI_FUNC extern -#endif /* } */ - -#define LUAI_DDEC LUAI_FUNC -#define LUAI_DDEF /* empty */ - -/* }================================================================== */ - - -/* -** {================================================================== -** Compatibility with previous versions -** =================================================================== -*/ - -/* -@@ LUA_COMPAT_5_2 controls other macros for compatibility with Lua 5.2. -@@ LUA_COMPAT_5_1 controls other macros for compatibility with Lua 5.1. -** You can define it to get all options, or change specific options -** to fit your specific needs. -*/ -#if defined(LUA_COMPAT_5_2) /* { */ - -/* -@@ LUA_COMPAT_MATHLIB controls the presence of several deprecated -** functions in the mathematical library. -*/ -#define LUA_COMPAT_MATHLIB - -/* -@@ LUA_COMPAT_BITLIB controls the presence of library 'bit32'. -*/ -#define LUA_COMPAT_BITLIB - -/* -@@ LUA_COMPAT_IPAIRS controls the effectiveness of the __ipairs metamethod. -*/ -#define LUA_COMPAT_IPAIRS - -/* -@@ LUA_COMPAT_APIINTCASTS controls the presence of macros for -** manipulating other integer types (lua_pushunsigned, lua_tounsigned, -** luaL_checkint, luaL_checklong, etc.) -*/ -#define LUA_COMPAT_APIINTCASTS - -#endif /* } */ - - -#if defined(LUA_COMPAT_5_1) /* { */ - -/* Incompatibilities from 5.2 -> 5.3 */ -#define LUA_COMPAT_MATHLIB -#define LUA_COMPAT_APIINTCASTS - -/* -@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'. -** You can replace it with 'table.unpack'. -*/ -#define LUA_COMPAT_UNPACK - -/* -@@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'. -** You can replace it with 'package.searchers'. -*/ -#define LUA_COMPAT_LOADERS - -/* -@@ macro 'lua_cpcall' emulates deprecated function lua_cpcall. -** You can call your C function directly (with light C functions). -*/ -#define lua_cpcall(L,f,u) \ - (lua_pushcfunction(L, (f)), \ - lua_pushlightuserdata(L,(u)), \ - lua_pcall(L,1,0,0)) - - -/* -@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library. -** You can rewrite 'log10(x)' as 'log(x, 10)'. -*/ -#define LUA_COMPAT_LOG10 - -/* -@@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base -** library. You can rewrite 'loadstring(s)' as 'load(s)'. -*/ -#define LUA_COMPAT_LOADSTRING - -/* -@@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library. -*/ -#define LUA_COMPAT_MAXN - -/* -@@ The following macros supply trivial compatibility for some -** changes in the API. The macros themselves document how to -** change your code to avoid using them. -*/ -#define lua_strlen(L,i) lua_rawlen(L, (i)) - -#define lua_objlen(L,i) lua_rawlen(L, (i)) - -#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) -#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) - -/* -@@ LUA_COMPAT_MODULE controls compatibility with previous -** module functions 'module' (Lua) and 'luaL_register' (C). -*/ -#define LUA_COMPAT_MODULE - -#endif /* } */ - - -/* -@@ LUA_COMPAT_FLOATSTRING makes Lua format integral floats without a -@@ a float mark ('.0'). -** This macro is not on by default even in compatibility mode, -** because this is not really an incompatibility. -*/ -/* #define LUA_COMPAT_FLOATSTRING */ - -/* }================================================================== */ - - - -/* -** {================================================================== -** Configuration for Numbers. -** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_* -** satisfy your needs. -** =================================================================== -*/ - -/* -@@ LUA_NUMBER is the floating-point type used by Lua. -@@ LUAI_UACNUMBER is the result of a 'default argument promotion' -@@ over a floating number. -@@ l_mathlim(x) corrects limit name 'x' to the proper float type -** by prefixing it with one of FLT/DBL/LDBL. -@@ LUA_NUMBER_FRMLEN is the length modifier for writing floats. -@@ LUA_NUMBER_FMT is the format for writing floats. -@@ lua_number2str converts a float to a string. -@@ l_mathop allows the addition of an 'l' or 'f' to all math operations. -@@ l_floor takes the floor of a float. -@@ lua_str2number converts a decimal numeric string to a number. -*/ - - -/* The following definitions are good for most cases here */ - -#define l_floor(x) (l_mathop(floor)(x)) - -#define lua_number2str(s,sz,n) \ - l_sprintf((s), sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)(n)) - -/* -@@ lua_numbertointeger converts a float number to an integer, or -** returns 0 if float is not within the range of a lua_Integer. -** (The range comparisons are tricky because of rounding. The tests -** here assume a two-complement representation, where MININTEGER always -** has an exact representation as a float; MAXINTEGER may not have one, -** and therefore its conversion to float may have an ill-defined value.) -*/ -#define lua_numbertointeger(n,p) \ - ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \ - (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \ - (*(p) = (LUA_INTEGER)(n), 1)) - - -/* now the variable definitions */ - -#if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT /* { single float */ - -#define LUA_NUMBER float - -#define l_mathlim(n) (FLT_##n) - -#define LUAI_UACNUMBER double - -#define LUA_NUMBER_FRMLEN "" -#define LUA_NUMBER_FMT "%.7g" - -#define l_mathop(op) op##f - -#define lua_str2number(s,p) strtof((s), (p)) - - -#elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE /* }{ long double */ - -#define LUA_NUMBER long double - -#define l_mathlim(n) (LDBL_##n) - -#define LUAI_UACNUMBER long double - -#define LUA_NUMBER_FRMLEN "L" -#define LUA_NUMBER_FMT "%.19Lg" - -#define l_mathop(op) op##l - -#define lua_str2number(s,p) strtold((s), (p)) - -#elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE /* }{ double */ - -#define LUA_NUMBER double - -#define l_mathlim(n) (DBL_##n) - -#define LUAI_UACNUMBER double - -#define LUA_NUMBER_FRMLEN "" -#define LUA_NUMBER_FMT "%.14g" - -#define l_mathop(op) op - -#define lua_str2number(s,p) strtod((s), (p)) - -#else /* }{ */ - -#error "numeric float type not defined" - -#endif /* } */ - - - -/* -@@ LUA_INTEGER is the integer type used by Lua. -** -@@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER. -** -@@ LUAI_UACINT is the result of a 'default argument promotion' -@@ over a lUA_INTEGER. -@@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers. -@@ LUA_INTEGER_FMT is the format for writing integers. -@@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER. -@@ LUA_MININTEGER is the minimum value for a LUA_INTEGER. -@@ lua_integer2str converts an integer to a string. -*/ - - -/* The following definitions are good for most cases here */ - -#define LUA_INTEGER_FMT "%" LUA_INTEGER_FRMLEN "d" - -#define LUAI_UACINT LUA_INTEGER - -#define lua_integer2str(s,sz,n) \ - l_sprintf((s), sz, LUA_INTEGER_FMT, (LUAI_UACINT)(n)) - -/* -** use LUAI_UACINT here to avoid problems with promotions (which -** can turn a comparison between unsigneds into a signed comparison) -*/ -#define LUA_UNSIGNED unsigned LUAI_UACINT - - -/* now the variable definitions */ - -#if LUA_INT_TYPE == LUA_INT_INT /* { int */ - -#define LUA_INTEGER int -#define LUA_INTEGER_FRMLEN "" - -#define LUA_MAXINTEGER INT_MAX -#define LUA_MININTEGER INT_MIN - -#elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */ - -#define LUA_INTEGER long -#define LUA_INTEGER_FRMLEN "l" - -#define LUA_MAXINTEGER LONG_MAX -#define LUA_MININTEGER LONG_MIN - -#elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */ - -/* use presence of macro LLONG_MAX as proxy for C99 compliance */ -#if defined(LLONG_MAX) /* { */ -/* use ISO C99 stuff */ - -#define LUA_INTEGER long long -#define LUA_INTEGER_FRMLEN "ll" - -#define LUA_MAXINTEGER LLONG_MAX -#define LUA_MININTEGER LLONG_MIN - -#elif defined(LUA_USE_WINDOWS) /* }{ */ -/* in Windows, can use specific Windows types */ - -#define LUA_INTEGER __int64 -#define LUA_INTEGER_FRMLEN "I64" - -#define LUA_MAXINTEGER _I64_MAX -#define LUA_MININTEGER _I64_MIN - -#else /* }{ */ - -#error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \ - or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)" - -#endif /* } */ - -#else /* }{ */ - -#error "numeric integer type not defined" - -#endif /* } */ - -/* }================================================================== */ - - -/* -** {================================================================== -** Dependencies with C99 and other C details -** =================================================================== -*/ - -/* -@@ l_sprintf is equivalent to 'snprintf' or 'sprintf' in C89. -** (All uses in Lua have only one format item.) -*/ -#if !defined(LUA_USE_C89) -#define l_sprintf(s,sz,f,i) snprintf(s,sz,f,i) -#else -#define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s,f,i)) -#endif - - -/* -@@ lua_strx2number converts an hexadecimal numeric string to a number. -** In C99, 'strtod' does that conversion. Otherwise, you can -** leave 'lua_strx2number' undefined and Lua will provide its own -** implementation. -*/ -#if !defined(LUA_USE_C89) -#define lua_strx2number(s,p) lua_str2number(s,p) -#endif - - -/* -@@ lua_number2strx converts a float to an hexadecimal numeric string. -** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that. -** Otherwise, you can leave 'lua_number2strx' undefined and Lua will -** provide its own implementation. -*/ -#if !defined(LUA_USE_C89) -#define lua_number2strx(L,b,sz,f,n) \ - ((void)L, l_sprintf(b,sz,f,(LUAI_UACNUMBER)(n))) -#endif - - -/* -** 'strtof' and 'opf' variants for math functions are not valid in -** C89. Otherwise, the macro 'HUGE_VALF' is a good proxy for testing the -** availability of these variants. ('math.h' is already included in -** all files that use these macros.) -*/ -#if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF)) -#undef l_mathop /* variants not available */ -#undef lua_str2number -#define l_mathop(op) (lua_Number)op /* no variant */ -#define lua_str2number(s,p) ((lua_Number)strtod((s), (p))) -#endif - - -/* -@@ LUA_KCONTEXT is the type of the context ('ctx') for continuation -** functions. It must be a numerical type; Lua will use 'intptr_t' if -** available, otherwise it will use 'ptrdiff_t' (the nearest thing to -** 'intptr_t' in C89) -*/ -#define LUA_KCONTEXT ptrdiff_t - -#if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \ - __STDC_VERSION__ >= 199901L -#include -#if defined(INTPTR_MAX) /* even in C99 this type is optional */ -#undef LUA_KCONTEXT -#define LUA_KCONTEXT intptr_t -#endif -#endif - - -/* -@@ lua_getlocaledecpoint gets the locale "radix character" (decimal point). -** Change that if you do not want to use C locales. (Code using this -** macro must include header 'locale.h'.) -*/ -#if !defined(lua_getlocaledecpoint) -#define lua_getlocaledecpoint() (localeconv()->decimal_point[0]) -#endif - -/* }================================================================== */ - - -/* -** {================================================================== -** Language Variations -** ===================================================================== -*/ - -/* -@@ LUA_NOCVTN2S/LUA_NOCVTS2N control how Lua performs some -** coercions. Define LUA_NOCVTN2S to turn off automatic coercion from -** numbers to strings. Define LUA_NOCVTS2N to turn off automatic -** coercion from strings to numbers. -*/ -/* #define LUA_NOCVTN2S */ -/* #define LUA_NOCVTS2N */ - - -/* -@@ LUA_USE_APICHECK turns on several consistency checks on the C API. -** Define it as a help when debugging C code. -*/ -#if defined(LUA_USE_APICHECK) -#include -#define luai_apicheck(l,e) assert(e) -#endif - -/* }================================================================== */ - - -/* -** {================================================================== -** Macros that affect the API and must be stable (that is, must be the -** same when you compile Lua and when you compile code that links to -** Lua). You probably do not want/need to change them. -** ===================================================================== -*/ - -/* -@@ LUAI_MAXSTACK limits the size of the Lua stack. -** CHANGE it if you need a different limit. This limit is arbitrary; -** its only purpose is to stop Lua from consuming unlimited stack -** space (and to reserve some numbers for pseudo-indices). -*/ -#if LUAI_BITSINT >= 32 -#define LUAI_MAXSTACK 1000000 -#else -#define LUAI_MAXSTACK 15000 -#endif - - -/* -@@ LUA_EXTRASPACE defines the size of a raw memory area associated with -** a Lua state with very fast access. -** CHANGE it if you need a different size. -*/ -#define LUA_EXTRASPACE (sizeof(void *)) - - -/* -@@ LUA_IDSIZE gives the maximum size for the description of the source -@@ of a function in debug information. -** CHANGE it if you want a different size. -*/ -#define LUA_IDSIZE 60 - - -/* -@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. -** CHANGE it if it uses too much C-stack space. (For long double, -** 'string.format("%.99f", -1e4932)' needs 5034 bytes, so a -** smaller buffer would force a memory allocation for each call to -** 'string.format'.) -*/ -#if LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE -#define LUAL_BUFFERSIZE 8192 -#else -#define LUAL_BUFFERSIZE ((int)(0x80 * sizeof(void*) * sizeof(lua_Integer))) -#endif - -/* }================================================================== */ - - -/* -@@ LUA_QL describes how error messages quote program elements. -** Lua does not use these macros anymore; they are here for -** compatibility only. -*/ -#define LUA_QL(x) "'" x "'" -#define LUA_QS LUA_QL("%s") - - - - -/* =================================================================== */ - -/* -** Local configuration. You can use this space to add your redefinitions -** without modifying the main part of the file. -*/ - - - - - -#endif - diff --git a/LuaSkin/lua-5.3.4/src/lundump.c b/LuaSkin/lua-5.3.4/src/lundump.c deleted file mode 100644 index 4080af9c0..000000000 --- a/LuaSkin/lua-5.3.4/src/lundump.c +++ /dev/null @@ -1,279 +0,0 @@ -/* -** $Id: lundump.c,v 2.44 2015/11/02 16:09:30 roberto Exp $ -** load precompiled Lua chunks -** See Copyright Notice in lua.h -*/ - -#define lundump_c -#define LUA_CORE - -#include "lprefix.h" - - -#include - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstring.h" -#include "lundump.h" -#include "lzio.h" - - -#if !defined(luai_verifycode) -#define luai_verifycode(L,b,f) /* empty */ -#endif - - -typedef struct { - lua_State *L; - ZIO *Z; - const char *name; -} LoadState; - - -static l_noret error(LoadState *S, const char *why) { - luaO_pushfstring(S->L, "%s: %s precompiled chunk", S->name, why); - luaD_throw(S->L, LUA_ERRSYNTAX); -} - - -/* -** All high-level loads go through LoadVector; you can change it to -** adapt to the endianness of the input -*/ -#define LoadVector(S,b,n) LoadBlock(S,b,(n)*sizeof((b)[0])) - -static void LoadBlock (LoadState *S, void *b, size_t size) { - if (luaZ_read(S->Z, b, size) != 0) - error(S, "truncated"); -} - - -#define LoadVar(S,x) LoadVector(S,&x,1) - - -static lu_byte LoadByte (LoadState *S) { - lu_byte x; - LoadVar(S, x); - return x; -} - - -static int LoadInt (LoadState *S) { - int x; - LoadVar(S, x); - return x; -} - - -static lua_Number LoadNumber (LoadState *S) { - lua_Number x; - LoadVar(S, x); - return x; -} - - -static lua_Integer LoadInteger (LoadState *S) { - lua_Integer x; - LoadVar(S, x); - return x; -} - - -static TString *LoadString (LoadState *S) { - size_t size = LoadByte(S); - if (size == 0xFF) - LoadVar(S, size); - if (size == 0) - return NULL; - else if (--size <= LUAI_MAXSHORTLEN) { /* short string? */ - char buff[LUAI_MAXSHORTLEN]; - LoadVector(S, buff, size); - return luaS_newlstr(S->L, buff, size); - } - else { /* long string */ - TString *ts = luaS_createlngstrobj(S->L, size); - LoadVector(S, getstr(ts), size); /* load directly in final place */ - return ts; - } -} - - -static void LoadCode (LoadState *S, Proto *f) { - int n = LoadInt(S); - f->code = luaM_newvector(S->L, n, Instruction); - f->sizecode = n; - LoadVector(S, f->code, n); -} - - -static void LoadFunction(LoadState *S, Proto *f, TString *psource); - - -static void LoadConstants (LoadState *S, Proto *f) { - int i; - int n = LoadInt(S); - f->k = luaM_newvector(S->L, n, TValue); - f->sizek = n; - for (i = 0; i < n; i++) - setnilvalue(&f->k[i]); - for (i = 0; i < n; i++) { - TValue *o = &f->k[i]; - int t = LoadByte(S); - switch (t) { - case LUA_TNIL: - setnilvalue(o); - break; - case LUA_TBOOLEAN: - setbvalue(o, LoadByte(S)); - break; - case LUA_TNUMFLT: - setfltvalue(o, LoadNumber(S)); - break; - case LUA_TNUMINT: - setivalue(o, LoadInteger(S)); - break; - case LUA_TSHRSTR: - case LUA_TLNGSTR: - setsvalue2n(S->L, o, LoadString(S)); - break; - default: - lua_assert(0); - } - } -} - - -static void LoadProtos (LoadState *S, Proto *f) { - int i; - int n = LoadInt(S); - f->p = luaM_newvector(S->L, n, Proto *); - f->sizep = n; - for (i = 0; i < n; i++) - f->p[i] = NULL; - for (i = 0; i < n; i++) { - f->p[i] = luaF_newproto(S->L); - LoadFunction(S, f->p[i], f->source); - } -} - - -static void LoadUpvalues (LoadState *S, Proto *f) { - int i, n; - n = LoadInt(S); - f->upvalues = luaM_newvector(S->L, n, Upvaldesc); - f->sizeupvalues = n; - for (i = 0; i < n; i++) - f->upvalues[i].name = NULL; - for (i = 0; i < n; i++) { - f->upvalues[i].instack = LoadByte(S); - f->upvalues[i].idx = LoadByte(S); - } -} - - -static void LoadDebug (LoadState *S, Proto *f) { - int i, n; - n = LoadInt(S); - f->lineinfo = luaM_newvector(S->L, n, int); - f->sizelineinfo = n; - LoadVector(S, f->lineinfo, n); - n = LoadInt(S); - f->locvars = luaM_newvector(S->L, n, LocVar); - f->sizelocvars = n; - for (i = 0; i < n; i++) - f->locvars[i].varname = NULL; - for (i = 0; i < n; i++) { - f->locvars[i].varname = LoadString(S); - f->locvars[i].startpc = LoadInt(S); - f->locvars[i].endpc = LoadInt(S); - } - n = LoadInt(S); - for (i = 0; i < n; i++) - f->upvalues[i].name = LoadString(S); -} - - -static void LoadFunction (LoadState *S, Proto *f, TString *psource) { - f->source = LoadString(S); - if (f->source == NULL) /* no source in dump? */ - f->source = psource; /* reuse parent's source */ - f->linedefined = LoadInt(S); - f->lastlinedefined = LoadInt(S); - f->numparams = LoadByte(S); - f->is_vararg = LoadByte(S); - f->maxstacksize = LoadByte(S); - LoadCode(S, f); - LoadConstants(S, f); - LoadUpvalues(S, f); - LoadProtos(S, f); - LoadDebug(S, f); -} - - -static void checkliteral (LoadState *S, const char *s, const char *msg) { - char buff[sizeof(LUA_SIGNATURE) + sizeof(LUAC_DATA)]; /* larger than both */ - size_t len = strlen(s); - LoadVector(S, buff, len); - if (memcmp(s, buff, len) != 0) - error(S, msg); -} - - -static void fchecksize (LoadState *S, size_t size, const char *tname) { - if (LoadByte(S) != size) - error(S, luaO_pushfstring(S->L, "%s size mismatch in", tname)); -} - - -#define checksize(S,t) fchecksize(S,sizeof(t),#t) - -static void checkHeader (LoadState *S) { - checkliteral(S, LUA_SIGNATURE + 1, "not a"); /* 1st char already checked */ - if (LoadByte(S) != LUAC_VERSION) - error(S, "version mismatch in"); - if (LoadByte(S) != LUAC_FORMAT) - error(S, "format mismatch in"); - checkliteral(S, LUAC_DATA, "corrupted"); - checksize(S, int); - checksize(S, size_t); - checksize(S, Instruction); - checksize(S, lua_Integer); - checksize(S, lua_Number); - if (LoadInteger(S) != LUAC_INT) - error(S, "endianness mismatch in"); - if (LoadNumber(S) != LUAC_NUM) - error(S, "float format mismatch in"); -} - - -/* -** load precompiled chunk -*/ -LClosure *luaU_undump(lua_State *L, ZIO *Z, const char *name) { - LoadState S; - LClosure *cl; - if (*name == '@' || *name == '=') - S.name = name + 1; - else if (*name == LUA_SIGNATURE[0]) - S.name = "binary string"; - else - S.name = name; - S.L = L; - S.Z = Z; - checkHeader(&S); - cl = luaF_newLclosure(L, LoadByte(&S)); - setclLvalue(L, L->top, cl); - luaD_inctop(L); - cl->p = luaF_newproto(L); - LoadFunction(&S, cl->p, NULL); - lua_assert(cl->nupvalues == cl->p->sizeupvalues); - luai_verifycode(L, buff, cl->p); - return cl; -} - diff --git a/LuaSkin/lua-5.3.4/src/lutf8lib.c b/LuaSkin/lua-5.3.4/src/lutf8lib.c deleted file mode 100644 index de9e3dcdd..000000000 --- a/LuaSkin/lua-5.3.4/src/lutf8lib.c +++ /dev/null @@ -1,256 +0,0 @@ -/* -** $Id: lutf8lib.c,v 1.16 2016/12/22 13:08:50 roberto Exp $ -** Standard library for UTF-8 manipulation -** See Copyright Notice in lua.h -*/ - -#define lutf8lib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include -#include -#include -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - -#define MAXUNICODE 0x10FFFF - -#define iscont(p) ((*(p) & 0xC0) == 0x80) - - -/* from strlib */ -/* translate a relative string position: negative means back from end */ -static lua_Integer u_posrelat (lua_Integer pos, size_t len) { - if (pos >= 0) return pos; - else if (0u - (size_t)pos > len) return 0; - else return (lua_Integer)len + pos + 1; -} - - -/* -** Decode one UTF-8 sequence, returning NULL if byte sequence is invalid. -*/ -static const char *utf8_decode (const char *o, int *val) { - static const unsigned int limits[] = {0xFF, 0x7F, 0x7FF, 0xFFFF}; - const unsigned char *s = (const unsigned char *)o; - unsigned int c = s[0]; - unsigned int res = 0; /* final result */ - if (c < 0x80) /* ascii? */ - res = c; - else { - int count = 0; /* to count number of continuation bytes */ - while (c & 0x40) { /* still have continuation bytes? */ - int cc = s[++count]; /* read next byte */ - if ((cc & 0xC0) != 0x80) /* not a continuation byte? */ - return NULL; /* invalid byte sequence */ - res = (res << 6) | (cc & 0x3F); /* add lower 6 bits from cont. byte */ - c <<= 1; /* to test next bit */ - } - res |= ((c & 0x7F) << (count * 5)); /* add first byte */ - if (count > 3 || res > MAXUNICODE || res <= limits[count]) - return NULL; /* invalid byte sequence */ - s += count; /* skip continuation bytes read */ - } - if (val) *val = res; - return (const char *)s + 1; /* +1 to include first byte */ -} - - -/* -** utf8len(s [, i [, j]]) --> number of characters that start in the -** range [i,j], or nil + current position if 's' is not well formed in -** that interval -*/ -static int utflen (lua_State *L) { - int n = 0; - size_t len; - const char *s = luaL_checklstring(L, 1, &len); - lua_Integer posi = u_posrelat(luaL_optinteger(L, 2, 1), len); - lua_Integer posj = u_posrelat(luaL_optinteger(L, 3, -1), len); - luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 2, - "initial position out of string"); - luaL_argcheck(L, --posj < (lua_Integer)len, 3, - "final position out of string"); - while (posi <= posj) { - const char *s1 = utf8_decode(s + posi, NULL); - if (s1 == NULL) { /* conversion error? */ - lua_pushnil(L); /* return nil ... */ - lua_pushinteger(L, posi + 1); /* ... and current position */ - return 2; - } - posi = s1 - s; - n++; - } - lua_pushinteger(L, n); - return 1; -} - - -/* -** codepoint(s, [i, [j]]) -> returns codepoints for all characters -** that start in the range [i,j] -*/ -static int codepoint (lua_State *L) { - size_t len; - const char *s = luaL_checklstring(L, 1, &len); - lua_Integer posi = u_posrelat(luaL_optinteger(L, 2, 1), len); - lua_Integer pose = u_posrelat(luaL_optinteger(L, 3, posi), len); - int n; - const char *se; - luaL_argcheck(L, posi >= 1, 2, "out of range"); - luaL_argcheck(L, pose <= (lua_Integer)len, 3, "out of range"); - if (posi > pose) return 0; /* empty interval; return no values */ - if (pose - posi >= INT_MAX) /* (lua_Integer -> int) overflow? */ - return luaL_error(L, "string slice too long"); - n = (int)(pose - posi) + 1; - luaL_checkstack(L, n, "string slice too long"); - n = 0; - se = s + pose; - for (s += posi - 1; s < se;) { - int code; - s = utf8_decode(s, &code); - if (s == NULL) - return luaL_error(L, "invalid UTF-8 code"); - lua_pushinteger(L, code); - n++; - } - return n; -} - - -static void pushutfchar (lua_State *L, int arg) { - lua_Integer code = luaL_checkinteger(L, arg); - luaL_argcheck(L, 0 <= code && code <= MAXUNICODE, arg, "value out of range"); - lua_pushfstring(L, "%U", (long)code); -} - - -/* -** utfchar(n1, n2, ...) -> char(n1)..char(n2)... -*/ -static int utfchar (lua_State *L) { - int n = lua_gettop(L); /* number of arguments */ - if (n == 1) /* optimize common case of single char */ - pushutfchar(L, 1); - else { - int i; - luaL_Buffer b; - luaL_buffinit(L, &b); - for (i = 1; i <= n; i++) { - pushutfchar(L, i); - luaL_addvalue(&b); - } - luaL_pushresult(&b); - } - return 1; -} - - -/* -** offset(s, n, [i]) -> index where n-th character counting from -** position 'i' starts; 0 means character at 'i'. -*/ -static int byteoffset (lua_State *L) { - size_t len; - const char *s = luaL_checklstring(L, 1, &len); - lua_Integer n = luaL_checkinteger(L, 2); - lua_Integer posi = (n >= 0) ? 1 : len + 1; - posi = u_posrelat(luaL_optinteger(L, 3, posi), len); - luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 3, - "position out of range"); - if (n == 0) { - /* find beginning of current byte sequence */ - while (posi > 0 && iscont(s + posi)) posi--; - } - else { - if (iscont(s + posi)) - luaL_error(L, "initial position is a continuation byte"); - if (n < 0) { - while (n < 0 && posi > 0) { /* move back */ - do { /* find beginning of previous character */ - posi--; - } while (posi > 0 && iscont(s + posi)); - n++; - } - } - else { - n--; /* do not move for 1st character */ - while (n > 0 && posi < (lua_Integer)len) { - do { /* find beginning of next character */ - posi++; - } while (iscont(s + posi)); /* (cannot pass final '\0') */ - n--; - } - } - } - if (n == 0) /* did it find given character? */ - lua_pushinteger(L, posi + 1); - else /* no such character */ - lua_pushnil(L); - return 1; -} - - -static int iter_aux (lua_State *L) { - size_t len; - const char *s = luaL_checklstring(L, 1, &len); - lua_Integer n = lua_tointeger(L, 2) - 1; - if (n < 0) /* first iteration? */ - n = 0; /* start from here */ - else if (n < (lua_Integer)len) { - n++; /* skip current byte */ - while (iscont(s + n)) n++; /* and its continuations */ - } - if (n >= (lua_Integer)len) - return 0; /* no more codepoints */ - else { - int code; - const char *next = utf8_decode(s + n, &code); - if (next == NULL || iscont(next)) - return luaL_error(L, "invalid UTF-8 code"); - lua_pushinteger(L, n + 1); - lua_pushinteger(L, code); - return 2; - } -} - - -static int iter_codes (lua_State *L) { - luaL_checkstring(L, 1); - lua_pushcfunction(L, iter_aux); - lua_pushvalue(L, 1); - lua_pushinteger(L, 0); - return 3; -} - - -/* pattern to match a single UTF-8 character */ -#define UTF8PATT "[\0-\x7F\xC2-\xF4][\x80-\xBF]*" - - -static const luaL_Reg funcs[] = { - {"offset", byteoffset}, - {"codepoint", codepoint}, - {"char", utfchar}, - {"len", utflen}, - {"codes", iter_codes}, - /* placeholders */ - {"charpattern", NULL}, - {NULL, NULL} -}; - - -LUAMOD_API int luaopen_utf8 (lua_State *L) { - luaL_newlib(L, funcs); - lua_pushlstring(L, UTF8PATT, sizeof(UTF8PATT)/sizeof(char) - 1); - lua_setfield(L, -2, "charpattern"); - return 1; -} - diff --git a/LuaSkin/lua-5.3.4/src/lvm.c b/LuaSkin/lua-5.3.4/src/lvm.c deleted file mode 100644 index 84ade6b2f..000000000 --- a/LuaSkin/lua-5.3.4/src/lvm.c +++ /dev/null @@ -1,1322 +0,0 @@ -/* -** $Id: lvm.c,v 2.268 2016/02/05 19:59:14 roberto Exp $ -** Lua virtual machine -** See Copyright Notice in lua.h -*/ - -#define lvm_c -#define LUA_CORE - -#include "lprefix.h" - -#include -#include -#include -#include -#include -#include - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lgc.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" -#include "lvm.h" - - -/* limit for table tag-method chains (to avoid loops) */ -#define MAXTAGLOOP 2000 - - - -/* -** 'l_intfitsf' checks whether a given integer can be converted to a -** float without rounding. Used in comparisons. Left undefined if -** all integers fit in a float precisely. -*/ -#if !defined(l_intfitsf) - -/* number of bits in the mantissa of a float */ -#define NBM (l_mathlim(MANT_DIG)) - -/* -** Check whether some integers may not fit in a float, that is, whether -** (maxinteger >> NBM) > 0 (that implies (1 << NBM) <= maxinteger). -** (The shifts are done in parts to avoid shifting by more than the size -** of an integer. In a worst case, NBM == 113 for long double and -** sizeof(integer) == 32.) -*/ -#if ((((LUA_MAXINTEGER >> (NBM / 4)) >> (NBM / 4)) >> (NBM / 4)) \ - >> (NBM - (3 * (NBM / 4)))) > 0 - -#define l_intfitsf(i) \ - (-((lua_Integer)1 << NBM) <= (i) && (i) <= ((lua_Integer)1 << NBM)) - -#endif - -#endif - - - -/* -** Try to convert a value to a float. The float case is already handled -** by the macro 'tonumber'. -*/ -int luaV_tonumber_ (const TValue *obj, lua_Number *n) { - TValue v; - if (ttisinteger(obj)) { - *n = cast_num(ivalue(obj)); - return 1; - } - else if (cvt2num(obj) && /* string convertible to number? */ - luaO_str2num(svalue(obj), &v) == vslen(obj) + 1) { - *n = nvalue(&v); /* convert result of 'luaO_str2num' to a float */ - return 1; - } - else - return 0; /* conversion failed */ -} - - -/* -** try to convert a value to an integer, rounding according to 'mode': -** mode == 0: accepts only integral values -** mode == 1: takes the floor of the number -** mode == 2: takes the ceil of the number -*/ -int luaV_tointeger (const TValue *obj, lua_Integer *p, int mode) { - TValue v; - again: - if (ttisfloat(obj)) { - lua_Number n = fltvalue(obj); - lua_Number f = l_floor(n); - if (n != f) { /* not an integral value? */ - if (mode == 0) return 0; /* fails if mode demands integral value */ - else if (mode > 1) /* needs ceil? */ - f += 1; /* convert floor to ceil (remember: n != f) */ - } - return lua_numbertointeger(f, p); - } - else if (ttisinteger(obj)) { - *p = ivalue(obj); - return 1; - } - else if (cvt2num(obj) && - luaO_str2num(svalue(obj), &v) == vslen(obj) + 1) { - obj = &v; - goto again; /* convert result from 'luaO_str2num' to an integer */ - } - return 0; /* conversion failed */ -} - - -/* -** Try to convert a 'for' limit to an integer, preserving the -** semantics of the loop. -** (The following explanation assumes a non-negative step; it is valid -** for negative steps mutatis mutandis.) -** If the limit can be converted to an integer, rounding down, that is -** it. -** Otherwise, check whether the limit can be converted to a number. If -** the number is too large, it is OK to set the limit as LUA_MAXINTEGER, -** which means no limit. If the number is too negative, the loop -** should not run, because any initial integer value is larger than the -** limit. So, it sets the limit to LUA_MININTEGER. 'stopnow' corrects -** the extreme case when the initial value is LUA_MININTEGER, in which -** case the LUA_MININTEGER limit would still run the loop once. -*/ -static int forlimit (const TValue *obj, lua_Integer *p, lua_Integer step, - int *stopnow) { - *stopnow = 0; /* usually, let loops run */ - if (!luaV_tointeger(obj, p, (step < 0 ? 2 : 1))) { /* not fit in integer? */ - lua_Number n; /* try to convert to float */ - if (!tonumber(obj, &n)) /* cannot convert to float? */ - return 0; /* not a number */ - if (luai_numlt(0, n)) { /* if true, float is larger than max integer */ - *p = LUA_MAXINTEGER; - if (step < 0) *stopnow = 1; - } - else { /* float is smaller than min integer */ - *p = LUA_MININTEGER; - if (step >= 0) *stopnow = 1; - } - } - return 1; -} - - -/* -** Finish the table access 'val = t[key]'. -** if 'slot' is NULL, 't' is not a table; otherwise, 'slot' points to -** t[k] entry (which must be nil). -*/ -void luaV_finishget (lua_State *L, const TValue *t, TValue *key, StkId val, - const TValue *slot) { - int loop; /* counter to avoid infinite loops */ - const TValue *tm; /* metamethod */ - for (loop = 0; loop < MAXTAGLOOP; loop++) { - if (slot == NULL) { /* 't' is not a table? */ - lua_assert(!ttistable(t)); - tm = luaT_gettmbyobj(L, t, TM_INDEX); - if (ttisnil(tm)) - luaG_typeerror(L, t, "index"); /* no metamethod */ - /* else will try the metamethod */ - } - else { /* 't' is a table */ - lua_assert(ttisnil(slot)); - tm = fasttm(L, hvalue(t)->metatable, TM_INDEX); /* table's metamethod */ - if (tm == NULL) { /* no metamethod? */ - setnilvalue(val); /* result is nil */ - return; - } - /* else will try the metamethod */ - } - if (ttisfunction(tm)) { /* is metamethod a function? */ - luaT_callTM(L, tm, t, key, val, 1); /* call it */ - return; - } - t = tm; /* else try to access 'tm[key]' */ - if (luaV_fastget(L,t,key,slot,luaH_get)) { /* fast track? */ - setobj2s(L, val, slot); /* done */ - return; - } - /* else repeat (tail call 'luaV_finishget') */ - } - luaG_runerror(L, "'__index' chain too long; possible loop"); -} - - -/* -** Finish a table assignment 't[key] = val'. -** If 'slot' is NULL, 't' is not a table. Otherwise, 'slot' points -** to the entry 't[key]', or to 'luaO_nilobject' if there is no such -** entry. (The value at 'slot' must be nil, otherwise 'luaV_fastset' -** would have done the job.) -*/ -void luaV_finishset (lua_State *L, const TValue *t, TValue *key, - StkId val, const TValue *slot) { - int loop; /* counter to avoid infinite loops */ - for (loop = 0; loop < MAXTAGLOOP; loop++) { - const TValue *tm; /* '__newindex' metamethod */ - if (slot != NULL) { /* is 't' a table? */ - Table *h = hvalue(t); /* save 't' table */ - lua_assert(ttisnil(slot)); /* old value must be nil */ - tm = fasttm(L, h->metatable, TM_NEWINDEX); /* get metamethod */ - if (tm == NULL) { /* no metamethod? */ - if (slot == luaO_nilobject) /* no previous entry? */ - slot = luaH_newkey(L, h, key); /* create one */ - /* no metamethod and (now) there is an entry with given key */ - setobj2t(L, cast(TValue *, slot), val); /* set its new value */ - invalidateTMcache(h); - luaC_barrierback(L, h, val); - return; - } - /* else will try the metamethod */ - } - else { /* not a table; check metamethod */ - if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX))) - luaG_typeerror(L, t, "index"); - } - /* try the metamethod */ - if (ttisfunction(tm)) { - luaT_callTM(L, tm, t, key, val, 0); - return; - } - t = tm; /* else repeat assignment over 'tm' */ - if (luaV_fastset(L, t, key, slot, luaH_get, val)) - return; /* done */ - /* else loop */ - } - luaG_runerror(L, "'__newindex' chain too long; possible loop"); -} - - -/* -** Compare two strings 'ls' x 'rs', returning an integer smaller-equal- -** -larger than zero if 'ls' is smaller-equal-larger than 'rs'. -** The code is a little tricky because it allows '\0' in the strings -** and it uses 'strcoll' (to respect locales) for each segments -** of the strings. -*/ -static int l_strcmp (const TString *ls, const TString *rs) { - const char *l = getstr(ls); - size_t ll = tsslen(ls); - const char *r = getstr(rs); - size_t lr = tsslen(rs); - for (;;) { /* for each segment */ - int temp = strcoll(l, r); - if (temp != 0) /* not equal? */ - return temp; /* done */ - else { /* strings are equal up to a '\0' */ - size_t len = strlen(l); /* index of first '\0' in both strings */ - if (len == lr) /* 'rs' is finished? */ - return (len == ll) ? 0 : 1; /* check 'ls' */ - else if (len == ll) /* 'ls' is finished? */ - return -1; /* 'ls' is smaller than 'rs' ('rs' is not finished) */ - /* both strings longer than 'len'; go on comparing after the '\0' */ - len++; - l += len; ll -= len; r += len; lr -= len; - } - } -} - - -/* -** Check whether integer 'i' is less than float 'f'. If 'i' has an -** exact representation as a float ('l_intfitsf'), compare numbers as -** floats. Otherwise, if 'f' is outside the range for integers, result -** is trivial. Otherwise, compare them as integers. (When 'i' has no -** float representation, either 'f' is "far away" from 'i' or 'f' has -** no precision left for a fractional part; either way, how 'f' is -** truncated is irrelevant.) When 'f' is NaN, comparisons must result -** in false. -*/ -static int LTintfloat (lua_Integer i, lua_Number f) { -#if defined(l_intfitsf) - if (!l_intfitsf(i)) { - if (f >= -cast_num(LUA_MININTEGER)) /* -minint == maxint + 1 */ - return 1; /* f >= maxint + 1 > i */ - else if (f > cast_num(LUA_MININTEGER)) /* minint < f <= maxint ? */ - return (i < cast(lua_Integer, f)); /* compare them as integers */ - else /* f <= minint <= i (or 'f' is NaN) --> not(i < f) */ - return 0; - } -#endif - return luai_numlt(cast_num(i), f); /* compare them as floats */ -} - - -/* -** Check whether integer 'i' is less than or equal to float 'f'. -** See comments on previous function. -*/ -static int LEintfloat (lua_Integer i, lua_Number f) { -#if defined(l_intfitsf) - if (!l_intfitsf(i)) { - if (f >= -cast_num(LUA_MININTEGER)) /* -minint == maxint + 1 */ - return 1; /* f >= maxint + 1 > i */ - else if (f >= cast_num(LUA_MININTEGER)) /* minint <= f <= maxint ? */ - return (i <= cast(lua_Integer, f)); /* compare them as integers */ - else /* f < minint <= i (or 'f' is NaN) --> not(i <= f) */ - return 0; - } -#endif - return luai_numle(cast_num(i), f); /* compare them as floats */ -} - - -/* -** Return 'l < r', for numbers. -*/ -static int LTnum (const TValue *l, const TValue *r) { - if (ttisinteger(l)) { - lua_Integer li = ivalue(l); - if (ttisinteger(r)) - return li < ivalue(r); /* both are integers */ - else /* 'l' is int and 'r' is float */ - return LTintfloat(li, fltvalue(r)); /* l < r ? */ - } - else { - lua_Number lf = fltvalue(l); /* 'l' must be float */ - if (ttisfloat(r)) - return luai_numlt(lf, fltvalue(r)); /* both are float */ - else if (luai_numisnan(lf)) /* 'r' is int and 'l' is float */ - return 0; /* NaN < i is always false */ - else /* without NaN, (l < r) <--> not(r <= l) */ - return !LEintfloat(ivalue(r), lf); /* not (r <= l) ? */ - } -} - - -/* -** Return 'l <= r', for numbers. -*/ -static int LEnum (const TValue *l, const TValue *r) { - if (ttisinteger(l)) { - lua_Integer li = ivalue(l); - if (ttisinteger(r)) - return li <= ivalue(r); /* both are integers */ - else /* 'l' is int and 'r' is float */ - return LEintfloat(li, fltvalue(r)); /* l <= r ? */ - } - else { - lua_Number lf = fltvalue(l); /* 'l' must be float */ - if (ttisfloat(r)) - return luai_numle(lf, fltvalue(r)); /* both are float */ - else if (luai_numisnan(lf)) /* 'r' is int and 'l' is float */ - return 0; /* NaN <= i is always false */ - else /* without NaN, (l <= r) <--> not(r < l) */ - return !LTintfloat(ivalue(r), lf); /* not (r < l) ? */ - } -} - - -/* -** Main operation less than; return 'l < r'. -*/ -int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { - int res; - if (ttisnumber(l) && ttisnumber(r)) /* both operands are numbers? */ - return LTnum(l, r); - else if (ttisstring(l) && ttisstring(r)) /* both are strings? */ - return l_strcmp(tsvalue(l), tsvalue(r)) < 0; - else if ((res = luaT_callorderTM(L, l, r, TM_LT)) < 0) /* no metamethod? */ - luaG_ordererror(L, l, r); /* error */ - return res; -} - - -/* -** Main operation less than or equal to; return 'l <= r'. If it needs -** a metamethod and there is no '__le', try '__lt', based on -** l <= r iff !(r < l) (assuming a total order). If the metamethod -** yields during this substitution, the continuation has to know -** about it (to negate the result of r= 0) /* try 'le' */ - return res; - else { /* try 'lt': */ - L->ci->callstatus |= CIST_LEQ; /* mark it is doing 'lt' for 'le' */ - res = luaT_callorderTM(L, r, l, TM_LT); - L->ci->callstatus ^= CIST_LEQ; /* clear mark */ - if (res < 0) - luaG_ordererror(L, l, r); - return !res; /* result is negated */ - } -} - - -/* -** Main operation for equality of Lua values; return 't1 == t2'. -** L == NULL means raw equality (no metamethods) -*/ -int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2) { - const TValue *tm; - if (ttype(t1) != ttype(t2)) { /* not the same variant? */ - if (ttnov(t1) != ttnov(t2) || ttnov(t1) != LUA_TNUMBER) - return 0; /* only numbers can be equal with different variants */ - else { /* two numbers with different variants */ - lua_Integer i1, i2; /* compare them as integers */ - return (tointeger(t1, &i1) && tointeger(t2, &i2) && i1 == i2); - } - } - /* values have same type and same variant */ - switch (ttype(t1)) { - case LUA_TNIL: return 1; - case LUA_TNUMINT: return (ivalue(t1) == ivalue(t2)); - case LUA_TNUMFLT: return luai_numeq(fltvalue(t1), fltvalue(t2)); - case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ - case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); - case LUA_TLCF: return fvalue(t1) == fvalue(t2); - case LUA_TSHRSTR: return eqshrstr(tsvalue(t1), tsvalue(t2)); - case LUA_TLNGSTR: return luaS_eqlngstr(tsvalue(t1), tsvalue(t2)); - case LUA_TUSERDATA: { - if (uvalue(t1) == uvalue(t2)) return 1; - else if (L == NULL) return 0; - tm = fasttm(L, uvalue(t1)->metatable, TM_EQ); - if (tm == NULL) - tm = fasttm(L, uvalue(t2)->metatable, TM_EQ); - break; /* will try TM */ - } - case LUA_TTABLE: { - if (hvalue(t1) == hvalue(t2)) return 1; - else if (L == NULL) return 0; - tm = fasttm(L, hvalue(t1)->metatable, TM_EQ); - if (tm == NULL) - tm = fasttm(L, hvalue(t2)->metatable, TM_EQ); - break; /* will try TM */ - } - default: - return gcvalue(t1) == gcvalue(t2); - } - if (tm == NULL) /* no TM? */ - return 0; /* objects are different */ - luaT_callTM(L, tm, t1, t2, L->top, 1); /* call TM */ - return !l_isfalse(L->top); -} - - -/* macro used by 'luaV_concat' to ensure that element at 'o' is a string */ -#define tostring(L,o) \ - (ttisstring(o) || (cvt2str(o) && (luaO_tostring(L, o), 1))) - -#define isemptystr(o) (ttisshrstring(o) && tsvalue(o)->shrlen == 0) - -/* copy strings in stack from top - n up to top - 1 to buffer */ -static void copy2buff (StkId top, int n, char *buff) { - size_t tl = 0; /* size already copied */ - do { - size_t l = vslen(top - n); /* length of string being copied */ - memcpy(buff + tl, svalue(top - n), l * sizeof(char)); - tl += l; - } while (--n > 0); -} - - -/* -** Main operation for concatenation: concat 'total' values in the stack, -** from 'L->top - total' up to 'L->top - 1'. -*/ -void luaV_concat (lua_State *L, int total) { - lua_assert(total >= 2); - do { - StkId top = L->top; - int n = 2; /* number of elements handled in this pass (at least 2) */ - if (!(ttisstring(top-2) || cvt2str(top-2)) || !tostring(L, top-1)) - luaT_trybinTM(L, top-2, top-1, top-2, TM_CONCAT); - else if (isemptystr(top - 1)) /* second operand is empty? */ - cast_void(tostring(L, top - 2)); /* result is first operand */ - else if (isemptystr(top - 2)) { /* first operand is an empty string? */ - setobjs2s(L, top - 2, top - 1); /* result is second op. */ - } - else { - /* at least two non-empty string values; get as many as possible */ - size_t tl = vslen(top - 1); - TString *ts; - /* collect total length and number of strings */ - for (n = 1; n < total && tostring(L, top - n - 1); n++) { - size_t l = vslen(top - n - 1); - if (l >= (MAX_SIZE/sizeof(char)) - tl) - luaG_runerror(L, "string length overflow"); - tl += l; - } - if (tl <= LUAI_MAXSHORTLEN) { /* is result a short string? */ - char buff[LUAI_MAXSHORTLEN]; - copy2buff(top, n, buff); /* copy strings to buffer */ - ts = luaS_newlstr(L, buff, tl); - } - else { /* long string; copy strings directly to final result */ - ts = luaS_createlngstrobj(L, tl); - copy2buff(top, n, getstr(ts)); - } - setsvalue2s(L, top - n, ts); /* create result */ - } - total -= n-1; /* got 'n' strings to create 1 new */ - L->top -= n-1; /* popped 'n' strings and pushed one */ - } while (total > 1); /* repeat until only 1 result left */ -} - - -/* -** Main operation 'ra' = #rb'. -*/ -void luaV_objlen (lua_State *L, StkId ra, const TValue *rb) { - const TValue *tm; - switch (ttype(rb)) { - case LUA_TTABLE: { - Table *h = hvalue(rb); - tm = fasttm(L, h->metatable, TM_LEN); - if (tm) break; /* metamethod? break switch to call it */ - setivalue(ra, luaH_getn(h)); /* else primitive len */ - return; - } - case LUA_TSHRSTR: { - setivalue(ra, tsvalue(rb)->shrlen); - return; - } - case LUA_TLNGSTR: { - setivalue(ra, tsvalue(rb)->u.lnglen); - return; - } - default: { /* try metamethod */ - tm = luaT_gettmbyobj(L, rb, TM_LEN); - if (ttisnil(tm)) /* no metamethod? */ - luaG_typeerror(L, rb, "get length of"); - break; - } - } - luaT_callTM(L, tm, rb, rb, ra, 1); -} - - -/* -** Integer division; return 'm // n', that is, floor(m/n). -** C division truncates its result (rounds towards zero). -** 'floor(q) == trunc(q)' when 'q >= 0' or when 'q' is integer, -** otherwise 'floor(q) == trunc(q) - 1'. -*/ -lua_Integer luaV_div (lua_State *L, lua_Integer m, lua_Integer n) { - if (l_castS2U(n) + 1u <= 1u) { /* special cases: -1 or 0 */ - if (n == 0) - luaG_runerror(L, "attempt to divide by zero"); - return intop(-, 0, m); /* n==-1; avoid overflow with 0x80000...//-1 */ - } - else { - lua_Integer q = m / n; /* perform C division */ - if ((m ^ n) < 0 && m % n != 0) /* 'm/n' would be negative non-integer? */ - q -= 1; /* correct result for different rounding */ - return q; - } -} - - -/* -** Integer modulus; return 'm % n'. (Assume that C '%' with -** negative operands follows C99 behavior. See previous comment -** about luaV_div.) -*/ -lua_Integer luaV_mod (lua_State *L, lua_Integer m, lua_Integer n) { - if (l_castS2U(n) + 1u <= 1u) { /* special cases: -1 or 0 */ - if (n == 0) - luaG_runerror(L, "attempt to perform 'n%%0'"); - return 0; /* m % -1 == 0; avoid overflow with 0x80000...%-1 */ - } - else { - lua_Integer r = m % n; - if (r != 0 && (m ^ n) < 0) /* 'm/n' would be non-integer negative? */ - r += n; /* correct result for different rounding */ - return r; - } -} - - -/* number of bits in an integer */ -#define NBITS cast_int(sizeof(lua_Integer) * CHAR_BIT) - -/* -** Shift left operation. (Shift right just negates 'y'.) -*/ -lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y) { - if (y < 0) { /* shift right? */ - if (y <= -NBITS) return 0; - else return intop(>>, x, -y); - } - else { /* shift left */ - if (y >= NBITS) return 0; - else return intop(<<, x, y); - } -} - - -/* -** check whether cached closure in prototype 'p' may be reused, that is, -** whether there is a cached closure with the same upvalues needed by -** new closure to be created. -*/ -static LClosure *getcached (Proto *p, UpVal **encup, StkId base) { - LClosure *c = p->cache; - if (c != NULL) { /* is there a cached closure? */ - int nup = p->sizeupvalues; - Upvaldesc *uv = p->upvalues; - int i; - for (i = 0; i < nup; i++) { /* check whether it has right upvalues */ - TValue *v = uv[i].instack ? base + uv[i].idx : encup[uv[i].idx]->v; - if (c->upvals[i]->v != v) - return NULL; /* wrong upvalue; cannot reuse closure */ - } - } - return c; /* return cached closure (or NULL if no cached closure) */ -} - - -/* -** create a new Lua closure, push it in the stack, and initialize -** its upvalues. Note that the closure is not cached if prototype is -** already black (which means that 'cache' was already cleared by the -** GC). -*/ -static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base, - StkId ra) { - int nup = p->sizeupvalues; - Upvaldesc *uv = p->upvalues; - int i; - LClosure *ncl = luaF_newLclosure(L, nup); - ncl->p = p; - setclLvalue(L, ra, ncl); /* anchor new closure in stack */ - for (i = 0; i < nup; i++) { /* fill in its upvalues */ - if (uv[i].instack) /* upvalue refers to local variable? */ - ncl->upvals[i] = luaF_findupval(L, base + uv[i].idx); - else /* get upvalue from enclosing function */ - ncl->upvals[i] = encup[uv[i].idx]; - ncl->upvals[i]->refcount++; - /* new closure is white, so we do not need a barrier here */ - } - if (!isblack(p)) /* cache will not break GC invariant? */ - p->cache = ncl; /* save it on cache for reuse */ -} - - -/* -** finish execution of an opcode interrupted by an yield -*/ -void luaV_finishOp (lua_State *L) { - CallInfo *ci = L->ci; - StkId base = ci->u.l.base; - Instruction inst = *(ci->u.l.savedpc - 1); /* interrupted instruction */ - OpCode op = GET_OPCODE(inst); - switch (op) { /* finish its execution */ - case OP_ADD: case OP_SUB: case OP_MUL: case OP_DIV: case OP_IDIV: - case OP_BAND: case OP_BOR: case OP_BXOR: case OP_SHL: case OP_SHR: - case OP_MOD: case OP_POW: - case OP_UNM: case OP_BNOT: case OP_LEN: - case OP_GETTABUP: case OP_GETTABLE: case OP_SELF: { - setobjs2s(L, base + GETARG_A(inst), --L->top); - break; - } - case OP_LE: case OP_LT: case OP_EQ: { - int res = !l_isfalse(L->top - 1); - L->top--; - if (ci->callstatus & CIST_LEQ) { /* "<=" using "<" instead? */ - lua_assert(op == OP_LE); - ci->callstatus ^= CIST_LEQ; /* clear mark */ - res = !res; /* negate result */ - } - lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_JMP); - if (res != GETARG_A(inst)) /* condition failed? */ - ci->u.l.savedpc++; /* skip jump instruction */ - break; - } - case OP_CONCAT: { - StkId top = L->top - 1; /* top when 'luaT_trybinTM' was called */ - int b = GETARG_B(inst); /* first element to concatenate */ - int total = cast_int(top - 1 - (base + b)); /* yet to concatenate */ - setobj2s(L, top - 2, top); /* put TM result in proper position */ - if (total > 1) { /* are there elements to concat? */ - L->top = top - 1; /* top is one after last element (at top-2) */ - luaV_concat(L, total); /* concat them (may yield again) */ - } - /* move final result to final position */ - setobj2s(L, ci->u.l.base + GETARG_A(inst), L->top - 1); - L->top = ci->top; /* restore top */ - break; - } - case OP_TFORCALL: { - lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_TFORLOOP); - L->top = ci->top; /* correct top */ - break; - } - case OP_CALL: { - if (GETARG_C(inst) - 1 >= 0) /* nresults >= 0? */ - L->top = ci->top; /* adjust results */ - break; - } - case OP_TAILCALL: case OP_SETTABUP: case OP_SETTABLE: - break; - default: lua_assert(0); - } -} - - - - -/* -** {================================================================== -** Function 'luaV_execute': main interpreter loop -** =================================================================== -*/ - - -/* -** some macros for common tasks in 'luaV_execute' -*/ - - -#define RA(i) (base+GETARG_A(i)) -#define RB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i)) -#define RC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i)) -#define RKB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, \ - ISK(GETARG_B(i)) ? k+INDEXK(GETARG_B(i)) : base+GETARG_B(i)) -#define RKC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \ - ISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i)) - - -/* execute a jump instruction */ -#define dojump(ci,i,e) \ - { int a = GETARG_A(i); \ - if (a != 0) luaF_close(L, ci->u.l.base + a - 1); \ - ci->u.l.savedpc += GETARG_sBx(i) + e; } - -/* for test instructions, execute the jump instruction that follows it */ -#define donextjump(ci) { i = *ci->u.l.savedpc; dojump(ci, i, 1); } - - -#define Protect(x) { {x;}; base = ci->u.l.base; } - -#define checkGC(L,c) \ - { luaC_condGC(L, L->top = (c), /* limit of live values */ \ - Protect(L->top = ci->top)); /* restore top */ \ - luai_threadyield(L); } - - -/* fetch an instruction and prepare its execution */ -#define vmfetch() { \ - i = *(ci->u.l.savedpc++); \ - if (L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) \ - Protect(luaG_traceexec(L)); \ - ra = RA(i); /* WARNING: any stack reallocation invalidates 'ra' */ \ - lua_assert(base == ci->u.l.base); \ - lua_assert(base <= L->top && L->top < L->stack + L->stacksize); \ -} - -#define vmdispatch(o) switch(o) -#define vmcase(l) case l: -#define vmbreak break - - -/* -** copy of 'luaV_gettable', but protecting the call to potential -** metamethod (which can reallocate the stack) -*/ -#define gettableProtected(L,t,k,v) { const TValue *slot; \ - if (luaV_fastget(L,t,k,slot,luaH_get)) { setobj2s(L, v, slot); } \ - else Protect(luaV_finishget(L,t,k,v,slot)); } - - -/* same for 'luaV_settable' */ -#define settableProtected(L,t,k,v) { const TValue *slot; \ - if (!luaV_fastset(L,t,k,slot,luaH_get,v)) \ - Protect(luaV_finishset(L,t,k,v,slot)); } - - - -void luaV_execute (lua_State *L) { - CallInfo *ci = L->ci; - LClosure *cl; - TValue *k; - StkId base; - ci->callstatus |= CIST_FRESH; /* fresh invocation of 'luaV_execute" */ - newframe: /* reentry point when frame changes (call/return) */ - lua_assert(ci == L->ci); - cl = clLvalue(ci->func); /* local reference to function's closure */ - k = cl->p->k; /* local reference to function's constant table */ - base = ci->u.l.base; /* local copy of function's base */ - /* main loop of interpreter */ - for (;;) { - Instruction i; - StkId ra; - vmfetch(); - vmdispatch (GET_OPCODE(i)) { - vmcase(OP_MOVE) { - setobjs2s(L, ra, RB(i)); - vmbreak; - } - vmcase(OP_LOADK) { - TValue *rb = k + GETARG_Bx(i); - setobj2s(L, ra, rb); - vmbreak; - } - vmcase(OP_LOADKX) { - TValue *rb; - lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_EXTRAARG); - rb = k + GETARG_Ax(*ci->u.l.savedpc++); - setobj2s(L, ra, rb); - vmbreak; - } - vmcase(OP_LOADBOOL) { - setbvalue(ra, GETARG_B(i)); - if (GETARG_C(i)) ci->u.l.savedpc++; /* skip next instruction (if C) */ - vmbreak; - } - vmcase(OP_LOADNIL) { - int b = GETARG_B(i); - do { - setnilvalue(ra++); - } while (b--); - vmbreak; - } - vmcase(OP_GETUPVAL) { - int b = GETARG_B(i); - setobj2s(L, ra, cl->upvals[b]->v); - vmbreak; - } - vmcase(OP_GETTABUP) { - TValue *upval = cl->upvals[GETARG_B(i)]->v; - TValue *rc = RKC(i); - gettableProtected(L, upval, rc, ra); - vmbreak; - } - vmcase(OP_GETTABLE) { - StkId rb = RB(i); - TValue *rc = RKC(i); - gettableProtected(L, rb, rc, ra); - vmbreak; - } - vmcase(OP_SETTABUP) { - TValue *upval = cl->upvals[GETARG_A(i)]->v; - TValue *rb = RKB(i); - TValue *rc = RKC(i); - settableProtected(L, upval, rb, rc); - vmbreak; - } - vmcase(OP_SETUPVAL) { - UpVal *uv = cl->upvals[GETARG_B(i)]; - setobj(L, uv->v, ra); - luaC_upvalbarrier(L, uv); - vmbreak; - } - vmcase(OP_SETTABLE) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - settableProtected(L, ra, rb, rc); - vmbreak; - } - vmcase(OP_NEWTABLE) { - int b = GETARG_B(i); - int c = GETARG_C(i); - Table *t = luaH_new(L); - sethvalue(L, ra, t); - if (b != 0 || c != 0) - luaH_resize(L, t, luaO_fb2int(b), luaO_fb2int(c)); - checkGC(L, ra + 1); - vmbreak; - } - vmcase(OP_SELF) { - const TValue *aux; - StkId rb = RB(i); - TValue *rc = RKC(i); - TString *key = tsvalue(rc); /* key must be a string */ - setobjs2s(L, ra + 1, rb); - if (luaV_fastget(L, rb, key, aux, luaH_getstr)) { - setobj2s(L, ra, aux); - } - else Protect(luaV_finishget(L, rb, rc, ra, aux)); - vmbreak; - } - vmcase(OP_ADD) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Number nb; lua_Number nc; - if (ttisinteger(rb) && ttisinteger(rc)) { - lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); - setivalue(ra, intop(+, ib, ic)); - } - else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setfltvalue(ra, luai_numadd(L, nb, nc)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_ADD)); } - vmbreak; - } - vmcase(OP_SUB) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Number nb; lua_Number nc; - if (ttisinteger(rb) && ttisinteger(rc)) { - lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); - setivalue(ra, intop(-, ib, ic)); - } - else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setfltvalue(ra, luai_numsub(L, nb, nc)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SUB)); } - vmbreak; - } - vmcase(OP_MUL) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Number nb; lua_Number nc; - if (ttisinteger(rb) && ttisinteger(rc)) { - lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); - setivalue(ra, intop(*, ib, ic)); - } - else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setfltvalue(ra, luai_nummul(L, nb, nc)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MUL)); } - vmbreak; - } - vmcase(OP_DIV) { /* float division (always with floats) */ - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Number nb; lua_Number nc; - if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setfltvalue(ra, luai_numdiv(L, nb, nc)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_DIV)); } - vmbreak; - } - vmcase(OP_BAND) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Integer ib; lua_Integer ic; - if (tointeger(rb, &ib) && tointeger(rc, &ic)) { - setivalue(ra, intop(&, ib, ic)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_BAND)); } - vmbreak; - } - vmcase(OP_BOR) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Integer ib; lua_Integer ic; - if (tointeger(rb, &ib) && tointeger(rc, &ic)) { - setivalue(ra, intop(|, ib, ic)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_BOR)); } - vmbreak; - } - vmcase(OP_BXOR) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Integer ib; lua_Integer ic; - if (tointeger(rb, &ib) && tointeger(rc, &ic)) { - setivalue(ra, intop(^, ib, ic)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_BXOR)); } - vmbreak; - } - vmcase(OP_SHL) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Integer ib; lua_Integer ic; - if (tointeger(rb, &ib) && tointeger(rc, &ic)) { - setivalue(ra, luaV_shiftl(ib, ic)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SHL)); } - vmbreak; - } - vmcase(OP_SHR) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Integer ib; lua_Integer ic; - if (tointeger(rb, &ib) && tointeger(rc, &ic)) { - setivalue(ra, luaV_shiftl(ib, -ic)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SHR)); } - vmbreak; - } - vmcase(OP_MOD) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Number nb; lua_Number nc; - if (ttisinteger(rb) && ttisinteger(rc)) { - lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); - setivalue(ra, luaV_mod(L, ib, ic)); - } - else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - lua_Number m; - luai_nummod(L, nb, nc, m); - setfltvalue(ra, m); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MOD)); } - vmbreak; - } - vmcase(OP_IDIV) { /* floor division */ - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Number nb; lua_Number nc; - if (ttisinteger(rb) && ttisinteger(rc)) { - lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); - setivalue(ra, luaV_div(L, ib, ic)); - } - else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setfltvalue(ra, luai_numidiv(L, nb, nc)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_IDIV)); } - vmbreak; - } - vmcase(OP_POW) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Number nb; lua_Number nc; - if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setfltvalue(ra, luai_numpow(L, nb, nc)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_POW)); } - vmbreak; - } - vmcase(OP_UNM) { - TValue *rb = RB(i); - lua_Number nb; - if (ttisinteger(rb)) { - lua_Integer ib = ivalue(rb); - setivalue(ra, intop(-, 0, ib)); - } - else if (tonumber(rb, &nb)) { - setfltvalue(ra, luai_numunm(L, nb)); - } - else { - Protect(luaT_trybinTM(L, rb, rb, ra, TM_UNM)); - } - vmbreak; - } - vmcase(OP_BNOT) { - TValue *rb = RB(i); - lua_Integer ib; - if (tointeger(rb, &ib)) { - setivalue(ra, intop(^, ~l_castS2U(0), ib)); - } - else { - Protect(luaT_trybinTM(L, rb, rb, ra, TM_BNOT)); - } - vmbreak; - } - vmcase(OP_NOT) { - TValue *rb = RB(i); - int res = l_isfalse(rb); /* next assignment may change this value */ - setbvalue(ra, res); - vmbreak; - } - vmcase(OP_LEN) { - Protect(luaV_objlen(L, ra, RB(i))); - vmbreak; - } - vmcase(OP_CONCAT) { - int b = GETARG_B(i); - int c = GETARG_C(i); - StkId rb; - L->top = base + c + 1; /* mark the end of concat operands */ - Protect(luaV_concat(L, c - b + 1)); - ra = RA(i); /* 'luaV_concat' may invoke TMs and move the stack */ - rb = base + b; - setobjs2s(L, ra, rb); - checkGC(L, (ra >= rb ? ra + 1 : rb)); - L->top = ci->top; /* restore top */ - vmbreak; - } - vmcase(OP_JMP) { - dojump(ci, i, 0); - vmbreak; - } - vmcase(OP_EQ) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - Protect( - if (luaV_equalobj(L, rb, rc) != GETARG_A(i)) - ci->u.l.savedpc++; - else - donextjump(ci); - ) - vmbreak; - } - vmcase(OP_LT) { - Protect( - if (luaV_lessthan(L, RKB(i), RKC(i)) != GETARG_A(i)) - ci->u.l.savedpc++; - else - donextjump(ci); - ) - vmbreak; - } - vmcase(OP_LE) { - Protect( - if (luaV_lessequal(L, RKB(i), RKC(i)) != GETARG_A(i)) - ci->u.l.savedpc++; - else - donextjump(ci); - ) - vmbreak; - } - vmcase(OP_TEST) { - if (GETARG_C(i) ? l_isfalse(ra) : !l_isfalse(ra)) - ci->u.l.savedpc++; - else - donextjump(ci); - vmbreak; - } - vmcase(OP_TESTSET) { - TValue *rb = RB(i); - if (GETARG_C(i) ? l_isfalse(rb) : !l_isfalse(rb)) - ci->u.l.savedpc++; - else { - setobjs2s(L, ra, rb); - donextjump(ci); - } - vmbreak; - } - vmcase(OP_CALL) { - int b = GETARG_B(i); - int nresults = GETARG_C(i) - 1; - if (b != 0) L->top = ra+b; /* else previous instruction set top */ - if (luaD_precall(L, ra, nresults)) { /* C function? */ - if (nresults >= 0) - L->top = ci->top; /* adjust results */ - Protect((void)0); /* update 'base' */ - } - else { /* Lua function */ - ci = L->ci; - goto newframe; /* restart luaV_execute over new Lua function */ - } - vmbreak; - } - vmcase(OP_TAILCALL) { - int b = GETARG_B(i); - if (b != 0) L->top = ra+b; /* else previous instruction set top */ - lua_assert(GETARG_C(i) - 1 == LUA_MULTRET); - if (luaD_precall(L, ra, LUA_MULTRET)) { /* C function? */ - Protect((void)0); /* update 'base' */ - } - else { - /* tail call: put called frame (n) in place of caller one (o) */ - CallInfo *nci = L->ci; /* called frame */ - CallInfo *oci = nci->previous; /* caller frame */ - StkId nfunc = nci->func; /* called function */ - StkId ofunc = oci->func; /* caller function */ - /* last stack slot filled by 'precall' */ - StkId lim = nci->u.l.base + getproto(nfunc)->numparams; - int aux; - /* close all upvalues from previous call */ - if (cl->p->sizep > 0) luaF_close(L, oci->u.l.base); - /* move new frame into old one */ - for (aux = 0; nfunc + aux < lim; aux++) - setobjs2s(L, ofunc + aux, nfunc + aux); - oci->u.l.base = ofunc + (nci->u.l.base - nfunc); /* correct base */ - oci->top = L->top = ofunc + (L->top - nfunc); /* correct top */ - oci->u.l.savedpc = nci->u.l.savedpc; - oci->callstatus |= CIST_TAIL; /* function was tail called */ - ci = L->ci = oci; /* remove new frame */ - lua_assert(L->top == oci->u.l.base + getproto(ofunc)->maxstacksize); - goto newframe; /* restart luaV_execute over new Lua function */ - } - vmbreak; - } - vmcase(OP_RETURN) { - int b = GETARG_B(i); - if (cl->p->sizep > 0) luaF_close(L, base); - b = luaD_poscall(L, ci, ra, (b != 0 ? b - 1 : cast_int(L->top - ra))); - if (ci->callstatus & CIST_FRESH) /* local 'ci' still from callee */ - return; /* external invocation: return */ - else { /* invocation via reentry: continue execution */ - ci = L->ci; - if (b) L->top = ci->top; - lua_assert(isLua(ci)); - lua_assert(GET_OPCODE(*((ci)->u.l.savedpc - 1)) == OP_CALL); - goto newframe; /* restart luaV_execute over new Lua function */ - } - } - vmcase(OP_FORLOOP) { - if (ttisinteger(ra)) { /* integer loop? */ - lua_Integer step = ivalue(ra + 2); - lua_Integer idx = intop(+, ivalue(ra), step); /* increment index */ - lua_Integer limit = ivalue(ra + 1); - if ((0 < step) ? (idx <= limit) : (limit <= idx)) { - ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ - chgivalue(ra, idx); /* update internal index... */ - setivalue(ra + 3, idx); /* ...and external index */ - } - } - else { /* floating loop */ - lua_Number step = fltvalue(ra + 2); - lua_Number idx = luai_numadd(L, fltvalue(ra), step); /* inc. index */ - lua_Number limit = fltvalue(ra + 1); - if (luai_numlt(0, step) ? luai_numle(idx, limit) - : luai_numle(limit, idx)) { - ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ - chgfltvalue(ra, idx); /* update internal index... */ - setfltvalue(ra + 3, idx); /* ...and external index */ - } - } - vmbreak; - } - vmcase(OP_FORPREP) { - TValue *init = ra; - TValue *plimit = ra + 1; - TValue *pstep = ra + 2; - lua_Integer ilimit; - int stopnow; - if (ttisinteger(init) && ttisinteger(pstep) && - forlimit(plimit, &ilimit, ivalue(pstep), &stopnow)) { - /* all values are integer */ - lua_Integer initv = (stopnow ? 0 : ivalue(init)); - setivalue(plimit, ilimit); - setivalue(init, intop(-, initv, ivalue(pstep))); - } - else { /* try making all values floats */ - lua_Number ninit; lua_Number nlimit; lua_Number nstep; - if (!tonumber(plimit, &nlimit)) - luaG_runerror(L, "'for' limit must be a number"); - setfltvalue(plimit, nlimit); - if (!tonumber(pstep, &nstep)) - luaG_runerror(L, "'for' step must be a number"); - setfltvalue(pstep, nstep); - if (!tonumber(init, &ninit)) - luaG_runerror(L, "'for' initial value must be a number"); - setfltvalue(init, luai_numsub(L, ninit, nstep)); - } - ci->u.l.savedpc += GETARG_sBx(i); - vmbreak; - } - vmcase(OP_TFORCALL) { - StkId cb = ra + 3; /* call base */ - setobjs2s(L, cb+2, ra+2); - setobjs2s(L, cb+1, ra+1); - setobjs2s(L, cb, ra); - L->top = cb + 3; /* func. + 2 args (state and index) */ - Protect(luaD_call(L, cb, GETARG_C(i))); - L->top = ci->top; - i = *(ci->u.l.savedpc++); /* go to next instruction */ - ra = RA(i); - lua_assert(GET_OPCODE(i) == OP_TFORLOOP); - goto l_tforloop; - } - vmcase(OP_TFORLOOP) { - l_tforloop: - if (!ttisnil(ra + 1)) { /* continue loop? */ - setobjs2s(L, ra, ra + 1); /* save control variable */ - ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ - } - vmbreak; - } - vmcase(OP_SETLIST) { - int n = GETARG_B(i); - int c = GETARG_C(i); - unsigned int last; - Table *h; - if (n == 0) n = cast_int(L->top - ra) - 1; - if (c == 0) { - lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_EXTRAARG); - c = GETARG_Ax(*ci->u.l.savedpc++); - } - h = hvalue(ra); - last = ((c-1)*LFIELDS_PER_FLUSH) + n; - if (last > h->sizearray) /* needs more space? */ - luaH_resizearray(L, h, last); /* preallocate it at once */ - for (; n > 0; n--) { - TValue *val = ra+n; - luaH_setint(L, h, last--, val); - luaC_barrierback(L, h, val); - } - L->top = ci->top; /* correct top (in case of previous open call) */ - vmbreak; - } - vmcase(OP_CLOSURE) { - Proto *p = cl->p->p[GETARG_Bx(i)]; - LClosure *ncl = getcached(p, cl->upvals, base); /* cached closure */ - if (ncl == NULL) /* no match? */ - pushclosure(L, p, cl->upvals, base, ra); /* create a new one */ - else - setclLvalue(L, ra, ncl); /* push cashed closure */ - checkGC(L, ra + 1); - vmbreak; - } - vmcase(OP_VARARG) { - int b = GETARG_B(i) - 1; /* required results */ - int j; - int n = cast_int(base - ci->func) - cl->p->numparams - 1; - if (n < 0) /* less arguments than parameters? */ - n = 0; /* no vararg arguments */ - if (b < 0) { /* B == 0? */ - b = n; /* get all var. arguments */ - Protect(luaD_checkstack(L, n)); - ra = RA(i); /* previous call may change the stack */ - L->top = ra + n; - } - for (j = 0; j < b && j < n; j++) - setobjs2s(L, ra + j, base - n + j); - for (; j < b; j++) /* complete required results with nil */ - setnilvalue(ra + j); - vmbreak; - } - vmcase(OP_EXTRAARG) { - lua_assert(0); - vmbreak; - } - } - } -} - -/* }================================================================== */ - diff --git a/LuaSkin/lua-5.3.4/src/lvm.h b/LuaSkin/lua-5.3.4/src/lvm.h deleted file mode 100644 index 422f87194..000000000 --- a/LuaSkin/lua-5.3.4/src/lvm.h +++ /dev/null @@ -1,113 +0,0 @@ -/* -** $Id: lvm.h,v 2.41 2016/12/22 13:08:50 roberto Exp $ -** Lua virtual machine -** See Copyright Notice in lua.h -*/ - -#ifndef lvm_h -#define lvm_h - - -#include "ldo.h" -#include "lobject.h" -#include "ltm.h" - - -#if !defined(LUA_NOCVTN2S) -#define cvt2str(o) ttisnumber(o) -#else -#define cvt2str(o) 0 /* no conversion from numbers to strings */ -#endif - - -#if !defined(LUA_NOCVTS2N) -#define cvt2num(o) ttisstring(o) -#else -#define cvt2num(o) 0 /* no conversion from strings to numbers */ -#endif - - -/* -** You can define LUA_FLOORN2I if you want to convert floats to integers -** by flooring them (instead of raising an error if they are not -** integral values) -*/ -#if !defined(LUA_FLOORN2I) -#define LUA_FLOORN2I 0 -#endif - - -#define tonumber(o,n) \ - (ttisfloat(o) ? (*(n) = fltvalue(o), 1) : luaV_tonumber_(o,n)) - -#define tointeger(o,i) \ - (ttisinteger(o) ? (*(i) = ivalue(o), 1) : luaV_tointeger(o,i,LUA_FLOORN2I)) - -#define intop(op,v1,v2) l_castU2S(l_castS2U(v1) op l_castS2U(v2)) - -#define luaV_rawequalobj(t1,t2) luaV_equalobj(NULL,t1,t2) - - -/* -** fast track for 'gettable': if 't' is a table and 't[k]' is not nil, -** return 1 with 'slot' pointing to 't[k]' (final result). Otherwise, -** return 0 (meaning it will have to check metamethod) with 'slot' -** pointing to a nil 't[k]' (if 't' is a table) or NULL (otherwise). -** 'f' is the raw get function to use. -*/ -#define luaV_fastget(L,t,k,slot,f) \ - (!ttistable(t) \ - ? (slot = NULL, 0) /* not a table; 'slot' is NULL and result is 0 */ \ - : (slot = f(hvalue(t), k), /* else, do raw access */ \ - !ttisnil(slot))) /* result not nil? */ - -/* -** standard implementation for 'gettable' -*/ -#define luaV_gettable(L,t,k,v) { const TValue *slot; \ - if (luaV_fastget(L,t,k,slot,luaH_get)) { setobj2s(L, v, slot); } \ - else luaV_finishget(L,t,k,v,slot); } - - -/* -** Fast track for set table. If 't' is a table and 't[k]' is not nil, -** call GC barrier, do a raw 't[k]=v', and return true; otherwise, -** return false with 'slot' equal to NULL (if 't' is not a table) or -** 'nil'. (This is needed by 'luaV_finishget'.) Note that, if the macro -** returns true, there is no need to 'invalidateTMcache', because the -** call is not creating a new entry. -*/ -#define luaV_fastset(L,t,k,slot,f,v) \ - (!ttistable(t) \ - ? (slot = NULL, 0) \ - : (slot = f(hvalue(t), k), \ - ttisnil(slot) ? 0 \ - : (luaC_barrierback(L, hvalue(t), v), \ - setobj2t(L, cast(TValue *,slot), v), \ - 1))) - - -#define luaV_settable(L,t,k,v) { const TValue *slot; \ - if (!luaV_fastset(L,t,k,slot,luaH_get,v)) \ - luaV_finishset(L,t,k,v,slot); } - - - -LUAI_FUNC int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2); -LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); -LUAI_FUNC int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r); -LUAI_FUNC int luaV_tonumber_ (const TValue *obj, lua_Number *n); -LUAI_FUNC int luaV_tointeger (const TValue *obj, lua_Integer *p, int mode); -LUAI_FUNC void luaV_finishget (lua_State *L, const TValue *t, TValue *key, - StkId val, const TValue *slot); -LUAI_FUNC void luaV_finishset (lua_State *L, const TValue *t, TValue *key, - StkId val, const TValue *slot); -LUAI_FUNC void luaV_finishOp (lua_State *L); -LUAI_FUNC void luaV_execute (lua_State *L); -LUAI_FUNC void luaV_concat (lua_State *L, int total); -LUAI_FUNC lua_Integer luaV_div (lua_State *L, lua_Integer x, lua_Integer y); -LUAI_FUNC lua_Integer luaV_mod (lua_State *L, lua_Integer x, lua_Integer y); -LUAI_FUNC lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y); -LUAI_FUNC void luaV_objlen (lua_State *L, StkId ra, const TValue *rb); - -#endif diff --git a/LuaSkin/lua-5.4.7/Makefile b/LuaSkin/lua-5.4.7/Makefile new file mode 100644 index 000000000..72ca8ff3c --- /dev/null +++ b/LuaSkin/lua-5.4.7/Makefile @@ -0,0 +1,106 @@ +# Makefile for installing Lua +# See doc/readme.html for installation and customization instructions. + +# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= + +# Your platform. See PLATS for possible values. +PLAT= guess + +# Where to install. The installation starts in the src and doc directories, +# so take care if INSTALL_TOP is not an absolute path. See the local target. +# You may want to make INSTALL_LMOD and INSTALL_CMOD consistent with +# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h. +INSTALL_TOP= /usr/local +INSTALL_BIN= $(INSTALL_TOP)/bin +INSTALL_INC= $(INSTALL_TOP)/include +INSTALL_LIB= $(INSTALL_TOP)/lib +INSTALL_MAN= $(INSTALL_TOP)/man/man1 +INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V +INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V + +# How to install. If your install program does not support "-p", then +# you may have to run ranlib on the installed liblua.a. +INSTALL= install -p +INSTALL_EXEC= $(INSTALL) -m 0755 +INSTALL_DATA= $(INSTALL) -m 0644 +# +# If you don't have "install" you can use "cp" instead. +# INSTALL= cp -p +# INSTALL_EXEC= $(INSTALL) +# INSTALL_DATA= $(INSTALL) + +# Other utilities. +MKDIR= mkdir -p +RM= rm -f + +# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE ======= + +# Convenience platforms targets. +PLATS= guess aix bsd c89 freebsd generic ios linux linux-readline macosx mingw posix solaris + +# What to install. +TO_BIN= lua luac +TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp +TO_LIB= liblua.a +TO_MAN= lua.1 luac.1 + +# Lua version and release. +V= 5.4 +R= $V.7 + +# Targets start here. +all: $(PLAT) + +$(PLATS) help test clean: + @cd src && $(MAKE) $@ + +install: dummy + cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD) + cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN) + cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) + cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) + cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) + +uninstall: + cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN) + cd src && cd $(INSTALL_INC) && $(RM) $(TO_INC) + cd src && cd $(INSTALL_LIB) && $(RM) $(TO_LIB) + cd doc && cd $(INSTALL_MAN) && $(RM) $(TO_MAN) + +local: + $(MAKE) install INSTALL_TOP=../install + +# make may get confused with install/ if it does not support .PHONY. +dummy: + +# Echo config parameters. +echo: + @cd src && $(MAKE) -s echo + @echo "PLAT= $(PLAT)" + @echo "V= $V" + @echo "R= $R" + @echo "TO_BIN= $(TO_BIN)" + @echo "TO_INC= $(TO_INC)" + @echo "TO_LIB= $(TO_LIB)" + @echo "TO_MAN= $(TO_MAN)" + @echo "INSTALL_TOP= $(INSTALL_TOP)" + @echo "INSTALL_BIN= $(INSTALL_BIN)" + @echo "INSTALL_INC= $(INSTALL_INC)" + @echo "INSTALL_LIB= $(INSTALL_LIB)" + @echo "INSTALL_MAN= $(INSTALL_MAN)" + @echo "INSTALL_LMOD= $(INSTALL_LMOD)" + @echo "INSTALL_CMOD= $(INSTALL_CMOD)" + @echo "INSTALL_EXEC= $(INSTALL_EXEC)" + @echo "INSTALL_DATA= $(INSTALL_DATA)" + +# Echo pkg-config data. +pc: + @echo "version=$R" + @echo "prefix=$(INSTALL_TOP)" + @echo "libdir=$(INSTALL_LIB)" + @echo "includedir=$(INSTALL_INC)" + +# Targets that do not create files (not all makes understand .PHONY). +.PHONY: all $(PLATS) help test clean install uninstall local dummy echo pc + +# (end of Makefile) diff --git a/LuaSkin/lua-5.4.7/README b/LuaSkin/lua-5.4.7/README new file mode 100644 index 000000000..fe99b874f --- /dev/null +++ b/LuaSkin/lua-5.4.7/README @@ -0,0 +1,6 @@ + +This is Lua 5.4.7, released on 13 Jun 2024. + +For installation instructions, license details, and +further information about Lua, see doc/readme.html. + diff --git a/LuaSkin/lua-5.4.7/doc/OSIApproved_100X125.png b/LuaSkin/lua-5.4.7/doc/OSIApproved_100X125.png new file mode 100644 index 000000000..795f7a06e Binary files /dev/null and b/LuaSkin/lua-5.4.7/doc/OSIApproved_100X125.png differ diff --git a/LuaSkin/lua-5.3.4/doc/contents.html b/LuaSkin/lua-5.4.7/doc/contents.html similarity index 86% rename from LuaSkin/lua-5.3.4/doc/contents.html rename to LuaSkin/lua-5.4.7/doc/contents.html index 445556f96..e17104845 100644 --- a/LuaSkin/lua-5.3.4/doc/contents.html +++ b/LuaSkin/lua-5.4.7/doc/contents.html @@ -1,7 +1,7 @@ -Lua 5.3 Reference Manual - contents +Lua 5.4 Reference Manual - contents @@ -10,15 +10,15 @@

-Lua -Lua 5.3 Reference Manual +Lua +Lua 5.4 Reference Manual

The reference manual is the official definition of the Lua language.
For a complete introduction to Lua programming, see the book -Programming in Lua. +Programming in Lua.

-Copyright © 2015–2017 Lua.org, PUC-Rio. +Copyright © 2020–2024 Lua.org, PUC-Rio. Freely available under the terms of the -Lua license. +Lua license.

Contents

@@ -49,8 +49,10 @@

Contents

  • 2.4 – Metatables and Metamethods
  • 2.5 – Garbage Collection
  • 2.6 – Coroutines @@ -68,6 +70,7 @@

    Contents

  • 3.3.5 – For Statement
  • 3.3.6 – Function Calls as Statements
  • 3.3.7 – Local Declarations +
  • 3.3.8 – To-be-closed Variables
  • 3.4 – Expressions
  • 3.5 – Visibility Rules @@ -89,14 +94,20 @@

    Contents

  • 4 – The Application Program Interface

  • 5 – The Auxiliary Library @@ -104,7 +115,7 @@

    Contents

  • 5.1 – Functions and Types

    -

  • 6 – Standard Libraries +
  • 6 – The Standard Libraries
    • 6.1 – Basic Functions
    • 6.2 – Coroutine Manipulation @@ -126,9 +137,9 @@

      Contents

    • 8 – Incompatibilities with the Previous Version

    • 9 – The Complete Syntax of Lua @@ -165,10 +176,12 @@

      Lua functions

      tonumber
      tostring
      type
      +warn
      xpcall

      coroutine
      +coroutine.close
      coroutine.create
      coroutine.isyieldable
      coroutine.resume
      @@ -318,14 +331,46 @@

       

      utf8.len
      utf8.offset
      +

      metamethods

      +

      +__add
      +__band
      +__bnot
      +__bor
      +__bxor
      +__call
      +__close
      +__concat
      +__div
      +__eq
      +__gc
      +__idiv
      +__index
      +__le
      +__len
      +__lt
      +__metatable
      +__mod
      +__mode
      +__mul
      +__name
      +__newindex
      +__pairs
      +__pow
      +__shl
      +__shr
      +__sub
      +__tostring
      +__unm
      +

      environment
      variables

      LUA_CPATH
      -LUA_CPATH_5_3
      +LUA_CPATH_5_4
      LUA_INIT
      -LUA_INIT_5_3
      +LUA_INIT_5_4
      LUA_PATH
      -LUA_PATH_5_3
      +LUA_PATH_5_4
      @@ -342,6 +387,7 @@

      C API

      lua_Reader
      lua_State
      lua_Unsigned
      +lua_WarnFunction
      lua_Writer

      @@ -352,6 +398,7 @@

      C API

      lua_callk
      lua_checkstack
      lua_close
      +lua_closeslot
      lua_compare
      lua_concat
      lua_copy
      @@ -368,13 +415,13 @@

      C API

      lua_gethookmask
      lua_geti
      lua_getinfo
      +lua_getiuservalue
      lua_getlocal
      lua_getmetatable
      lua_getstack
      lua_gettable
      lua_gettop
      lua_getupvalue
      -lua_getuservalue
      lua_insert
      lua_isboolean
      lua_iscfunction
      @@ -395,7 +442,7 @@

      C API

      lua_newstate
      lua_newtable
      lua_newthread
      -lua_newuserdata
      +lua_newuserdatauv
      lua_next
      lua_numbertointeger
      lua_pcall
      @@ -427,6 +474,7 @@

      C API

      lua_register
      lua_remove
      lua_replace
      +lua_resetthread
      lua_resume
      lua_rotate
      lua_setallocf
      @@ -434,16 +482,18 @@

      C API

      lua_setglobal
      lua_sethook
      lua_seti
      +lua_setiuservalue
      lua_setlocal
      lua_setmetatable
      lua_settable
      lua_settop
      lua_setupvalue
      -lua_setuservalue
      +lua_setwarnf
      lua_status
      lua_stringtonumber
      lua_toboolean
      lua_tocfunction
      +lua_toclose
      lua_tointeger
      lua_tointegerx
      lua_tolstring
      @@ -459,6 +509,7 @@

      C API

      lua_upvalueindex
      lua_upvaluejoin
      lua_version
      +lua_warning
      lua_xmove
      lua_yield
      lua_yieldk
      @@ -473,14 +524,19 @@

      auxiliary library

      luaL_addchar
      +luaL_addgsub
      luaL_addlstring
      luaL_addsize
      luaL_addstring
      luaL_addvalue
      luaL_argcheck
      luaL_argerror
      +luaL_argexpected
      +luaL_buffaddr
      luaL_buffinit
      luaL_buffinitsize
      +luaL_bufflen
      +luaL_buffsub
      luaL_callmeta
      luaL_checkany
      luaL_checkinteger
      @@ -519,6 +575,7 @@

      auxiliary library

      luaL_optstring
      luaL_prepbuffer
      luaL_prepbuffsize
      +luaL_pushfail
      luaL_pushresult
      luaL_pushresultsize
      luaL_ref
      @@ -528,6 +585,7 @@

      auxiliary library

      luaL_testudata
      luaL_tolstring
      luaL_traceback
      +luaL_typeerror
      luaL_typename
      luaL_unref
      luaL_where
      @@ -549,7 +607,6 @@

      constants

      LUA_ERRERR
      LUA_ERRFILE
      -LUA_ERRGCMM
      LUA_ERRMEM
      LUA_ERRRUN
      LUA_ERRSYNTAX
      @@ -558,6 +615,7 @@

      constants

      LUA_HOOKLINE
      LUA_HOOKRET
      LUA_HOOKTAILCALL
      +LUA_LOADED_TABLE
      LUA_MASKCALL
      LUA_MASKCOUNT
      LUA_MASKLINE
      @@ -585,6 +643,7 @@

      constants

      LUA_OPSHR
      LUA_OPSUB
      LUA_OPUNM
      +LUA_PRELOAD_TABLE
      LUA_REFNIL
      LUA_REGISTRYINDEX
      LUA_RIDX_GLOBALS
      @@ -609,10 +668,10 @@

      constants

      diff --git a/LuaSkin/lua-5.3.4/doc/index.css b/LuaSkin/lua-5.4.7/doc/index.css similarity index 100% rename from LuaSkin/lua-5.3.4/doc/index.css rename to LuaSkin/lua-5.4.7/doc/index.css diff --git a/LuaSkin/lua-5.3.4/doc/logo.gif b/LuaSkin/lua-5.4.7/doc/logo.gif similarity index 100% rename from LuaSkin/lua-5.3.4/doc/logo.gif rename to LuaSkin/lua-5.4.7/doc/logo.gif diff --git a/LuaSkin/lua-5.4.7/doc/lua.1 b/LuaSkin/lua-5.4.7/doc/lua.1 new file mode 100644 index 000000000..3c9e00023 --- /dev/null +++ b/LuaSkin/lua-5.4.7/doc/lua.1 @@ -0,0 +1,155 @@ +.\" $Id: lua.man,v 1.14 2024/05/08 18:48:27 lhf Exp $ +.TH LUA 1 "$Date: 2024/05/08 18:48:27 $" +.SH NAME +lua \- Lua interpreter +.SH SYNOPSIS +.B lua +[ +.I options +] +[ +.I script +[ +.I args +] +] +.SH DESCRIPTION +.B lua +is the standalone Lua interpreter. +It loads and executes Lua programs, +either in textual source form or +in precompiled binary form. +(Precompiled binaries are output by +.BR luac , +the Lua compiler.) +.B lua +can be used as a batch interpreter and also interactively. +.LP +After handling the +.IR options , +the Lua program in file +.I script +is loaded and executed. +The +.I args +are available to +.I script +as strings in a global table named +.B arg +and also as arguments to its main function. +When called without arguments, +.B lua +behaves as +.B "lua \-v \-i" +if the standard input is a terminal, +and as +.B "lua \-" +otherwise. +.LP +In interactive mode, +.B lua +prompts the user, +reads lines from the standard input, +and executes them as they are read. +If the line contains an expression, +then the line is evaluated and the result is printed. +If a line does not contain a complete statement, +then a secondary prompt is displayed and +lines are read until a complete statement is formed or +a syntax error is found. +.LP +Before handling command line options and scripts, +.B lua +checks the contents of the environment variables +.B LUA_INIT_5_4 +and +.BR LUA_INIT , +in that order. +If the contents are of the form +.RI '@ filename ', +then +.I filename +is executed. +Otherwise, the contents are assumed to be a Lua statement and is executed. +When +.B LUA_INIT_5_4 +is defined, +.B LUA_INIT +is ignored. +.SH OPTIONS +.TP +.BI \-e " stat" +execute statement +.IR stat . +.TP +.B \-i +enter interactive mode after executing +.IR script . +.TP +.BI \-l " mod" +require library +.I mod +into global +.IR mod . +.TP +.BI \-l " g=mod" +require library +.I mod +into global +.IR g . +.TP +.B \-v +show version information. +.TP +.B \-E +ignore environment variables. +.TP +.B \-W +turn warnings on. +.TP +.B \-\- +stop handling options. +.TP +.B \- +stop handling options and execute the standard input as a file. +.SH ENVIRONMENT VARIABLES +The following environment variables affect the execution of +.BR lua . +When defined, +the version-specific variants take priority +and the version-neutral variants are ignored. +.TP +.B LUA_INIT, LUA_INIT_5_4 +Code to be executed before command line options and scripts. +.TP +.B LUA_PATH, LUA_PATH_5_4 +Initial value of package.path, +the path used by require to search for Lua loaders. +.TP +.B LUA_CPATH, LUA_CPATH_5_4 +Initial value of package.cpath, +the path used by require to search for C loaders. +.SH EXIT STATUS +If a script calls os.exit, +then +.B lua +exits with the given exit status. +Otherwise, +.B lua +exits +with EXIT_SUCCESS (0 on POSIX systems) if there were no errors +and +with EXIT_FAILURE (1 on POSIX systems) if there were errors. +Errors raised in interactive mode do not cause exits. +.SH DIAGNOSTICS +Error messages should be self explanatory. +.SH "SEE ALSO" +.BR luac (1) +.br +The documentation at lua.org, +especially section 7 of the reference manual. +.SH AUTHORS +R. Ierusalimschy, +L. H. de Figueiredo, +W. Celes +.\" EOF diff --git a/LuaSkin/lua-5.3.4/doc/lua.css b/LuaSkin/lua-5.4.7/doc/lua.css similarity index 94% rename from LuaSkin/lua-5.3.4/doc/lua.css rename to LuaSkin/lua-5.4.7/doc/lua.css index 5bedf7eb8..9013b445c 100644 --- a/LuaSkin/lua-5.3.4/doc/lua.css +++ b/LuaSkin/lua-5.4.7/doc/lua.css @@ -10,7 +10,7 @@ body { line-height: 1.25 ; margin: 16px auto ; padding: 32px ; - border: solid #a0a0a0 1px ; + border: solid #ccc 1px ; border-radius: 20px ; max-width: 70em ; width: 90% ; @@ -111,36 +111,29 @@ pre.session { border-radius: 8px ; } -td.gutter { - width: 4% ; -} - -table.columns { +table { border: none ; border-spacing: 0 ; border-collapse: collapse ; } -table.columns td { - vertical-align: top ; +td { padding: 0 ; - padding-bottom: 1em ; - text-align: justify ; - line-height: 1.25 ; + margin: 0 ; } -p.logos a:link:hover, p.logos a:visited:hover { - background-color: inherit ; +td.gutter { + width: 4% ; } -table.book { - border: none ; - border-spacing: 0 ; - border-collapse: collapse ; +table.columns td { + vertical-align: top ; + padding-bottom: 1em ; + text-align: justify ; + line-height: 1.25 ; } table.book td { - padding: 0 ; vertical-align: top ; } @@ -150,6 +143,7 @@ table.book td.cover { table.book img { border: solid #000080 1px ; + border-radius: 2px ; } table.book span { @@ -159,6 +153,10 @@ table.book span { margin-top: 0.25em ; } +p.logos a:link:hover, p.logos a:visited:hover { + background-color: inherit ; +} + img { background-color: white ; } diff --git a/LuaSkin/lua-5.3.4/doc/luac.1 b/LuaSkin/lua-5.4.7/doc/luac.1 similarity index 100% rename from LuaSkin/lua-5.3.4/doc/luac.1 rename to LuaSkin/lua-5.4.7/doc/luac.1 diff --git a/LuaSkin/lua-5.3.4/doc/manual.css b/LuaSkin/lua-5.4.7/doc/manual.css similarity index 100% rename from LuaSkin/lua-5.3.4/doc/manual.css rename to LuaSkin/lua-5.4.7/doc/manual.css diff --git a/LuaSkin/lua-5.3.4/doc/manual.html b/LuaSkin/lua-5.4.7/doc/manual.html similarity index 75% rename from LuaSkin/lua-5.3.4/doc/manual.html rename to LuaSkin/lua-5.4.7/doc/manual.html index 3126b5d6a..574c7432c 100644 --- a/LuaSkin/lua-5.3.4/doc/manual.html +++ b/LuaSkin/lua-5.4.7/doc/manual.html @@ -1,7 +1,7 @@ -Lua 5.3 Reference Manual +Lua 5.4 Reference Manual @@ -10,8 +10,8 @@

      -Lua -Lua 5.3 Reference Manual +Lua +Lua 5.4 Reference Manual

      @@ -19,9 +19,9 @@

      -Copyright © 2015–2017 Lua.org, PUC-Rio. +Copyright © 2020–2024 Lua.org, PUC-Rio. Freely available under the terms of the -Lua license. +Lua license.

      - + @@ -56,14 +56,14 @@

      1 – Introduction

      runs by interpreting bytecode with a register-based virtual machine, and has automatic memory management with -incremental garbage collection, +a generational garbage collection, making it ideal for configuration, scripting, and rapid prototyping.

      Lua is implemented as a library, written in clean C, -the common subset of Standard C and C++. +the common subset of standard C and C++. The Lua distribution includes a host program called lua, which uses the Lua library to offer a complete, standalone Lua interpreter, @@ -106,15 +106,19 @@

      1 – Introduction

      2 – Basic Concepts

      + +

      This section describes the basic concepts of the language. + +

      2.1 – Values and Types

      -Lua is a dynamically typed language. +Lua is a dynamically typed language. This means that variables do not have types; only values do. There are no type definitions in the language. @@ -122,7 +126,7 @@

      2.1 – Values and Types

      -All values in Lua are first-class values. +All values in Lua are first-class values. This means that all values can be stored in variables, passed as arguments to other functions, and returned as results. @@ -134,31 +138,22 @@

      2.1 – Values and Types

      thread, and table. The type nil has one single value, nil, whose main property is to be different from any other value; -it usually represents the absence of a useful value. +it often represents the absence of a useful value. The type boolean has two values, false and true. Both nil and false make a condition false; -any other value makes it true. -The type number represents both -integer numbers and real (floating-point) numbers. -The type string represents immutable sequences of bytes. - -Lua is 8-bit clean: -strings can contain any 8-bit value, -including embedded zeros ('\0'). -Lua is also encoding-agnostic; -it makes no assumptions about the contents of a string. +they are collectively called false values. +Any other value makes a condition true. +Despite its name, +false is frequently used as an alternative to nil, +with the key difference that false behaves +like a regular value in a table, +while a nil in a table represents an absent key.

      -The type number uses two internal representations, -or two subtypes, -one called integer and the other called float. -Lua has explicit rules about when each representation is used, -but it also converts between them automatically as needed (see §3.4.3). -Therefore, -the programmer may choose to mostly ignore the difference -between integers and floats -or to assume complete control over the representation of each number. +The type number represents both +integer numbers and real (floating-point) numbers, +using two subtypes: integer and float. Standard Lua uses 64-bit integers and double-precision (64-bit) floats, but you can also compile Lua so that it uses 32-bit integers and/or single-precision (32-bit) floats. @@ -168,6 +163,36 @@

      2.1 – Values and Types

      (See macro LUA_32BITS in file luaconf.h.) +

      +Unless stated otherwise, +any overflow when manipulating integer values wrap around, +according to the usual rules of two-complement arithmetic. +(In other words, +the actual result is the unique representable integer +that is equal modulo 2n to the mathematical result, +where n is the number of bits of the integer type.) + + +

      +Lua has explicit rules about when each subtype is used, +but it also converts between them automatically as needed (see §3.4.3). +Therefore, +the programmer may choose to mostly ignore the difference +between integers and floats +or to assume complete control over the representation of each number. + + +

      +The type string represents immutable sequences of bytes. + +Lua is 8-bit clean: +strings can contain any 8-bit value, +including embedded zeros ('\0'). +Lua is also encoding-agnostic; +it makes no assumptions about the contents of a string. +The length of any string in Lua must fit in a Lua integer. + +

      Lua can call (and manipulate) functions written in Lua and functions written in C (see §3.4.10). @@ -190,7 +215,8 @@

      2.1 – Values and Types

      (see §2.4). Userdata values cannot be created or modified in Lua, only through the C API. -This guarantees the integrity of data owned by the host program. +This guarantees the integrity of data owned by +the host program and C libraries.

      @@ -203,13 +229,14 @@

      2.1 – Values and Types

      The type table implements associative arrays, -that is, arrays that can be indexed not only with numbers, -but with any Lua value except nil and NaN. -(Not a Number is a special value used to represent -undefined or unrepresentable numerical results, such as 0/0.) +that is, arrays that can have as indices not only numbers, +but any Lua value except nil and NaN. +(Not a Number is a special floating-point value +used by the IEEE 754 standard to represent +undefined numerical results, such as 0/0.) Tables can be heterogeneous; that is, they can contain values of all types (except nil). -Any key with value nil is not considered part of the table. +Any key associated to the value nil is not considered part of the table. Conversely, any key that is not part of a table has an associated value nil. @@ -245,14 +272,10 @@

      2.1 – Values and Types

      are equal to their respective integers (e.g., 1.0 == 1). To avoid ambiguities, -any float with integral value used as a key -is converted to its respective integer. +any float used as a key that is equal to an integer +is converted to that integer. For instance, if you write a[2.0] = true, -the actual key inserted into the table will be the -integer 2. -(On the other hand, -2 and "2" are different Lua values and therefore -denote different table entries.) +the actual key inserted into the table will be the integer 2.

      @@ -266,7 +289,7 @@

      2.1 – Values and Types

      The library function type returns a string describing the type -of a given value (see §6.1). +of a given value (see type). @@ -275,7 +298,7 @@

      2.1 – Values and Types

      2.2 – Environments and the Global Environment

      -As will be discussed in §3.2 and §3.3.3, +As we will discuss further in §3.2 and §3.3.3, any reference to a free name (that is, a name not bound to any declaration) var is syntactically translated to _ENV.var. @@ -301,24 +324,25 @@

      2.2 – Environments and the Global Environment

      Lua keeps a distinguished environment called the global environment. -This value is kept at a special index in the C registry (see §4.5). +This value is kept at a special index in the C registry (see §4.3). In Lua, the global variable _G is initialized with this same value. -(_G is never used internally.) +(_G is never used internally, +so changing its value will affect only your own code.)

      When Lua loads a chunk, -the default value for its _ENV upvalue +the default value for its _ENV variable is the global environment (see load). Therefore, by default, free names in Lua code refer to entries in the global environment -(and, therefore, they are also called global variables). +and, therefore, they are also called global variables. Moreover, all standard libraries are loaded in the global environment and some functions there operate on that environment. You can use load (or loadfile) to load a chunk with a different environment. (In C, you have to load the chunk and then change the value -of its first upvalue.) +of its first upvalue; see lua_setupvalue.) @@ -326,40 +350,58 @@

      2.2 – Environments and the Global Environment

      2.3 – Error Handling

      +

      +Several operations in Lua can raise an error. +An error interrupts the normal flow of the program, +which can continue by catching the error. + + +

      +Lua code can explicitly raise an error by calling the +error function. +(This function never returns.) + + +

      +To catch errors in Lua, +you can do a protected call, +using pcall (or xpcall). +The function pcall calls a given function in protected mode. +Any error while running the function stops its execution, +and control returns immediately to pcall, +which returns a status code. + +

      Because Lua is an embedded extension language, -all Lua actions start from C code in the host program -calling a function from the Lua library. +Lua code starts running by a call +from C code in the host program. (When you use Lua standalone, the lua application is the host program.) -Whenever an error occurs during +Usually, this call is protected; +so, when an otherwise unprotected error occurs during the compilation or execution of a Lua chunk, control returns to the host, -which can take appropriate measures -(such as printing an error message). - - -

      -Lua code can explicitly generate an error by calling the -error function. -If you need to catch errors in Lua, -you can use pcall or xpcall -to call a given function in protected mode. +which can take appropriate measures, +such as printing an error message.

      Whenever there is an error, -an error object (also called an error message) +an error object is propagated with information about the error. Lua itself only generates errors whose error object is a string, -but programs may generate errors with +but programs can generate errors with any value as the error object. It is up to the Lua program or its host to handle such error objects. +For historical reasons, +an error object is often called an error message, +even though it does not have to be a string.

      -When you use xpcall or lua_pcall, -you may give a message handler +When you use xpcall (or lua_pcall, in C) +you can give a message handler to be called in case of errors. This function is called with the original error object and returns a new error object. @@ -371,9 +413,17 @@

      2.3 – Error Handling

      will call the message handler again. If this loop goes on for too long, Lua breaks it and returns an appropriate message. -(The message handler is called only for regular runtime errors. +The message handler is called only for regular runtime errors. It is not called for memory-allocation errors -nor for errors while running finalizers.) +nor for errors while running finalizers or other message handlers. + + +

      +Lua also offers a system of warnings (see warn). +Unlike errors, warnings do not interfere +in any way with program execution. +They typically only generate a message to the user, +although this behavior can be adapted from C (see lua_setwarnf). @@ -385,11 +435,11 @@

      2.4 – Metatables and Metamethods

      Every value in Lua can have a metatable. This metatable is an ordinary Lua table that defines the behavior of the original value -under certain special operations. +under certain events. You can change several aspects of the behavior -of operations over a value by setting specific fields in its metatable. +of a value by setting specific fields in its metatable. For instance, when a non-numeric value is the operand of an addition, -Lua checks for a function in the field "__add" of the value's metatable. +Lua checks for a function in the field __add of the value's metatable. If it finds one, Lua calls this function to perform the addition. @@ -397,33 +447,32 @@

      2.4 – Metatables and Metamethods

      The key for each event in a metatable is a string with the event name prefixed by two underscores; -the corresponding values are called metamethods. -In the previous example, the key is "__add" +the corresponding value is called a metavalue. +For most events, the metavalue must be a function, +which is then called a metamethod. +In the previous example, the key is the string "__add" and the metamethod is the function that performs the addition. +Unless stated otherwise, +a metamethod can in fact be any callable value, +which is either a function or a value with a __call metamethod.

      You can query the metatable of any value using the getmetatable function. Lua queries metamethods in metatables using a raw access (see rawget). -So, to retrieve the metamethod for event ev in object o, -Lua does the equivalent to the following code: -

      -     rawget(getmetatable(o) or {}, "__ev")
      -

      You can replace the metatable of tables using the setmetatable function. -You cannot change the metatable of other types from Lua code -(except by using the debug library (§6.10)); -you should use the C API for that. +You cannot change the metatable of other types from Lua code, +except by using the debug library (§6.10).

      -Tables and full userdata have individual metatables -(although multiple tables and userdata can share their metatables). +Tables and full userdata have individual metatables, +although multiple tables and userdata can share their metatables. Values of all other types share one single metatable per type; that is, there is one single metatable for all numbers, one for all strings, etc. @@ -432,26 +481,10 @@

      2.4 – Metatables and Metamethods

      -A metatable controls how an object behaves in -arithmetic operations, bitwise operations, -order comparisons, concatenation, length operation, calls, and indexing. -A metatable also can define a function to be called -when a userdata or a table is garbage collected (§2.5). - - -

      -For the unary operators (negation, length, and bitwise NOT), -the metamethod is computed and called with a dummy second operand, -equal to the first one. -This extra operand is only to simplify Lua's internals -(by making these operators behave like a binary operation) -and may be removed in future versions. -(For most uses this extra operand is irrelevant.) - - -

      -A detailed list of events controlled by metatables is given next. -Each operation is identified by its corresponding key. +A detailed list of operations controlled by metatables is given next. +Each event is identified by its corresponding key. +By convention, all metatable keys used by Lua are composed by +two underscores followed by lowercase Latin letters. @@ -459,19 +492,18 @@

      2.4 – Metatables and Metamethods

    • __add: the addition (+) operation. -If any operand for an addition is not a number -(nor a string coercible to a number), +If any operand for an addition is not a number, Lua will try to call a metamethod. -First, Lua will check the first operand (even if it is valid). -If that operand does not define a metamethod for __add, +It starts by checking the first operand (even if it is a number); +if that operand does not define a metamethod for __add, then Lua will check the second operand. If Lua can find a metamethod, it calls the metamethod with the two operands as arguments, and the result of the call (adjusted to one value) is the result of the operation. -Otherwise, -it raises an error. +Otherwise, if no metamethod is found, +Lua raises an error.
    • __sub: @@ -514,7 +546,7 @@

      2.4 – Metatables and Metamethods

      Behavior similar to the addition operation, except that Lua will try a metamethod if any operand is neither an integer -nor a value coercible to an integer (see §3.4.3). +nor a float coercible to an integer (see §3.4.3).
    • __bor: @@ -578,43 +610,33 @@

      2.4 – Metatables and Metamethods

      Behavior similar to the addition operation, except that Lua will try a metamethod only when the values being compared are neither both numbers nor both strings. -The result of the call is always converted to a boolean. +Moreover, the result of the call is always converted to a boolean.
    • __le: the less equal (<=) operation. -Unlike other operations, -the less-equal operation can use two different events. -First, Lua looks for the __le metamethod in both operands, -like in the less than operation. -If it cannot find such a metamethod, -then it will try the __lt metamethod, -assuming that a <= b is equivalent to not (b < a). -As with the other comparison operators, -the result is always a boolean. -(This use of the __lt event can be removed in future versions; -it is also slower than a real __le metamethod.) +Behavior similar to the less than operation.
    • __index: -The indexing access table[key]. +The indexing access operation table[key]. This event happens when table is not a table or when key is not present in table. -The metamethod is looked up in table. +The metavalue is looked up in the metatable of table.

      -Despite the name, -the metamethod for this event can be either a function or a table. +The metavalue for this event can be either a function, a table, +or any value with an __index metavalue. If it is a function, it is called with table and key as arguments, and the result of the call (adjusted to one value) is the result of the operation. -If it is a table, -the final result is the result of indexing this table with key. -(This indexing is regular, not raw, -and therefore can trigger another metamethod.) +Otherwise, +the final result is the result of indexing this metavalue with key. +This indexing is regular, not raw, +and therefore can trigger another __index metavalue.

    • __newindex: @@ -622,26 +644,28 @@

      2.4 – Metatables and Metamethods

      Like the index event, this event happens when table is not a table or when key is not present in table. -The metamethod is looked up in table. +The metavalue is looked up in the metatable of table.

      Like with indexing, -the metamethod for this event can be either a function or a table. +the metavalue for this event can be either a function, a table, +or any value with an __newindex metavalue. If it is a function, it is called with table, key, and value as arguments. -If it is a table, -Lua does an indexing assignment to this table with the same key and value. -(This assignment is regular, not raw, -and therefore can trigger another metamethod.) +Otherwise, +Lua repeats the indexing assignment over this metavalue +with the same key and value. +This assignment is regular, not raw, +and therefore can trigger another __newindex metavalue.

      -Whenever there is a __newindex metamethod, +Whenever a __newindex metavalue is invoked, Lua does not perform the primitive assignment. -(If necessary, +If needed, the metamethod itself can call rawset -to do the assignment.) +to do the assignment.

    • __call: @@ -653,17 +677,32 @@

      2.4 – Metatables and Metamethods

      the metamethod is called with func as its first argument, followed by the arguments of the original call (args). All results of the call -are the result of the operation. -(This is the only metamethod that allows multiple results.) +are the results of the operation. +This is the only metamethod that allows multiple results.

    -It is a good practice to add all needed metamethods to a table -before setting it as a metatable of some object. -In particular, the __gc metamethod works only when this order -is followed (see §2.5.1). +In addition to the previous list, +the interpreter also respects the following keys in metatables: +__gc (see §2.5.3), +__close (see §3.3.8), +__mode (see §2.5.4), +and __name. +(The entry __name, +when it contains a string, +may be used by tostring and in error messages.) + + +

    +For the unary operators (negation, length, and bitwise NOT), +the metamethod is computed and called with a dummy second operand, +equal to the first one. +This extra operand is only to simplify Lua's internals +(by making these operators behave like a binary operation) +and may be removed in future versions. +For most uses this extra operand is irrelevant.

    @@ -675,86 +714,191 @@

    2.4 – Metatables and Metamethods

    use other fields in metatables for their own purposes. +

    +It is a good practice to add all needed metamethods to a table +before setting it as a metatable of some object. +In particular, the __gc metamethod works only when this order +is followed (see §2.5.3). +It is also a good practice to set the metatable of an object +right after its creation. + +

    2.5 – Garbage Collection

    + +

    Lua performs automatic memory management. This means that you do not have to worry about allocating memory for new objects or freeing it when the objects are no longer needed. Lua manages memory automatically by running -a garbage collector to collect all dead objects -(that is, objects that are no longer accessible from Lua). +a garbage collector to collect all dead objects. All memory used by Lua is subject to automatic management: strings, tables, userdata, functions, threads, internal structures, etc.

    -Lua implements an incremental mark-and-sweep collector. -It uses two numbers to control its garbage-collection cycles: -the garbage-collector pause and -the garbage-collector step multiplier. -Both use percentage points as units -(e.g., a value of 100 means an internal value of 1). +An object is considered dead +as soon as the collector can be sure the object +will not be accessed again in the normal execution of the program. +("Normal execution" here excludes finalizers, +which can resurrect dead objects (see §2.5.3), +and excludes also operations using the debug library.) +Note that the time when the collector can be sure that an object +is dead may not coincide with the programmer's expectations. +The only guarantees are that Lua will not collect an object +that may still be accessed in the normal execution of the program, +and it will eventually collect an object +that is inaccessible from Lua. +(Here, +inaccessible from Lua means that neither a variable nor +another live object refer to the object.) +Because Lua has no knowledge about C code, +it never collects objects accessible through the registry (see §4.3), +which includes the global environment (see §2.2). + + +

    +The garbage collector (GC) in Lua can work in two modes: +incremental and generational. + + +

    +The default GC mode with the default parameters +are adequate for most uses. +However, programs that waste a large proportion of their time +allocating and freeing memory can benefit from other settings. +Keep in mind that the GC behavior is non-portable +both across platforms and across different Lua releases; +therefore, optimal settings are also non-portable. + + +

    +You can change the GC mode and parameters by calling +lua_gc in C +or collectgarbage in Lua. +You can also use these functions to control +the collector directly (e.g., to stop and restart it). + + + + + +

    2.5.1 – Incremental Garbage Collection

    + +

    +In incremental mode, +each GC cycle performs a mark-and-sweep collection in small steps +interleaved with the program's execution. +In this mode, +the collector uses three numbers to control its garbage-collection cycles: +the garbage-collector pause, +the garbage-collector step multiplier, +and the garbage-collector step size.

    The garbage-collector pause controls how long the collector waits before starting a new cycle. +The collector starts a new cycle when the use of memory +hits n% of the use after the previous collection. Larger values make the collector less aggressive. -Values smaller than 100 mean the collector will not wait to +Values equal to or less than 100 mean the collector will not wait to start a new cycle. A value of 200 means that the collector waits for the total memory in use to double before starting a new cycle. +The default value is 200; the maximum value is 1000.

    The garbage-collector step multiplier -controls the relative speed of the collector relative to -memory allocation. +controls the speed of the collector relative to +memory allocation, +that is, +how many elements it marks or sweeps for each +kilobyte of memory allocated. Larger values make the collector more aggressive but also increase the size of each incremental step. -You should not use values smaller than 100, +You should not use values less than 100, because they make the collector too slow and can result in the collector never finishing a cycle. -The default is 200, -which means that the collector runs at "twice" -the speed of memory allocation. +The default value is 100; the maximum value is 1000.

    -If you set the step multiplier to a very large number -(larger than 10% of the maximum number of -bytes that the program may use), -the collector behaves like a stop-the-world collector. -If you then set the pause to 200, -the collector behaves as in old Lua versions, -doing a complete collection every time Lua doubles its -memory usage. +The garbage-collector step size controls the +size of each incremental step, +specifically how many bytes the interpreter allocates +before performing a step. +This parameter is logarithmic: +A value of n means the interpreter will allocate 2n +bytes between steps and perform equivalent work during the step. +A large value (e.g., 60) makes the collector a stop-the-world +(non-incremental) collector. +The default value is 13, +which means steps of approximately 8 Kbytes. + + + +

    2.5.2 – Generational Garbage Collection

    +

    -You can change these numbers by calling lua_gc in C -or collectgarbage in Lua. -You can also use these functions to control -the collector directly (e.g., stop and restart it). +In generational mode, +the collector does frequent minor collections, +which traverses only objects recently created. +If after a minor collection the use of memory is still above a limit, +the collector does a stop-the-world major collection, +which traverses all objects. +The generational mode uses two parameters: +the minor multiplier and the the major multiplier. +

    +The minor multiplier controls the frequency of minor collections. +For a minor multiplier x, +a new minor collection will be done when memory +grows x% larger than the memory in use after the previous major +collection. +For instance, for a multiplier of 20, +the collector will do a minor collection when the use of memory +gets 20% larger than the use after the previous major collection. +The default value is 20; the maximum value is 200. -

    2.5.1 – Garbage-Collection Metamethods

    + +

    +The major multiplier controls the frequency of major collections. +For a major multiplier x, +a new major collection will be done when memory +grows x% larger than the memory in use after the previous major +collection. +For instance, for a multiplier of 100, +the collector will do a major collection when the use of memory +gets larger than twice the use after the previous collection. +The default value is 100; the maximum value is 1000. + + + + + +

    2.5.3 – Garbage-Collection Metamethods

    You can set garbage-collector metamethods for tables and, using the C API, for full userdata (see §2.4). -These metamethods are also called finalizers. +These metamethods, called finalizers, +are called when the garbage collector detects that the +corresponding table or userdata is dead. Finalizers allow you to coordinate Lua's garbage collection -with external resource management -(such as closing files, network or database connections, -or freeing your own memory). +with external resource management such as closing files, +network or database connections, +or freeing your own memory.

    @@ -762,29 +906,27 @@

    2.5.1 – Garbage-Collection Metamethods

    you must mark it for finalization. You mark an object for finalization when you set its metatable -and the metatable has a field indexed by the string "__gc". +and the metatable has a __gc metamethod. Note that if you set a metatable without a __gc field and later create that field in the metatable, the object will not be marked for finalization.

    -When a marked object becomes garbage, +When a marked object becomes dead, it is not collected immediately by the garbage collector. Instead, Lua puts it in a list. After the collection, Lua goes through that list. For each object in the list, it checks the object's __gc metamethod: -If it is a function, -Lua calls it with the object as its single argument; -if the metamethod is not a function, -Lua simply ignores it. +If it is present, +Lua calls it with the object as its single argument.

    At the end of each garbage-collection cycle, -the finalizers for objects are called in +the finalizers are called in the reverse order that the objects were marked for finalization, among those collected in that cycle; that is, the first finalizer to be called is the one associated @@ -804,10 +946,10 @@

    2.5.1 – Garbage-Collection Metamethods

    then the resurrection is permanent. Moreover, if the finalizer marks a finalizing object for finalization again, its finalizer will be called again in the next cycle where the -object is unreachable. +object is dead. In any case, the object memory is freed only in a GC cycle where -the object is unreachable and not marked for finalization. +the object is dead and not marked for finalization.

    @@ -818,10 +960,23 @@

    2.5.1 – Garbage-Collection Metamethods

    these marks have no effect. +

    +Finalizers cannot yield nor run the garbage collector. +Because they can run in unpredictable times, +it is good practice to restrict each finalizer +to the minimum necessary to properly release +its associated resource. + + +

    +Any error while running a finalizer generates a warning; +the error is not propagated. -

    2.5.2 – Weak Tables

    + + +

    2.5.4 – Weak Tables

    A weak table is a table whose elements are @@ -842,10 +997,10 @@

    2.5.2 – Weak Tables

    the whole pair is removed from the table. The weakness of a table is controlled by the __mode field of its metatable. -If the __mode field is a string containing the character 'k', -the keys in the table are weak. -If __mode contains 'v', -the values in the table are weak. +This metavalue, if present, must be one of the following strings: +"k", for a table with weak keys; +"v", for a table with weak values; +or "kv", for a table with both weak keys and values.

    @@ -874,8 +1029,10 @@

    2.5.2 – Weak Tables

    and therefore are not removed from weak tables (unless their associated values are collected). Although strings are subject to garbage collection, -they do not have an explicit construction, -and therefore are not removed from weak tables. +they do not have an explicit construction and +their equality is by value; +they behave more like values than like objects. +Therefore, they are not removed from weak tables.

    @@ -942,7 +1099,10 @@

    2.6 – Coroutines

    coroutine.resume returns true, plus any values returned by the coroutine main function. In case of errors, coroutine.resume returns false -plus an error object. +plus the error object. +In this case, the coroutine does not unwind its stack, +so that it is possible to inspect it after the error +with the debug API.

    @@ -970,8 +1130,10 @@

    2.6 – Coroutines

    coroutine.wrap returns all the values returned by coroutine.resume, except the first one (the boolean error code). Unlike coroutine.resume, -coroutine.wrap does not catch errors; -any error is propagated to the caller. +the function created by coroutine.wrap +propagates any error to the caller. +In this case, +the function also closes the coroutine (see coroutine.close).

    @@ -1022,6 +1184,8 @@

    2.6 – Coroutines

    3 – The Language

    + +

    This section describes the lexis, the syntax, and the semantics of Lua. In other words, @@ -1044,20 +1208,25 @@

    3 – The Language

    + +

    3.1 – Lexical Conventions

    Lua is a free-form language. -It ignores spaces (including new lines) and comments -between lexical elements (tokens), -except as delimiters between names and keywords. +It ignores spaces and comments between lexical elements (tokens), +except as delimiters between two tokens. +In source code, +Lua recognizes as spaces the standard ASCII whitespace +characters space, form feed, newline, +carriage return, horizontal tab, and vertical tab.

    Names (also called identifiers) -in Lua can be any string of letters, -digits, and underscores, +in Lua can be any string of Latin letters, +Arabic-Indic digits, and underscores, not beginning with a digit and not being a reserved word. Identifiers are used to name variables, table fields, and labels. @@ -1113,7 +1282,7 @@

    3.1 – Lexical Conventions

    A backslash followed by a line break results in a newline in the string. The escape sequence '\z' skips the following span -of white-space characters, +of whitespace characters, including line breaks; it is particularly useful to break and indent a long literal string into multiple lines without adding the newlines and spaces @@ -1123,8 +1292,9 @@

    3.1 – Lexical Conventions

    -We can specify any byte in a short literal string by its numeric value -(including embedded zeros). +We can specify any byte in a short literal string, +including embedded zeros, +by its numeric value. This can be done with the escape sequence \xXX, where XX is a sequence of exactly two hexadecimal digits, @@ -1138,9 +1308,12 @@

    3.1 – Lexical Conventions

    The UTF-8 encoding of a Unicode character can be inserted in a literal string with the escape sequence \u{XXX} -(note the mandatory enclosing brackets), +(with mandatory enclosing braces), where XXX is a sequence of one or more hexadecimal digits representing the character code point. +This code point can be any value less than 231. +(Lua uses the original UTF-8 specification here, +which is not restricted to valid Unicode code points.)

    @@ -1165,12 +1338,11 @@

    3.1 – Lexical Conventions

    (carriage return, newline, carriage return followed by newline, or newline followed by carriage return) is converted to a simple newline. +When the opening long bracket is immediately followed by a newline, +the newline is not included in the string.

    -For convenience, -when the opening long bracket is immediately followed by a newline, -the newline is not included in the string. As an example, in a system using ASCII (in which 'a' is coded as 97, newline is coded as 10, and '1' is coded as 49), @@ -1191,10 +1363,10 @@

    3.1 – Lexical Conventions

    Any byte in a literal string not explicitly affected by the previous rules represents itself. However, Lua opens files for parsing in text mode, -and the system file functions may have problems with +and the system's file functions may have problems with some control characters. So, it is safer to represent -non-text data as a quoted literal with +binary data as a quoted literal with explicit escape sequences for the non-text characters. @@ -1207,12 +1379,26 @@

    3.1 – Lexical Conventions

    which start with 0x or 0X. Hexadecimal constants also accept an optional fractional part plus an optional binary exponent, -marked by a letter 'p' or 'P'. +marked by a letter 'p' or 'P' and written in decimal. +(For instance, 0x1.fp10 denotes 1984, +which is 0x1f / 16 multiplied by 210.) + + +

    A numeric constant with a radix point or an exponent denotes a float; otherwise, -if its value fits in an integer, -it denotes an integer. +if its value fits in an integer or it is a hexadecimal constant, +it denotes an integer; +otherwise (that is, a decimal integer numeral that overflows), +it denotes a float. +Hexadecimal numerals with neither a radix point nor an exponent +always denote an integer value; +if the value overflows, it wraps around +to fit into a valid integer. + + +

    Examples of valid integer constants are

    @@ -1233,7 +1419,6 @@ 

    3.1 – Lexical Conventions

    which runs until the end of the line. Otherwise, it is a long comment, which runs until the corresponding closing long bracket. -Long comments are frequently used to disable code temporarily. @@ -1255,7 +1440,7 @@

    3.2 – Variables

     	var ::= Name
     

    -Name denotes identifiers, as defined in §3.1. +Name denotes identifiers (see §3.1).

    @@ -1276,13 +1461,8 @@

    3.2 – Variables

     	var ::= prefixexp ‘[’ exp ‘]

    -The meaning of accesses to table fields can be changed via metatables. -An access to an indexed variable t[i] is equivalent to -a call gettable_event(t,i). -(See §2.4 for a complete description of the -gettable_event function. -This function is not defined or callable in Lua. -We use it here only for explanatory purposes.) +The meaning of accesses to table fields can be changed via metatables +(see §2.4).

    @@ -1297,7 +1477,7 @@

    3.2 – Variables

    An access to a global variable x is equivalent to _ENV.x. Due to the way that chunks are compiled, -_ENV is never a global name (see §2.2). +the variable _ENV itself is never global (see §2.2). @@ -1305,15 +1485,19 @@

    3.2 – Variables

    3.3 – Statements

    + +

    Lua supports an almost conventional set of statements, -similar to those in Pascal or C. +similar to those in other conventional languages. This set includes -assignments, control structures, function calls, +blocks, assignments, control structures, function calls, and variable declarations. + +

    3.3.1 – Blocks

    @@ -1333,7 +1517,7 @@

    3.3.1 – Blocks

    -Function calls and assignments +Both function calls and assignments can start with an open parenthesis. This possibility leads to an ambiguity in Lua's grammar. Consider the following fragment: @@ -1342,7 +1526,7 @@

    3.3.1 – Blocks

    a = b + c (print or io.write)('done')

    -The grammar could see it in two ways: +The grammar could see this fragment in two ways:

          a = b + c(print or io.write)('done')
    @@ -1396,7 +1580,7 @@ 

    3.3.2 – Chunks

    receive arguments, and return values. Moreover, such anonymous function is compiled as in the scope of an external local variable called _ENV (see §2.2). -The resulting function always has _ENV as its only upvalue, +The resulting function always has _ENV as its only external variable, even if it does not use that variable. @@ -1411,7 +1595,7 @@

    3.3.2 – Chunks

    Chunks can also be precompiled into binary form; -see program luac and function string.dump for details. +see the program luac and the function string.dump for details. Programs in source and compiled forms are interchangeable; Lua automatically detects the file type and acts accordingly (see load). @@ -1439,20 +1623,14 @@

    3.3.3 – Assignment

    Before the assignment, the list of values is adjusted to the length of -the list of variables. -If there are more values than needed, -the excess values are thrown away. -If there are fewer values than needed, -the list is extended with as many nil's as needed. -If the list of expressions ends with a function call, -then all values returned by that call enter the list of values, -before the adjustment -(except when the call is enclosed in parentheses; see §3.4). +the list of variables (see §3.4.12).

    -The assignment statement first evaluates all its expressions -and only then the assignments are performed. +If a variable is both assigned and read +inside a multiple assignment, +Lua ensures that all reads get the value of the variable +before the assignment. Thus the code

    @@ -1477,14 +1655,11 @@ 

    3.3.3 – Assignment

    -The meaning of assignments to global variables -and table fields can be changed via metatables. -An assignment to an indexed variable t[i] = val is equivalent to -settable_event(t,i,val). -(See §2.4 for a complete description of the -settable_event function. -This function is not defined or callable in Lua. -We use it here only for explanatory purposes.) +Note that this guarantee covers only accesses +syntactically inside the assignment statement. +If a function or a metamethod called during the assignment +changes the value of a variable, +Lua gives no guarantees about the order of that access.

    @@ -1493,6 +1668,12 @@

    3.3.3 – Assignment

    _ENV.x = val (see §2.2). +

    +The meaning of assignments to table fields and +global variables (which are actually table fields, too) +can be changed via metatables (see §2.4). + + @@ -1515,9 +1696,9 @@

    3.3.4 – Control Structures

    The condition expression of a control structure can return any value. -Both false and nil are considered false. -All values different from nil and false are considered true -(in particular, the number 0 and the empty string are also true). +Both false and nil test false. +All values different from nil and false test true. +In particular, the number 0 and the empty string also test true.

    @@ -1543,16 +1724,12 @@

    3.3.4 – Control Structures

    A label is visible in the entire block where it is defined, -except -inside nested blocks where a label with the same name is defined and -inside nested functions. -A goto may jump to any visible label as long as it does not +except inside nested functions. +A goto can jump to any visible label as long as it does not enter into the scope of a local variable. - - -

    -Labels and empty statements are called void statements, -as they perform no actions. +A label should not be declared +where a label with the same name is visible, +even if this other label has been declared in an enclosing block.

    @@ -1570,7 +1747,7 @@

    3.3.4 – Control Structures

    The return statement is used to return values from a function or a chunk -(which is an anonymous function). +(which is handled as an anonymous function). Functions can return more than one value, so the syntax for the return statement is @@ -1582,7 +1759,7 @@

    3.3.4 – Control Structures

    The return statement can only be written as the last statement of a block. -If it is really necessary to return in the middle of a block, +If it is necessary to return in the middle of a block, then an explicit inner block can be used, as in the idiom do return end, because now return is the last statement in its (inner) block. @@ -1599,72 +1776,70 @@

    3.3.5 – For Statement

    one numerical and one generic. + +

    The numerical for loop

    +

    The numerical for loop repeats a block of code while a -control variable runs through an arithmetic progression. +control variable goes through an arithmetic progression. It has the following syntax:

     	stat ::= for Name ‘=’ exp ‘,’ exp [‘,’ exp] do block end
     

    -The block is repeated for name starting at the value of -the first exp, until it passes the second exp by steps of the -third exp. -More precisely, a for statement like +The given identifier (Name) defines the control variable, +which is a new variable local to the loop body (block). -

    -     for v = e1, e2, e3 do block end
    -

    -is equivalent to the code: -

    -     do
    -       local var, limit, step = tonumber(e1), tonumber(e2), tonumber(e3)
    -       if not (var and limit and step) then error() end
    -       var = var - step
    -       while true do
    -         var = var + step
    -         if (step >= 0 and var > limit) or (step < 0 and var < limit) then
    -           break
    -         end
    -         local v = var
    -         block
    -       end
    -     end
    -
    +

    +The loop starts by evaluating once the three control expressions. +Their values are called respectively +the initial value, the limit, and the step. +If the step is absent, it defaults to 1. +

    -Note the following: +If both the initial value and the step are integers, +the loop is done with integers; +note that the limit may not be an integer. +Otherwise, the three values are converted to +floats and the loop is done with floats. +Beware of floating-point accuracy in this case. -

      -
    • -All three control expressions are evaluated only once, -before the loop starts. -They must all result in numbers. -
    • +

      +After that initialization, +the loop body is repeated with the value of the control variable +going through an arithmetic progression, +starting at the initial value, +with a common difference given by the step. +A negative step makes a decreasing sequence; +a step equal to zero raises an error. +The loop continues while the value is less than +or equal to the limit +(greater than or equal to for a negative step). +If the initial value is already greater than the limit +(or less than, if the step is negative), +the body is not executed. -

    • -var, limit, and step are invisible variables. -The names shown here are for explanatory purposes only. -
    • -
    • -If the third expression (the step) is absent, -then a step of 1 is used. -
    • +

      +For integer loops, +the control variable never wraps around; +instead, the loop ends in case of an overflow. -

    • -You can use break and goto to exit a for loop. -
    • -
    • -The loop variable v is local to the loop body. +

      +You should not change the value of the control variable +during the loop. If you need its value after the loop, assign it to another variable before exiting the loop. -

    • -
    + + + + +

    The generic for loop

    The generic for statement works over functions, @@ -1680,49 +1855,50 @@

    3.3.5 – For Statement

    A for statement like
    -     for var_1, ···, var_n in explist do block end
    +     for var_1, ···, var_n in explist do body end
     

    -is equivalent to the code: +works as follows. -

    -     do
    -       local f, s, var = explist
    -       while true do
    -         local var_1, ···, var_n = f(s, var)
    -         if var_1 == nil then break end
    -         var = var_1
    -         block
    -       end
    -     end
    -

    -Note the following: -

      +

      +The names var_i declare loop variables local to the loop body. +The first of these variables is the control variable. -

    • -explist is evaluated only once. -Its results are an iterator function, + +

      +The loop starts by evaluating explist +to produce four values: +an iterator function, a state, -and an initial value for the first iterator variable. -

    • +an initial value for the control variable, +and a closing value. -
    • -f, s, and var are invisible variables. -The names are here for explanatory purposes only. -
    • -
    • -You can use break to exit a for loop. -
    • +

      +Then, at each iteration, +Lua calls the iterator function with two arguments: +the state and the control variable. +The results from this call are then assigned to the loop variables, +following the rules of multiple assignments (see §3.3.3). +If the control variable becomes nil, +the loop terminates. +Otherwise, the body is executed and the loop goes +to the next iteration. + + +

      +The closing value behaves like a +to-be-closed variable (see §3.3.8), +which can be used to release resources when the loop ends. +Otherwise, it does not interfere with the loop. + + +

      +You should not change the value of the control variable +during the loop. + -

    • -The loop variables var_i are local to the loop; -you cannot use their values after the for ends. -If you need these values, -then assign them to other variables before breaking or exiting the loop. -
    • -
    @@ -1743,16 +1919,32 @@

    3.3.6 – Function Calls as Statements

    3.3.7 – Local Declarations

    Local variables can be declared anywhere inside a block. -The declaration can include an initial assignment: +The declaration can include an initialization:

    -	stat ::= local namelist [‘=’ explist]
    +	stat ::= local attnamelist [‘=’ explist]
    +	attnamelist ::=  Name attrib {‘,’ Name attrib}
     

    If present, an initial assignment has the same semantics of a multiple assignment (see §3.3.3). Otherwise, all variables are initialized with nil. +

    +Each variable name may be postfixed by an attribute +(a name between angle brackets): + +

    +	attrib ::= [‘<’ Name ‘>’]
    +

    +There are two possible attributes: +const, which declares a constant variable, +that is, a variable that cannot be assigned to +after its initialization; +and close, which declares a to-be-closed variable (see §3.3.8). +A list of variables can contain at most one to-be-closed variable. + +

    A chunk is also a block (see §3.3.2), and so local variables can be declared in a chunk outside any explicit block. @@ -1765,10 +1957,73 @@

    3.3.7 – Local Declarations

    +

    3.3.8 – To-be-closed Variables

    + +

    +A to-be-closed variable behaves like a constant local variable, +except that its value is closed whenever the variable +goes out of scope, including normal block termination, +exiting its block by break/goto/return, +or exiting by an error. + + +

    +Here, to close a value means +to call its __close metamethod. +When calling the metamethod, +the value itself is passed as the first argument +and the error object that caused the exit (if any) +is passed as a second argument; +if there was no error, the second argument is nil. + + +

    +The value assigned to a to-be-closed variable +must have a __close metamethod +or be a false value. +(nil and false are ignored as to-be-closed values.) + + +

    +If several to-be-closed variables go out of scope at the same event, +they are closed in the reverse order that they were declared. + + +

    +If there is any error while running a closing method, +that error is handled like an error in the regular code +where the variable was defined. +After an error, +the other pending closing methods will still be called. + + +

    +If a coroutine yields and is never resumed again, +some variables may never go out of scope, +and therefore they will never be closed. +(These variables are the ones created inside the coroutine +and in scope at the point where the coroutine yielded.) +Similarly, if a coroutine ends with an error, +it does not unwind its stack, +so it does not close any variable. +In both cases, +you can either use finalizers +or call coroutine.close to close the variables. +However, if the coroutine was created +through coroutine.wrap, +then its corresponding function will close the coroutine +in case of errors. + + + + +

    3.4 – Expressions

    + +

    The basic expressions in Lua are the following: @@ -1793,7 +2048,7 @@

    3.4 – Expressions

    table constructors are explained in §3.4.9. Vararg expressions, denoted by three dots ('...'), can only be used when -directly inside a vararg function; +directly inside a variadic function; they are explained in §3.4.11. @@ -1808,50 +2063,6 @@

    3.4 – Expressions

    and the unary length operator (see §3.4.7). -

    -Both function calls and vararg expressions can result in multiple values. -If a function call is used as a statement (see §3.3.6), -then its return list is adjusted to zero elements, -thus discarding all returned values. -If an expression is used as the last (or the only) element -of a list of expressions, -then no adjustment is made -(unless the expression is enclosed in parentheses). -In all other contexts, -Lua adjusts the result list to one element, -either discarding all values except the first one -or adding a single nil if there are no values. - - -

    -Here are some examples: - -

    -     f()                -- adjusted to 0 results
    -     g(f(), x)          -- f() is adjusted to 1 result
    -     g(x, f())          -- g gets x plus all results from f()
    -     a,b,c = f(), x     -- f() is adjusted to 1 result (c gets nil)
    -     a,b = ...          -- a gets the first vararg parameter, b gets
    -                        -- the second (both a and b can get nil if there
    -                        -- is no corresponding vararg parameter)
    -     
    -     a,b,c = x, f()     -- f() is adjusted to 2 results
    -     a,b,c = f()        -- f() is adjusted to 3 results
    -     return f()         -- returns all results from f()
    -     return ...         -- returns all received vararg parameters
    -     return x,y,f()     -- returns x, y, and all results from f()
    -     {f()}              -- creates a list with all results from f()
    -     {...}              -- creates a list with all vararg parameters
    -     {f(), nil}         -- f() is adjusted to 1 result
    -
    - -

    -Any expression enclosed in parentheses always results in only one value. -Thus, -(f(x,y,z)) is always a single value, -even if f returns several values. -(The value of (f(x,y,z)) is the first value returned by f -or nil if f does not return any values.) @@ -1874,14 +2085,14 @@

    3.4.1 – Arithmetic Operators

    the arithmetic operators work as follows: If both operands are integers, the operation is performed over integers and the result is an integer. -Otherwise, if both operands are numbers -or strings that can be converted to -numbers (see §3.4.3), +Otherwise, if both operands are numbers, then they are converted to floats, -the operation is performed following the usual rules +the operation is performed following the machine's rules for floating-point arithmetic (usually the IEEE 754 standard), and the result is a float. +(The string library coerces strings to numbers in +arithmetic operations; see §3.4.3 for details.)

    @@ -1895,7 +2106,7 @@

    3.4.1 – Arithmetic Operators

    Floor division (//) is a division that rounds the quotient towards minus infinity, -that is, the floor of the division of its operands. +resulting in the floor of the division of its operands.

    @@ -1905,11 +2116,7 @@

    3.4.1 – Arithmetic Operators

    In case of overflows in integer arithmetic, -all operations wrap around, -according to the usual rules of two-complement arithmetic. -(In other words, -they return the unique representable integer -that is equal modulo 264 to the mathematical result.) +all operations wrap around. @@ -1950,19 +2157,13 @@

    3.4.3 – Coercions and Conversions

    Exponentiation and float division always convert integer operands to floats. All other arithmetic operations applied to mixed numbers -(integers and floats) convert the integer operand to a float; -this is called the usual rule. +(integers and floats) convert the integer operand to a float. The C API also converts both integers to floats and floats to integers, as needed. Moreover, string concatenation accepts numbers as arguments, besides strings. -

    -Lua also converts strings to numbers, -whenever a number is expected. - -

    In a conversion from integer to float, if the integer value has an exact representation as a float, @@ -1983,28 +2184,46 @@

    3.4.3 – Coercions and Conversions

    -The conversion from strings to numbers goes as follows: -First, the string is converted to an integer or a float, -following its syntax and the rules of the Lua lexer. -(The string may have also leading and trailing spaces and a sign.) -Then, the resulting number (float or integer) -is converted to the type (float or integer) required by the context -(e.g., the operation that forced the conversion). +Several places in Lua coerce strings to numbers when necessary. +In particular, +the string library sets metamethods that try to coerce +strings to numbers in all arithmetic operations. +If the conversion fails, +the library calls the metamethod of the other operand +(if present) or it raises an error. +Note that bitwise operators do not do this coercion.

    +It is always a good practice not to rely on the +implicit coercions from strings to numbers, +as they are not always applied; +in particular, "1"==1 is false and "1"<1 raises an error +(see §3.4.4). +These coercions exist mainly for compatibility and may be removed +in future versions of the language. + + +

    +A string is converted to an integer or a float +following its syntax and the rules of the Lua lexer. +The string may have also leading and trailing whitespaces and a sign. All conversions from strings to numbers accept both a dot and the current locale mark as the radix character. (The Lua lexer, however, accepts only a dot.) +If the string is not a valid numeral, +the conversion fails. +If necessary, the result of this first step is then converted +to a specific number subtype following the previous rules +for conversions between floats and integers.

    The conversion from numbers to strings uses a non-specified human-readable format. -For complete control over how numbers are converted to strings, -use the format function from the string library -(see string.format). +To convert numbers to strings in any specific way, +use the function string.format. @@ -2028,7 +2247,7 @@

    3.4.4 – Relational Operators

    Equality (==) first compares the type of its operands. If the types are different, then the result is false. Otherwise, the values of the operands are compared. -Strings are compared in the obvious way. +Strings are equal if they have the same byte content. Numbers are equal if they denote the same mathematical value. @@ -2037,16 +2256,19 @@

    3.4.4 – Relational Operators

    are compared by reference: two objects are considered equal only if they are the same object. Every time you create a new object -(a table, userdata, or thread), +(a table, a userdata, or a thread), this new object is different from any previously existing object. -Closures with the same reference are always equal. -Closures with any detectable difference +A function is always equal to itself. +Functions with any detectable difference (different behavior, different definition) are always different. +Functions created at different times but with no detectable differences +may be classified as equal or not +(depending on internal caching details).

    You can change the way that Lua compares tables and userdata -by using the "eq" metamethod (see §2.4). +by using the __eq metamethod (see §2.4).

    @@ -2064,11 +2286,11 @@

    3.4.4 – Relational Operators

    The order operators work as follows. If both arguments are numbers, -then they are compared according to their mathematical values -(regardless of their subtypes). +then they are compared according to their mathematical values, +regardless of their subtypes. Otherwise, if both arguments are strings, then their values are compared according to the current locale. -Otherwise, Lua tries to call the "lt" or the "le" +Otherwise, Lua tries to call the __lt or the __le metamethod (see §2.4). A comparison a > b is translated to b < a and a >= b is translated to b <= a. @@ -2076,8 +2298,8 @@

    3.4.4 – Relational Operators

    Following the IEEE 754 standard, -NaN is considered neither smaller than, -nor equal to, nor greater than any value (including itself). +the special value NaN is considered neither less than, +nor equal to, nor greater than any value, including itself. @@ -2113,10 +2335,7 @@

    3.4.5 – Logical Operators

    false and nil --> false false or nil --> nil 10 and 20 --> 20 -

    -(In this manual, ---> indicates the result of the preceding expression.) - +

    @@ -2124,8 +2343,9 @@

    3.4.5 – Logical Operators

    3.4.6 – Concatenation

    The string concatenation operator in Lua is denoted by two dots ('..'). -If both operands are strings or numbers, then they are converted to -strings according to the rules described in §3.4.3. +If both operands are strings or numbers, +then the numbers are converted to strings +in a non-specified format (see §3.4.3). Otherwise, the __concat metamethod is called (see §2.4). @@ -2139,24 +2359,29 @@

    3.4.7 – The Length Operator

    -The length of a string is its number of bytes -(that is, the usual meaning of string length when each -character is one byte). +The length of a string is its number of bytes. +(That is the usual meaning of string length when each +character is one byte.)

    The length operator applied on a table returns a border in that table. -A border in a table t is any natural number +A border in a table t is any non-negative integer that satisfies the following condition:

    -     (border == 0 or t[border] ~= nil) and t[border + 1] == nil
    +     (border == 0 or t[border] ~= nil) and
    +     (t[border + 1] == nil or border == math.maxinteger)
     

    In words, -a border is any (natural) index in a table -where a non-nil value is followed by a nil value -(or zero, when index 1 is nil). +a border is any positive integer index present in the table +that is followed by an absent index, +plus two limit cases: +zero, when index 1 is absent; +and the maximum value for an integer, when that index is present. +Note that keys that are not positive integers +do not interfere with borders.

    @@ -2165,12 +2390,11 @@

    3.4.7 – The Length Operator

    as it has only one border (5). The table {10, 20, 30, nil, 50} has two borders (3 and 5), and therefore it is not a sequence. +(The nil at index 4 is called a hole.) The table {nil, 20, 30, nil, nil, 60, nil} has three borders (0, 3, and 6), so it is not a sequence, too. The table {} is a sequence with border 0. -Note that non-natural keys do not interfere -with whether a table is a sequence.

    @@ -2188,7 +2412,7 @@

    3.4.7 – The Length Operator

    The computation of the length of a table has a guaranteed worst time of O(log n), -where n is the largest natural key in the table. +where n is the largest integer key in the table.

    @@ -2246,10 +2470,10 @@

    3.4.9 – Table Constructors

    with key exp1 and value exp2. A field of the form name = exp is equivalent to ["name"] = exp. -Finally, fields of the form exp are equivalent to +Fields of the form exp are equivalent to [i] = exp, where i are consecutive integers -starting with 1. -Fields in the other formats do not affect this counting. +starting with 1; +fields in the other formats do not affect this counting. For example,

    @@ -2278,9 +2502,9 @@ 

    3.4.9 – Table Constructors

    If the last field in the list has the form exp -and the expression is a function call or a vararg expression, +and the expression is a multires expression, then all values returned by this expression enter the list consecutively -(see §3.4.10). +(see §3.4.12).

    @@ -2302,8 +2526,9 @@

    3.4.10 – Function Calls

    If the value of prefixexp has type function, then this function is called with the given arguments. -Otherwise, the prefixexp "call" metamethod is called, -having as first parameter the value of prefixexp, +Otherwise, if present, +the prefixexp __call metamethod is called: +its first argument is the value of prefixexp, followed by the original call arguments (see §2.4). @@ -2314,7 +2539,7 @@

    3.4.10 – Function Calls

     	functioncall ::= prefixexp ‘:’ Name args
     

    -can be used to call "methods". +can be used to emulate methods. A call v:name(args) is syntactic sugar for v.name(v,args), except that v is evaluated only once. @@ -2339,25 +2564,27 @@

    3.4.10 – Function Calls

    -A call of the form return functioncall is called -a tail call. +A call of the form return functioncall not in the +scope of a to-be-closed variable is called a tail call. Lua implements proper tail calls (or proper tail recursion): -in a tail call, +In a tail call, the called function reuses the stack entry of the calling function. Therefore, there is no limit on the number of nested tail calls that a program can execute. However, a tail call erases any debug information about the calling function. Note that a tail call only happens with a particular syntax, -where the return has one single function call as argument; -this syntax makes the calling function return exactly -the returns of the called function. +where the return has one single function call as argument, +and it is outside the scope of any to-be-closed variable. +This syntax makes the calling function return exactly +the returns of the called function, +without any intervening action. So, none of the following examples are tail calls:

          return (f(x))        -- results adjusted to 1
    -     return 2 * f(x)
    +     return 2 * f(x)      -- result multiplied by 2
          return x, f(x)       -- additional results
          f(x); return         -- results discarded
          return x or f(x)     -- results adjusted to 1
    @@ -2427,10 +2654,11 @@ 

    3.4.11 – Function Definitions

    A function definition is an executable expression, whose value has type function. When Lua precompiles a chunk, -all its function bodies are precompiled too. +all its function bodies are precompiled too, +but they are not created yet. Then, whenever Lua executes the function definition, the function is instantiated (or closed). -This function instance (or closure) +This function instance, or closure, is the final value of the expression. @@ -2441,24 +2669,18 @@

    3.4.11 – Function Definitions

     	parlist ::= namelist [‘,’ ‘...’] | ‘...

    -When a function is called, -the list of arguments is adjusted to -the length of the list of parameters, -unless the function is a vararg function, +When a Lua function is called, +it adjusts its list of arguments to +the length of its list of parameters (see §3.4.12), +unless the function is a variadic function, which is indicated by three dots ('...') at the end of its parameter list. -A vararg function does not adjust its argument list; +A variadic function does not adjust its argument list; instead, it collects all extra arguments and supplies them to the function through a vararg expression, which is also written as three dots. The value of this expression is a list of all actual extra arguments, -similar to a function with multiple results. -If a vararg expression is used inside another expression -or in the middle of a list of expressions, -then its return list is adjusted to one element. -If the expression is used as the last element of a list of expressions, -then no adjustment is made -(unless that last expression is enclosed in parentheses). +similar to a function with multiple results (see §3.4.12).

    @@ -2473,7 +2695,7 @@

    3.4.11 – Function Definitions

    to the vararg expression:
    -     CALL            PARAMETERS
    +     CALL             PARAMETERS
          
          f(3)             a=3, b=nil
          f(3, 4)          a=3, b=4
    @@ -2498,13 +2720,13 @@ 

    3.4.11 – Function Definitions

    There is a system-dependent limit on the number of values that a function may return. -This limit is guaranteed to be larger than 1000. +This limit is guaranteed to be greater than 1000.

    The colon syntax -is used for defining methods, -that is, functions that have an implicit extra parameter self. +is used to emulate methods, +adding an implicit extra parameter self to the function. Thus, the statement

    @@ -2519,6 +2741,122 @@ 

    3.4.11 – Function Definitions

    +

    3.4.12 – Lists of expressions, multiple results, +and adjustment

    + +

    +Both function calls and vararg expressions can result in multiple values. +These expressions are called multires expressions. + + +

    +When a multires expression is used as the last element +of a list of expressions, +all results from the expression are added to the +list of values produced by the list of expressions. +Note that a single expression +in a place that expects a list of expressions +is the last expression in that (singleton) list. + + +

    +These are the places where Lua expects a list of expressions: + +

      + +
    • A return statement, +for instance return e1, e2, e3 (see §3.3.4).
    • + +
    • A table constructor, +for instance {e1, e2, e3} (see §3.4.9).
    • + +
    • The arguments of a function call, +for instance foo(e1, e2, e3) (see §3.4.10).
    • + +
    • A multiple assignment, +for instance a , b, c = e1, e2, e3 (see §3.3.3).
    • + +
    • A local declaration, +for instance local a , b, c = e1, e2, e3 (see §3.3.7).
    • + +
    • The initial values in a generic for loop, +for instance for k in e1, e2, e3 do ... end (see §3.3.5).
    • + +

    +In the last four cases, +the list of values from the list of expressions +must be adjusted to a specific length: +the number of parameters in a call to a non-variadic function +(see §3.4.11), +the number of variables in a multiple assignment or +a local declaration, +and exactly four values for a generic for loop. +The adjustment follows these rules: +If there are more values than needed, +the extra values are thrown away; +if there are fewer values than needed, +the list is extended with nil's. +When the list of expressions ends with a multires expression, +all results from that expression enter the list of values +before the adjustment. + + +

    +When a multires expression is used +in a list of expressions without being the last element, +or in a place where the syntax expects a single expression, +Lua adjusts the result list of that expression to one element. +As a particular case, +the syntax expects a single expression inside a parenthesized expression; +therefore, adding parentheses around a multires expression +forces it to produce exactly one result. + + +

    +We seldom need to use a vararg expression in a place +where the syntax expects a single expression. +(Usually it is simpler to add a regular parameter before +the variadic part and use that parameter.) +When there is such a need, +we recommend assigning the vararg expression +to a single variable and using that variable +in its place. + + +

    +Here are some examples of uses of mutlres expressions. +In all cases, when the construction needs +"the n-th result" and there is no such result, +it uses a nil. + +

    +     print(x, f())      -- prints x and all results from f().
    +     print(x, (f()))    -- prints x and the first result from f().
    +     print(f(), x)      -- prints the first result from f() and x.
    +     print(1 + f())     -- prints 1 added to the first result from f().
    +     local x = ...      -- x gets the first vararg argument.
    +     x,y = ...          -- x gets the first vararg argument,
    +                        -- y gets the second vararg argument.
    +     x,y,z = w, f()     -- x gets w, y gets the first result from f(),
    +                        -- z gets the second result from f().
    +     x,y,z = f()        -- x gets the first result from f(),
    +                        -- y gets the second result from f(),
    +                        -- z gets the third result from f().
    +     x,y,z = f(), g()   -- x gets the first result from f(),
    +                        -- y gets the first result from g(),
    +                        -- z gets the second result from g().
    +     x,y,z = (f())      -- x gets the first result from f(), y and z get nil.
    +     return f()         -- returns all results from f().
    +     return x, ...      -- returns x and all received vararg arguments.
    +     return x,y,f()     -- returns x, y, and all results from f().
    +     {f()}              -- creates a list with all results from f().
    +     {...}              -- creates a list with all vararg arguments.
    +     {f(), 5}           -- creates a list with the first result from f() and 5.
    +
    + + + +

    3.5 – Visibility Rules

    @@ -2529,6 +2867,7 @@

    3.5 – Visibility Rules

    The scope of a local variable begins at the first statement after its declaration and lasts until the last non-void statement of the innermost block that includes the declaration. +(Void statements are labels and empty statements.) Consider the following example:
    @@ -2556,8 +2895,8 @@ 

    3.5 – Visibility Rules

    Because of the lexical scoping rules, local variables can be freely accessed by functions defined inside their scope. -A local variable used by an inner function is called -an upvalue, or external local variable, +A local variable used by an inner function is called an upvalue +(or external local variable, or simply external variable) inside the inner function. @@ -2569,9 +2908,9 @@

    3.5 – Visibility Rules

          a = {}
          local x = 20
    -     for i=1,10 do
    +     for i = 1, 10 do
            local y = 0
    -       a[i] = function () y=y+1; return x+y end
    +       a[i] = function () y = y + 1; return x + y end
          end
     

    The loop creates ten closures @@ -2585,6 +2924,8 @@

    3.5 – Visibility Rules

    4 – The Application Program Interface

    + +

    This section describes the C API for Lua, that is, @@ -2605,7 +2946,8 @@

    4 – The Application Program Interface

    As in most C libraries, -the Lua API functions do not check their arguments for validity or consistency. +the Lua API functions do not check their arguments +for validity or consistency. However, you can change this behavior by compiling Lua with the macro LUA_USE_APICHECK defined. @@ -2633,8 +2975,12 @@

    4 – The Application Program Interface

    + +

    4.1 – The Stack

    + +

    Lua uses a virtual stack to pass values to and from C. Each element in this stack represents a Lua value @@ -2658,8 +3004,8 @@

    4.1 – The Stack

    most query operations in the API do not follow a strict stack discipline. Instead, they can refer to any element in the stack by using an index: -A positive index represents an absolute stack position -(starting at 1); +A positive index represents an absolute stack position, +starting at 1 as the bottom of the stack; a negative index represents an offset relative to the top of the stack. More specifically, if the stack has n elements, then index 1 represents the first element @@ -2674,39 +3020,44 @@

    4.1 – The Stack

    -

    4.2 – Stack Size

    +

    4.1.1 – Stack Size

    When you interact with the Lua API, you are responsible for ensuring consistency. In particular, you are responsible for controlling stack overflow. -You can use the function lua_checkstack -to ensure that the stack has enough space for pushing new elements. +When you call any API function, +you must ensure the stack has enough room to accommodate the results. + + +

    +There is one exception to the above rule: +When you call a Lua function +without a fixed number of results (see lua_call), +Lua ensures that the stack has enough space for all results. +However, it does not ensure any extra space. +So, before pushing anything on the stack after such a call +you should use lua_checkstack.

    Whenever Lua calls C, it ensures that the stack has space for -at least LUA_MINSTACK extra slots. +at least LUA_MINSTACK extra elements; +that is, you can safely push up to LUA_MINSTACK values into it. LUA_MINSTACK is defined as 20, so that usually you do not have to worry about stack space unless your code has loops pushing elements onto the stack. - - -

    -When you call a Lua function -without a fixed number of results (see lua_call), -Lua ensures that the stack has enough space for all results, -but it does not ensure any extra space. -So, before pushing anything in the stack after such a call -you should use lua_checkstack. +Whenever necessary, +you can use the function lua_checkstack +to ensure that the stack has enough space for pushing new elements. -

    4.3 – Valid and Acceptable Indices

    +

    4.1.2 – Valid and Acceptable Indices

    Any function in the API that receives stack indices @@ -2722,8 +3073,8 @@

    4.3 – Valid and Acceptable Indices

    plus pseudo-indices, which represent some positions that are accessible to C code but that are not in the stack. -Pseudo-indices are used to access the registry (see §4.5) -and the upvalues of a C function (see §4.4). +Pseudo-indices are used to access the registry (see §4.3) +and the upvalues of a C function (see §4.2).

    @@ -2735,6 +3086,8 @@

    4.3 – Valid and Acceptable Indices

    within the space allocated for the stack, that is, indices up to the stack size. (Note that 0 is never an acceptable index.) +Indices to upvalues (see §4.2) greater than the real number +of upvalues in the current C function are also acceptable (but invalid). Except when noted otherwise, functions in the API work with acceptable indices. @@ -2743,7 +3096,7 @@

    4.3 – Valid and Acceptable Indices

    Acceptable indices serve to avoid extra tests against the stack top when querying the stack. For instance, a C function can query its third argument -without the need to first check whether there is a third argument, +without the need to check whether there is a third argument, that is, without the need to check whether 3 is a valid index. @@ -2757,7 +3110,52 @@

    4.3 – Valid and Acceptable Indices

    -

    4.4 – C Closures

    +

    4.1.3 – Pointers to strings

    + +

    +Several functions in the API return pointers (const char*) +to Lua strings in the stack. +(See lua_pushfstring, lua_pushlstring, +lua_pushstring, and lua_tolstring. +See also luaL_checklstring, luaL_checkstring, +and luaL_tolstring in the auxiliary library.) + + +

    +In general, +Lua's garbage collection can free or move internal memory +and then invalidate pointers to internal strings. +To allow a safe use of these pointers, +the API guarantees that any pointer to a string in a stack index +is valid while the string value at that index is not removed from the stack. +(It can be moved to another index, though.) +When the index is a pseudo-index (referring to an upvalue), +the pointer is valid while the corresponding call is active and +the corresponding upvalue is not modified. + + +

    +Some functions in the debug interface +also return pointers to strings, +namely lua_getlocal, lua_getupvalue, +lua_setlocal, and lua_setupvalue. +For these functions, the pointer is guaranteed to +be valid while the caller function is active and +the given closure (if one was given) is in the stack. + + +

    +Except for these guarantees, +the garbage collector is free to invalidate +any pointer to internal strings. + + + + + + + +

    4.2 – C Closures

    When a C function is created, @@ -2783,16 +3181,21 @@

    4.4 – C Closures

    produces an acceptable but invalid index. +

    +A C closure can also change the values +of its corresponding upvalues. + + -

    4.5 – Registry

    +

    4.3 – Registry

    Lua provides a registry, a predefined table that can be used by any C code to store whatever Lua values it needs to store. -The registry table is always located at pseudo-index +The registry table is always accessible at pseudo-index LUA_REGISTRYINDEX. Any C library can store data into this table, but it must take care to choose keys @@ -2810,7 +3213,8 @@

    4.5 – Registry

    The integer keys in the registry are used by the reference mechanism (see luaL_ref) and by some predefined values. -Therefore, integer keys must not be used for other purposes. +Therefore, integer keys in the registry +must not be used for other purposes.

    @@ -2834,14 +3238,16 @@

    4.5 – Registry

    -

    4.6 – Error Handling in C

    +

    4.4 – Error Handling in C

    + +

    Internally, Lua uses the C longjmp facility to handle errors. (Lua will use exceptions if you compile it as C++; search for LUAI_THROW in the source code for details.) -When Lua faces any error -(such as a memory allocation error or a type error) +When Lua faces any error, +such as a memory allocation error or a type error, it raises an error; that is, it does a long jump. A protected environment uses setjmp @@ -2850,7 +3256,8 @@

    4.6 – Error Handling in C

    -Inside a C function you can raise an error by calling lua_error. +Inside a C function you can raise an error explicitly +by calling lua_error.

    @@ -2881,7 +3288,7 @@

    4.6 – Error Handling in C

    as it should be already protected. However, when C code operates on other Lua states -(e.g., a Lua parameter to the function, +(e.g., a Lua-state argument to the function, a Lua state stored in the registry, or the result of lua_newthread), it should use them only in API calls that cannot raise errors. @@ -2889,16 +3296,51 @@

    4.6 – Error Handling in C

    The panic function runs as if it were a message handler (see §2.3); -in particular, the error object is at the top of the stack. +in particular, the error object is on the top of the stack. However, there is no guarantee about stack space. To push anything on the stack, -the panic function must first check the available space (see §4.2). +the panic function must first check the available space (see §4.1.1). -

    4.7 – Handling Yields in C

    +

    4.4.1 – Status Codes

    + +

    +Several functions that report errors in the API use the following +status codes to indicate different kinds of errors or other conditions: + +

      + +
    • LUA_OK (0): no errors.
    • + +
    • LUA_ERRRUN: a runtime error.
    • + +
    • LUA_ERRMEM: +memory allocation error. +For such errors, Lua does not call the message handler. +
    • + +
    • LUA_ERRERR: error while running the message handler.
    • + +
    • LUA_ERRSYNTAX: syntax error during precompilation.
    • + +
    • LUA_YIELD: the thread (coroutine) yields.
    • + +
    • LUA_ERRFILE: a file-related error; +e.g., it cannot open or read the file.
    • + +

    +These constants are defined in the header file lua.h. + + + + + + + +

    4.5 – Handling Yields in C

    Internally, Lua uses the C longjmp facility to yield a coroutine. @@ -2906,7 +3348,7 @@

    4.7 – Handling Yields in C

    and this API function yields (directly or indirectly by calling another function that yields), Lua cannot return to foo any more, -because the longjmp removes its frame from the C stack. +because the longjmp removes its frame from the C stack.

    @@ -2925,9 +3367,9 @@

    4.7 – Handling Yields in C

    This original function then calls one of those three functions in the C API, which we will call the callee function, that then yields the current thread. -(This can happen when the callee function is lua_yieldk, +This can happen when the callee function is lua_yieldk, or when the callee function is either lua_callk or lua_pcallk -and the function called by them yields.) +and the function called by them yields.

    @@ -2936,7 +3378,7 @@

    4.7 – Handling Yields in C

    it eventually will finish running the callee function. However, the callee function cannot return to the original function, -because its frame in the C stack was destroyed by the yield. +because its frame in the C stack was destroyed by the yield. Instead, Lua calls a continuation function, which was given as an argument to the callee function. As the name implies, @@ -2997,11 +3439,11 @@

    4.7 – Handling Yields in C

    Besides the Lua state, the continuation function has two other parameters: -the final status of the call plus the context value (ctx) that +the final status of the call and the context value (ctx) that was passed originally to lua_pcallk. -(Lua does not use this context value; +Lua does not use this context value; it only passes this value from the original function to the -continuation function.) +continuation function. For lua_pcallk, the status is the same value that would be returned by lua_pcallk, except that it is LUA_YIELD when being executed after a yield @@ -3035,7 +3477,7 @@

    4.7 – Handling Yields in C

    -

    4.8 – Functions and Types

    +

    4.6 – Functions and Types

    Here we list all functions and types from the C API in @@ -3055,17 +3497,16 @@

    4.8 – Functions and Types

    depending on the situation; an interrogation mark '?' means that we cannot know how many elements the function pops/pushes -by looking only at its arguments -(e.g., they may depend on what is on the stack). +by looking only at its arguments. +(For instance, they may depend on what is in the stack.) The third field, x, tells whether the function may raise errors: '-' means the function never raises any error; -'m' means the function may raise out-of-memory errors -and errors running a __gc metamethod; -'e' means the function may raise any errors -(it can run arbitrary Lua code, -either directly or through metamethods); -'v' means the function may raise an error on purpose. +'m' means the function may raise only out-of-memory errors; +'v' means the function may raise the errors explained in the text; +'e' means the function can run arbitrary Lua code, +either directly or through metamethods, +and therefore may raise any errors. @@ -3076,7 +3517,7 @@

    4.8 – Functions and Types

    Converts the acceptable index idx into an equivalent absolute index -(that is, one that does not depend on the stack top). +(that is, one that does not depend on the stack size). @@ -3125,16 +3566,14 @@

    4.8 – Functions and Types

    When nsize is zero, the allocator must behave like free -and return NULL. +and then return NULL.

    When nsize is not zero, the allocator must behave like realloc. -The allocator returns NULL +In particular, the allocator returns NULL if and only if it cannot fulfill the request. -Lua assumes that the allocator never fails when -osize >= nsize.

    @@ -3153,12 +3592,9 @@

    4.8 – Functions and Types

    return realloc(ptr, nsize); }

    -Note that Standard C ensures +Note that ISO C ensures that free(NULL) has no effect and that realloc(NULL,size) is equivalent to malloc(size). -This code assumes that realloc does not fail when shrinking a block. -(Although Standard C does not ensure this behavior, -it seems to be a safe assumption.) @@ -3172,7 +3608,7 @@

    4.8 – Functions and Types

    Performs an arithmetic or bitwise operation over the two values (or one, in the case of negations) at the top of the stack, -with the value at the top being the second operand, +with the value on the top being the second operand, pops these values, and pushes the result of the operation. The function follows the semantics of the corresponding Lua operator (that is, it may call metamethods). @@ -3208,7 +3644,7 @@

    4.8 – Functions and Types

    lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);

    -Sets a new panic function and returns the old one (see §4.6). +Sets a new panic function and returns the old one (see §4.4). @@ -3220,19 +3656,23 @@

    4.8 – Functions and Types

    Calls a function. +Like regular Lua calls, +lua_call respects the __call metamethod. +So, here the word "function" +means any callable value.

    -To call a function you must use the following protocol: +To do a call you must use the following protocol: first, the function to be called is pushed onto the stack; -then, the arguments to the function are pushed +then, the arguments to the call are pushed in direct order; that is, the first argument is pushed first. Finally you call lua_call; nargs is the number of arguments that you pushed onto the stack. -All arguments and the function value are popped from the stack -when the function is called. -The function results are pushed onto the stack when the function returns. +When the function returns, +all arguments and the function value are popped +and the call results are pushed onto the stack. The number of results is adjusted to nresults, unless nresults is LUA_MULTRET. In this case, all results from the function are pushed; @@ -3244,7 +3684,7 @@

    4.8 – Functions and Types

    -Any error inside the called function is propagated upwards +Any error while calling and running the function is propagated upwards (with a longjmp). @@ -3285,7 +3725,7 @@

    4.8 – Functions and Types

    This function behaves exactly like lua_call, -but allows the called function to yield (see §4.7). +but allows the called function to yield (see §4.5). @@ -3310,7 +3750,7 @@

    4.8 – Functions and Types

    and its last argument is at index lua_gettop(L). To return values to Lua, a C function just pushes them onto the stack, in direct order (the first result is pushed first), -and returns the number of results. +and returns in C the number of results. Any other value in the stack below the results will be properly discarded by Lua. Like a Lua function, a C function called by Lua can also return @@ -3347,15 +3787,15 @@

    4.8 – Functions and Types

    int lua_checkstack (lua_State *L, int n);

    -Ensures that the stack has space for at least n extra slots -(that is, that you can safely push up to n values into it). +Ensures that the stack has space for at least n extra elements, +that is, that you can safely push up to n values into it. It returns false if it cannot fulfill the request, either because it would cause the stack -to be larger than a fixed maximum size +to be greater than a fixed maximum size (typically at least several thousand elements) or because it cannot allocate memory for the extra space. This function never shrinks the stack; -if the stack already has space for the extra slots, +if the stack already has space for the extra elements, it is left unchanged. @@ -3367,14 +3807,69 @@

    4.8 – Functions and Types

    void lua_close (lua_State *L);

    -Destroys all objects in the given Lua state -(calling the corresponding garbage-collection metamethods, if any) -and frees all dynamic memory used by this state. -On several platforms, you may not need to call this function, -because all resources are naturally released when the host program ends. -On the other hand, long-running programs that create multiple states, -such as daemons or web servers, -will probably need to close states as soon as they are not needed. +Close all active to-be-closed variables in the main thread, +release all objects in the given Lua state +(calling the corresponding garbage-collection metamethods, if any), +and frees all dynamic memory used by this state. + + +

    +On several platforms, you may not need to call this function, +because all resources are naturally released when the host program ends. +On the other hand, long-running programs that create multiple states, +such as daemons or web servers, +will probably need to close states as soon as they are not needed. + + + + + +


    lua_closeslot

    +[-0, +0, e] +

    void lua_closeslot (lua_State *L, int index);
    + +

    +Close the to-be-closed slot at the given index and set its value to nil. +The index must be the last index previously marked to be closed +(see lua_toclose) that is still active (that is, not closed yet). + + +

    +A __close metamethod cannot yield +when called through this function. + + +

    +(This function was introduced in release 5.4.3.) + + + + + +


    lua_closethread

    +[-0, +?, –] +

    int lua_closethread (lua_State *L, lua_State *from);
    + +

    +Resets a thread, cleaning its call stack and closing all pending +to-be-closed variables. +Returns a status code: +LUA_OK for no errors in the thread +(either the original error that stopped the thread or +errors in closing methods), +or an error status otherwise. +In case of error, +leaves the error object on the top of the stack. + + +

    +The parameter from represents the coroutine that is resetting L. +If there is no such coroutine, +this parameter can be NULL. + + +

    +(This function was introduced in release 5.4.6.) @@ -3414,7 +3909,7 @@

    4.8 – Functions and Types

    Concatenates the n values at the top of the stack, -pops them, and leaves the result at the top. +pops them, and leaves the result on the top. If n is 1, the result is the single value on the stack (that is, the function does nothing); if n is 0, the result is the empty string. @@ -3450,7 +3945,7 @@

    4.8 – Functions and Types

    parameter nrec is a hint for how many other elements the table will have. Lua may use these hints to preallocate memory for the new table. -This preallocation is useful for performance when you know in advance +This preallocation may help performance when you know in advance how many elements the table will have. Otherwise you can use the function lua_newtable. @@ -3502,8 +3997,8 @@

    4.8 – Functions and Types

    int lua_error (lua_State *L);

    -Generates a Lua error, -using the value at the top of the stack as the error object. +Raises a Lua error, +using the value on the top of the stack as the error object. This function does a long jump, and therefore never returns (see luaL_error). @@ -3513,8 +4008,8 @@

    4.8 – Functions and Types


    lua_gc

    -[-0, +0, m] -

    int lua_gc (lua_State *L, int what, int data);
    +[-0, +0, –] +
    int lua_gc (lua_State *L, int what, ...);

    Controls the garbage collector. @@ -3522,59 +4017,64 @@

    4.8 – Functions and Types

    This function performs several tasks, -according to the value of the parameter what: +according to the value of the parameter what. +For options that need extra arguments, +they are listed after the option.

      -
    • LUA_GCSTOP: -stops the garbage collector. +
    • LUA_GCCOLLECT: +Performs a full garbage-collection cycle.
    • -
    • LUA_GCRESTART: -restarts the garbage collector. +
    • LUA_GCSTOP: +Stops the garbage collector.
    • -
    • LUA_GCCOLLECT: -performs a full garbage-collection cycle. +
    • LUA_GCRESTART: +Restarts the garbage collector.
    • LUA_GCCOUNT: -returns the current amount of memory (in Kbytes) in use by Lua. +Returns the current amount of memory (in Kbytes) in use by Lua.
    • LUA_GCCOUNTB: -returns the remainder of dividing the current amount of bytes of +Returns the remainder of dividing the current amount of bytes of memory in use by Lua by 1024.
    • -
    • LUA_GCSTEP: -performs an incremental step of garbage collection. +
    • LUA_GCSTEP (int stepsize): +Performs an incremental step of garbage collection, +corresponding to the allocation of stepsize Kbytes.
    • -
    • LUA_GCSETPAUSE: -sets data as the new value -for the pause of the collector (see §2.5) -and returns the previous value of the pause. +
    • LUA_GCISRUNNING: +Returns a boolean that tells whether the collector is running +(i.e., not stopped).
    • -
    • LUA_GCSETSTEPMUL: -sets data as the new value for the step multiplier of -the collector (see §2.5) -and returns the previous value of the step multiplier. +
    • LUA_GCINC (int pause, int stepmul, stepsize): +Changes the collector to incremental mode +with the given parameters (see §2.5.1). +Returns the previous mode (LUA_GCGEN or LUA_GCINC).
    • -
    • LUA_GCISRUNNING: -returns a boolean that tells whether the collector is running -(i.e., not stopped). +
    • LUA_GCGEN (int minormul, int majormul): +Changes the collector to generational mode +with the given parameters (see §2.5.2). +Returns the previous mode (LUA_GCGEN or LUA_GCINC).
    • -
    - -

    +

    For more details about these options, see collectgarbage. +

    +This function should not be called by a finalizer. + + @@ -3685,7 +4185,7 @@

    4.8 – Functions and Types

    Pushes onto the stack the value t[k], where t is the value at the given index -and k is the value at the top of the stack. +and k is the value on the top of the stack.

    @@ -3716,17 +4216,19 @@

    4.8 – Functions and Types

    -

    lua_getuservalue

    +


    lua_getiuservalue

    [-0, +1, –] -

    int lua_getuservalue (lua_State *L, int index);
    +
    int lua_getiuservalue (lua_State *L, int index, int n);

    -Pushes onto the stack the Lua value associated with the full userdata -at the given index. +Pushes onto the stack the n-th user value associated with the +full userdata at the given index and +returns the type of the pushed value.

    -Returns the type of the pushed value. +If the userdata does not have that value, +pushes nil and returns LUA_TNONE. @@ -3961,7 +4463,7 @@

    4.8 – Functions and Types

    typedef int (*lua_KFunction) (lua_State *L, int status, lua_KContext ctx);

    -Type for continuation functions (see §4.7). +Type for continuation functions (see §4.5). @@ -3997,27 +4499,6 @@

    4.8 – Functions and Types

    Otherwise, it pushes an error message. -

    -The return values of lua_load are: - -

      - -
    • LUA_OK: no errors;
    • - -
    • LUA_ERRSYNTAX: -syntax error during precompilation;
    • - -
    • LUA_ERRMEM: -memory allocation (out-of-memory) error;
    • - -
    • LUA_ERRGCMM: -error while running a __gc metamethod. -(This error has no relation with the chunk being loaded. -It is generated by the garbage collector.) -
    • - -
    -

    The lua_load function uses a user-supplied reader function to read the chunk (see lua_Reader). @@ -4026,7 +4507,7 @@

    4.8 – Functions and Types

    The chunkname argument gives a name to the chunk, -which is used for error messages and in debug information (see §4.9). +which is used for error messages and in debug information (see §4.7).

    @@ -4043,10 +4524,17 @@

    4.8 – Functions and Types

    unmodified when returning. +

    +lua_load can return +LUA_OK, LUA_ERRSYNTAX, or LUA_ERRMEM. +The function may also return other values corresponding to +errors raised by the read function (see §4.4.1). + +

    If the resulting function has upvalues, its first upvalue is set to the value of the global environment -stored at index LUA_RIDX_GLOBALS in the registry (see §4.5). +stored at index LUA_RIDX_GLOBALS in the registry (see §4.3). When loading main chunks, this upvalue will be the _ENV variable (see §2.2). Other upvalues are initialized with nil. @@ -4060,11 +4548,11 @@

    4.8 – Functions and Types

    lua_State *lua_newstate (lua_Alloc f, void *ud);

    -Creates a new thread running in a new, independent state. -Returns NULL if it cannot create the thread or the state +Creates a new independent state and returns its main thread. +Returns NULL if it cannot create the state (due to lack of memory). The argument f is the allocator function; -Lua does all memory allocation for this state +Lua will do all memory allocation for this state through this function (see lua_Alloc). The second argument, ud, is an opaque pointer that Lua passes to the allocator in every call. @@ -4098,7 +4586,6 @@

    4.8 – Functions and Types

    -There is no explicit function to close or to destroy a thread. Threads are subject to garbage collection, like any Lua object. @@ -4106,34 +4593,43 @@

    4.8 – Functions and Types

    -

    lua_newuserdata

    +


    lua_newuserdatauv

    [-0, +1, m] -

    void *lua_newuserdata (lua_State *L, size_t size);
    +
    void *lua_newuserdatauv (lua_State *L, size_t size, int nuvalue);
    + +

    +This function creates and pushes on the stack a new full userdata, +with nuvalue associated Lua values, called user values, +plus an associated block of raw memory with size bytes. +(The user values can be set and read with the functions +lua_setiuservalue and lua_getiuservalue.) +

    -This function allocates a new block of memory with the given size, -pushes onto the stack a new full userdata with the block address, -and returns this address. -The host program can freely use this memory. +The function returns the address of the block of memory. +Lua ensures that this address is valid as long as +the corresponding userdata is alive (see §2.5). +Moreover, if the userdata is marked for finalization (see §2.5.3), +its address is valid at least until the call to its finalizer.


    lua_next

    -[-1, +(2|0), e] +[-1, +(2|0), v]

    int lua_next (lua_State *L, int index);

    Pops a key from the stack, -and pushes a key–value pair from the table at the given index -(the "next" pair after the given key). +and pushes a key–value pair from the table at the given index, +the "next" pair after the given key. If there are no more elements in the table, -then lua_next returns 0 (and pushes nothing). +then lua_next returns 0 and pushes nothing.

    -A typical traversal looks like this: +A typical table traversal looks like this:

          /* table is in the stack at index 't' */
    @@ -4150,7 +4646,7 @@ 

    4.8 – Functions and Types

    While traversing a table, -do not call lua_tolstring directly on a key, +avoid calling lua_tolstring directly on a key, unless you know that the key is actually a string. Recall that lua_tolstring may change the value at the given index; @@ -4158,6 +4654,8 @@

    4.8 – Functions and Types

    +This function may raise an error if the given key +is neither nil nor present in the table. See function next for the caveats of modifying the table during its traversal. @@ -4185,15 +4683,14 @@

    4.8 – Functions and Types

    int lua_numbertointeger (lua_Number n, lua_Integer *p);

    -Converts a Lua float to a Lua integer. -This macro assumes that n has an integral value. +Tries to convert a Lua float to a Lua integer; +the float n must have an integral value. If that value is within the range of Lua integers, it is converted to an integer and assigned to *p. The macro results in a boolean indicating whether the conversion was successful. (Note that this range test can be tricky to do -correctly without this macro, -due to roundings.) +correctly without this macro, due to rounding.)

    @@ -4208,7 +4705,7 @@

    4.8 – Functions and Types

    int lua_pcall (lua_State *L, int nargs, int nresults, int msgh);

    -Calls a function in protected mode. +Calls a function (or a callable object) in protected mode.

    @@ -4233,7 +4730,7 @@

    4.8 – Functions and Types

    message handler. (This index cannot be a pseudo-index.) In case of runtime errors, -this function will be called with the error object +this handler will be called with the error object and its return value will be the object returned on the stack by lua_pcall. @@ -4246,35 +4743,9 @@

    4.8 – Functions and Types

    -The lua_pcall function returns one of the following constants -(defined in lua.h): - -

      - -
    • LUA_OK (0): -success.
    • - -
    • LUA_ERRRUN: -a runtime error. -
    • - -
    • LUA_ERRMEM: -memory allocation error. -For such errors, Lua does not call the message handler. -
    • - -
    • LUA_ERRERR: -error while running the message handler. -
    • +The lua_pcall function returns one of the following status codes: +LUA_OK, LUA_ERRRUN, LUA_ERRMEM, or LUA_ERRERR. -
    • LUA_ERRGCMM: -error while running a __gc metamethod. -For such errors, Lua does not call the message handler -(as this kind of error typically has no relation -with the function being called). -
    • - -
    @@ -4290,18 +4761,19 @@

    4.8 – Functions and Types

    This function behaves exactly like lua_pcall, -but allows the called function to yield (see §4.7). +except that it allows the called function to yield (see §4.5).


    lua_pop

    -[-n, +0, –] +[-n, +0, e]

    void lua_pop (lua_State *L, int n);

    Pops n elements from the stack. +It is implemented as a macro over lua_settop. @@ -4324,16 +4796,28 @@

    4.8 – Functions and Types

    Pushes a new C closure onto the stack. +This function receives a pointer to a C function +and pushes onto the stack a Lua value of type function that, +when called, invokes the corresponding C function. +The parameter n tells how many upvalues this function will have +(see §4.2). + + +

    +Any function to be callable by Lua must +follow the correct protocol to receive its parameters +and return its results (see lua_CFunction).

    When a C function is created, it is possible to associate some values with it, -thus creating a C closure (see §4.4); -these values are then accessible to the function whenever it is called. -To associate values with a C function, -first these values must be pushed onto the stack -(when there are multiple values, the first value is pushed first). +the so called upvalues; +these upvalues are then accessible to the function whenever it is called. +This association is called a C closure (see §4.2). +To create a C closure, +first the initial values for its upvalues must be pushed onto the stack. +(When there are multiple upvalues, the first value is pushed first.) Then lua_pushcclosure is called to create and push the C function onto the stack, with the argument n telling how many values will be @@ -4361,58 +4845,42 @@

    4.8 – Functions and Types

    Pushes a C function onto the stack. -This function receives a pointer to a C function -and pushes onto the stack a Lua value of type function that, -when called, invokes the corresponding C function. - - -

    -Any function to be callable by Lua must -follow the correct protocol to receive its parameters -and return its results (see lua_CFunction). +This function is equivalent to lua_pushcclosure with no upvalues.


    lua_pushfstring

    -[-0, +1, e] +[-0, +1, v]

    const char *lua_pushfstring (lua_State *L, const char *fmt, ...);

    Pushes onto the stack a formatted string -and returns a pointer to this string. +and returns a pointer to this string (see §4.1.3). It is similar to the ISO C function sprintf, -but has some important differences: - -

      - -
    • -You do not have to allocate space for the result: +but has two important differences. +First, +you do not have to allocate space for the result; the result is a Lua string and Lua takes care of memory allocation (and deallocation, through garbage collection). -
    • - -
    • -The conversion specifiers are quite restricted. +Second, +the conversion specifiers are quite restricted. There are no flags, widths, or precisions. The conversion specifiers can only be '%%' (inserts the character '%'), '%s' (inserts a zero-terminated string, with no size restrictions), '%f' (inserts a lua_Number), '%I' (inserts a lua_Integer), -'%p' (inserts a pointer as a hexadecimal numeral), +'%p' (inserts a pointer), '%d' (inserts an int), '%c' (inserts an int as a one-byte character), and '%U' (inserts a long int as a UTF-8 byte sequence). -
    • -

    -Unlike other push functions, -this function checks for the stack space it needs, -including the slot for its result. +This function may raise errors due to memory overflow +or an invalid conversion specifier. @@ -4468,6 +4936,7 @@

    4.8 – Functions and Types

    This macro is equivalent to lua_pushstring, but should be used only when s is a literal string. +(Lua may optimize this case.) @@ -4480,7 +4949,7 @@

    4.8 – Functions and Types

    Pushes the string pointed to by s with size len onto the stack. -Lua makes (or reuses) an internal copy of the given string, +Lua will make or reuse an internal copy of the given string, so the memory at s can be freed or reused immediately after the function returns. The string can contain any binary data, @@ -4488,7 +4957,7 @@

    4.8 – Functions and Types

    -Returns a pointer to the internal copy of the string. +Returns a pointer to the internal copy of the string (see §4.1.3). @@ -4523,13 +4992,13 @@

    4.8 – Functions and Types

    Pushes the zero-terminated string pointed to by s onto the stack. -Lua makes (or reuses) an internal copy of the given string, +Lua will make or reuse an internal copy of the given string, so the memory at s can be freed or reused immediately after the function returns.

    -Returns a pointer to the internal copy of the string. +Returns a pointer to the internal copy of the string (see §4.1.3).

    @@ -4564,7 +5033,7 @@

    4.8 – Functions and Types


    lua_pushvfstring

    -[-0, +1, m] +[-0, +1, v]

    const char *lua_pushvfstring (lua_State *L,
                                   const char *fmt,
                                   va_list argp);
    @@ -4584,7 +5053,7 @@

    4.8 – Functions and Types

    Returns 1 if the two values in indices index1 and index2 are primitively equal -(that is, without calling the __eq metamethod). +(that is, equal without calling the __eq metamethod). Otherwise returns 0. Also returns 0 if any of the indices are not valid. @@ -4599,6 +5068,7 @@

    4.8 – Functions and Types

    Similar to lua_gettable, but does a raw access (i.e., without metamethods). +The value at index must be a table. @@ -4612,7 +5082,7 @@

    4.8 – Functions and Types

    Pushes onto the stack the value t[n], where t is the table at the given index. The access is raw, -that is, it does not invoke the __index metamethod. +that is, it does not use the __index metavalue.

    @@ -4631,7 +5101,7 @@

    4.8 – Functions and Types

    where t is the table at the given index and k is the pointer p represented as a light userdata. The access is raw; -that is, it does not invoke the __index metamethod. +that is, it does not use the __index metavalue.

    @@ -4643,7 +5113,7 @@

    4.8 – Functions and Types


    lua_rawlen

    [-0, +0, –] -

    size_t lua_rawlen (lua_State *L, int index);
    +
    lua_Unsigned lua_rawlen (lua_State *L, int index);

    Returns the raw "length" of the value at the given index: @@ -4651,8 +5121,8 @@

    4.8 – Functions and Types

    for tables, this is the result of the length operator ('#') with no metamethods; for userdata, this is the size of the block of memory allocated -for the userdata; -for other values, it is 0. +for the userdata. +For other values, this call returns 0. @@ -4665,6 +5135,7 @@

    4.8 – Functions and Types

    Similar to lua_settable, but does a raw assignment (i.e., without metamethods). +The value at index must be a table. @@ -4677,13 +5148,13 @@

    4.8 – Functions and Types

    Does the equivalent of t[i] = v, where t is the table at the given index -and v is the value at the top of the stack. +and v is the value on the top of the stack.

    This function pops the value from the stack. The assignment is raw, -that is, it does not invoke the __newindex metamethod. +that is, it does not use the __newindex metavalue. @@ -4697,13 +5168,13 @@

    4.8 – Functions and Types

    Does the equivalent of t[p] = v, where t is the table at the given index, p is encoded as a light userdata, -and v is the value at the top of the stack. +and v is the value on the top of the stack.

    This function pops the value from the stack. The assignment is raw, -that is, it does not invoke __newindex metamethod. +that is, it does not use the __newindex metavalue. @@ -4716,8 +5187,8 @@

    4.8 – Functions and Types

    The reader function used by lua_load. -Every time it needs another piece of the chunk, -lua_load calls the reader, +Every time lua_load needs another piece of the chunk, +it calls the reader, passing along its data parameter. The reader must return a pointer to a block of memory with a new piece of the chunk @@ -4775,9 +5246,23 @@

    4.8 – Functions and Types

    +

    lua_resetthread

    +[-0, +?, –] +

    int lua_resetthread (lua_State *L);
    + +

    +This function is deprecated; +it is equivalent to lua_closethread with +from being NULL. + + + + +


    lua_resume

    [-?, +?, –] -

    int lua_resume (lua_State *L, lua_State *from, int nargs);
    +
    int lua_resume (lua_State *L, lua_State *from, int nargs,
    +                          int *nresults);

    Starts and resumes a coroutine in the given thread L. @@ -4785,31 +5270,29 @@

    4.8 – Functions and Types

    To start a coroutine, -you push onto the thread stack the main function plus any arguments; +you push the main function plus any arguments +onto the empty stack of the thread. then you call lua_resume, with nargs being the number of arguments. This call returns when the coroutine suspends or finishes its execution. -When it returns, the stack contains all values passed to lua_yield, -or all values returned by the body function. +When it returns, +*nresults is updated and +the top of the stack contains +the *nresults values passed to lua_yield +or returned by the body function. lua_resume returns LUA_YIELD if the coroutine yields, LUA_OK if the coroutine finishes its execution without errors, -or an error code in case of errors (see lua_pcall). - - -

    +or an error code in case of errors (see §4.4.1). In case of errors, -the stack is not unwound, -so you can use the debug API over it. -The error object is on the top of the stack. +the error object is on the top of the stack.

    To resume a coroutine, -you remove any results from the last lua_yield, -put on its stack only the values to -be passed as results from yield, +you remove the *nresults yielded values from its stack, +push the values to be passed as results from yield, and then call lua_resume. @@ -4861,7 +5344,7 @@

    4.8 – Functions and Types

    Does the equivalent to t[k] = v, where t is the value at the given index -and v is the value at the top of the stack. +and v is the value on the top of the stack.

    @@ -4892,7 +5375,7 @@

    4.8 – Functions and Types

    Does the equivalent to t[n] = v, where t is the value at the given index -and v is the value at the top of the stack. +and v is the value on the top of the stack.

    @@ -4904,13 +5387,33 @@

    4.8 – Functions and Types

    +

    lua_setiuservalue

    +[-1, +0, –] +

    int lua_setiuservalue (lua_State *L, int index, int n);
    + +

    +Pops a value from the stack and sets it as +the new n-th user value associated to the +full userdata at the given index. +Returns 0 if the userdata does not have that value. + + + + +


    lua_setmetatable

    [-1, +0, –] -

    void lua_setmetatable (lua_State *L, int index);
    +
    int lua_setmetatable (lua_State *L, int index);

    -Pops a table from the stack and -sets it as the new metatable for the value at the given index. +Pops a table or nil from the stack and +sets that value as the new metatable for the value at the given index. +(nil means no metatable.) + + +

    +(For historical reasons, this function returns an int, +which now is always 1.) @@ -4923,7 +5426,7 @@

    4.8 – Functions and Types

    Does the equivalent to t[k] = v, where t is the value at the given index, -v is the value at the top of the stack, +v is the value on the top of the stack, and k is the value just below the top. @@ -4937,27 +5440,34 @@

    4.8 – Functions and Types


    lua_settop

    -[-?, +?, –] +[-?, +?, e]

    void lua_settop (lua_State *L, int index);

    Accepts any index, or 0, and sets the stack top to this index. -If the new top is larger than the old one, +If the new top is greater than the old one, then the new elements are filled with nil. If index is 0, then all stack elements are removed. +

    +This function can run arbitrary code when removing an index +marked as to-be-closed from the stack. + -


    lua_setuservalue

    -[-1, +0, –] -

    void lua_setuservalue (lua_State *L, int index);
    + +

    lua_setwarnf

    +[-0, +0, –] +

    void lua_setwarnf (lua_State *L, lua_WarnFunction f, void *ud);

    -Pops a value from the stack and sets it as -the new value associated to the full userdata at the given index. +Sets the warning function to be used by Lua to emit warnings +(see lua_WarnFunction). +The ud parameter sets the value ud passed to +the warning function. @@ -4992,14 +5502,14 @@

    4.8 – Functions and Types

    -The status can be 0 (LUA_OK) for a normal thread, +The status can be LUA_OK for a normal thread, an error code if the thread finished the execution of a lua_resume with an error, -or LUA_YIELD if the thread is suspended. +or LUA_YIELD if the thread is suspended.

    -You can only call functions in threads with status LUA_OK. +You can call functions only in threads with status LUA_OK. You can resume threads with status LUA_OK (to start a new coroutine) or LUA_YIELD (to resume a coroutine). @@ -5019,7 +5529,7 @@

    4.8 – Functions and Types

    that is, its length plus one. The conversion can result in an integer or a float, according to the lexical conventions of Lua (see §3.1). -The string may have leading and trailing spaces and a sign. +The string may have leading and trailing whitespaces and a sign. If the string is not a valid numeral, returns 0 and pushes nothing. (Note that the result can be used as a boolean, @@ -5060,6 +5570,48 @@

    4.8 – Functions and Types

    +

    lua_toclose

    +[-0, +0, v] +

    void lua_toclose (lua_State *L, int index);
    + +

    +Marks the given index in the stack as a +to-be-closed slot (see §3.3.8). +Like a to-be-closed variable in Lua, +the value at that slot in the stack will be closed +when it goes out of scope. +Here, in the context of a C function, +to go out of scope means that the running function returns to Lua, +or there is an error, +or the slot is removed from the stack through +lua_settop or lua_pop, +or there is a call to lua_closeslot. +A slot marked as to-be-closed should not be removed from the stack +by any other function in the API except lua_settop or lua_pop, +unless previously deactivated by lua_closeslot. + + +

    +This function raises an error if the value at the given slot +neither has a __close metamethod nor is a false value. + + +

    +This function should not be called for an index +that is equal to or below an active to-be-closed slot. + + +

    +Note that, both in case of errors and of a regular return, +by the time the __close metamethod runs, +the C stack was already unwound, +so that any automatic C variable declared in the calling function +(e.g., a buffer) will be out of scope. + + + + +


    lua_tointeger

    [-0, +0, –]

    lua_Integer lua_tointeger (lua_State *L, int index);
    @@ -5111,16 +5663,16 @@

    4.8 – Functions and Types

    lua_tolstring returns a pointer -to a string inside the Lua state. +to a string inside the Lua state (see §4.1.3). This string always has a zero ('\0') after its last character (as in C), but can contain other zeros in its body.

    -Because Lua has garbage collection, -there is no guarantee that the pointer returned by lua_tolstring -will be valid after the corresponding Lua value is removed from the stack. +This function can raise memory errors only +when converting a number to a string +(as then it may create a new string). @@ -5165,7 +5717,7 @@

    4.8 – Functions and Types

    Converts the value at the given index to a generic C pointer (void*). -The value can be a userdata, a table, a thread, or a function; +The value can be a userdata, a table, a thread, a string, or a function; otherwise, lua_topointer returns NULL. Different objects will give different pointers. There is no way to convert the pointer back to its original value. @@ -5209,9 +5761,9 @@

    4.8 – Functions and Types

    If the value at the given index is a full userdata, -returns its block address. +returns its memory-block address. If the value is a light userdata, -returns its pointer. +returns its value (a pointer). Otherwise, returns NULL. @@ -5224,10 +5776,10 @@

    4.8 – Functions and Types

    Returns the type of the value in the given valid index, -or LUA_TNONE for a non-valid (but acceptable) index. +or LUA_TNONE for a non-valid but acceptable index. The types returned by lua_type are coded by the following constants defined in lua.h: -LUA_TNIL (0), +LUA_TNIL, LUA_TNUMBER, LUA_TBOOLEAN, LUA_TSTRING, @@ -5270,7 +5822,8 @@

    4.8 – Functions and Types

    Returns the pseudo-index that represents the i-th upvalue of -the running function (see §4.4). +the running function (see §4.2). +i must be in the range [1,256]. @@ -5278,16 +5831,47 @@

    4.8 – Functions and Types


    lua_version

    [-0, +0, –] -

    const lua_Number *lua_version (lua_State *L);
    +
    lua_Number lua_version (lua_State *L);
    + +

    +Returns the version number of this core. + + + + + +


    lua_WarnFunction

    +
    typedef void (*lua_WarnFunction) (void *ud, const char *msg, int tocont);
    + +

    +The type of warning functions, called by Lua to emit warnings. +The first parameter is an opaque pointer +set by lua_setwarnf. +The second parameter is the warning message. +The third parameter is a boolean that +indicates whether the message is +to be continued by the message in the next call. + + +

    +See warn for more details about warnings. + + + + + +


    lua_warning

    +[-0, +0, –] +

    void lua_warning (lua_State *L, const char *msg, int tocont);
    + +

    +Emits a warning with the given message. +A message in a call with tocont true should be +continued in another call to this function. +

    -Returns the address of the version number -(a C static variable) -stored in the Lua core. -When called with a valid lua_State, -returns the address of the version used to create that state. -When called with NULL, -returns the address of the version running the call. +See warn for more details about warnings. @@ -5301,11 +5885,11 @@

    4.8 – Functions and Types

    The type of the writer function used by lua_dump. -Every time it produces another piece of chunk, -lua_dump calls the writer, +Every time lua_dump produces another piece of chunk, +it calls the writer, passing along the buffer to be written (p), its size (sz), -and the data parameter supplied to lua_dump. +and the ud parameter supplied to lua_dump.

    @@ -5335,22 +5919,24 @@

    4.8 – Functions and Types


    lua_yield

    -[-?, +?, e] +[-?, +?, v]

    int lua_yield (lua_State *L, int nresults);

    This function is equivalent to lua_yieldk, -but it has no continuation (see §4.7). +but it has no continuation (see §4.5). Therefore, when the thread resumes, it continues the function that called the function calling lua_yield. +To avoid surprises, +this function should be called only in a tail call.


    lua_yieldk

    -[-?, +?, e] +[-?, +?, v]

    int lua_yieldk (lua_State *L,
                     int nresults,
                     lua_KContext ctx,
    @@ -5371,7 +5957,7 @@ 

    4.8 – Functions and Types

    When the coroutine is resumed again, Lua calls the given continuation function k to continue -the execution of the C function that yielded (see §4.7). +the execution of the C function that yielded (see §4.5). This continuation function receives the same stack from the previous function, with the n results removed and @@ -5387,7 +5973,7 @@

    4.8 – Functions and Types

    it continues executing the continuation function. However, there is one special case, which is when this function is called -from inside a line or a count hook (see §4.9). +from inside a line or a count hook (see §4.7). In that case, lua_yieldk should be called with no continuation (probably in the form of lua_yield) and no results, and the hook should return immediately after the call. @@ -5399,9 +5985,10 @@

    4.8 – Functions and Types

    This function can raise an error if it is called from a thread -with a pending C call with no continuation function, +with a pending C call with no continuation function +(what is called a C-call boundary), or it is called from a thread that is not running inside a resume -(e.g., the main thread). +(typically the main thread). @@ -5409,7 +5996,7 @@

    4.8 – Functions and Types

    -

    4.9 – The Debug Interface

    +

    4.7 – The Debug Interface

    Lua has no built-in debugging facilities. @@ -5428,6 +6015,7 @@

    4.9 – The Debug Interface

    const char *namewhat; /* (n) */ const char *what; /* (S) */ const char *source; /* (S) */ + size_t srclen; /* (S) */ int currentline; /* (l) */ int linedefined; /* (S) */ int lastlinedefined; /* (S) */ @@ -5435,6 +6023,8 @@

    4.9 – The Debug Interface

    unsigned char nparams; /* (u) number of parameters */ char isvararg; /* (u) */ char istailcall; /* (t) */ + unsigned short ftransfer; /* (r) index of first value transferred */ + unsigned short ntransfer; /* (r) number of transferred values */ char short_src[LUA_IDSIZE]; /* (S) */ /* private part */ other fields @@ -5446,7 +6036,10 @@

    4.9 – The Debug Interface

    lua_getstack fills only the private part of this structure, for later use. To fill the other fields of lua_Debug with useful information, -call lua_getinfo. +you must call lua_getinfo with an appropriate parameter. +(Specifically, to get a field, +you must add the letter between parentheses in the field's comment +to the parameter what of lua_getinfo.)

    @@ -5455,17 +6048,21 @@

    4.9 – The Debug Interface

    • source: -the name of the chunk that created the function. +the source of the chunk that created the function. If source starts with a '@', it means that the function was defined in a file where the file name follows the '@'. If source starts with a '=', -the remainder of its contents describe the source in a user-dependent manner. +the remainder of its contents describes the source in a user-dependent manner. Otherwise, the function was defined in a string where source is that string.
    • +
    • srclen: +The length of the string source. +
    • +
    • short_src: a "printable" version of source, to be used in error messages.
    • @@ -5521,15 +6118,33 @@

      4.9 – The Debug Interface

    • nparams: -the number of fixed parameters of the function +the number of parameters of the function (always 0 for C functions).
    • isvararg: -true if the function is a vararg function +true if the function is a variadic function (always true for C functions).
    • +
    • ftransfer: +the index in the stack of the first value being "transferred", +that is, parameters in a call or return values in a return. +(The other values are in consecutive indices.) +Using this index, you can access and modify these values +through lua_getlocal and lua_setlocal. +This field is only meaningful during a +call hook, denoting the first parameter, +or a return hook, denoting the first value being returned. +(For call hooks, this value is always 1.) +
    • + +
    • ntransfer: +The number of values being transferred (see previous item). +(For calls of Lua functions, +this value is always equal to nparams.) +
    • +
    @@ -5569,7 +6184,7 @@

    4.9 – The Debug Interface


    lua_getinfo

    -[-(0|1), +(0|1|2), e] +[-(0|1), +(0|1|2), m]

    int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);

    @@ -5584,7 +6199,7 @@

    4.9 – The Debug Interface

    -To get information about a function you push it onto the stack +To get information about a function, you push it onto the stack and start the what string with the character '>'. (In that case, lua_getinfo pops the function from the top of the stack.) @@ -5601,11 +6216,25 @@

    4.9 – The Debug Interface

    Each character in the string what selects some fields of the structure ar to be filled or -a value to be pushed on the stack: +a value to be pushed on the stack. +(These characters are also documented in the declaration of +the structure lua_Debug, +between parentheses in the comments following each field.)

      -
    • 'n': fills in the field name and namewhat; +
    • 'f': +pushes onto the stack the function that is +running at the given level; +
    • + +
    • 'l': fills in the field currentline; +
    • + +
    • 'n': fills in the fields name and namewhat; +
    • + +
    • 'r': fills in the fields ftransfer and ntransfer;
    • 'S': @@ -5613,9 +6242,6 @@

      4.9 – The Debug Interface

      linedefined, lastlinedefined, and what;
    • -
    • 'l': fills in the field currentline; -
    • -
    • 't': fills in the field istailcall;
    • @@ -5623,29 +6249,21 @@

      4.9 – The Debug Interface

      nups, nparams, and isvararg; -
    • 'f': -pushes onto the stack the function that is -running at the given level; -
    • -
    • 'L': -pushes onto the stack a table whose indices are the -numbers of the lines that are valid on the function. -(A valid line is a line with some associated code, -that is, a line where you can put a break point. -Non-valid lines include empty lines and comments.) - - -

      +pushes onto the stack a table whose indices are +the lines on the function with some associated code, +that is, the lines where you can put a break point. +(Lines with no code include empty lines and comments.) If this option is given together with option 'f', its table is pushed after the function. +This is the only option that can raise a memory error.

    -This function returns 0 on error -(for instance, an invalid option in what). +This function returns 0 to signal an invalid option in what; +even then the valid options are handled correctly. @@ -5656,8 +6274,8 @@

    4.9 – The Debug Interface

    const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);

    -Gets information about a local variable of -a given activation record or a given function. +Gets information about a local variable or a temporary value +of a given activation record or a given function.

    @@ -5677,7 +6295,7 @@

    4.9 – The Debug Interface

    In the second case, ar must be NULL and the function -to be inspected must be at the top of the stack. +to be inspected must be on the top of the stack. In this case, only parameters of Lua functions are visible (as there is no information about what variables are active) and no values are pushed onto the stack. @@ -5706,10 +6324,10 @@

    4.9 – The Debug Interface

    of the function executing at a given level. Level 0 is the current running function, whereas level n+1 is the function that has called level n -(except for tail calls, which do not count on the stack). -When there are no errors, lua_getstack returns 1; -when called with a level greater than the stack depth, -it returns 0. +(except for tail calls, which do not count in the stack). +When called with a level greater than the stack depth, +lua_getstack returns 0; +otherwise it returns 1. @@ -5729,17 +6347,7 @@

    4.9 – The Debug Interface

    -For C functions, this function uses the empty string "" -as a name for all upvalues. -(For Lua functions, -upvalues are the external local variables that the function uses, -and that are consequently included in its closure.) - - -

    -Upvalues have no particular order, -as they are active through the whole function. -They are numbered in an arbitrary order. +See debug.getupvalue for more information about upvalues. @@ -5816,31 +6424,28 @@

    4.9 – The Debug Interface

    • The call hook: is called when the interpreter calls a function. -The hook is called just after Lua enters the new function, -before the function gets its arguments. +The hook is called just after Lua enters the new function.
    • The return hook: is called when the interpreter returns from a function. The hook is called just before Lua leaves the function. -There is no standard way to access the values -to be returned by the function.
    • The line hook: is called when the interpreter is about to start the execution of a new line of code, or when it jumps back in the code (even to the same line). -(This event only happens while Lua is executing a Lua function.) +This event only happens while Lua is executing a Lua function.
    • The count hook: is called after the interpreter executes every count instructions. -(This event only happens while Lua is executing a Lua function.) +This event only happens while Lua is executing a Lua function.

    -A hook is disabled by setting mask to zero. +Hooks are disabled by setting mask to zero. @@ -5852,7 +6457,7 @@

    4.9 – The Debug Interface

    Sets the value of a local variable of a given activation record. -It assigns the value at the top of the stack +It assigns the value on the top of the stack to the variable and returns its name. It also pops the value from the stack. @@ -5864,7 +6469,7 @@

    4.9 – The Debug Interface

    -Parameters ar and n are as in function lua_getlocal. +Parameters ar and n are as in the function lua_getlocal. @@ -5876,7 +6481,7 @@

    4.9 – The Debug Interface

    Sets the value of a closure's upvalue. -It assigns the value at the top of the stack +It assigns the value on the top of the stack to the upvalue and returns its name. It also pops the value from the stack. @@ -5887,7 +6492,8 @@

    4.9 – The Debug Interface

    -Parameters funcindex and n are as in function lua_getupvalue. +Parameters funcindex and n are as in +the function lua_getupvalue. @@ -5911,7 +6517,8 @@

    4.9 – The Debug Interface

    -Parameters funcindex and n are as in function lua_getupvalue, +Parameters funcindex and n are as in +the function lua_getupvalue, but n cannot be greater than the number of upvalues. @@ -5935,6 +6542,8 @@

    4.9 – The Debug Interface

    5 – The Auxiliary Library

    + +

    The auxiliary library provides several convenient functions @@ -5981,6 +6590,8 @@

    5 – The Auxiliary Library

    + +

    5.1 – Functions and Types

    @@ -6001,6 +6612,20 @@

    5.1 – Functions and Types

    +

    luaL_addgsub

    +[-?, +?, m] +

    const void luaL_addgsub (luaL_Buffer *B, const char *s,
    +                         const char *p, const char *r);
    + +

    +Adds a copy of the string s to the buffer B (see luaL_Buffer), +replacing any occurrence of the string p +with the string r. + + + + +


    luaL_addlstring

    [-?, +?, m]

    void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l);
    @@ -6020,7 +6645,7 @@

    5.1 – Functions and Types

    void luaL_addsize (luaL_Buffer *B, size_t n);

    -Adds to the buffer B (see luaL_Buffer) +Adds to the buffer B a string of length n previously copied to the buffer area (see luaL_prepbuffer). @@ -6042,11 +6667,11 @@

    5.1 – Functions and Types


    luaL_addvalue

    -[-1, +?, m] +[-?, +?, m]

    void luaL_addvalue (luaL_Buffer *B);

    -Adds the value at the top of the stack +Adds the value on the top of the stack to the buffer B (see luaL_Buffer). Pops the value. @@ -6095,6 +6720,22 @@

    5.1 – Functions and Types

    +

    luaL_argexpected

    +[-0, +0, v] +

    void luaL_argexpected (lua_State *L,
    +                       int cond,
    +                       int arg,
    +                       const char *tname);
    + +

    +Checks whether cond is true. +If it is not, raises an error about the type of the argument arg +with a standard message (see luaL_typeerror). + + + + +


    luaL_Buffer

    typedef struct luaL_Buffer luaL_Buffer;
    @@ -6125,7 +6766,7 @@

    5.1 – Functions and Types

    -If you know beforehand the total size of the resulting string, +If you know beforehand the maximum size of the resulting string, you can use the buffer like this:

      @@ -6135,12 +6776,13 @@

      5.1 – Functions and Types

    • Then initialize it and preallocate a space of size sz with a call luaL_buffinitsize(L, &b, sz).
    • -
    • Then copy the string into that space.
    • +
    • Then produce the string into that space.
    • Finish by calling luaL_pushresultsize(&b, sz), where sz is the total size of the resulting string -copied into that space. +copied into that space (which may be less than or +equal to the preallocated size).
    @@ -6157,22 +6799,47 @@

    5.1 – Functions and Types

    the stack is at the same level it was immediately after the previous buffer operation. (The only exception to this rule is luaL_addvalue.) -After calling luaL_pushresult the stack is back to its -level when the buffer was initialized, +After calling luaL_pushresult, +the stack is back to its level when the buffer was initialized, plus the final string on its top. -

    luaL_buffinit

    +


    luaL_buffaddr

    [-0, +0, –] +

    char *luaL_buffaddr (luaL_Buffer *B);
    + +

    +Returns the address of the current content of buffer B +(see luaL_Buffer). +Note that any addition to the buffer may invalidate this address. + + + + + +


    luaL_buffinit

    +[-0, +?, –]

    void luaL_buffinit (lua_State *L, luaL_Buffer *B);

    -Initializes a buffer B. +Initializes a buffer B +(see luaL_Buffer). This function does not allocate any space; -the buffer must be declared as a variable +the buffer must be declared as a variable. + + + + + +


    luaL_bufflen

    +[-0, +0, –] +

    size_t luaL_bufflen (luaL_Buffer *B);
    + +

    +Returns the length of the current content of buffer B (see luaL_Buffer). @@ -6191,6 +6858,19 @@

    5.1 – Functions and Types

    +

    luaL_buffsub

    +[-?, +?, –] +

    void luaL_buffsub (luaL_Buffer *B, int n);
    + +

    +Removes n bytes from the buffer B +(see luaL_Buffer). +The buffer must have at least that many bytes. + + + + +


    luaL_callmeta

    [-0, +(0|1), e]

    int luaL_callmeta (lua_State *L, int obj, const char *e);
    @@ -6206,7 +6886,7 @@

    5.1 – Functions and Types

    In this case this function returns true and pushes onto the stack the value returned by the call. If there is no metatable or no metamethod, -this function returns false (without pushing any value on the stack). +this function returns false without pushing any value on the stack. @@ -6231,7 +6911,7 @@

    5.1 – Functions and Types

    Checks whether the function argument arg is an integer (or can be converted to an integer) -and returns this integer cast to a lua_Integer. +and returns this integer. @@ -6244,7 +6924,7 @@

    5.1 – Functions and Types

    Checks whether the function argument arg is a string and returns this string; -if l is not NULL fills *l +if l is not NULL fills its referent with the string's length. @@ -6262,7 +6942,7 @@

    5.1 – Functions and Types

    Checks whether the function argument arg is a number -and returns this number. +and returns this number converted to a lua_Number. @@ -6349,7 +7029,7 @@

    5.1 – Functions and Types

    Checks whether the function argument arg is a userdata of the type tname (see luaL_newmetatable) and -returns the userdata address (see lua_touserdata). +returns the userdata's memory-block address (see lua_touserdata). @@ -6360,19 +7040,15 @@

    5.1 – Functions and Types

    void luaL_checkversion (lua_State *L);

    -Checks whether the core running the call, -the core that created the Lua state, -and the code making the call are all using the same version of Lua. -Also checks whether the core running the call -and the core that created the Lua state -are using the same address space. +Checks whether the code making the call and the Lua library being called +are using the same version of Lua and the same numeric types.


    luaL_dofile

    -[-0, +?, e] +[-0, +?, m]

    int luaL_dofile (lua_State *L, const char *filename);

    @@ -6382,8 +7058,8 @@

    5.1 – Functions and Types

          (luaL_loadfile(L, filename) || lua_pcall(L, 0, LUA_MULTRET, 0))
     

    -It returns false if there are no errors -or true in case of errors. +It returns 0 (LUA_OK) if there are no errors, +or 1 in case of errors. @@ -6400,8 +7076,8 @@

    5.1 – Functions and Types

          (luaL_loadstring(L, str) || lua_pcall(L, 0, LUA_MULTRET, 0))
     

    -It returns false if there are no errors -or true in case of errors. +It returns 0 (LUA_OK) if there are no errors, +or 1 in case of errors. @@ -6462,7 +7138,7 @@

    5.1 – Functions and Types

    Pushes onto the stack the field e from the metatable -of the object at index obj and returns the type of pushed value. +of the object at index obj and returns the type of the pushed value. If the object does not have a metatable, or if the metatable does not have this field, pushes nothing and returns LUA_TNIL. @@ -6476,9 +7152,9 @@

    5.1 – Functions and Types

    int luaL_getmetatable (lua_State *L, const char *tname);

    -Pushes onto the stack the metatable associated with name tname -in the registry (see luaL_newmetatable) -(nil if there is no metatable associated with that name). +Pushes onto the stack the metatable associated with the name tname +in the registry (see luaL_newmetatable), +or nil if there is no metatable associated with that name. Returns the type of the pushed value. @@ -6509,8 +7185,8 @@

    5.1 – Functions and Types

    const char *r);

    -Creates a copy of string s by replacing -any occurrence of the string p +Creates a copy of string s, +replacing any occurrence of the string p with the string r. Pushes the resulting string on the stack and returns it. @@ -6527,7 +7203,7 @@

    5.1 – Functions and Types

    as a number; it is equivalent to the '#' operator in Lua (see §3.4.7). Raises an error if the result of the operation is not an integer. -(This case only can happen through metamethods.) +(This case can only happen through metamethods.) @@ -6565,7 +7241,7 @@

    5.1 – Functions and Types

    This function returns the same results as lua_load. name is the chunk name, used for debug information and error messages. -The string mode works as in function lua_load. +The string mode works as in the function lua_load. @@ -6597,14 +7273,12 @@

    5.1 – Functions and Types

    -The string mode works as in function lua_load. +The string mode works as in the function lua_load.

    -This function returns the same results as lua_load, -but it has an extra error code LUA_ERRFILE -for file-related errors -(e.g., it cannot open or read the file). +This function returns the same results as lua_load +or LUA_ERRFILE for file-related errors.

    @@ -6643,7 +7317,7 @@

    5.1 – Functions and Types

    Creates a new table and registers there -the functions in list l. +the functions in the list l.

    @@ -6692,11 +7366,11 @@

    5.1 – Functions and Types

    adds to this new table the pair __name = tname, adds to the registry the pair [tname] = new table, and returns 1. -(The entry __name is used by some error-reporting functions.)

    -In both cases pushes onto the stack the final value associated +In both cases, +the function pushes onto the stack the final value associated with tname in the registry. @@ -6710,10 +7384,9 @@

    5.1 – Functions and Types

    Creates a new Lua state. It calls lua_newstate with an -allocator based on the standard C realloc function -and then sets a panic function (see §4.6) that prints -an error message to the standard error output in case of fatal -errors. +allocator based on the ISO C allocation functions +and then sets a warning function and a panic function (see §4.4) +that print messages to the standard error output.

    @@ -6736,7 +7409,7 @@

    5.1 – Functions and Types


    luaL_opt

    -[-0, +0, e] +[-0, +0, –]

    T luaL_opt (L, func, arg, dflt);

    @@ -6749,7 +7422,7 @@

    5.1 – Functions and Types

    the macro results in the default dflt. Otherwise, it results in the result of calling func with the state L and the argument index arg as -parameters. +arguments. Note that it evaluates the expression dflt only if needed. @@ -6764,7 +7437,7 @@

    5.1 – Functions and Types

    If the function argument arg is an integer -(or convertible to an integer), +(or it is convertible to an integer), returns this integer. If this argument is absent or is nil, returns d. @@ -6791,7 +7464,7 @@

    5.1 – Functions and Types

    If l is not NULL, -fills the position *l with the result's length. +fills its referent with the result's length. If the result is NULL (only possible when returning d and d == NULL), its length is considered zero. @@ -6811,7 +7484,7 @@

    5.1 – Functions and Types

    If the function argument arg is a number, -returns this number. +returns this number as a lua_Number. If this argument is absent or is nil, returns d. Otherwise, raises an error. @@ -6865,6 +7538,17 @@

    5.1 – Functions and Types

    +

    luaL_pushfail

    +[-0, +1, –] +

    void luaL_pushfail (lua_State *L);
    + +

    +Pushes the fail value onto the stack (see §6). + + + + +


    luaL_pushresult

    [-?, +1, m]

    void luaL_pushresult (luaL_Buffer *B);
    @@ -6895,20 +7579,20 @@

    5.1 – Functions and Types

    Creates and returns a reference, in the table at index t, -for the object at the top of the stack (and pops the object). +for the object on the top of the stack (and pops the object).

    A reference is a unique integer key. -As long as you do not manually add integer keys into table t, +As long as you do not manually add integer keys into the table t, luaL_ref ensures the uniqueness of the key it returns. -You can retrieve an object referred by reference r +You can retrieve an object referred by the reference r by calling lua_rawgeti(L, t, r). -Function luaL_unref frees a reference and its associated object. +The function luaL_unref frees a reference.

    -If the object at the top of the stack is nil, +If the object on the top of the stack is nil, luaL_ref returns the constant LUA_REFNIL. The constant LUA_NOREF is guaranteed to be different from any reference returned by luaL_ref. @@ -6941,15 +7625,15 @@

    5.1 – Functions and Types

    lua_CFunction openf, int glb);

    -If modname is not already present in package.loaded, -calls function openf with string modname as an argument -and sets the call result in package.loaded[modname], +If package.loaded[modname] is not true, +calls the function openf with the string modname as an argument +and sets the call result to package.loaded[modname], as if that function has been called through require.

    If glb is true, -also stores the module into global modname. +also stores the module into the global modname.

    @@ -6971,12 +7655,18 @@

    5.1 – Functions and Types

    When nup is not zero, -all functions are created sharing nup upvalues, -which must be previously pushed on the stack +all functions are created with nup upvalues, +initialized with copies of the nup values +previously pushed on the stack on top of the library table. These values are popped from the stack after the registration. +

    +A function with a NULL value represents a placeholder, +which is filled with false. + + @@ -6985,7 +7675,7 @@

    5.1 – Functions and Types

    void luaL_setmetatable (lua_State *L, const char *tname);

    -Sets the metatable of the object at the top of the stack +Sets the metatable of the object on the top of the stack as the metatable associated with name tname in the registry (see luaL_newmetatable). @@ -7000,8 +7690,8 @@

    5.1 – Functions and Types

    } luaL_Stream;

    -The standard representation for file handles, -which is used by the standard I/O library. +The standard representation for file handles +used by the standard I/O library.

    @@ -7015,14 +7705,14 @@

    5.1 – Functions and Types

    This userdata must start with the structure luaL_Stream; it can contain other data after this initial structure. -Field f points to the corresponding C stream +The field f points to the corresponding C stream (or it can be NULL to indicate an incompletely created handle). -Field closef points to a Lua function +The field closef points to a Lua function that will be called to close the stream when the handle is closed or collected; this function receives the file handle as its sole argument and -must return either true (in case of success) -or nil plus an error message (in case of error). +must return either a true value, in case of success, +or a false value plus an error message, in case of error. Once Lua calls this field, it changes the field value to NULL to signal that the handle is closed. @@ -7052,7 +7742,7 @@

    5.1 – Functions and Types

    Converts any Lua value at the given index to a C string in a reasonable format. The resulting string is pushed onto the stack and also -returned by the function. +returned by the function (see §4.1.3). If len is not NULL, the function also sets *len with the string length. @@ -7074,7 +7764,7 @@

    5.1 – Functions and Types

    Creates and pushes a traceback of the stack L1. -If msg is not NULL it is appended +If msg is not NULL, it is appended at the beginning of the traceback. The level parameter tells at which level to start the traceback. @@ -7083,6 +7773,21 @@

    5.1 – Functions and Types

    +

    luaL_typeerror

    +[-0, +0, v] +

    int luaL_typeerror (lua_State *L, int arg, const char *tname);
    + +

    +Raises a type error for the argument arg +of the C function that called it, +using a standard message; +tname is a "name" for the expected type. +This function never returns. + + + + +


    luaL_typename

    [-0, +0, –]

    const char *luaL_typename (lua_State *L, int index);
    @@ -7099,7 +7804,7 @@

    5.1 – Functions and Types

    void luaL_unref (lua_State *L, int t, int ref);

    -Releases reference ref from the table at index t +Releases the reference ref from the table at index t (see luaL_ref). The entry is removed from the table, so that the referred object can be collected. @@ -7140,22 +7845,41 @@

    5.1 – Functions and Types

    -

    6 – Standard Libraries

    +

    6 – The Standard Libraries

    + +

    The standard Lua libraries provide useful functions -that are implemented directly through the C API. +that are implemented in C through the C API. Some of these functions provide essential services to the language (e.g., type and getmetatable); -others provide access to "outside" services (e.g., I/O); +others provide access to outside services (e.g., I/O); and others could be implemented in Lua itself, -but are quite useful or have critical performance requirements that +but that for different reasons deserve an implementation in C (e.g., table.sort).

    All libraries are implemented through the official C API and are provided as separate C modules. +Unless otherwise noted, +these library functions do not adjust its number of arguments +to its expected parameters. +For instance, a function documented as foo(arg) +should not be called without an argument. + + +

    +The notation fail means a false value representing +some kind of failure. +(Currently, fail is equal to nil, +but that may change in future versions. +The recommendation is to always test the success of these functions +with (not status), instead of (status == nil).) + + +

    Currently, Lua has the following standard libraries:

      @@ -7197,7 +7921,7 @@

      6 – Standard Libraries

      luaopen_package (for the package library), luaopen_coroutine (for the coroutine library), luaopen_string (for the string library), -luaopen_utf8 (for the UTF8 library), +luaopen_utf8 (for the UTF-8 library), luaopen_table (for the table library), luaopen_math (for the mathematical library), luaopen_io (for the I/O library), @@ -7207,6 +7931,8 @@

      6 – Standard Libraries

      + +

      6.1 – Basic Functions

      @@ -7221,7 +7947,7 @@

      6.1 – Basic Functions

      -Calls error if +Raises an error if the value of its argument v is false (i.e., nil or false); otherwise, returns all its arguments. In case of error, @@ -7242,77 +7968,88 @@

      6.1 – Basic Functions

      • "collect": -performs a full garbage-collection cycle. +Performs a full garbage-collection cycle. This is the default option.
      • "stop": -stops automatic execution of the garbage collector. +Stops automatic execution of the garbage collector. The collector will run only when explicitly invoked, until a call to restart it.
      • "restart": -restarts automatic execution of the garbage collector. +Restarts automatic execution of the garbage collector.
      • "count": -returns the total memory in use by Lua in Kbytes. +Returns the total memory in use by Lua in Kbytes. The value has a fractional part, so that it multiplied by 1024 -gives the exact number of bytes in use by Lua -(except for overflows). +gives the exact number of bytes in use by Lua.
      • "step": -performs a garbage-collection step. +Performs a garbage-collection step. The step "size" is controlled by arg. With a zero value, the collector will perform one basic (indivisible) step. For non-zero values, the collector will perform as if that amount of memory -(in KBytes) had been allocated by Lua. +(in Kbytes) had been allocated by Lua. Returns true if the step finished a collection cycle.
      • -
      • "setpause": -sets arg as the new value for the pause of -the collector (see §2.5). -Returns the previous value for pause. +
      • "isrunning": +Returns a boolean that tells whether the collector is running +(i.e., not stopped).
      • -
      • "setstepmul": -sets arg as the new value for the step multiplier of -the collector (see §2.5). -Returns the previous value for step. +
      • "incremental": +Change the collector mode to incremental. +This option can be followed by three numbers: +the garbage-collector pause, +the step multiplier, +and the step size (see §2.5.1). +A zero means to not change that value.
      • -
      • "isrunning": -returns a boolean that tells whether the collector is running -(i.e., not stopped). +
      • "generational": +Change the collector mode to generational. +This option can be followed by two numbers: +the garbage-collector minor multiplier +and the major multiplier (see §2.5.2). +A zero means to not change that value.
      • -
      +

    +See §2.5 for more details about garbage collection +and some of these options. + + +

    +This function should not be called by a finalizer. +


    dofile ([filename])

    -Opens the named file and executes its contents as a Lua chunk. +Opens the named file and executes its content as a Lua chunk. When called without arguments, -dofile executes the contents of the standard input (stdin). +dofile executes the content of the standard input (stdin). Returns all values returned by the chunk. In case of errors, dofile propagates the error -to its caller (that is, dofile does not run in protected mode). +to its caller. +(That is, dofile does not run in protected mode.)


    error (message [, level])

    -Terminates the last protected function called -and returns message as the error object. -Function error never returns. +Raises an error (see §2.3) with message as the error object. +This function never returns.

    @@ -7367,7 +8104,7 @@

    6.1 – Basic Functions

    will iterate over the key–value pairs (1,t[1]), (2,t[2]), ..., -up to the first nil value. +up to the first absent index. @@ -7391,29 +8128,35 @@

    6.1 – Basic Functions

    If there are no syntactic errors, -returns the compiled chunk as a function; -otherwise, returns nil plus the error message. +load returns the compiled chunk as a function; +otherwise, it returns fail plus the error message.

    -If the resulting function has upvalues, -the first upvalue is set to the value of env, -if that parameter is given, -or to the value of the global environment. -Other upvalues are initialized with nil. -(When you load a main chunk, +When you load a main chunk, the resulting function will always have exactly one upvalue, the _ENV variable (see §2.2). However, when you load a binary chunk created from a function (see string.dump), -the resulting function can have an arbitrary number of upvalues.) +the resulting function can have an arbitrary number of upvalues, +and there is no guarantee that its first upvalue will be +the _ENV variable. +(A non-main function may not even have an _ENV upvalue.) + + +

    +Regardless, if the resulting function has any upvalues, +its first upvalue is set to the value of env, +if that parameter is given, +or to the value of the global environment. +Other upvalues are initialized with nil. All upvalues are fresh, that is, they are not shared with any other function.

    chunkname is used as the name of the chunk for error messages -and debug information (see §4.9). +and debug information (see §4.7). When absent, it defaults to chunk, if chunk is a string, or to "=(load)" otherwise. @@ -7429,9 +8172,11 @@

    6.1 – Basic Functions

    -Lua does not check the consistency of binary chunks. -Maliciously crafted binary chunks can crash -the interpreter. +It is safe to load malformed binary chunks; +load signals an appropriate error. +However, +Lua does not check the consistency of the code inside binary chunks; +running maliciously crafted bytecode can crash the interpreter. @@ -7457,7 +8202,7 @@

    6.1 – Basic Functions

    Allows a program to traverse all fields of a table. Its first argument is a table and its second argument is an index in this table. -next returns the next index of the table +A call to next returns the next index of the table and its associated value. When called with nil as its second argument, next returns an initial index @@ -7478,11 +8223,10 @@

    6.1 – Basic Functions

    -The behavior of next is undefined if, -during the traversal, -you assign any value to a non-existent field in the table. +You should not assign any value to a non-existent field in a table +during its traversal. You may however modify existing fields. -In particular, you may clear existing fields. +In particular, you may set existing fields to nil. @@ -7520,16 +8264,17 @@

    6.1 – Basic Functions

    -Calls function f with +Calls the function f with the given arguments in protected mode. This means that any error inside f is not propagated; instead, pcall catches the error and returns a status code. Its first result is the status code (a boolean), -which is true if the call succeeds without errors. +which is true if the call succeeds without errors. In such case, pcall also returns all results from the call, after this first result. -In case of any error, pcall returns false plus the error message. +In case of any error, pcall returns false plus the error object. +Note that errors caught by pcall do not call a message handler. @@ -7538,8 +8283,12 @@

    6.1 – Basic Functions


    print (···)

    Receives any number of arguments and prints their values to stdout, -using the tostring function to convert each argument to a string. -print is not intended for formatted output, +converting each argument to a string +following the same rules of tostring. + + +

    +The function print is not intended for formatted output, but only as a quick way to show a value, for instance for debugging. For complete control over the output, @@ -7560,7 +8309,7 @@

    6.1 – Basic Functions


    rawget (table, index)

    Gets the real value of table[index], -without invoking the __index metamethod. +without using the __index metavalue. table must be a table; index may be any value. @@ -7580,7 +8329,7 @@

    6.1 – Basic Functions


    rawset (table, index, value)

    Sets the real value of table[index] to value, -without invoking the __newindex metamethod. +without using the __newindex metavalue. table must be a table, index any value different from nil and NaN, and value any Lua value. @@ -7612,8 +8361,6 @@

    6.1 – Basic Functions

    Sets the metatable for the given table. -(To change the metatable of other types from Lua code, -you must use the debug library (§6.10).) If metatable is nil, removes the metatable of the given table. If the original metatable has a __metatable field, @@ -7624,6 +8371,11 @@

    6.1 – Basic Functions

    This function returns table. +

    +To change the metatable of other types from Lua code, +you must use the debug library (§6.10). + +

    @@ -7636,13 +8388,13 @@

    6.1 – Basic Functions

    If the argument is already a number or a string convertible to a number, then tonumber returns this number; -otherwise, it returns nil. +otherwise, it returns fail.

    The conversion of strings can result in integers or floats, according to the lexical conventions of Lua (see §3.1). -(The string may have leading and trailing spaces and a sign.) +The string may have leading and trailing spaces and a sign.

    @@ -7654,17 +8406,18 @@

    6.1 – Basic Functions

    represents 10, 'B' represents 11, and so forth, with 'Z' representing 35. If the string e is not a valid numeral in the given base, -the function returns nil. +the function returns fail.


    tostring (v)

    + + +

    Receives a value of any type and converts it to a string in a human-readable format. -(For complete control of how numbers are converted, -use string.format.)

    @@ -7672,12 +8425,23 @@

    6.1 – Basic Functions

    then tostring calls the corresponding value with v as argument, and uses the result of the call as its result. +Otherwise, if the metatable of v has a __name field +with a string value, +tostring may use that string in its final result. + + +

    +For complete control of how numbers are converted, +use string.format.


    type (v)

    + + +

    Returns the type of its only argument, coded as a string. The possible results of this function are "nil" (a string, not the value nil), @@ -7699,7 +8463,30 @@

    6.1 – Basic Functions

    A global variable (not a function) that holds a string containing the running Lua version. -The current value of this variable is "Lua 5.3". +The current value of this variable is "Lua 5.4". + + + + +

    +


    warn (msg1, ···)

    + + +

    +Emits a warning with a message composed by the concatenation +of all its arguments (which should be strings). + + +

    +By convention, +a one-piece message starting with '@' +is intended to be a control message, +which is a message to the warning system itself. +In particular, the standard warning function in Lua +recognizes the control messages "@off", +to stop the emission of warnings, +and "@on", to (re)start the emission; +it ignores unknown control messages. @@ -7726,6 +8513,25 @@

    6.2 – Coroutine Manipulation

    See §2.6 for a general description of coroutines. +

    +


    coroutine.close (co)

    + + +

    +Closes coroutine co, +that is, +closes all its pending to-be-closed variables +and puts the coroutine in a dead state. +The given coroutine must be dead or suspended. +In case of error +(either the original error that stopped the coroutine or +errors in closing methods), +returns false plus the error object; +otherwise returns true. + + + +


    coroutine.create (f)

    @@ -7740,15 +8546,16 @@

    6.2 – Coroutine Manipulation

    -


    coroutine.isyieldable ()

    +

    coroutine.isyieldable ([co])

    -Returns true when the running coroutine can yield. +Returns true when the coroutine co can yield. +The default for co is the running coroutine.

    -A running coroutine is yieldable if it is not the main thread and +A coroutine is yieldable if it is not the main thread and it is not inside a non-yieldable C function. @@ -7787,7 +8594,7 @@

    6.2 – Coroutine Manipulation

    Returns the running coroutine plus a boolean, -true when the running coroutine is the main one. +true when the running coroutine is the main one. @@ -7797,9 +8604,10 @@

    6.2 – Coroutine Manipulation

    -Returns the status of coroutine co, as a string: +Returns the status of the coroutine co, as a string: "running", -if the coroutine is running (that is, it called status); +if the coroutine is running +(that is, it is the one that called status); "suspended", if the coroutine is suspended in a call to yield, or if it has not started running yet; "normal" if the coroutine is active but not running @@ -7815,14 +8623,15 @@

    6.2 – Coroutine Manipulation

    -Creates a new coroutine, with body f. +Creates a new coroutine, with body f; f must be a function. Returns a function that resumes the coroutine each time it is called. -Any arguments passed to the function behave as the +Any arguments passed to this function behave as the extra arguments to resume. -Returns the same values returned by resume, +The function returns the same values returned by resume, except the first boolean. -In case of error, propagates the error. +In case of error, +the function closes the coroutine and propagates the error. @@ -7848,7 +8657,7 @@

    6.3 – Modules

    facilities for loading modules in Lua. It exports one function directly in the global environment: require. -Everything else is exported in a table package. +Everything else is exported in the table package.

    @@ -7861,13 +8670,17 @@

    6.3 – Modules

    to determine whether modname is already loaded. If it is, then require returns the value stored at package.loaded[modname]. +(The absence of a second result in this case +signals that this call did not have to load the module.) Otherwise, it tries to find a loader for the module.

    To find a loader, -require is guided by the package.searchers sequence. -By changing this sequence, +require is guided by the table package.searchers. +Each item in this table is a search function, +that searches for the module in a particular way. +By changing this table, we can change how require looks for a module. The following explanation is based on the default configuration for package.searchers. @@ -7888,9 +8701,14 @@

    6.3 – Modules

    Once a loader is found, require calls the loader with two arguments: -modname and an extra value dependent on how it got the loader. -(If the loader came from a file, -this extra value is the file name.) +modname and an extra value, +a loader data, +also returned by the searcher. +The loader data can be any value useful to the module; +for the default searchers, +it indicates where the loader was found. +(For instance, if the loader came from a file, +this extra value is the file path.) If the loader returns any non-nil value, require assigns the returned value to package.loaded[modname]. If the loader does not return a non-nil value and @@ -7898,6 +8716,9 @@

    6.3 – Modules

    then require assigns true to this entry. In any case, require returns the final value of package.loaded[modname]. +Besides that value, require also returns as a second result +the loader data returned by the searcher, +which indicates how require found the module.

    @@ -7945,13 +8766,14 @@

    6.3 – Modules

    -The path used by require to search for a C loader. +A string with the path used by require +to search for a C loader.

    Lua initializes the C path package.cpath in the same way it initializes the Lua path package.path, -using the environment variable LUA_CPATH_5_3, +using the environment variable LUA_CPATH_5_4, or the environment variable LUA_CPATH, or a default path defined in luaconf.h. @@ -7974,6 +8796,8 @@

    6.3 – Modules

    This variable is only a reference to the real table; assignments to this variable do not change the table used by require. +The real table is stored in the C registry (see §4.3), +indexed by the key LUA_LOADED_TABLE, a string. @@ -8011,12 +8835,24 @@

    6.3 – Modules

    -This function is not supported by Standard C. +This functionality is not supported by ISO C. As such, it is only available on some platforms (Windows, Linux, Mac OS X, Solaris, BSD, plus other Unix systems that support the dlfcn standard). +

    +This function is inherently insecure, +as it allows Lua to call any function in any readable dynamic +library in the system. +(Lua calls any function assuming the function +has a proper prototype and respects a proper protocol +(see lua_CFunction). +Therefore, +calling an arbitrary function in an arbitrary dynamic library +more often than not results in an access violation.) + +

    @@ -8024,16 +8860,17 @@

    6.3 – Modules

    -The path used by require to search for a Lua loader. +A string with the path used by require +to search for a Lua loader.

    At start-up, Lua initializes this variable with -the value of the environment variable LUA_PATH_5_3 or +the value of the environment variable LUA_PATH_5_4 or the environment variable LUA_PATH or with a default path defined in luaconf.h, if those environment variables are not defined. -Any ";;" in the value of the environment variable +A ";;" in the value of the environment variable is replaced by the default path. @@ -8052,6 +8889,8 @@

    6.3 – Modules

    This variable is only a reference to the real table; assignments to this variable do not change the table used by require. +The real table is stored in the C registry (see §4.3), +indexed by the key LUA_PRELOAD_TABLE, a string. @@ -8061,7 +8900,7 @@

    6.3 – Modules

    -A table used by require to control how to load modules. +A table used by require to control how to find modules.

    @@ -8069,10 +8908,14 @@

    6.3 – Modules

    When looking for a module, require calls each of these searchers in ascending order, with the module name (the argument given to require) as its -sole parameter. -The function can return another function (the module loader) -plus an extra value that will be passed to that loader, -or a string explaining why it did not find that module +sole argument. +If the searcher finds the module, +it returns another function, the module loader, +plus an extra value, a loader data, +that will be passed to that loader and +returned as a second result by require. +If it cannot find the module, +it returns a string explaining why (or nil if it has nothing to say). @@ -8135,9 +8978,15 @@

    6.3 – Modules

    All searchers except the first one (preload) return as the extra value -the file name where the module was found, +the file path where the module was found, as returned by package.searchpath. -The first searcher returns no extra value. +The first searcher always returns the string ":preload:". + + +

    +Searchers should raise no errors and have no side effects in Lua. +(They may have side effects in C, +for instance by linking the application with a library.) @@ -8178,7 +9027,7 @@

    6.3 – Modules

    Returns the resulting name of the first file that it can open in read mode (after closing the file), -or nil plus an error message if none succeeds. +or fail plus an error message if none succeeds. (This error message lists all file names it tried to open.) @@ -8189,6 +9038,8 @@

    6.3 – Modules

    6.4 – String Manipulation

    + +

    This library provides generic functions for string manipulation, such as finding and extracting substrings, and pattern matching. @@ -8262,8 +9113,10 @@

    6.4 – String Manipulation

    Functions with upvalues have only their number of upvalues saved. When (re)loaded, -those upvalues receive fresh instances containing nil. -(You can use the debug library to serialize +those upvalues receive fresh instances. +(See the load function for details about +how these upvalues are initialized. +You can use the debug library to serialize and reload the upvalues of a function in a way adequate to your needs.) @@ -8279,15 +9132,14 @@

    6.4 – String Manipulation

    pattern (see §6.4.1) in the string s. If it finds a match, then find returns the indices of s where this occurrence starts and ends; -otherwise, it returns nil. +otherwise, it returns fail. A third, optional numeric argument init specifies where to start the search; its default value is 1 and can be negative. -A value of true as a fourth, optional argument plain +A true as a fourth, optional argument plain turns off the pattern matching facilities, so the function does a plain "find substring" operation, with no characters in pattern being considered magic. -Note that if plain is given, then init must be given as well.

    @@ -8305,16 +9157,24 @@

    6.4 – String Manipulation

    Returns a formatted version of its variable number of arguments -following the description given in its first argument (which must be a string). +following the description given in its first argument, +which must be a string. The format string follows the same rules as the ISO C function sprintf. -The only differences are that the options/modifiers -*, h, L, l, n, -and p are not supported -and that there is an extra option, q. +The only differences are that the conversion specifiers and modifiers +F, n, *, h, L, and l are not supported +and that there is an extra specifier, q. +Both width and precision, when present, +are limited to two digits.

    -The q option formats a string between double quotes, +The specifier q formats booleans, nil, numbers, and strings +in a way that the result is a valid constant in Lua source code. +Booleans and nil are written in the obvious way +(true, false, nil). +Floats are written in hexadecimal, +to preserve full precision. +A string is written between double quotes, using escape sequences when necessary to ensure that it can safely be read back by the Lua interpreter. For instance, the call @@ -8327,38 +9187,53 @@

    6.4 – String Manipulation

          "a string with \"quotes\" and \
           new line"
    -
    +

    +This specifier does not support modifiers (flags, width, precision). +

    -Options +The conversion specifiers A, a, E, e, f, G, and g all expect a number as argument. -Options c, d, +The specifiers c, d, i, o, u, X, and x expect an integer. When Lua is compiled with a C89 compiler, -options A and a (hexadecimal floats) -do not support any modifier (flags, width, length). +the specifiers A and a (hexadecimal floats) +do not support modifiers.

    -Option s expects a string; +The specifier s expects a string; if its argument is not a string, it is converted to one following the same rules of tostring. -If the option has any modifier (flags, width, length), -the string argument should not contain embedded zeros. +If the specifier has any modifier, +the corresponding string argument should not contain embedded zeros. + + +

    +The specifier p formats the pointer +returned by lua_topointer. +That gives a unique string identifier for tables, userdata, +threads, strings, and functions. +For other values (numbers, nil, booleans), +this specifier results in a string representing +the pointer NULL.

    -


    string.gmatch (s, pattern)

    +

    string.gmatch (s, pattern [, init])

    Returns an iterator function that, each time it is called, returns the next captures from pattern (see §6.4.1) over the string s. If pattern specifies no captures, then the whole match is produced in each call. +A third, optional numeric argument init specifies +where to start the search; +its default value is 1 and can be negative.

    @@ -8407,9 +9282,9 @@

    6.4 – String Manipulation

    The character % works as an escape character: any sequence in repl of the form %d, with d between 1 and 9, -stands for the value of the d-th captured substring. -The sequence %0 stands for the whole match. -The sequence %% stands for a single %. +stands for the value of the d-th captured substring; +the sequence %0 stands for the whole match; +the sequence %% stands for a single %.

    @@ -8459,15 +9334,18 @@

    6.4 – String Manipulation

    end) --> x="4+5 = 9" - local t = {name="lua", version="5.3"} + local t = {name="lua", version="5.4"} x = string.gsub("$name-$version.tar.gz", "%$(%w+)", t) - --> x="lua-5.3.tar.gz" + --> x="lua-5.4.tar.gz"


    string.len (s)

    + + +

    Receives a string and returns its length. The empty string "" has length 0. Embedded zeros are counted, @@ -8478,6 +9356,9 @@

    6.4 – String Manipulation


    string.lower (s)

    + + +

    Receives a string and returns a copy of this string with all uppercase letters changed to lowercase. All other characters are left unchanged. @@ -8488,11 +9369,14 @@

    6.4 – String Manipulation


    string.match (s, pattern [, init])

    + + +

    Looks for the first match of -pattern (see §6.4.1) in the string s. +the pattern (see §6.4.1) in the string s. If it finds one, then match returns the captures from the pattern; -otherwise it returns nil. +otherwise it returns fail. If pattern specifies no captures, then the whole match is returned. A third, optional numeric argument init specifies @@ -8508,7 +9392,7 @@

    6.4 – String Manipulation

    Returns a binary string containing the values v1, v2, etc. -packed (that is, serialized in binary form) +serialized in binary form (packed) according to the format string fmt (see §6.4.2). @@ -8519,7 +9403,7 @@

    6.4 – String Manipulation

    -Returns the size of a string resulting from string.pack +Returns the length of a string resulting from string.pack with the given format. The format string cannot have the variable-length options 's' or 'z' (see §6.4.2). @@ -8529,6 +9413,9 @@

    6.4 – String Manipulation


    string.rep (s, n [, sep])

    + + +

    Returns a string that is the concatenation of n copies of the string s separated by the string sep. The default value for sep is the empty string @@ -8545,6 +9432,9 @@

    6.4 – String Manipulation


    string.reverse (s)

    + + +

    Returns a string that is the string s reversed. @@ -8552,6 +9442,9 @@

    6.4 – String Manipulation


    string.sub (s, i [, j])

    + + +

    Returns the substring of s that starts at i and continues until j; i and j can be negative. @@ -8595,6 +9488,9 @@

    6.4 – String Manipulation


    string.upper (s)

    + + +

    Receives a string and returns a copy of this string with all lowercase letters changed to uppercase. All other characters are left unchanged. @@ -8604,8 +9500,12 @@

    6.4 – String Manipulation

    + +

    6.4.1 – Patterns

    + +

    Patterns in Lua are described by regular strings, which are interpreted as patterns by the pattern-matching functions @@ -8618,6 +9518,8 @@

    6.4.1 – Patterns

    + +

    Character Class:

    A character class is used to represent a set of characters. The following combinations are allowed in describing a character class: @@ -8657,8 +9559,7 @@

    Character Class:

    This is the standard way to escape the magic characters. Any non-alphanumeric character (including all punctuation characters, even the non-magical) -can be preceded by a '%' -when used to represent itself in a pattern. +can be preceded by a '%' to represent itself in a pattern.

  • [set]: @@ -8680,7 +9581,7 @@

    Character Class:

    You can put a closing square bracket in a set by positioning it as the first character in the set. -You can put an hyphen in a set +You can put a hyphen in a set by positioning it as the first or the last character in the set. (You can also use an escape for both cases.) @@ -8723,19 +9624,19 @@

    Pattern Item:

  • a single character class followed by '*', -which matches zero or more repetitions of characters in the class. +which matches sequences of zero or more characters in the class. These repetition items will always match the longest possible sequence;
  • a single character class followed by '+', -which matches one or more repetitions of characters in the class. +which matches sequences of one or more characters in the class. These repetition items will always match the longest possible sequence;
  • a single character class followed by '-', -which also matches zero or more repetitions of characters in the class. +which also matches sequences of zero or more characters in the class. Unlike '*', these repetition items will always match the shortest possible sequence;
  • @@ -8799,13 +9700,13 @@

    Captures:

    Captures are numbered according to their left parentheses. For instance, in the pattern "(a*(.)%w(%s*))", the part of the string matching "a*(.)%w(%s*)" is -stored as the first capture (and therefore has number 1); +stored as the first capture, and therefore has number 1; the character matching "." is captured with number 2, and the part matching "%s*" has number 3.

    -As a special case, the empty capture () captures +As a special case, the capture () captures the current string position (a number). For instance, if we apply the pattern "()aa()" on the string "flaaap", there will be two captures: 3 and 5. @@ -8814,6 +9715,32 @@

    Captures:

    +

    Multiple matches:

    +The function string.gsub and the iterator string.gmatch +match multiple occurrences of the given pattern in the subject. +For these functions, +a new match is considered valid only +if it ends at least one byte after the end of the previous match. +In other words, the pattern machine never accepts the +empty string as a match immediately after another match. +As an example, +consider the results of the following code: + +

    +     > string.gsub("abc", "()a*()", print);
    +     --> 1   2
    +     --> 3   3
    +     --> 4   4
    +

    +The second and third results come from Lua matching an empty +string after 'b' and another one after 'c'. +Lua does not match an empty string after 'a', +because it would end at the same position of the previous match. + + + + +

    6.4.2 – Format Strings for Pack and Unpack

    @@ -8860,13 +9787,13 @@

    6.4.2 – Format Strings for Pack and Unpack

  • Xop: an empty item that aligns according to option op (which is otherwise ignored)
  • -
  • ' ': (empty space) ignored
  • +
  • ' ': (space) ignored
  • (A "[n]" means an optional integral numeral.) Except for padding, spaces, and configurations (options "xX <=>!"), -each option corresponds to an argument (in string.pack) -or a result (in string.unpack). +each option corresponds to an argument in string.pack +or a result in string.unpack.

    @@ -8875,6 +9802,8 @@

    6.4.2 – Format Strings for Pack and Unpack

    All integral options check overflows; string.pack checks whether the given value fits in the given size; string.unpack checks whether the read value fits in a Lua integer. +For the unsigned options, +Lua integers are treated as unsigned values too.

    @@ -8884,6 +9813,13 @@

    6.4.2 – Format Strings for Pack and Unpack

    and native endianness. +

    +Native endianness assumes that the whole system is +either big or little endian. +The packing functions will not emulate correctly the behavior +of mixed-endian formats. + +

    Alignment works as follows: For each option, @@ -8897,7 +9833,7 @@

    6.4.2 – Format Strings for Pack and Unpack

    All padding is filled with zeros by string.pack -(and ignored by string.unpack). +and ignored by string.unpack. @@ -8925,8 +9861,30 @@

    6.5 – UTF-8 Support

    negative indices count from the end of the string. +

    +Functions that create byte sequences +accept all values up to 0x7FFFFFFF, +as defined in the original UTF-8 specification; +that implies byte sequences of up to six bytes. + + +

    +Functions that interpret byte sequences only accept +valid sequences (well formed and not overlong). +By default, they only accept byte sequences +that result in valid Unicode code points, +rejecting values greater than 10FFFF and surrogates. +A boolean argument lax, when available, +lifts these checks, +so that all values up to 0x7FFFFFFF are accepted. +(Not well formed and overlong sequences are still rejected.) + +


    utf8.char (···)

    + + +

    Receives zero or more integers, converts each one to its corresponding UTF-8 byte sequence and returns a string with the concatenation of all these sequences. @@ -8936,7 +9894,10 @@

    6.5 – UTF-8 Support


    utf8.charpattern

    -The pattern (a string, not a function) "[\0-\x7F\xC2-\xF4][\x80-\xBF]*" + + +

    +The pattern (a string, not a function) "[\0-\x7F\xC2-\xFD][\x80-\xBF]*" (see §6.4.1), which matches exactly one UTF-8 byte sequence, assuming that the subject is a valid UTF-8 string. @@ -8945,7 +9906,7 @@

    6.5 – UTF-8 Support

    -


    utf8.codes (s)

    +

    utf8.codes (s [, lax])

    @@ -8954,7 +9915,7 @@

    6.5 – UTF-8 Support

          for p, c in utf8.codes(s) do body end
     

    -will iterate over all characters in string s, +will iterate over all UTF-8 characters in string s, with p being the position (in bytes) and c the code point of each character. It raises an error if it meets any invalid byte sequence. @@ -8963,8 +9924,11 @@

    6.5 – UTF-8 Support

    -


    utf8.codepoint (s [, i [, j]])

    -Returns the codepoints (as integers) from all characters in s +

    utf8.codepoint (s [, i [, j [, lax]]])

    + + +

    +Returns the code points (as integers) from all characters in s that start between byte position i and j (both included). The default for i is 1 and for j is i. It raises an error if it meets any invalid byte sequence. @@ -8973,18 +9937,24 @@

    6.5 – UTF-8 Support

    -


    utf8.len (s [, i [, j]])

    +

    utf8.len (s [, i [, j [, lax]]])

    + + +

    Returns the number of UTF-8 characters in string s that start between positions i and j (both inclusive). The default for i is 1 and for j is -1. If it finds any invalid byte sequence, -returns a false value plus the position of the first invalid byte. +returns fail plus the position of the first invalid byte.


    utf8.offset (s, n [, i])

    + + +

    Returns the position (in bytes) where the encoding of the n-th character of s (counting from position i) starts. @@ -8995,7 +9965,7 @@

    6.5 – UTF-8 Support

    n-th character from the end of the string. If the specified character is neither in the subject nor right after its end, -the function returns nil. +the function returns fail.

    @@ -9052,7 +10022,7 @@

    6.6 – Table Manipulation

    list[pos], list[pos+1], ···, list[#list]. The default value for pos is #list+1, so that a call table.insert(t,x) inserts x at the end -of list t. +of the list t. @@ -9062,7 +10032,7 @@

    6.6 – Table Manipulation

    -Moves elements from table a1 to table a2, +Moves elements from the table a1 to the table a2, performing the equivalent to the following multiple assignment: a2[t],··· = a1[f],···,a1[e]. @@ -9082,9 +10052,10 @@

    6.6 – Table Manipulation

    -Returns a new table with all parameters stored into keys 1, 2, etc. -and with a field "n" with the total number of parameters. -Note that the resulting table may not be a sequence. +Returns a new table with all arguments stored into keys 1, 2, etc. +and with a field "n" with the total number of arguments. +Note that the resulting table may not be a sequence, +if some arguments are nil. @@ -9101,14 +10072,13 @@

    6.6 – Table Manipulation

    list[pos+1], list[pos+2], ···, list[#list] and erases element list[#list]; The index pos can also be 0 when #list is 0, -or #list + 1; -in those cases, the function erases the element list[pos]. +or #list + 1.

    The default value for pos is #list, so that a call table.remove(l) removes the last element -of list l. +of the list l. @@ -9118,28 +10088,28 @@

    6.6 – Table Manipulation

    -Sorts list elements in a given order, in-place, +Sorts the list elements in a given order, in-place, from list[1] to list[#list]. If comp is given, then it must be a function that receives two list elements and returns true when the first element must come -before the second in the final order -(so that, after the sort, -i < j implies not comp(list[j],list[i])). +before the second in the final order, +so that, after the sort, +i <= j implies not comp(list[j],list[i]). If comp is not given, then the standard Lua operator < is used instead.

    -Note that the comp function must define -a strict partial order over the elements in the list; -that is, it must be asymmetric and transitive. -Otherwise, no valid sort may be possible. +The comp function must define a consistent order; +more formally, the function must define a strict weak order. +(A weak order is similar to a total order, +but it can equate different elements for comparison purposes.)

    The sort algorithm is not stable: -elements considered equal by the given order +Different elements considered equal by the given order may have their relative positions changed by the sort. @@ -9171,9 +10141,9 @@

    6.7 – Mathematical Functions

    It provides all its functions and constants inside the table math. Functions with the annotation "integer/float" give integer results for integer arguments -and float results for float (or mixed) arguments. -Rounding functions -(math.ceil, math.floor, and math.modf) +and float results for non-integer arguments. +The rounding functions +math.ceil, math.floor, and math.modf return an integer when the result fits in the range of an integer, or a float otherwise. @@ -9183,7 +10153,7 @@

    6.7 – Mathematical Functions

    -Returns the absolute value of x. (integer/float) +Returns the maximum value between x and -x. (integer/float) @@ -9213,11 +10183,11 @@

    6.7 – Mathematical Functions

    - + Returns the arc tangent of y/x (in radians), -but uses the signs of both parameters to find the +using the signs of both arguments to find the quadrant of the result. -(It also handles correctly the case of x being zero.) +It also handles correctly the case of x being zero.

    @@ -9233,7 +10203,7 @@

    6.7 – Mathematical Functions

    -Returns the smallest integral value larger than or equal to x. +Returns the smallest integral value greater than or equal to x. @@ -9274,7 +10244,7 @@

    6.7 – Mathematical Functions

    -Returns the largest integral value smaller than or equal to x. +Returns the largest integral value less than or equal to x. @@ -9296,7 +10266,7 @@

    6.7 – Mathematical Functions

    The float value HUGE_VAL, -a value larger than any other numeric value. +a value greater than any other numeric value. @@ -9319,7 +10289,7 @@

    6.7 – Mathematical Functions

    Returns the argument with the maximum value, -according to the Lua operator <. (integer/float) +according to the Lua operator <. @@ -9337,7 +10307,7 @@

    6.7 – Mathematical Functions

    Returns the argument with the minimum value, -according to the Lua operator <. (integer/float) +according to the Lua operator <. @@ -9391,25 +10361,59 @@

    6.7 – Mathematical Functions

    When called with two integers m and n, math.random returns a pseudo-random integer with uniform distribution in the range [m, n]. -(The value n-m cannot be negative and must fit in a Lua integer.) -The call math.random(n) is equivalent to math.random(1,n). +The call math.random(n), for a positive n, +is equivalent to math.random(1,n). +The call math.random(0) produces an integer with +all bits (pseudo)random.

    -This function is an interface to the underling -pseudo-random generator function provided by C. +This function uses the xoshiro256** algorithm to produce +pseudo-random 64-bit integers, +which are the results of calls with argument 0. +Other results (ranges and floats) +are unbiased extracted from these integers. + + +

    +Lua initializes its pseudo-random generator with the equivalent of +a call to math.randomseed with no arguments, +so that math.random should generate +different sequences of results each time the program runs.

    -


    math.randomseed (x)

    +

    math.randomseed ([x [, y]])

    -Sets x as the "seed" -for the pseudo-random generator: +When called with at least one argument, +the integer parameters x and y are +joined into a 128-bit seed that +is used to reinitialize the pseudo-random generator; equal seeds produce equal sequences of numbers. +The default for y is zero. + + +

    +When called with no arguments, +Lua generates a seed with +a weak attempt for randomness. + + +

    +This function returns the two seed components +that were effectively used, +so that setting them again repeats the sequence. + + +

    +To ensure a required level of randomness to the initial state +(or contrarily, to have a deterministic sequence, +for instance when debugging a program), +you should call math.randomseed with explicit arguments. @@ -9452,7 +10456,7 @@

    6.7 – Mathematical Functions

    If the value x is convertible to an integer, returns that integer. -Otherwise, returns nil. +Otherwise, returns fail. @@ -9464,7 +10468,7 @@

    6.7 – Mathematical Functions

    Returns "integer" if x is an integer, "float" if it is a float, -or nil if x is not a number. +or fail if x is not a number. @@ -9475,7 +10479,7 @@

    6.7 – Mathematical Functions

    Returns a boolean, -true if and only if integer m is below integer n when +true if and only if integer m is below integer n when they are compared as unsigned integers. @@ -9491,7 +10495,7 @@

    6.8 – Input and Output Facilities

    The first one uses implicit file handles; that is, there are operations to set a default input file and a default output file, -and all input/output operations are over these default files. +and all input/output operations are done over these default files. The second style uses explicit file handles. @@ -9503,6 +10507,12 @@

    6.8 – Input and Output Facilities

    and then all operations are supplied as methods of the file handle. +

    +The metatable for file handles provides metamethods +for __gc and __close that try +to close the file when called. + +

    The table io also provides three predefined file handles with their usual meanings from C: @@ -9512,10 +10522,10 @@

    6.8 – Input and Output Facilities

    Unless otherwise stated, -all I/O functions return nil on failure -(plus an error message as a second result and -a system-dependent error code as a third result) -and some value different from nil on success. +all I/O functions return fail on failure, +plus an error message as a second result and +a system-dependent error code as a third result, +and some non-false value on success. On non-POSIX systems, the computation of the error message and error code in case of errors @@ -9553,7 +10563,7 @@

    6.8 – Input and Output Facilities

    and sets its handle as the default input file. When called with a file handle, it simply sets this file handle as the default input file. -When called without parameters, +When called without arguments, it returns the current default input file. @@ -9572,19 +10582,27 @@

    6.8 – Input and Output Facilities

    Opens the given file name in read mode and returns an iterator function that works like file:lines(···) over the opened file. -When the iterator function detects the end of file, -it returns no values (to finish the loop) and automatically closes the file. +When the iterator function fails to read any value, +it automatically closes the file. +Besides the iterator function, +io.lines returns three other values: +two nil values as placeholders, +plus the created file handle. +Therefore, when used in a generic for loop, +the file is closed also if the loop is interrupted by an +error or a break.

    The call io.lines() (with no file name) is equivalent -to io.input():lines("*l"); +to io.input():lines("l"); that is, it iterates over the lines of the default input file. -In this case it does not close the file when the loop ends. +In this case, the iterator does not close the file when the loop ends.

    -In case of errors this function raises the error, +In case of errors opening the file, +this function raises the error, instead of returning an error code. @@ -9639,7 +10657,7 @@

    6.8 – Input and Output Facilities

    -Starts program prog in a separated process and returns +Starts the program prog in a separated process and returns a file handle that you can use to read data from this program (if mode is "r", the default) or to write data to this program @@ -9679,7 +10697,7 @@

    6.8 – Input and Output Facilities

    Checks whether obj is a valid file handle. Returns the string "file" if obj is an open file handle, "closed file" if obj is a closed file handle, -or nil if obj is not a file handle. +or fail if obj is not a file handle. @@ -9744,11 +10762,6 @@

    6.8 – Input and Output Facilities

    when the loop ends. -

    -In case of errors this function raises the error, -instead of returning an error code. - -

    @@ -9760,10 +10773,10 @@

    6.8 – Input and Output Facilities

    according to the given formats, which specify what to read. For each format, the function returns a string or a number with the characters read, -or nil if it cannot read data with the specified format. +or fail if it cannot read data with the specified format. (In this latter case, the function does not read subsequent formats.) -When called without formats, +When called without arguments, it uses a default format that reads the next line (see below). @@ -9776,36 +10789,38 @@

    6.8 – Input and Output Facilities

  • "n": reads a numeral and returns it as a float or an integer, following the lexical conventions of Lua. -(The numeral may have leading spaces and a sign.) +(The numeral may have leading whitespaces and a sign.) This format always reads the longest input sequence that is a valid prefix for a numeral; if that prefix does not form a valid numeral -(e.g., an empty string, "0x", or "3.4e-"), -it is discarded and the function returns nil. +(e.g., an empty string, "0x", or "3.4e-") +or it is too long (more than 200 characters), +it is discarded and the format returns fail.
  • "a": reads the whole file, starting at the current position. -On end of file, it returns the empty string. +On end of file, it returns the empty string; +this format never fails.
  • "l": reads the next line skipping the end of line, -returning nil on end of file. +returning fail on end of file. This is the default format.
  • "L": reads the next line keeping the end-of-line character (if present), -returning nil on end of file. +returning fail on end of file.
  • number: reads a string with up to this number of bytes, -returning nil on end of file. +returning fail on end of file. If number is zero, it reads nothing and returns an empty string, -or nil on end of file. +or fail on end of file.
  • @@ -9831,7 +10846,7 @@

    6.8 – Input and Output Facilities

    In case of success, seek returns the final file position, measured in bytes from the beginning of the file. -If seek fails, it returns nil, +If seek fails, it returns fail, plus a string describing the error. @@ -9853,31 +10868,25 @@

    6.8 – Input and Output Facilities

    -Sets the buffering mode for an output file. +Sets the buffering mode for a file. There are three available modes:

      +
    • "no": no buffering.
    • +
    • "full": full buffering.
    • +
    • "line": line buffering.
    • +
    -
  • "no": -no buffering; the result of any output operation appears immediately. -
  • - -
  • "full": -full buffering; output operation is performed only -when the buffer is full or when -you explicitly flush the file (see io.flush). -
  • +

    +For the last two cases, +size is a hint for the size of the buffer, in bytes. +The default is an appropriate size. -

  • "line": -line buffering; output is buffered until a newline is output -or there is any input from some special files -(such as a terminal device). -
  • -

    -For the last two cases, size -specifies the size of the buffer, in bytes. -The default is an appropriate size. +

    +The specific behavior of each mode is non portable; +check the underlying ISO C function setvbuf in your platform for +more details. @@ -9893,7 +10902,6 @@

    6.8 – Input and Output Facilities

    In case of success, this function returns file. -Otherwise it returns nil plus a string describing the error. @@ -9913,7 +10921,8 @@

    6.9 – Operating System Facilities

    Returns an approximation of the amount in seconds of CPU time -used by the program. +used by the program, +as returned by the underlying ISO C function clock. @@ -9941,7 +10950,8 @@

    6.9 – Operating System Facilities

    if format is the string "*t", then date returns a table with the following fields: year, month (1–12), day (1–31), -hour (0–23), min (0–59), sec (0–61), +hour (0–23), min (0–59), +sec (0–61, due to leap seconds), wday (weekday, 1–7, Sunday is 1), yday (day of the year, 1–366), and isdst (daylight saving flag, a boolean). @@ -9956,10 +10966,9 @@

    6.9 – Operating System Facilities

    -When called without arguments, -date returns a reasonable date and time representation that depends on -the host system and on the current locale. -(More specifically, os.date() is equivalent to os.date("%c").) +If format is absent, it defaults to "%c", +which gives a human-readable date and time representation +using the current locale.

    @@ -9993,7 +11002,7 @@

    6.9 – Operating System Facilities

    It passes command to be executed by an operating system shell. Its first result is true if the command terminated successfully, -or nil otherwise. +or fail otherwise. After this first result the function returns a string plus a number, as follows: @@ -10036,7 +11045,7 @@

    6.9 – Operating System Facilities

    If the optional second argument close is true, -closes the Lua state before exiting. +the function closes the Lua state before exiting (see lua_close). @@ -10046,8 +11055,8 @@

    6.9 – Operating System Facilities

    -Returns the value of the process environment variable varname, -or nil if the variable is not defined. +Returns the value of the process environment variable varname +or fail if the variable is not defined. @@ -10059,7 +11068,7 @@

    6.9 – Operating System Facilities

    Deletes the file (or empty directory, on POSIX systems) with the given name. -If this function fails, it returns nil, +If this function fails, it returns fail plus a string describing the error and the error code. Otherwise, it returns true. @@ -10072,7 +11081,7 @@

    6.9 – Operating System Facilities

    Renames the file or directory named oldname to newname. -If this function fails, it returns nil, +If this function fails, it returns fail, plus a string describing the error and the error code. Otherwise, it returns true. @@ -10091,7 +11100,7 @@

    6.9 – Operating System Facilities

    "monetary", "numeric", or "time"; the default category is "all". The function returns the name of the new locale, -or nil if the request cannot be honored. +or fail if the request cannot be honored.

    @@ -10132,11 +11141,12 @@

    6.9 – Operating System Facilities

    -The values in these fields do not need to be inside their valid ranges. +When the function is called, +the values in these fields do not need to be inside their valid ranges. For instance, if sec is -10, -it means -10 seconds from the time specified by the other fields; +it means 10 seconds before the time specified by the other fields; if hour is 1000, -it means +1000 hours from the time specified by the other fields. +it means 1000 hours after the time specified by the other fields.

    @@ -10149,6 +11159,14 @@

    6.9 – Operating System Facilities

    os.date and os.difftime. +

    +When called with a table, +os.time also normalizes all the fields +documented in the os.date function, +so that they represent the same time as before the call +but with values inside their valid ranges. + +

    @@ -10163,7 +11181,7 @@

    6.9 – Operating System Facilities

    -On POSIX systems, +In POSIX systems, this function also creates a file with that name, to avoid security risks. (Someone else might create the file with wrong permissions @@ -10187,7 +11205,7 @@

    6.10 – The Debug Library

    This library provides -the functionality of the debug interface (§4.9) to Lua programs. +the functionality of the debug interface (§4.7) to Lua programs. You should exert care when using this library. Several of its functions violate basic assumptions about Lua code @@ -10236,8 +11254,12 @@

    6.10 – The Debug Library

    Returns the current hook settings of the thread, as three values: the current hook function, the current hook mask, -and the current hook count -(as set by the debug.sethook function). +and the current hook count, +as set by the debug.sethook function. + + +

    +Returns fail if there is no active hook. @@ -10254,10 +11276,10 @@

    6.10 – The Debug Library

    of the given thread: level 0 is the current function (getinfo itself); level 1 is the function that called getinfo -(except for tail calls, which do not count on the stack); +(except for tail calls, which do not count in the stack); and so on. -If f is a number larger than the number of active functions, -then getinfo returns nil. +If f is a number greater than the number of active functions, +then getinfo returns fail.

    @@ -10265,13 +11287,13 @@

    6.10 – The Debug Library

    with the string what describing which fields to fill in. The default for what is to get all information available, except the table of valid lines. -If present, -the option 'f' +The option 'f' adds a field named func with the function itself. -If present, -the option 'L' -adds a field named activelines with the table of -valid lines. +The option 'L' adds a field named activelines +with the table of valid lines, +provided the function is a Lua function. +If the function has no debug information, +the table is empty.

    @@ -10293,7 +11315,7 @@

    6.10 – The Debug Library

    This function returns the name and the value of the local variable with index local of the function at level f of the stack. This function accesses not only explicit local variables, -but also parameters, temporaries, etc. +but also parameters and temporary values.

    @@ -10301,9 +11323,12 @@

    6.10 – The Debug Library

    following the order that they are declared in the code, counting only the variables that are active in the current scope of the function. -Negative indices refer to vararg parameters; --1 is the first vararg parameter. -The function returns nil if there is no variable with the given index, +Compile-time constants may not appear in this listing, +if they were optimized away by the compiler. +Negative indices refer to vararg arguments; +-1 is the first vararg argument. +The function returns fail +if there is no variable with the given index, and raises an error when called with a level out of range. (You can call debug.getinfo to check whether the level is valid.) @@ -10338,7 +11363,7 @@

    6.10 – The Debug Library

    -Returns the registry table (see §4.5). +Returns the registry table (see §4.3). @@ -10350,25 +11375,37 @@

    6.10 – The Debug Library

    This function returns the name and the value of the upvalue with index up of the function f. -The function returns nil if there is no upvalue with the given index. +The function returns fail +if there is no upvalue with the given index.

    -Variable names starting with '(' (open parenthesis) -represent variables with no known names +(For Lua functions, +upvalues are the external local variables that the function uses, +and that are consequently included in its closure.) + + +

    +For C functions, this function uses the empty string "" +as a name for all upvalues. + + +

    +Variable name '?' (interrogation mark) +represents variables with no known names (variables from chunks saved without debug information).

    -


    debug.getuservalue (u)

    +

    debug.getuservalue (u, n)

    -Returns the Lua value associated to u. -If u is not a full userdata, -returns nil. +Returns the n-th user value associated +to the userdata u plus a boolean, +false if the userdata does not have that value. @@ -10378,7 +11415,7 @@

    6.10 – The Debug Library

    -Sets the given function as a hook. +Sets the given function as the debug hook. The string mask and the number count describe when the hook will be called. The string mask may have any combination of the following characters, @@ -10402,16 +11439,15 @@

    6.10 – The Debug Library

    When the hook is called, its first parameter is a string describing the event that has triggered its call: -"call" (or "tail call"), -"return", +"call", "tail call", "return", "line", and "count". For line events, the hook also gets the new line number as its second parameter. Inside a hook, you can call getinfo with level 2 to get more information about -the running function -(level 0 is the getinfo function, -and level 1 is the hook function). +the running function. +(Level 0 is the getinfo function, +and level 1 is the hook function.) @@ -10423,7 +11459,7 @@

    6.10 – The Debug Library

    This function assigns the value value to the local variable with index local of the function at level level of the stack. -The function returns nil if there is no local +The function returns fail if there is no local variable with the given index, and raises an error when called with a level out of range. (You can call getinfo to check whether the level is valid.) @@ -10456,25 +11492,30 @@

    6.10 – The Debug Library

    This function assigns the value value to the upvalue with index up of the function f. -The function returns nil if there is no upvalue +The function returns fail if there is no upvalue with the given index. Otherwise, it returns the name of the upvalue. +

    +See debug.getupvalue for more information about upvalues. + +

    -


    debug.setuservalue (udata, value)

    +

    debug.setuservalue (udata, value, n)

    Sets the given value as -the Lua value associated to the given udata. +the n-th user value associated to the given udata. udata must be a full userdata.

    -Returns udata. +Returns udata, +or fail if the userdata does not have that value. @@ -10541,7 +11582,7 @@

    7 – Lua Standalone

    called simply lua, is provided with the standard distribution. The standalone interpreter includes -all standard libraries, including the debug library. +all standard libraries. Its usage is:
    @@ -10550,14 +11591,22 @@ 

    7 – Lua Standalone

    The options are:
      -
    • -e stat: executes string stat;
    • -
    • -l mod: "requires" mod;
    • -
    • -i: enters interactive mode after running script;
    • -
    • -v: prints version information;
    • -
    • -E: ignores environment variables;
    • -
    • --: stops handling options;
    • -
    • -: executes stdin as a file and stops handling options.
    • +
    • -e stat: execute string stat;
    • +
    • -i: enter interactive mode after running script;
    • +
    • -l mod: "require" mod and assign the + result to global mod;
    • +
    • -l g=mod: "require" mod and assign the + result to global g;
    • +
    • -v: print version information;
    • +
    • -E: ignore environment variables;
    • +
    • -W: turn warnings on;
    • +
    • --: stop handling options;
    • +
    • -: execute stdin as a file and stop handling options.

    +(The form -l g=mod was introduced in release 5.4.4.) + + +

    After handling its options, lua runs the given script. When called without arguments, lua behaves as lua -v -i @@ -10566,8 +11615,8 @@

    7 – Lua Standalone

    -When called without option -E, -the interpreter checks for an environment variable LUA_INIT_5_3 +When called without the option -E, +the interpreter checks for an environment variable LUA_INIT_5_4 (or LUA_INIT if the versioned name is not defined) before running any argument. If the variable content has the format @filename, @@ -10576,23 +11625,26 @@

    7 – Lua Standalone

    -When called with option -E, -besides ignoring LUA_INIT, -Lua also ignores -the values of LUA_PATH and LUA_CPATH, -setting the values of -package.path and package.cpath -with the default paths defined in luaconf.h. +When called with the option -E, +Lua does not consult any environment variables. +In particular, +the values of package.path and package.cpath +are set with the default paths defined in luaconf.h. +To signal to the libraries that this option is on, +the stand-alone interpreter sets the field +"LUA_NOENV" in the registry to a true value. +Other libraries may consult this field for the same purpose.

    -All options are handled in order, except -i and -E. +The options -e, -l, and -W are handled in +the order they appear. For instance, an invocation like

    -     $ lua -e'a=1' -e 'print(a)' script.lua
    +     $ lua -e 'a=1' -llib1 script.lua
     

    -will first set a to 1, then print the value of a, +will first set a to 1, then require the library lib1, and finally run the file script.lua with no arguments. (Here $ is the shell prompt. Your prompt may be different.) @@ -10629,10 +11681,10 @@

    7 – Lua Standalone

    will print "-e". If there is a script, -the script is called with parameters +the script is called with arguments arg[1], ···, arg[#arg]. -(Like all chunks in Lua, -the script is compiled as a vararg function.) +Like all chunks in Lua, +the script is compiled as a variadic function.

    @@ -10663,6 +11715,8 @@

    7 – Lua Standalone

    the interpreter calls this metamethod to produce the final message. Otherwise, the interpreter converts the error object to a string and adds a stack traceback to it. +When warnings are on, +they are simply printed in the standard error output.

    @@ -10676,8 +11730,7 @@

    7 – Lua Standalone

    To allow the use of Lua as a script interpreter in Unix systems, -the standalone interpreter skips -the first line of a chunk if it starts with #. +Lua skips the first line of a file chunk if it starts with #. Therefore, Lua scripts can be made into executable programs by using chmod +x and the #! form, as in @@ -10685,7 +11738,7 @@

    7 – Lua Standalone

          #!/usr/local/bin/lua
     

    -(Of course, +Of course, the location of the Lua interpreter may be different in your machine. If lua is in your PATH, then @@ -10693,19 +11746,31 @@

    7 – Lua Standalone

          #!/usr/bin/env lua
     

    -is a more portable solution.) +is a more portable solution.

    8 – Incompatibilities with the Previous Version

    + +

    Here we list the incompatibilities that you may find when moving a program -from Lua 5.2 to Lua 5.3. +from Lua 5.3 to Lua 5.4. + + +

    You can avoid some incompatibilities by compiling Lua with appropriate options (see file luaconf.h). However, all these compatibility options will be removed in the future. +More often than not, +compatibility issues arise when these compatibility options +are removed. +So, whenever you have the chance, +you should try to test your code with a version of Lua compiled +with all compatibility options turned off. +That will ease transitions to newer versions of Lua.

    @@ -10714,7 +11779,7 @@

    8 – Incompatibilities with the Previous Version

    such as the numeric values for constants or the implementation of functions as macros. Therefore, -you should not assume that binaries are compatible between +you should never assume that binaries are compatible between different Lua versions. Always recompile clients of the Lua API when using a new version. @@ -10732,49 +11797,57 @@

    8 – Incompatibilities with the Previous Version

    -

    8.1 – Changes in the Language

    + + +

    8.1 – Incompatibilities in the Language

    • -The main difference between Lua 5.2 and Lua 5.3 is the -introduction of an integer subtype for numbers. -Although this change should not affect "normal" computations, -some computations -(mainly those that involve some kind of overflow) -can give different results. - - -

      -You can fix these differences by forcing a number to be a float -(in Lua 5.2 all numbers were float), -in particular writing constants with an ending .0 -or using x = x + 0.0 to convert a variable. -(This recommendation is only for a quick fix -for an occasional incompatibility; -it is not a general guideline for good programming. -For good programming, -use floats where you need floats -and integers where you need integers.) +The coercion of strings to numbers in +arithmetic and bitwise operations +has been removed from the core language. +The string library does a similar job +for arithmetic (but not for bitwise) operations +using the string metamethods. +However, unlike in previous versions, +the new implementation preserves the implicit type of the numeral +in the string. +For instance, the result of "1" + "2" now is an integer, +not a float. +

    • + +
    • +Literal decimal integer constants that overflow are read as floats, +instead of wrapping around. +You can use hexadecimal notation for such constants if you +want the old behavior +(reading them as integers with wrap around).
    • -The conversion of a float to a string now adds a .0 suffix -to the result if it looks like an integer. -(For instance, the float 2.0 will be printed as 2.0, -not as 2.) -You should always use an explicit format -when you need a specific format for numbers. +The use of the __lt metamethod to emulate __le +has been removed. +When needed, this metamethod must be explicitly defined. +
    • +
    • +The semantics of the numerical for loop +over integers changed in some details. +In particular, the control variable never wraps around. +
    • -

      -(Formally this is not an incompatibility, -because Lua does not specify how numbers are formatted as strings, -but some programs assumed a specific format.) +

    • +A label for a goto cannot be declared where a label with the same +name is visible, even if this other label is declared in an enclosing +block.
    • -The generational mode for the garbage collector was removed. -(It was an experimental feature in Lua 5.2.) +When finalizing an object, +Lua does not ignore __gc metamethods that are not functions. +Any value will be called, if present. +(Non-callable values will generate a warning, +like any other error when calling a finalizer.)
    @@ -10782,61 +11855,43 @@

    8.1 – Changes in the Language

    -

    8.2 – Changes in the Libraries

    +

    8.2 – Incompatibilities in the Libraries

    • -The bit32 library has been deprecated. -It is easy to require a compatible external library or, -better yet, to replace its functions with appropriate bitwise operations. -(Keep in mind that bit32 operates on 32-bit integers, -while the bitwise operators in Lua 5.3 operate on Lua integers, -which by default have 64 bits.) -
    • - -
    • -The Table library now respects metamethods -for setting and getting elements. +The function print does not call tostring +to format its arguments; +instead, it has this functionality hardwired. +You should use __tostring to modify how values are printed.
    • -The ipairs iterator now respects metamethods and -its __ipairs metamethod has been deprecated. +The pseudo-random number generator used by the function math.random +now starts with a somewhat random seed. +Moreover, it uses a different algorithm.
    • -Option names in io.read do not have a starting '*' anymore. -For compatibility, Lua will continue to accept (and ignore) this character. +By default, the decoding functions in the utf8 library +do not accept surrogates as valid code points. +An extra parameter in these functions makes them more permissive.
    • -The following functions were deprecated in the mathematical library: -atan2, cosh, sinh, tanh, pow, -frexp, and ldexp. -You can replace math.pow(x,y) with x^y; -you can replace math.atan2 with math.atan, -which now accepts one or two parameters; -you can replace math.ldexp(x,exp) with x * 2.0^exp. -For the other operations, -you can either use an external library or -implement them in Lua. +The options "setpause" and "setstepmul" +of the function collectgarbage are deprecated. +You should use the new option "incremental" to set them.
    • -The searcher for C loaders used by require -changed the way it handles versioned names. -Now, the version should come after the module name -(as is usual in most other tools). -For compatibility, that searcher still tries the old format -if it cannot find an open function according to the new style. -(Lua 5.2 already worked that way, -but it did not document the change.) -
    • - -
    • -The call collectgarbage("count") now returns only one result. -(You can compute that second result from the fractional part -of the first result.) +The function io.lines now returns four values, +instead of just one. +That can be a problem when it is used as the sole +argument to another function that has optional parameters, +such as in load(io.lines(filename, "L")). +To fix that issue, +you can wrap the call into parentheses, +to adjust its number of results to one.
    @@ -10844,37 +11899,54 @@

    8.2 – Changes in the Libraries

    -

    8.3 – Changes in the API

    +

    8.3 – Incompatibilities in the API

    • -Continuation functions now receive as parameters what they needed -to get through lua_getctx, -so lua_getctx has been removed. -Adapt your code accordingly. +Full userdata now has an arbitrary number of associated user values. +Therefore, the functions lua_newuserdata, +lua_setuservalue, and lua_getuservalue were +replaced by lua_newuserdatauv, +lua_setiuservalue, and lua_getiuservalue, +which have an extra argument. + + +

      +For compatibility, the old names still work as macros assuming +one single user value. +Note, however, that userdata with zero user values +are more efficient memory-wise. +

    • + +
    • +The function lua_resume has an extra parameter. +This out parameter returns the number of values on +the top of the stack that were yielded or returned by the coroutine. +(In previous versions, +those values were the entire stack.)
    • -Function lua_dump has an extra parameter, strip. -Use 0 as the value of this parameter to get the old behavior. +The function lua_version returns the version number, +instead of an address of the version number. +The Lua core should work correctly with libraries using their +own static copies of the same core, +so there is no need to check whether they are using the same +address space.
    • -Functions to inject/project unsigned integers -(lua_pushunsigned, lua_tounsigned, lua_tounsignedx, -luaL_checkunsigned, luaL_optunsigned) -were deprecated. -Use their signed equivalents with a type cast. +The constant LUA_ERRGCMM was removed. +Errors in finalizers are never propagated; +instead, they generate a warning.
    • -Macros to project non-default integer types -(luaL_checkint, luaL_optint, luaL_checklong, luaL_optlong) -were deprecated. -Use their equivalent over lua_Integer with a type cast -(or, when possible, use lua_Integer in your code). +The options LUA_GCSETPAUSE and LUA_GCSETSTEPMUL +of the function lua_gc are deprecated. +You should use the new option LUA_GCINC to set them.
    @@ -10917,7 +11989,11 @@

    9 – The Complete Syntax of Lua

    for namelist in explist do block end | function funcname funcbody | local function Name funcbody | - local namelist [‘=’ explist] + local attnamelist [‘=’ explist] + + attnamelist ::= Name attrib {‘,’ Name attrib} + + attrib ::= [‘<’ Name ‘>’] retstat ::= return [explist] [‘;’] @@ -10972,13 +12048,12 @@

    9 – The Complete Syntax of Lua

    - diff --git a/LuaSkin/lua-5.4.7/doc/readme.html b/LuaSkin/lua-5.4.7/doc/readme.html new file mode 100644 index 000000000..3bcefadfe --- /dev/null +++ b/LuaSkin/lua-5.4.7/doc/readme.html @@ -0,0 +1,339 @@ + + + +Lua 5.4 readme + + + + + + + +

    +Lua +Welcome to Lua 5.4 +

    + + + +

    About Lua

    +

    +Lua is a powerful, efficient, lightweight, embeddable scripting language +developed by a +team +at +PUC-Rio, +the Pontifical Catholic University of Rio de Janeiro in Brazil. +Lua is +free software +used in +many products and projects +around the world. + +

    +Lua's +official website +provides complete information +about Lua, +including +an +executive summary, +tips on +getting started, +and +updated +documentation, +especially the +reference manual, +which may differ slightly from the +local copy +distributed in this package. + +

    Installing Lua

    +

    +Lua is distributed in +source +form. +You need to build it before using it. +Building Lua should be straightforward +because +Lua is implemented in pure ANSI C and compiles unmodified in all known +platforms that have an ANSI C compiler. +Lua also compiles unmodified as C++. +The instructions given below for building Lua are for Unix-like platforms, +such as Linux and macOS. +See also +instructions for other systems +and +customization options. + +

    +If you don't have the time or the inclination to compile Lua yourself, +get a binary from +LuaBinaries. + +

    Building Lua

    +

    +In most common Unix-like platforms, simply do "make". +Here are the details. + +

      +
    1. +Open a terminal window and move to +the top-level directory, which is named lua-5.4.7. +The Makefile there controls both the build process and the installation process. +

      +

    2. + Do "make". The Makefile will guess your platform and build Lua for it. +

      +

    3. + If the guess failed, do "make help" and see if your platform is listed. + The platforms currently supported are: +

      +

      + guess aix bsd c89 freebsd generic ios linux linux-readline macosx mingw posix solaris +

      +

      + If your platform is listed, just do "make xxx", where xxx + is your platform name. +

      + If your platform is not listed, try the closest one or posix, generic, + c89, in this order. +

      +

    4. +The compilation takes only a few moments +and produces three files in the src directory: +lua (the interpreter), +luac (the compiler), +and liblua.a (the library). +

      +

    5. + To check that Lua has been built correctly, do "make test" + after building Lua. This will run the interpreter and print its version. +
    +

    +If you're running Linux, try "make linux-readline" to build the interactive Lua interpreter with handy line-editing and history capabilities. +If you get compilation errors, +make sure you have installed the readline development package +(which is probably named libreadline-dev or readline-devel). +If you get link errors after that, +then try "make linux-readline MYLIBS=-ltermcap". + +

    Installing Lua

    +

    + Once you have built Lua, you may want to install it in an official + place in your system. In this case, do "make install". The official + place and the way to install files are defined in the Makefile. You'll + probably need the right permissions to install files, and so may need to do "sudo make install". + +

    + To build and install Lua in one step, do "make all install", + or "make xxx install", + where xxx is your platform name. + +

    + To install Lua locally after building it, do "make local". + This will create a directory install with subdirectories + bin, include, lib, man, share, + and install Lua as listed below. + + To install Lua locally, but in some other directory, do + "make install INSTALL_TOP=xxx", where xxx is your chosen directory. + The installation starts in the src and doc directories, + so take care if INSTALL_TOP is not an absolute path. + +

    +
    + bin: +
    + lua luac +
    + include: +
    + lua.h luaconf.h lualib.h lauxlib.h lua.hpp +
    + lib: +
    + liblua.a +
    + man/man1: +
    + lua.1 luac.1 +
    + +

    + These are the only directories you need for development. + If you only want to run Lua programs, + you only need the files in bin and man. + The files in include and lib are needed for + embedding Lua in C or C++ programs. + +

    Customization

    +

    + Three kinds of things can be customized by editing a file: +

      +
    • Where and how to install Lua — edit Makefile. +
    • How to build Lua — edit src/Makefile. +
    • Lua features — edit src/luaconf.h. +
    + +

    + You don't actually need to edit the Makefiles because you may set the + relevant variables in the command line when invoking make. + Nevertheless, it's probably best to edit and save the Makefiles to + record the changes you've made. + +

    + On the other hand, if you need to customize some Lua features, + edit src/luaconf.h before building and installing Lua. + The edited file will be the one installed, and + it will be used by any Lua clients that you build, to ensure consistency. + Further customization is available to experts by editing the Lua sources. + +

    Building Lua on other systems

    +

    + If you're not using the usual Unix tools, then the instructions for + building Lua depend on the compiler you use. You'll need to create + projects (or whatever your compiler uses) for building the library, + the interpreter, and the compiler, as follows: + +

    +
    +library: +
    +lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c +lauxlib.c lbaselib.c lcorolib.c ldblib.c liolib.c lmathlib.c loadlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c linit.c +
    +interpreter: +
    + library, lua.c +
    +compiler: +
    + library, luac.c +
    + +

    + To use Lua as a library in your own programs, you need to know how to + create and use libraries with your compiler. Moreover, to dynamically load + C libraries for Lua, you'll need to know how to create dynamic libraries + and you'll need to make sure that the Lua API functions are accessible to + those dynamic libraries — but don't link the Lua library + into each dynamic library. For Unix, we recommend that the Lua library + be linked statically into the host program and its symbols exported for + dynamic linking; src/Makefile does this for the Lua interpreter. + For Windows, we recommend that the Lua library be a DLL. + In all cases, the compiler luac should be linked statically. + +

    + As mentioned above, you may edit src/luaconf.h to customize + some features before building Lua. + +

    Changes since Lua 5.3

    +

    +Here are the main changes introduced in Lua 5.4. +The +reference manual +lists the +incompatibilities that had to be introduced. + +

    Main changes

    +
      +
    • new generational mode for garbage collection +
    • to-be-closed variables +
    • const variables +
    • userdata can have multiple user values +
    • new implementation for math.random +
    • warning system +
    • debug information about function arguments and returns +
    • new semantics for the integer 'for' loop +
    • optional 'init' argument to 'string.gmatch' +
    • new functions 'lua_resetthread' and 'coroutine.close' +
    • string-to-number coercions moved to the string library +
    • allocation function allowed to fail when shrinking a memory block +
    • new format '%p' in 'string.format' +
    • utf8 library accepts codepoints up to 2^31 +
    + +

    License

    +

    + +[Open Source Initiative Approved License] + +Lua is free software distributed under the terms of the +MIT license +reproduced below; +it may be used for any purpose, including commercial purposes, +at absolutely no cost without having to ask us. + +The only requirement is that if you do use Lua, +then you should give us credit by including the appropriate copyright notice somewhere in your product or its documentation. + +For details, see the +license page. + +

    +Copyright © 1994–2024 Lua.org, PUC-Rio. + +

    +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +

    +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +

    +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +

    +

    + +

    + + + + diff --git a/LuaSkin/lua-5.4.7/src/Makefile b/LuaSkin/lua-5.4.7/src/Makefile new file mode 100644 index 000000000..b7711963b --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/Makefile @@ -0,0 +1,225 @@ +# Makefile for building Lua +# See ../doc/readme.html for installation and customization instructions. + +# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= + +# Your platform. See PLATS for possible values. +PLAT= guess + +CC= gcc -std=gnu99 +CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_3 $(SYSCFLAGS) $(MYCFLAGS) +LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) +LIBS= -lm $(SYSLIBS) $(MYLIBS) + +AR= ar rcu +RANLIB= ranlib +RM= rm -f +UNAME= uname + +SYSCFLAGS= +SYSLDFLAGS= +SYSLIBS= + +MYCFLAGS= +MYLDFLAGS= +MYLIBS= +MYOBJS= + +# Special flags for compiler modules; -Os reduces code size. +CMCFLAGS= + +# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE ======= + +PLATS= guess aix bsd c89 freebsd generic ios linux linux-readline macosx mingw posix solaris + +LUA_A= liblua.a +CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o +LIB_O= lauxlib.o lbaselib.o lcorolib.o ldblib.o liolib.o lmathlib.o loadlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o linit.o +BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS) + +LUA_T= lua +LUA_O= lua.o + +LUAC_T= luac +LUAC_O= luac.o + +ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O) +ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) +ALL_A= $(LUA_A) + +# Targets start here. +default: $(PLAT) + +all: $(ALL_T) + +o: $(ALL_O) + +a: $(ALL_A) + +$(LUA_A): $(BASE_O) + $(AR) $@ $(BASE_O) + $(RANLIB) $@ + +$(LUA_T): $(LUA_O) $(LUA_A) + $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) + +$(LUAC_T): $(LUAC_O) $(LUA_A) + $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) + +test: + ./$(LUA_T) -v + +clean: + $(RM) $(ALL_T) $(ALL_O) + +depend: + @$(CC) $(CFLAGS) -MM l*.c + +echo: + @echo "PLAT= $(PLAT)" + @echo "CC= $(CC)" + @echo "CFLAGS= $(CFLAGS)" + @echo "LDFLAGS= $(LDFLAGS)" + @echo "LIBS= $(LIBS)" + @echo "AR= $(AR)" + @echo "RANLIB= $(RANLIB)" + @echo "RM= $(RM)" + @echo "UNAME= $(UNAME)" + +# Convenience targets for popular platforms. +ALL= all + +help: + @echo "Do 'make PLATFORM' where PLATFORM is one of these:" + @echo " $(PLATS)" + @echo "See doc/readme.html for complete instructions." + +guess: + @echo Guessing `$(UNAME)` + @$(MAKE) `$(UNAME)` + +AIX aix: + $(MAKE) $(ALL) CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-ldl" SYSLDFLAGS="-brtl -bexpall" + +bsd: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-Wl,-E" + +c89: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_C89" CC="gcc -std=c89" + @echo '' + @echo '*** C89 does not guarantee 64-bit integers for Lua.' + @echo '*** Make sure to compile all external Lua libraries' + @echo '*** with LUA_USE_C89 to ensure consistency' + @echo '' + +FreeBSD NetBSD OpenBSD freebsd: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc" + +generic: $(ALL) + +ios: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_IOS" + +Linux linux: linux-noreadline + +linux-noreadline: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl" + +linux-readline: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE" SYSLIBS="-Wl,-E -ldl -lreadline" + +Darwin macos macosx: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX -DLUA_USE_READLINE" SYSLIBS="-lreadline" + +mingw: + $(MAKE) "LUA_A=lua54.dll" "LUA_T=lua.exe" \ + "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \ + "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe + $(MAKE) "LUAC_T=luac.exe" luac.exe + +posix: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX" + +SunOS solaris: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN -D_REENTRANT" SYSLIBS="-ldl" + +# Targets that do not create files (not all makes understand .PHONY). +.PHONY: all $(PLATS) help test clean default o a depend echo + +# Compiler modules may use special flags. +llex.o: + $(CC) $(CFLAGS) $(CMCFLAGS) -c llex.c + +lparser.o: + $(CC) $(CFLAGS) $(CMCFLAGS) -c lparser.c + +lcode.o: + $(CC) $(CFLAGS) $(CMCFLAGS) -c lcode.c + +# DO NOT DELETE + +lapi.o: lapi.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ + lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lstring.h \ + ltable.h lundump.h lvm.h +lauxlib.o: lauxlib.c lprefix.h lua.h luaconf.h lauxlib.h +lbaselib.o: lbaselib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +lcode.o: lcode.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \ + llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \ + ldo.h lgc.h lstring.h ltable.h lvm.h +lcorolib.o: lcorolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +lctype.o: lctype.c lprefix.h lctype.h lua.h luaconf.h llimits.h +ldblib.o: ldblib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +ldebug.o: ldebug.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ + lobject.h ltm.h lzio.h lmem.h lcode.h llex.h lopcodes.h lparser.h \ + ldebug.h ldo.h lfunc.h lstring.h lgc.h ltable.h lvm.h +ldo.o: ldo.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ + lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lopcodes.h \ + lparser.h lstring.h ltable.h lundump.h lvm.h +ldump.o: ldump.c lprefix.h lua.h luaconf.h lobject.h llimits.h lstate.h \ + ltm.h lzio.h lmem.h lundump.h +lfunc.o: lfunc.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ + llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h +lgc.o: lgc.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ + llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h +linit.o: linit.c lprefix.h lua.h luaconf.h lualib.h lauxlib.h +liolib.o: liolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +llex.o: llex.c lprefix.h lua.h luaconf.h lctype.h llimits.h ldebug.h \ + lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lgc.h llex.h lparser.h \ + lstring.h ltable.h +lmathlib.o: lmathlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +lmem.o: lmem.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ + llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h +loadlib.o: loadlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +lobject.o: lobject.c lprefix.h lua.h luaconf.h lctype.h llimits.h \ + ldebug.h lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h \ + lvm.h +lopcodes.o: lopcodes.c lprefix.h lopcodes.h llimits.h lua.h luaconf.h +loslib.o: loslib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +lparser.o: lparser.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \ + llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \ + ldo.h lfunc.h lstring.h lgc.h ltable.h +lstate.o: lstate.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ + lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h llex.h \ + lstring.h ltable.h +lstring.o: lstring.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \ + lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h +lstrlib.o: lstrlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +ltable.o: ltable.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ + llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h +ltablib.o: ltablib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +ltm.o: ltm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ + llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h +lua.o: lua.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +luac.o: luac.c lprefix.h lua.h luaconf.h lauxlib.h ldebug.h lstate.h \ + lobject.h llimits.h ltm.h lzio.h lmem.h lopcodes.h lopnames.h lundump.h +lundump.o: lundump.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \ + lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h \ + lundump.h +lutf8lib.o: lutf8lib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +lvm.o: lvm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ + llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h \ + ltable.h lvm.h ljumptab.h +lzio.o: lzio.c lprefix.h lua.h luaconf.h llimits.h lmem.h lstate.h \ + lobject.h ltm.h lzio.h + +# (end of Makefile) diff --git a/LuaSkin/lua-5.4.7/src/lapi.c b/LuaSkin/lua-5.4.7/src/lapi.c new file mode 100644 index 000000000..332e97d16 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lapi.c @@ -0,0 +1,1463 @@ +/* +** $Id: lapi.c $ +** Lua API +** See Copyright Notice in lua.h +*/ + +#define lapi_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include +#include + +#include "lua.h" + +#include "lapi.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lundump.h" +#include "lvm.h" + + + +const char lua_ident[] = + "$LuaVersion: " LUA_COPYRIGHT " $" + "$LuaAuthors: " LUA_AUTHORS " $"; + + + +/* +** Test for a valid index (one that is not the 'nilvalue'). +** '!ttisnil(o)' implies 'o != &G(L)->nilvalue', so it is not needed. +** However, it covers the most common cases in a faster way. +*/ +#define isvalid(L, o) (!ttisnil(o) || o != &G(L)->nilvalue) + + +/* test for pseudo index */ +#define ispseudo(i) ((i) <= LUA_REGISTRYINDEX) + +/* test for upvalue */ +#define isupvalue(i) ((i) < LUA_REGISTRYINDEX) + + +/* +** Convert an acceptable index to a pointer to its respective value. +** Non-valid indices return the special nil value 'G(L)->nilvalue'. +*/ +static TValue *index2value (lua_State *L, int idx) { + CallInfo *ci = L->ci; + if (idx > 0) { + StkId o = ci->func.p + idx; + api_check(L, idx <= ci->top.p - (ci->func.p + 1), "unacceptable index"); + if (o >= L->top.p) return &G(L)->nilvalue; + else return s2v(o); + } + else if (!ispseudo(idx)) { /* negative index */ + api_check(L, idx != 0 && -idx <= L->top.p - (ci->func.p + 1), + "invalid index"); + return s2v(L->top.p + idx); + } + else if (idx == LUA_REGISTRYINDEX) + return &G(L)->l_registry; + else { /* upvalues */ + idx = LUA_REGISTRYINDEX - idx; + api_check(L, idx <= MAXUPVAL + 1, "upvalue index too large"); + if (ttisCclosure(s2v(ci->func.p))) { /* C closure? */ + CClosure *func = clCvalue(s2v(ci->func.p)); + return (idx <= func->nupvalues) ? &func->upvalue[idx-1] + : &G(L)->nilvalue; + } + else { /* light C function or Lua function (through a hook)?) */ + api_check(L, ttislcf(s2v(ci->func.p)), "caller not a C function"); + return &G(L)->nilvalue; /* no upvalues */ + } + } +} + + + +/* +** Convert a valid actual index (not a pseudo-index) to its address. +*/ +l_sinline StkId index2stack (lua_State *L, int idx) { + CallInfo *ci = L->ci; + if (idx > 0) { + StkId o = ci->func.p + idx; + api_check(L, o < L->top.p, "invalid index"); + return o; + } + else { /* non-positive index */ + api_check(L, idx != 0 && -idx <= L->top.p - (ci->func.p + 1), + "invalid index"); + api_check(L, !ispseudo(idx), "invalid index"); + return L->top.p + idx; + } +} + + +LUA_API int lua_checkstack (lua_State *L, int n) { + int res; + CallInfo *ci; + lua_lock(L); + ci = L->ci; + api_check(L, n >= 0, "negative 'n'"); + if (L->stack_last.p - L->top.p > n) /* stack large enough? */ + res = 1; /* yes; check is OK */ + else /* need to grow stack */ + res = luaD_growstack(L, n, 0); + if (res && ci->top.p < L->top.p + n) + ci->top.p = L->top.p + n; /* adjust frame top */ + lua_unlock(L); + return res; +} + + +LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) { + int i; + if (from == to) return; + lua_lock(to); + api_checknelems(from, n); + api_check(from, G(from) == G(to), "moving among independent states"); + api_check(from, to->ci->top.p - to->top.p >= n, "stack overflow"); + from->top.p -= n; + for (i = 0; i < n; i++) { + setobjs2s(to, to->top.p, from->top.p + i); + to->top.p++; /* stack already checked by previous 'api_check' */ + } + lua_unlock(to); +} + + +LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) { + lua_CFunction old; + lua_lock(L); + old = G(L)->panic; + G(L)->panic = panicf; + lua_unlock(L); + return old; +} + + +LUA_API lua_Number lua_version (lua_State *L) { + UNUSED(L); + return LUA_VERSION_NUM; +} + + + +/* +** basic stack manipulation +*/ + + +/* +** convert an acceptable stack index into an absolute index +*/ +LUA_API int lua_absindex (lua_State *L, int idx) { + return (idx > 0 || ispseudo(idx)) + ? idx + : cast_int(L->top.p - L->ci->func.p) + idx; +} + + +LUA_API int lua_gettop (lua_State *L) { + return cast_int(L->top.p - (L->ci->func.p + 1)); +} + + +LUA_API void lua_settop (lua_State *L, int idx) { + CallInfo *ci; + StkId func, newtop; + ptrdiff_t diff; /* difference for new top */ + lua_lock(L); + ci = L->ci; + func = ci->func.p; + if (idx >= 0) { + api_check(L, idx <= ci->top.p - (func + 1), "new top too large"); + diff = ((func + 1) + idx) - L->top.p; + for (; diff > 0; diff--) + setnilvalue(s2v(L->top.p++)); /* clear new slots */ + } + else { + api_check(L, -(idx+1) <= (L->top.p - (func + 1)), "invalid new top"); + diff = idx + 1; /* will "subtract" index (as it is negative) */ + } + api_check(L, L->tbclist.p < L->top.p, "previous pop of an unclosed slot"); + newtop = L->top.p + diff; + if (diff < 0 && L->tbclist.p >= newtop) { + lua_assert(hastocloseCfunc(ci->nresults)); + newtop = luaF_close(L, newtop, CLOSEKTOP, 0); + } + L->top.p = newtop; /* correct top only after closing any upvalue */ + lua_unlock(L); +} + + +LUA_API void lua_closeslot (lua_State *L, int idx) { + StkId level; + lua_lock(L); + level = index2stack(L, idx); + api_check(L, hastocloseCfunc(L->ci->nresults) && L->tbclist.p == level, + "no variable to close at given level"); + level = luaF_close(L, level, CLOSEKTOP, 0); + setnilvalue(s2v(level)); + lua_unlock(L); +} + + +/* +** Reverse the stack segment from 'from' to 'to' +** (auxiliary to 'lua_rotate') +** Note that we move(copy) only the value inside the stack. +** (We do not move additional fields that may exist.) +*/ +l_sinline void reverse (lua_State *L, StkId from, StkId to) { + for (; from < to; from++, to--) { + TValue temp; + setobj(L, &temp, s2v(from)); + setobjs2s(L, from, to); + setobj2s(L, to, &temp); + } +} + + +/* +** Let x = AB, where A is a prefix of length 'n'. Then, +** rotate x n == BA. But BA == (A^r . B^r)^r. +*/ +LUA_API void lua_rotate (lua_State *L, int idx, int n) { + StkId p, t, m; + lua_lock(L); + t = L->top.p - 1; /* end of stack segment being rotated */ + p = index2stack(L, idx); /* start of segment */ + api_check(L, (n >= 0 ? n : -n) <= (t - p + 1), "invalid 'n'"); + m = (n >= 0 ? t - n : p - n - 1); /* end of prefix */ + reverse(L, p, m); /* reverse the prefix with length 'n' */ + reverse(L, m + 1, t); /* reverse the suffix */ + reverse(L, p, t); /* reverse the entire segment */ + lua_unlock(L); +} + + +LUA_API void lua_copy (lua_State *L, int fromidx, int toidx) { + TValue *fr, *to; + lua_lock(L); + fr = index2value(L, fromidx); + to = index2value(L, toidx); + api_check(L, isvalid(L, to), "invalid index"); + setobj(L, to, fr); + if (isupvalue(toidx)) /* function upvalue? */ + luaC_barrier(L, clCvalue(s2v(L->ci->func.p)), fr); + /* LUA_REGISTRYINDEX does not need gc barrier + (collector revisits it before finishing collection) */ + lua_unlock(L); +} + + +LUA_API void lua_pushvalue (lua_State *L, int idx) { + lua_lock(L); + setobj2s(L, L->top.p, index2value(L, idx)); + api_incr_top(L); + lua_unlock(L); +} + + + +/* +** access functions (stack -> C) +*/ + + +LUA_API int lua_type (lua_State *L, int idx) { + const TValue *o = index2value(L, idx); + return (isvalid(L, o) ? ttype(o) : LUA_TNONE); +} + + +LUA_API const char *lua_typename (lua_State *L, int t) { + UNUSED(L); + api_check(L, LUA_TNONE <= t && t < LUA_NUMTYPES, "invalid type"); + return ttypename(t); +} + + +LUA_API int lua_iscfunction (lua_State *L, int idx) { + const TValue *o = index2value(L, idx); + return (ttislcf(o) || (ttisCclosure(o))); +} + + +LUA_API int lua_isinteger (lua_State *L, int idx) { + const TValue *o = index2value(L, idx); + return ttisinteger(o); +} + + +LUA_API int lua_isnumber (lua_State *L, int idx) { + lua_Number n; + const TValue *o = index2value(L, idx); + return tonumber(o, &n); +} + + +LUA_API int lua_isstring (lua_State *L, int idx) { + const TValue *o = index2value(L, idx); + return (ttisstring(o) || cvt2str(o)); +} + + +LUA_API int lua_isuserdata (lua_State *L, int idx) { + const TValue *o = index2value(L, idx); + return (ttisfulluserdata(o) || ttislightuserdata(o)); +} + + +LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { + const TValue *o1 = index2value(L, index1); + const TValue *o2 = index2value(L, index2); + return (isvalid(L, o1) && isvalid(L, o2)) ? luaV_rawequalobj(o1, o2) : 0; +} + + +LUA_API void lua_arith (lua_State *L, int op) { + lua_lock(L); + if (op != LUA_OPUNM && op != LUA_OPBNOT) + api_checknelems(L, 2); /* all other operations expect two operands */ + else { /* for unary operations, add fake 2nd operand */ + api_checknelems(L, 1); + setobjs2s(L, L->top.p, L->top.p - 1); + api_incr_top(L); + } + /* first operand at top - 2, second at top - 1; result go to top - 2 */ + luaO_arith(L, op, s2v(L->top.p - 2), s2v(L->top.p - 1), L->top.p - 2); + L->top.p--; /* remove second operand */ + lua_unlock(L); +} + + +LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) { + const TValue *o1; + const TValue *o2; + int i = 0; + lua_lock(L); /* may call tag method */ + o1 = index2value(L, index1); + o2 = index2value(L, index2); + if (isvalid(L, o1) && isvalid(L, o2)) { + switch (op) { + case LUA_OPEQ: i = luaV_equalobj(L, o1, o2); break; + case LUA_OPLT: i = luaV_lessthan(L, o1, o2); break; + case LUA_OPLE: i = luaV_lessequal(L, o1, o2); break; + default: api_check(L, 0, "invalid option"); + } + } + lua_unlock(L); + return i; +} + + +LUA_API size_t lua_stringtonumber (lua_State *L, const char *s) { + size_t sz = luaO_str2num(s, s2v(L->top.p)); + if (sz != 0) + api_incr_top(L); + return sz; +} + + +LUA_API lua_Number lua_tonumberx (lua_State *L, int idx, int *pisnum) { + lua_Number n = 0; + const TValue *o = index2value(L, idx); + int isnum = tonumber(o, &n); + if (pisnum) + *pisnum = isnum; + return n; +} + + +LUA_API lua_Integer lua_tointegerx (lua_State *L, int idx, int *pisnum) { + lua_Integer res = 0; + const TValue *o = index2value(L, idx); + int isnum = tointeger(o, &res); + if (pisnum) + *pisnum = isnum; + return res; +} + + +LUA_API int lua_toboolean (lua_State *L, int idx) { + const TValue *o = index2value(L, idx); + return !l_isfalse(o); +} + + +LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { + TValue *o; + lua_lock(L); + o = index2value(L, idx); + if (!ttisstring(o)) { + if (!cvt2str(o)) { /* not convertible? */ + if (len != NULL) *len = 0; + lua_unlock(L); + return NULL; + } + luaO_tostring(L, o); + luaC_checkGC(L); + o = index2value(L, idx); /* previous call may reallocate the stack */ + } + if (len != NULL) + *len = tsslen(tsvalue(o)); + lua_unlock(L); + return getstr(tsvalue(o)); +} + + +LUA_API lua_Unsigned lua_rawlen (lua_State *L, int idx) { + const TValue *o = index2value(L, idx); + switch (ttypetag(o)) { + case LUA_VSHRSTR: return tsvalue(o)->shrlen; + case LUA_VLNGSTR: return tsvalue(o)->u.lnglen; + case LUA_VUSERDATA: return uvalue(o)->len; + case LUA_VTABLE: return luaH_getn(hvalue(o)); + default: return 0; + } +} + + +LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { + const TValue *o = index2value(L, idx); + if (ttislcf(o)) return fvalue(o); + else if (ttisCclosure(o)) + return clCvalue(o)->f; + else return NULL; /* not a C function */ +} + + +l_sinline void *touserdata (const TValue *o) { + switch (ttype(o)) { + case LUA_TUSERDATA: return getudatamem(uvalue(o)); + case LUA_TLIGHTUSERDATA: return pvalue(o); + default: return NULL; + } +} + + +LUA_API void *lua_touserdata (lua_State *L, int idx) { + const TValue *o = index2value(L, idx); + return touserdata(o); +} + + +LUA_API lua_State *lua_tothread (lua_State *L, int idx) { + const TValue *o = index2value(L, idx); + return (!ttisthread(o)) ? NULL : thvalue(o); +} + + +/* +** Returns a pointer to the internal representation of an object. +** Note that ANSI C does not allow the conversion of a pointer to +** function to a 'void*', so the conversion here goes through +** a 'size_t'. (As the returned pointer is only informative, this +** conversion should not be a problem.) +*/ +LUA_API const void *lua_topointer (lua_State *L, int idx) { + const TValue *o = index2value(L, idx); + switch (ttypetag(o)) { + case LUA_VLCF: return cast_voidp(cast_sizet(fvalue(o))); + case LUA_VUSERDATA: case LUA_VLIGHTUSERDATA: + return touserdata(o); + default: { + if (iscollectable(o)) + return gcvalue(o); + else + return NULL; + } + } +} + + + +/* +** push functions (C -> stack) +*/ + + +LUA_API void lua_pushnil (lua_State *L) { + lua_lock(L); + setnilvalue(s2v(L->top.p)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { + lua_lock(L); + setfltvalue(s2v(L->top.p), n); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) { + lua_lock(L); + setivalue(s2v(L->top.p), n); + api_incr_top(L); + lua_unlock(L); +} + + +/* +** Pushes on the stack a string with given length. Avoid using 's' when +** 'len' == 0 (as 's' can be NULL in that case), due to later use of +** 'memcmp' and 'memcpy'. +*/ +LUA_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len) { + TString *ts; + lua_lock(L); + ts = (len == 0) ? luaS_new(L, "") : luaS_newlstr(L, s, len); + setsvalue2s(L, L->top.p, ts); + api_incr_top(L); + luaC_checkGC(L); + lua_unlock(L); + return getstr(ts); +} + + +LUA_API const char *lua_pushstring (lua_State *L, const char *s) { + lua_lock(L); + if (s == NULL) + setnilvalue(s2v(L->top.p)); + else { + TString *ts; + ts = luaS_new(L, s); + setsvalue2s(L, L->top.p, ts); + s = getstr(ts); /* internal copy's address */ + } + api_incr_top(L); + luaC_checkGC(L); + lua_unlock(L); + return s; +} + + +LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt, + va_list argp) { + const char *ret; + lua_lock(L); + ret = luaO_pushvfstring(L, fmt, argp); + luaC_checkGC(L); + lua_unlock(L); + return ret; +} + + +LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) { + const char *ret; + va_list argp; + lua_lock(L); + va_start(argp, fmt); + ret = luaO_pushvfstring(L, fmt, argp); + va_end(argp); + luaC_checkGC(L); + lua_unlock(L); + return ret; +} + + +LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { + lua_lock(L); + if (n == 0) { + setfvalue(s2v(L->top.p), fn); + api_incr_top(L); + } + else { + CClosure *cl; + api_checknelems(L, n); + api_check(L, n <= MAXUPVAL, "upvalue index too large"); + cl = luaF_newCclosure(L, n); + cl->f = fn; + L->top.p -= n; + while (n--) { + setobj2n(L, &cl->upvalue[n], s2v(L->top.p + n)); + /* does not need barrier because closure is white */ + lua_assert(iswhite(cl)); + } + setclCvalue(L, s2v(L->top.p), cl); + api_incr_top(L); + luaC_checkGC(L); + } + lua_unlock(L); +} + + +LUA_API void lua_pushboolean (lua_State *L, int b) { + lua_lock(L); + if (b) + setbtvalue(s2v(L->top.p)); + else + setbfvalue(s2v(L->top.p)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushlightuserdata (lua_State *L, void *p) { + lua_lock(L); + setpvalue(s2v(L->top.p), p); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API int lua_pushthread (lua_State *L) { + lua_lock(L); + setthvalue(L, s2v(L->top.p), L); + api_incr_top(L); + lua_unlock(L); + return (G(L)->mainthread == L); +} + + + +/* +** get functions (Lua -> stack) +*/ + + +l_sinline int auxgetstr (lua_State *L, const TValue *t, const char *k) { + const TValue *slot; + TString *str = luaS_new(L, k); + if (luaV_fastget(L, t, str, slot, luaH_getstr)) { + setobj2s(L, L->top.p, slot); + api_incr_top(L); + } + else { + setsvalue2s(L, L->top.p, str); + api_incr_top(L); + luaV_finishget(L, t, s2v(L->top.p - 1), L->top.p - 1, slot); + } + lua_unlock(L); + return ttype(s2v(L->top.p - 1)); +} + + +/* +** Get the global table in the registry. Since all predefined +** indices in the registry were inserted right when the registry +** was created and never removed, they must always be in the array +** part of the registry. +*/ +#define getGtable(L) \ + (&hvalue(&G(L)->l_registry)->array[LUA_RIDX_GLOBALS - 1]) + + +LUA_API int lua_getglobal (lua_State *L, const char *name) { + const TValue *G; + lua_lock(L); + G = getGtable(L); + return auxgetstr(L, G, name); +} + + +LUA_API int lua_gettable (lua_State *L, int idx) { + const TValue *slot; + TValue *t; + lua_lock(L); + t = index2value(L, idx); + if (luaV_fastget(L, t, s2v(L->top.p - 1), slot, luaH_get)) { + setobj2s(L, L->top.p - 1, slot); + } + else + luaV_finishget(L, t, s2v(L->top.p - 1), L->top.p - 1, slot); + lua_unlock(L); + return ttype(s2v(L->top.p - 1)); +} + + +LUA_API int lua_getfield (lua_State *L, int idx, const char *k) { + lua_lock(L); + return auxgetstr(L, index2value(L, idx), k); +} + + +LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n) { + TValue *t; + const TValue *slot; + lua_lock(L); + t = index2value(L, idx); + if (luaV_fastgeti(L, t, n, slot)) { + setobj2s(L, L->top.p, slot); + } + else { + TValue aux; + setivalue(&aux, n); + luaV_finishget(L, t, &aux, L->top.p, slot); + } + api_incr_top(L); + lua_unlock(L); + return ttype(s2v(L->top.p - 1)); +} + + +l_sinline int finishrawget (lua_State *L, const TValue *val) { + if (isempty(val)) /* avoid copying empty items to the stack */ + setnilvalue(s2v(L->top.p)); + else + setobj2s(L, L->top.p, val); + api_incr_top(L); + lua_unlock(L); + return ttype(s2v(L->top.p - 1)); +} + + +static Table *gettable (lua_State *L, int idx) { + TValue *t = index2value(L, idx); + api_check(L, ttistable(t), "table expected"); + return hvalue(t); +} + + +LUA_API int lua_rawget (lua_State *L, int idx) { + Table *t; + const TValue *val; + lua_lock(L); + api_checknelems(L, 1); + t = gettable(L, idx); + val = luaH_get(t, s2v(L->top.p - 1)); + L->top.p--; /* remove key */ + return finishrawget(L, val); +} + + +LUA_API int lua_rawgeti (lua_State *L, int idx, lua_Integer n) { + Table *t; + lua_lock(L); + t = gettable(L, idx); + return finishrawget(L, luaH_getint(t, n)); +} + + +LUA_API int lua_rawgetp (lua_State *L, int idx, const void *p) { + Table *t; + TValue k; + lua_lock(L); + t = gettable(L, idx); + setpvalue(&k, cast_voidp(p)); + return finishrawget(L, luaH_get(t, &k)); +} + + +LUA_API void lua_createtable (lua_State *L, int narray, int nrec) { + Table *t; + lua_lock(L); + t = luaH_new(L); + sethvalue2s(L, L->top.p, t); + api_incr_top(L); + if (narray > 0 || nrec > 0) + luaH_resize(L, t, narray, nrec); + luaC_checkGC(L); + lua_unlock(L); +} + + +LUA_API int lua_getmetatable (lua_State *L, int objindex) { + const TValue *obj; + Table *mt; + int res = 0; + lua_lock(L); + obj = index2value(L, objindex); + switch (ttype(obj)) { + case LUA_TTABLE: + mt = hvalue(obj)->metatable; + break; + case LUA_TUSERDATA: + mt = uvalue(obj)->metatable; + break; + default: + mt = G(L)->mt[ttype(obj)]; + break; + } + if (mt != NULL) { + sethvalue2s(L, L->top.p, mt); + api_incr_top(L); + res = 1; + } + lua_unlock(L); + return res; +} + + +LUA_API int lua_getiuservalue (lua_State *L, int idx, int n) { + TValue *o; + int t; + lua_lock(L); + o = index2value(L, idx); + api_check(L, ttisfulluserdata(o), "full userdata expected"); + if (n <= 0 || n > uvalue(o)->nuvalue) { + setnilvalue(s2v(L->top.p)); + t = LUA_TNONE; + } + else { + setobj2s(L, L->top.p, &uvalue(o)->uv[n - 1].uv); + t = ttype(s2v(L->top.p)); + } + api_incr_top(L); + lua_unlock(L); + return t; +} + + +/* +** set functions (stack -> Lua) +*/ + +/* +** t[k] = value at the top of the stack (where 'k' is a string) +*/ +static void auxsetstr (lua_State *L, const TValue *t, const char *k) { + const TValue *slot; + TString *str = luaS_new(L, k); + api_checknelems(L, 1); + if (luaV_fastget(L, t, str, slot, luaH_getstr)) { + luaV_finishfastset(L, t, slot, s2v(L->top.p - 1)); + L->top.p--; /* pop value */ + } + else { + setsvalue2s(L, L->top.p, str); /* push 'str' (to make it a TValue) */ + api_incr_top(L); + luaV_finishset(L, t, s2v(L->top.p - 1), s2v(L->top.p - 2), slot); + L->top.p -= 2; /* pop value and key */ + } + lua_unlock(L); /* lock done by caller */ +} + + +LUA_API void lua_setglobal (lua_State *L, const char *name) { + const TValue *G; + lua_lock(L); /* unlock done in 'auxsetstr' */ + G = getGtable(L); + auxsetstr(L, G, name); +} + + +LUA_API void lua_settable (lua_State *L, int idx) { + TValue *t; + const TValue *slot; + lua_lock(L); + api_checknelems(L, 2); + t = index2value(L, idx); + if (luaV_fastget(L, t, s2v(L->top.p - 2), slot, luaH_get)) { + luaV_finishfastset(L, t, slot, s2v(L->top.p - 1)); + } + else + luaV_finishset(L, t, s2v(L->top.p - 2), s2v(L->top.p - 1), slot); + L->top.p -= 2; /* pop index and value */ + lua_unlock(L); +} + + +LUA_API void lua_setfield (lua_State *L, int idx, const char *k) { + lua_lock(L); /* unlock done in 'auxsetstr' */ + auxsetstr(L, index2value(L, idx), k); +} + + +LUA_API void lua_seti (lua_State *L, int idx, lua_Integer n) { + TValue *t; + const TValue *slot; + lua_lock(L); + api_checknelems(L, 1); + t = index2value(L, idx); + if (luaV_fastgeti(L, t, n, slot)) { + luaV_finishfastset(L, t, slot, s2v(L->top.p - 1)); + } + else { + TValue aux; + setivalue(&aux, n); + luaV_finishset(L, t, &aux, s2v(L->top.p - 1), slot); + } + L->top.p--; /* pop value */ + lua_unlock(L); +} + + +static void aux_rawset (lua_State *L, int idx, TValue *key, int n) { + Table *t; + lua_lock(L); + api_checknelems(L, n); + t = gettable(L, idx); + luaH_set(L, t, key, s2v(L->top.p - 1)); + invalidateTMcache(t); + luaC_barrierback(L, obj2gco(t), s2v(L->top.p - 1)); + L->top.p -= n; + lua_unlock(L); +} + + +LUA_API void lua_rawset (lua_State *L, int idx) { + aux_rawset(L, idx, s2v(L->top.p - 2), 2); +} + + +LUA_API void lua_rawsetp (lua_State *L, int idx, const void *p) { + TValue k; + setpvalue(&k, cast_voidp(p)); + aux_rawset(L, idx, &k, 1); +} + + +LUA_API void lua_rawseti (lua_State *L, int idx, lua_Integer n) { + Table *t; + lua_lock(L); + api_checknelems(L, 1); + t = gettable(L, idx); + luaH_setint(L, t, n, s2v(L->top.p - 1)); + luaC_barrierback(L, obj2gco(t), s2v(L->top.p - 1)); + L->top.p--; + lua_unlock(L); +} + + +LUA_API int lua_setmetatable (lua_State *L, int objindex) { + TValue *obj; + Table *mt; + lua_lock(L); + api_checknelems(L, 1); + obj = index2value(L, objindex); + if (ttisnil(s2v(L->top.p - 1))) + mt = NULL; + else { + api_check(L, ttistable(s2v(L->top.p - 1)), "table expected"); + mt = hvalue(s2v(L->top.p - 1)); + } + switch (ttype(obj)) { + case LUA_TTABLE: { + hvalue(obj)->metatable = mt; + if (mt) { + luaC_objbarrier(L, gcvalue(obj), mt); + luaC_checkfinalizer(L, gcvalue(obj), mt); + } + break; + } + case LUA_TUSERDATA: { + uvalue(obj)->metatable = mt; + if (mt) { + luaC_objbarrier(L, uvalue(obj), mt); + luaC_checkfinalizer(L, gcvalue(obj), mt); + } + break; + } + default: { + G(L)->mt[ttype(obj)] = mt; + break; + } + } + L->top.p--; + lua_unlock(L); + return 1; +} + + +LUA_API int lua_setiuservalue (lua_State *L, int idx, int n) { + TValue *o; + int res; + lua_lock(L); + api_checknelems(L, 1); + o = index2value(L, idx); + api_check(L, ttisfulluserdata(o), "full userdata expected"); + if (!(cast_uint(n) - 1u < cast_uint(uvalue(o)->nuvalue))) + res = 0; /* 'n' not in [1, uvalue(o)->nuvalue] */ + else { + setobj(L, &uvalue(o)->uv[n - 1].uv, s2v(L->top.p - 1)); + luaC_barrierback(L, gcvalue(o), s2v(L->top.p - 1)); + res = 1; + } + L->top.p--; + lua_unlock(L); + return res; +} + + +/* +** 'load' and 'call' functions (run Lua code) +*/ + + +#define checkresults(L,na,nr) \ + api_check(L, (nr) == LUA_MULTRET \ + || (L->ci->top.p - L->top.p >= (nr) - (na)), \ + "results from function overflow current stack size") + + +LUA_API void lua_callk (lua_State *L, int nargs, int nresults, + lua_KContext ctx, lua_KFunction k) { + StkId func; + lua_lock(L); + api_check(L, k == NULL || !isLua(L->ci), + "cannot use continuations inside hooks"); + api_checknelems(L, nargs+1); + api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); + checkresults(L, nargs, nresults); + func = L->top.p - (nargs+1); + if (k != NULL && yieldable(L)) { /* need to prepare continuation? */ + L->ci->u.c.k = k; /* save continuation */ + L->ci->u.c.ctx = ctx; /* save context */ + luaD_call(L, func, nresults); /* do the call */ + } + else /* no continuation or no yieldable */ + luaD_callnoyield(L, func, nresults); /* just do the call */ + adjustresults(L, nresults); + lua_unlock(L); +} + + + +/* +** Execute a protected call. +*/ +struct CallS { /* data to 'f_call' */ + StkId func; + int nresults; +}; + + +static void f_call (lua_State *L, void *ud) { + struct CallS *c = cast(struct CallS *, ud); + luaD_callnoyield(L, c->func, c->nresults); +} + + + +LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc, + lua_KContext ctx, lua_KFunction k) { + struct CallS c; + int status; + ptrdiff_t func; + lua_lock(L); + api_check(L, k == NULL || !isLua(L->ci), + "cannot use continuations inside hooks"); + api_checknelems(L, nargs+1); + api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); + checkresults(L, nargs, nresults); + if (errfunc == 0) + func = 0; + else { + StkId o = index2stack(L, errfunc); + api_check(L, ttisfunction(s2v(o)), "error handler must be a function"); + func = savestack(L, o); + } + c.func = L->top.p - (nargs+1); /* function to be called */ + if (k == NULL || !yieldable(L)) { /* no continuation or no yieldable? */ + c.nresults = nresults; /* do a 'conventional' protected call */ + status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); + } + else { /* prepare continuation (call is already protected by 'resume') */ + CallInfo *ci = L->ci; + ci->u.c.k = k; /* save continuation */ + ci->u.c.ctx = ctx; /* save context */ + /* save information for error recovery */ + ci->u2.funcidx = cast_int(savestack(L, c.func)); + ci->u.c.old_errfunc = L->errfunc; + L->errfunc = func; + setoah(ci->callstatus, L->allowhook); /* save value of 'allowhook' */ + ci->callstatus |= CIST_YPCALL; /* function can do error recovery */ + luaD_call(L, c.func, nresults); /* do the call */ + ci->callstatus &= ~CIST_YPCALL; + L->errfunc = ci->u.c.old_errfunc; + status = LUA_OK; /* if it is here, there were no errors */ + } + adjustresults(L, nresults); + lua_unlock(L); + return status; +} + + +LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data, + const char *chunkname, const char *mode) { + ZIO z; + int status; + lua_lock(L); + if (!chunkname) chunkname = "?"; + luaZ_init(L, &z, reader, data); + status = luaD_protectedparser(L, &z, chunkname, mode); + if (status == LUA_OK) { /* no errors? */ + LClosure *f = clLvalue(s2v(L->top.p - 1)); /* get new function */ + if (f->nupvalues >= 1) { /* does it have an upvalue? */ + /* get global table from registry */ + const TValue *gt = getGtable(L); + /* set global table as 1st upvalue of 'f' (may be LUA_ENV) */ + setobj(L, f->upvals[0]->v.p, gt); + luaC_barrier(L, f->upvals[0], gt); + } + } + lua_unlock(L); + return status; +} + + +LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data, int strip) { + int status; + TValue *o; + lua_lock(L); + api_checknelems(L, 1); + o = s2v(L->top.p - 1); + if (isLfunction(o)) + status = luaU_dump(L, getproto(o), writer, data, strip); + else + status = 1; + lua_unlock(L); + return status; +} + + +LUA_API int lua_status (lua_State *L) { + return L->status; +} + + +/* +** Garbage-collection function +*/ +LUA_API int lua_gc (lua_State *L, int what, ...) { + va_list argp; + int res = 0; + global_State *g = G(L); + if (g->gcstp & GCSTPGC) /* internal stop? */ + return -1; /* all options are invalid when stopped */ + lua_lock(L); + va_start(argp, what); + switch (what) { + case LUA_GCSTOP: { + g->gcstp = GCSTPUSR; /* stopped by the user */ + break; + } + case LUA_GCRESTART: { + luaE_setdebt(g, 0); + g->gcstp = 0; /* (GCSTPGC must be already zero here) */ + break; + } + case LUA_GCCOLLECT: { + luaC_fullgc(L, 0); + break; + } + case LUA_GCCOUNT: { + /* GC values are expressed in Kbytes: #bytes/2^10 */ + res = cast_int(gettotalbytes(g) >> 10); + break; + } + case LUA_GCCOUNTB: { + res = cast_int(gettotalbytes(g) & 0x3ff); + break; + } + case LUA_GCSTEP: { + int data = va_arg(argp, int); + l_mem debt = 1; /* =1 to signal that it did an actual step */ + lu_byte oldstp = g->gcstp; + g->gcstp = 0; /* allow GC to run (GCSTPGC must be zero here) */ + if (data == 0) { + luaE_setdebt(g, 0); /* do a basic step */ + luaC_step(L); + } + else { /* add 'data' to total debt */ + debt = cast(l_mem, data) * 1024 + g->GCdebt; + luaE_setdebt(g, debt); + luaC_checkGC(L); + } + g->gcstp = oldstp; /* restore previous state */ + if (debt > 0 && g->gcstate == GCSpause) /* end of cycle? */ + res = 1; /* signal it */ + break; + } + case LUA_GCSETPAUSE: { + int data = va_arg(argp, int); + res = getgcparam(g->gcpause); + setgcparam(g->gcpause, data); + break; + } + case LUA_GCSETSTEPMUL: { + int data = va_arg(argp, int); + res = getgcparam(g->gcstepmul); + setgcparam(g->gcstepmul, data); + break; + } + case LUA_GCISRUNNING: { + res = gcrunning(g); + break; + } + case LUA_GCGEN: { + int minormul = va_arg(argp, int); + int majormul = va_arg(argp, int); + res = isdecGCmodegen(g) ? LUA_GCGEN : LUA_GCINC; + if (minormul != 0) + g->genminormul = minormul; + if (majormul != 0) + setgcparam(g->genmajormul, majormul); + luaC_changemode(L, KGC_GEN); + break; + } + case LUA_GCINC: { + int pause = va_arg(argp, int); + int stepmul = va_arg(argp, int); + int stepsize = va_arg(argp, int); + res = isdecGCmodegen(g) ? LUA_GCGEN : LUA_GCINC; + if (pause != 0) + setgcparam(g->gcpause, pause); + if (stepmul != 0) + setgcparam(g->gcstepmul, stepmul); + if (stepsize != 0) + g->gcstepsize = stepsize; + luaC_changemode(L, KGC_INC); + break; + } + default: res = -1; /* invalid option */ + } + va_end(argp); + lua_unlock(L); + return res; +} + + + +/* +** miscellaneous functions +*/ + + +LUA_API int lua_error (lua_State *L) { + TValue *errobj; + lua_lock(L); + errobj = s2v(L->top.p - 1); + api_checknelems(L, 1); + /* error object is the memory error message? */ + if (ttisshrstring(errobj) && eqshrstr(tsvalue(errobj), G(L)->memerrmsg)) + luaM_error(L); /* raise a memory error */ + else + luaG_errormsg(L); /* raise a regular error */ + /* code unreachable; will unlock when control actually leaves the kernel */ + return 0; /* to avoid warnings */ +} + + +LUA_API int lua_next (lua_State *L, int idx) { + Table *t; + int more; + lua_lock(L); + api_checknelems(L, 1); + t = gettable(L, idx); + more = luaH_next(L, t, L->top.p - 1); + if (more) { + api_incr_top(L); + } + else /* no more elements */ + L->top.p -= 1; /* remove key */ + lua_unlock(L); + return more; +} + + +LUA_API void lua_toclose (lua_State *L, int idx) { + int nresults; + StkId o; + lua_lock(L); + o = index2stack(L, idx); + nresults = L->ci->nresults; + api_check(L, L->tbclist.p < o, "given index below or equal a marked one"); + luaF_newtbcupval(L, o); /* create new to-be-closed upvalue */ + if (!hastocloseCfunc(nresults)) /* function not marked yet? */ + L->ci->nresults = codeNresults(nresults); /* mark it */ + lua_assert(hastocloseCfunc(L->ci->nresults)); + lua_unlock(L); +} + + +LUA_API void lua_concat (lua_State *L, int n) { + lua_lock(L); + api_checknelems(L, n); + if (n > 0) + luaV_concat(L, n); + else { /* nothing to concatenate */ + setsvalue2s(L, L->top.p, luaS_newlstr(L, "", 0)); /* push empty string */ + api_incr_top(L); + } + luaC_checkGC(L); + lua_unlock(L); +} + + +LUA_API void lua_len (lua_State *L, int idx) { + TValue *t; + lua_lock(L); + t = index2value(L, idx); + luaV_objlen(L, L->top.p, t); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { + lua_Alloc f; + lua_lock(L); + if (ud) *ud = G(L)->ud; + f = G(L)->frealloc; + lua_unlock(L); + return f; +} + + +LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) { + lua_lock(L); + G(L)->ud = ud; + G(L)->frealloc = f; + lua_unlock(L); +} + + +void lua_setwarnf (lua_State *L, lua_WarnFunction f, void *ud) { + lua_lock(L); + G(L)->ud_warn = ud; + G(L)->warnf = f; + lua_unlock(L); +} + + +void lua_warning (lua_State *L, const char *msg, int tocont) { + lua_lock(L); + luaE_warning(L, msg, tocont); + lua_unlock(L); +} + + + +LUA_API void *lua_newuserdatauv (lua_State *L, size_t size, int nuvalue) { + Udata *u; + lua_lock(L); + api_check(L, 0 <= nuvalue && nuvalue < USHRT_MAX, "invalid value"); + u = luaS_newudata(L, size, nuvalue); + setuvalue(L, s2v(L->top.p), u); + api_incr_top(L); + luaC_checkGC(L); + lua_unlock(L); + return getudatamem(u); +} + + + +static const char *aux_upvalue (TValue *fi, int n, TValue **val, + GCObject **owner) { + switch (ttypetag(fi)) { + case LUA_VCCL: { /* C closure */ + CClosure *f = clCvalue(fi); + if (!(cast_uint(n) - 1u < cast_uint(f->nupvalues))) + return NULL; /* 'n' not in [1, f->nupvalues] */ + *val = &f->upvalue[n-1]; + if (owner) *owner = obj2gco(f); + return ""; + } + case LUA_VLCL: { /* Lua closure */ + LClosure *f = clLvalue(fi); + TString *name; + Proto *p = f->p; + if (!(cast_uint(n) - 1u < cast_uint(p->sizeupvalues))) + return NULL; /* 'n' not in [1, p->sizeupvalues] */ + *val = f->upvals[n-1]->v.p; + if (owner) *owner = obj2gco(f->upvals[n - 1]); + name = p->upvalues[n-1].name; + return (name == NULL) ? "(no name)" : getstr(name); + } + default: return NULL; /* not a closure */ + } +} + + +LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { + const char *name; + TValue *val = NULL; /* to avoid warnings */ + lua_lock(L); + name = aux_upvalue(index2value(L, funcindex), n, &val, NULL); + if (name) { + setobj2s(L, L->top.p, val); + api_incr_top(L); + } + lua_unlock(L); + return name; +} + + +LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { + const char *name; + TValue *val = NULL; /* to avoid warnings */ + GCObject *owner = NULL; /* to avoid warnings */ + TValue *fi; + lua_lock(L); + fi = index2value(L, funcindex); + api_checknelems(L, 1); + name = aux_upvalue(fi, n, &val, &owner); + if (name) { + L->top.p--; + setobj(L, val, s2v(L->top.p)); + luaC_barrier(L, owner, val); + } + lua_unlock(L); + return name; +} + + +static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) { + static const UpVal *const nullup = NULL; + LClosure *f; + TValue *fi = index2value(L, fidx); + api_check(L, ttisLclosure(fi), "Lua function expected"); + f = clLvalue(fi); + if (pf) *pf = f; + if (1 <= n && n <= f->p->sizeupvalues) + return &f->upvals[n - 1]; /* get its upvalue pointer */ + else + return (UpVal**)&nullup; +} + + +LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) { + TValue *fi = index2value(L, fidx); + switch (ttypetag(fi)) { + case LUA_VLCL: { /* lua closure */ + return *getupvalref(L, fidx, n, NULL); + } + case LUA_VCCL: { /* C closure */ + CClosure *f = clCvalue(fi); + if (1 <= n && n <= f->nupvalues) + return &f->upvalue[n - 1]; + /* else */ + } /* FALLTHROUGH */ + case LUA_VLCF: + return NULL; /* light C functions have no upvalues */ + default: { + api_check(L, 0, "function expected"); + return NULL; + } + } +} + + +LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1, + int fidx2, int n2) { + LClosure *f1; + UpVal **up1 = getupvalref(L, fidx1, n1, &f1); + UpVal **up2 = getupvalref(L, fidx2, n2, NULL); + api_check(L, *up1 != NULL && *up2 != NULL, "invalid upvalue index"); + *up1 = *up2; + luaC_objbarrier(L, f1, *up1); +} + + diff --git a/LuaSkin/lua-5.4.7/src/lapi.h b/LuaSkin/lua-5.4.7/src/lapi.h new file mode 100644 index 000000000..a742427cd --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lapi.h @@ -0,0 +1,52 @@ +/* +** $Id: lapi.h $ +** Auxiliary functions from Lua API +** See Copyright Notice in lua.h +*/ + +#ifndef lapi_h +#define lapi_h + + +#include "llimits.h" +#include "lstate.h" + + +/* Increments 'L->top.p', checking for stack overflows */ +#define api_incr_top(L) {L->top.p++; \ + api_check(L, L->top.p <= L->ci->top.p, \ + "stack overflow");} + + +/* +** If a call returns too many multiple returns, the callee may not have +** stack space to accommodate all results. In this case, this macro +** increases its stack space ('L->ci->top.p'). +*/ +#define adjustresults(L,nres) \ + { if ((nres) <= LUA_MULTRET && L->ci->top.p < L->top.p) \ + L->ci->top.p = L->top.p; } + + +/* Ensure the stack has at least 'n' elements */ +#define api_checknelems(L,n) \ + api_check(L, (n) < (L->top.p - L->ci->func.p), \ + "not enough elements in the stack") + + +/* +** To reduce the overhead of returning from C functions, the presence of +** to-be-closed variables in these functions is coded in the CallInfo's +** field 'nresults', in a way that functions with no to-be-closed variables +** with zero, one, or "all" wanted results have no overhead. Functions +** with other number of wanted results, as well as functions with +** variables to be closed, have an extra check. +*/ + +#define hastocloseCfunc(n) ((n) < LUA_MULTRET) + +/* Map [-1, inf) (range of 'nresults') into (-inf, -2] */ +#define codeNresults(n) (-(n) - 3) +#define decodeNresults(n) (-(n) - 3) + +#endif diff --git a/LuaSkin/lua-5.4.7/src/lauxlib.c b/LuaSkin/lua-5.4.7/src/lauxlib.c new file mode 100644 index 000000000..923105ed3 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lauxlib.c @@ -0,0 +1,1126 @@ +/* +** $Id: lauxlib.c $ +** Auxiliary functions for building Lua libraries +** See Copyright Notice in lua.h +*/ + +#define lauxlib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include +#include +#include + + +/* +** This file uses only the official API of Lua. +** Any function declared here could be written as an application function. +*/ + +#include "lua.h" + +#include "lauxlib.h" + + +#if !defined(MAX_SIZET) +/* maximum value for size_t */ +#define MAX_SIZET ((size_t)(~(size_t)0)) +#endif + + +/* +** {====================================================== +** Traceback +** ======================================================= +*/ + + +#define LEVELS1 10 /* size of the first part of the stack */ +#define LEVELS2 11 /* size of the second part of the stack */ + + + +/* +** Search for 'objidx' in table at index -1. ('objidx' must be an +** absolute index.) Return 1 + string at top if it found a good name. +*/ +static int findfield (lua_State *L, int objidx, int level) { + if (level == 0 || !lua_istable(L, -1)) + return 0; /* not found */ + lua_pushnil(L); /* start 'next' loop */ + while (lua_next(L, -2)) { /* for each pair in table */ + if (lua_type(L, -2) == LUA_TSTRING) { /* ignore non-string keys */ + if (lua_rawequal(L, objidx, -1)) { /* found object? */ + lua_pop(L, 1); /* remove value (but keep name) */ + return 1; + } + else if (findfield(L, objidx, level - 1)) { /* try recursively */ + /* stack: lib_name, lib_table, field_name (top) */ + lua_pushliteral(L, "."); /* place '.' between the two names */ + lua_replace(L, -3); /* (in the slot occupied by table) */ + lua_concat(L, 3); /* lib_name.field_name */ + return 1; + } + } + lua_pop(L, 1); /* remove value */ + } + return 0; /* not found */ +} + + +/* +** Search for a name for a function in all loaded modules +*/ +static int pushglobalfuncname (lua_State *L, lua_Debug *ar) { + int top = lua_gettop(L); + lua_getinfo(L, "f", ar); /* push function */ + lua_getfield(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); + luaL_checkstack(L, 6, "not enough stack"); /* slots for 'findfield' */ + if (findfield(L, top + 1, 2)) { + const char *name = lua_tostring(L, -1); + if (strncmp(name, LUA_GNAME ".", 3) == 0) { /* name start with '_G.'? */ + lua_pushstring(L, name + 3); /* push name without prefix */ + lua_remove(L, -2); /* remove original name */ + } + lua_copy(L, -1, top + 1); /* copy name to proper place */ + lua_settop(L, top + 1); /* remove table "loaded" and name copy */ + return 1; + } + else { + lua_settop(L, top); /* remove function and global table */ + return 0; + } +} + + +static void pushfuncname (lua_State *L, lua_Debug *ar) { + if (pushglobalfuncname(L, ar)) { /* try first a global name */ + lua_pushfstring(L, "function '%s'", lua_tostring(L, -1)); + lua_remove(L, -2); /* remove name */ + } + else if (*ar->namewhat != '\0') /* is there a name from code? */ + lua_pushfstring(L, "%s '%s'", ar->namewhat, ar->name); /* use it */ + else if (*ar->what == 'm') /* main? */ + lua_pushliteral(L, "main chunk"); + else if (*ar->what != 'C') /* for Lua functions, use */ + lua_pushfstring(L, "function <%s:%d>", ar->short_src, ar->linedefined); + else /* nothing left... */ + lua_pushliteral(L, "?"); +} + + +static int lastlevel (lua_State *L) { + lua_Debug ar; + int li = 1, le = 1; + /* find an upper bound */ + while (lua_getstack(L, le, &ar)) { li = le; le *= 2; } + /* do a binary search */ + while (li < le) { + int m = (li + le)/2; + if (lua_getstack(L, m, &ar)) li = m + 1; + else le = m; + } + return le - 1; +} + + +LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, + const char *msg, int level) { + luaL_Buffer b; + lua_Debug ar; + int last = lastlevel(L1); + int limit2show = (last - level > LEVELS1 + LEVELS2) ? LEVELS1 : -1; + luaL_buffinit(L, &b); + if (msg) { + luaL_addstring(&b, msg); + luaL_addchar(&b, '\n'); + } + luaL_addstring(&b, "stack traceback:"); + while (lua_getstack(L1, level++, &ar)) { + if (limit2show-- == 0) { /* too many levels? */ + int n = last - level - LEVELS2 + 1; /* number of levels to skip */ + lua_pushfstring(L, "\n\t...\t(skipping %d levels)", n); + luaL_addvalue(&b); /* add warning about skip */ + level += n; /* and skip to last levels */ + } + else { + lua_getinfo(L1, "Slnt", &ar); + if (ar.currentline <= 0) + lua_pushfstring(L, "\n\t%s: in ", ar.short_src); + else + lua_pushfstring(L, "\n\t%s:%d: in ", ar.short_src, ar.currentline); + luaL_addvalue(&b); + pushfuncname(L, &ar); + luaL_addvalue(&b); + if (ar.istailcall) + luaL_addstring(&b, "\n\t(...tail calls...)"); + } + } + luaL_pushresult(&b); +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Error-report functions +** ======================================================= +*/ + +LUALIB_API int luaL_argerror (lua_State *L, int arg, const char *extramsg) { + lua_Debug ar; + if (!lua_getstack(L, 0, &ar)) /* no stack frame? */ + return luaL_error(L, "bad argument #%d (%s)", arg, extramsg); + lua_getinfo(L, "n", &ar); + if (strcmp(ar.namewhat, "method") == 0) { + arg--; /* do not count 'self' */ + if (arg == 0) /* error is in the self argument itself? */ + return luaL_error(L, "calling '%s' on bad self (%s)", + ar.name, extramsg); + } + if (ar.name == NULL) + ar.name = (pushglobalfuncname(L, &ar)) ? lua_tostring(L, -1) : "?"; + return luaL_error(L, "bad argument #%d to '%s' (%s)", + arg, ar.name, extramsg); +} + + +LUALIB_API int luaL_typeerror (lua_State *L, int arg, const char *tname) { + const char *msg; + const char *typearg; /* name for the type of the actual argument */ + if (luaL_getmetafield(L, arg, "__name") == LUA_TSTRING) + typearg = lua_tostring(L, -1); /* use the given type name */ + else if (lua_type(L, arg) == LUA_TLIGHTUSERDATA) + typearg = "light userdata"; /* special name for messages */ + else + typearg = luaL_typename(L, arg); /* standard name */ + msg = lua_pushfstring(L, "%s expected, got %s", tname, typearg); + return luaL_argerror(L, arg, msg); +} + + +static void tag_error (lua_State *L, int arg, int tag) { + luaL_typeerror(L, arg, lua_typename(L, tag)); +} + + +/* +** The use of 'lua_pushfstring' ensures this function does not +** need reserved stack space when called. +*/ +LUALIB_API void luaL_where (lua_State *L, int level) { + lua_Debug ar; + if (lua_getstack(L, level, &ar)) { /* check function at level */ + lua_getinfo(L, "Sl", &ar); /* get info about it */ + if (ar.currentline > 0) { /* is there info? */ + lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline); + return; + } + } + lua_pushfstring(L, ""); /* else, no information available... */ +} + + +/* +** Again, the use of 'lua_pushvfstring' ensures this function does +** not need reserved stack space when called. (At worst, it generates +** an error with "stack overflow" instead of the given message.) +*/ +LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) { + va_list argp; + va_start(argp, fmt); + luaL_where(L, 1); + lua_pushvfstring(L, fmt, argp); + va_end(argp); + lua_concat(L, 2); + return lua_error(L); +} + + +LUALIB_API int luaL_fileresult (lua_State *L, int stat, const char *fname) { + int en = errno; /* calls to Lua API may change this value */ + if (stat) { + lua_pushboolean(L, 1); + return 1; + } + else { + const char *msg; + luaL_pushfail(L); + msg = (en != 0) ? strerror(en) : "(no extra info)"; + if (fname) + lua_pushfstring(L, "%s: %s", fname, msg); + else + lua_pushstring(L, msg); + lua_pushinteger(L, en); + return 3; + } +} + + +#if !defined(l_inspectstat) /* { */ + +#if defined(LUA_USE_POSIX) + +#include + +/* +** use appropriate macros to interpret 'pclose' return status +*/ +#define l_inspectstat(stat,what) \ + if (WIFEXITED(stat)) { stat = WEXITSTATUS(stat); } \ + else if (WIFSIGNALED(stat)) { stat = WTERMSIG(stat); what = "signal"; } + +#else + +#define l_inspectstat(stat,what) /* no op */ + +#endif + +#endif /* } */ + + +LUALIB_API int luaL_execresult (lua_State *L, int stat) { + if (stat != 0 && errno != 0) /* error with an 'errno'? */ + return luaL_fileresult(L, 0, NULL); + else { + const char *what = "exit"; /* type of termination */ + l_inspectstat(stat, what); /* interpret result */ + if (*what == 'e' && stat == 0) /* successful termination? */ + lua_pushboolean(L, 1); + else + luaL_pushfail(L); + lua_pushstring(L, what); + lua_pushinteger(L, stat); + return 3; /* return true/fail,what,code */ + } +} + +/* }====================================================== */ + + + +/* +** {====================================================== +** Userdata's metatable manipulation +** ======================================================= +*/ + +LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { + if (luaL_getmetatable(L, tname) != LUA_TNIL) /* name already in use? */ + return 0; /* leave previous value on top, but return 0 */ + lua_pop(L, 1); + lua_createtable(L, 0, 2); /* create metatable */ + lua_pushstring(L, tname); + lua_setfield(L, -2, "__name"); /* metatable.__name = tname */ + lua_pushvalue(L, -1); + lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */ + return 1; +} + + +LUALIB_API void luaL_setmetatable (lua_State *L, const char *tname) { + luaL_getmetatable(L, tname); + lua_setmetatable(L, -2); +} + + +LUALIB_API void *luaL_testudata (lua_State *L, int ud, const char *tname) { + void *p = lua_touserdata(L, ud); + if (p != NULL) { /* value is a userdata? */ + if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ + luaL_getmetatable(L, tname); /* get correct metatable */ + if (!lua_rawequal(L, -1, -2)) /* not the same? */ + p = NULL; /* value is a userdata with wrong metatable */ + lua_pop(L, 2); /* remove both metatables */ + return p; + } + } + return NULL; /* value is not a userdata with a metatable */ +} + + +LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) { + void *p = luaL_testudata(L, ud, tname); + luaL_argexpected(L, p != NULL, ud, tname); + return p; +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Argument check functions +** ======================================================= +*/ + +LUALIB_API int luaL_checkoption (lua_State *L, int arg, const char *def, + const char *const lst[]) { + const char *name = (def) ? luaL_optstring(L, arg, def) : + luaL_checkstring(L, arg); + int i; + for (i=0; lst[i]; i++) + if (strcmp(lst[i], name) == 0) + return i; + return luaL_argerror(L, arg, + lua_pushfstring(L, "invalid option '%s'", name)); +} + + +/* +** Ensures the stack has at least 'space' extra slots, raising an error +** if it cannot fulfill the request. (The error handling needs a few +** extra slots to format the error message. In case of an error without +** this extra space, Lua will generate the same 'stack overflow' error, +** but without 'msg'.) +*/ +LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *msg) { + if (l_unlikely(!lua_checkstack(L, space))) { + if (msg) + luaL_error(L, "stack overflow (%s)", msg); + else + luaL_error(L, "stack overflow"); + } +} + + +LUALIB_API void luaL_checktype (lua_State *L, int arg, int t) { + if (l_unlikely(lua_type(L, arg) != t)) + tag_error(L, arg, t); +} + + +LUALIB_API void luaL_checkany (lua_State *L, int arg) { + if (l_unlikely(lua_type(L, arg) == LUA_TNONE)) + luaL_argerror(L, arg, "value expected"); +} + + +LUALIB_API const char *luaL_checklstring (lua_State *L, int arg, size_t *len) { + const char *s = lua_tolstring(L, arg, len); + if (l_unlikely(!s)) tag_error(L, arg, LUA_TSTRING); + return s; +} + + +LUALIB_API const char *luaL_optlstring (lua_State *L, int arg, + const char *def, size_t *len) { + if (lua_isnoneornil(L, arg)) { + if (len) + *len = (def ? strlen(def) : 0); + return def; + } + else return luaL_checklstring(L, arg, len); +} + + +LUALIB_API lua_Number luaL_checknumber (lua_State *L, int arg) { + int isnum; + lua_Number d = lua_tonumberx(L, arg, &isnum); + if (l_unlikely(!isnum)) + tag_error(L, arg, LUA_TNUMBER); + return d; +} + + +LUALIB_API lua_Number luaL_optnumber (lua_State *L, int arg, lua_Number def) { + return luaL_opt(L, luaL_checknumber, arg, def); +} + + +static void interror (lua_State *L, int arg) { + if (lua_isnumber(L, arg)) + luaL_argerror(L, arg, "number has no integer representation"); + else + tag_error(L, arg, LUA_TNUMBER); +} + + +LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int arg) { + int isnum; + lua_Integer d = lua_tointegerx(L, arg, &isnum); + if (l_unlikely(!isnum)) { + interror(L, arg); + } + return d; +} + + +LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int arg, + lua_Integer def) { + return luaL_opt(L, luaL_checkinteger, arg, def); +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Generic Buffer manipulation +** ======================================================= +*/ + +/* userdata to box arbitrary data */ +typedef struct UBox { + void *box; + size_t bsize; +} UBox; + + +static void *resizebox (lua_State *L, int idx, size_t newsize) { + void *ud; + lua_Alloc allocf = lua_getallocf(L, &ud); + UBox *box = (UBox *)lua_touserdata(L, idx); + void *temp = allocf(ud, box->box, box->bsize, newsize); + if (l_unlikely(temp == NULL && newsize > 0)) { /* allocation error? */ + lua_pushliteral(L, "not enough memory"); + lua_error(L); /* raise a memory error */ + } + box->box = temp; + box->bsize = newsize; + return temp; +} + + +static int boxgc (lua_State *L) { + resizebox(L, 1, 0); + return 0; +} + + +static const luaL_Reg boxmt[] = { /* box metamethods */ + {"__gc", boxgc}, + {"__close", boxgc}, + {NULL, NULL} +}; + + +static void newbox (lua_State *L) { + UBox *box = (UBox *)lua_newuserdatauv(L, sizeof(UBox), 0); + box->box = NULL; + box->bsize = 0; + if (luaL_newmetatable(L, "_UBOX*")) /* creating metatable? */ + luaL_setfuncs(L, boxmt, 0); /* set its metamethods */ + lua_setmetatable(L, -2); +} + + +/* +** check whether buffer is using a userdata on the stack as a temporary +** buffer +*/ +#define buffonstack(B) ((B)->b != (B)->init.b) + + +/* +** Whenever buffer is accessed, slot 'idx' must either be a box (which +** cannot be NULL) or it is a placeholder for the buffer. +*/ +#define checkbufferlevel(B,idx) \ + lua_assert(buffonstack(B) ? lua_touserdata(B->L, idx) != NULL \ + : lua_touserdata(B->L, idx) == (void*)B) + + +/* +** Compute new size for buffer 'B', enough to accommodate extra 'sz' +** bytes. (The test for "not big enough" also gets the case when the +** computation of 'newsize' overflows.) +*/ +static size_t newbuffsize (luaL_Buffer *B, size_t sz) { + size_t newsize = (B->size / 2) * 3; /* buffer size * 1.5 */ + if (l_unlikely(MAX_SIZET - sz < B->n)) /* overflow in (B->n + sz)? */ + return luaL_error(B->L, "buffer too large"); + if (newsize < B->n + sz) /* not big enough? */ + newsize = B->n + sz; + return newsize; +} + + +/* +** Returns a pointer to a free area with at least 'sz' bytes in buffer +** 'B'. 'boxidx' is the relative position in the stack where is the +** buffer's box or its placeholder. +*/ +static char *prepbuffsize (luaL_Buffer *B, size_t sz, int boxidx) { + checkbufferlevel(B, boxidx); + if (B->size - B->n >= sz) /* enough space? */ + return B->b + B->n; + else { + lua_State *L = B->L; + char *newbuff; + size_t newsize = newbuffsize(B, sz); + /* create larger buffer */ + if (buffonstack(B)) /* buffer already has a box? */ + newbuff = (char *)resizebox(L, boxidx, newsize); /* resize it */ + else { /* no box yet */ + lua_remove(L, boxidx); /* remove placeholder */ + newbox(L); /* create a new box */ + lua_insert(L, boxidx); /* move box to its intended position */ + lua_toclose(L, boxidx); + newbuff = (char *)resizebox(L, boxidx, newsize); + memcpy(newbuff, B->b, B->n * sizeof(char)); /* copy original content */ + } + B->b = newbuff; + B->size = newsize; + return newbuff + B->n; + } +} + +/* +** returns a pointer to a free area with at least 'sz' bytes +*/ +LUALIB_API char *luaL_prepbuffsize (luaL_Buffer *B, size_t sz) { + return prepbuffsize(B, sz, -1); +} + + +LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) { + if (l > 0) { /* avoid 'memcpy' when 's' can be NULL */ + char *b = prepbuffsize(B, l, -1); + memcpy(b, s, l * sizeof(char)); + luaL_addsize(B, l); + } +} + + +LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) { + luaL_addlstring(B, s, strlen(s)); +} + + +LUALIB_API void luaL_pushresult (luaL_Buffer *B) { + lua_State *L = B->L; + checkbufferlevel(B, -1); + lua_pushlstring(L, B->b, B->n); + if (buffonstack(B)) + lua_closeslot(L, -2); /* close the box */ + lua_remove(L, -2); /* remove box or placeholder from the stack */ +} + + +LUALIB_API void luaL_pushresultsize (luaL_Buffer *B, size_t sz) { + luaL_addsize(B, sz); + luaL_pushresult(B); +} + + +/* +** 'luaL_addvalue' is the only function in the Buffer system where the +** box (if existent) is not on the top of the stack. So, instead of +** calling 'luaL_addlstring', it replicates the code using -2 as the +** last argument to 'prepbuffsize', signaling that the box is (or will +** be) below the string being added to the buffer. (Box creation can +** trigger an emergency GC, so we should not remove the string from the +** stack before we have the space guaranteed.) +*/ +LUALIB_API void luaL_addvalue (luaL_Buffer *B) { + lua_State *L = B->L; + size_t len; + const char *s = lua_tolstring(L, -1, &len); + char *b = prepbuffsize(B, len, -2); + memcpy(b, s, len * sizeof(char)); + luaL_addsize(B, len); + lua_pop(L, 1); /* pop string */ +} + + +LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { + B->L = L; + B->b = B->init.b; + B->n = 0; + B->size = LUAL_BUFFERSIZE; + lua_pushlightuserdata(L, (void*)B); /* push placeholder */ +} + + +LUALIB_API char *luaL_buffinitsize (lua_State *L, luaL_Buffer *B, size_t sz) { + luaL_buffinit(L, B); + return prepbuffsize(B, sz, -1); +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Reference system +** ======================================================= +*/ + +/* index of free-list header (after the predefined values) */ +#define freelist (LUA_RIDX_LAST + 1) + +/* +** The previously freed references form a linked list: +** t[freelist] is the index of a first free index, or zero if list is +** empty; t[t[freelist]] is the index of the second element; etc. +*/ +LUALIB_API int luaL_ref (lua_State *L, int t) { + int ref; + if (lua_isnil(L, -1)) { + lua_pop(L, 1); /* remove from stack */ + return LUA_REFNIL; /* 'nil' has a unique fixed reference */ + } + t = lua_absindex(L, t); + if (lua_rawgeti(L, t, freelist) == LUA_TNIL) { /* first access? */ + ref = 0; /* list is empty */ + lua_pushinteger(L, 0); /* initialize as an empty list */ + lua_rawseti(L, t, freelist); /* ref = t[freelist] = 0 */ + } + else { /* already initialized */ + lua_assert(lua_isinteger(L, -1)); + ref = (int)lua_tointeger(L, -1); /* ref = t[freelist] */ + } + lua_pop(L, 1); /* remove element from stack */ + if (ref != 0) { /* any free element? */ + lua_rawgeti(L, t, ref); /* remove it from list */ + lua_rawseti(L, t, freelist); /* (t[freelist] = t[ref]) */ + } + else /* no free elements */ + ref = (int)lua_rawlen(L, t) + 1; /* get a new reference */ + lua_rawseti(L, t, ref); + return ref; +} + + +LUALIB_API void luaL_unref (lua_State *L, int t, int ref) { + if (ref >= 0) { + t = lua_absindex(L, t); + lua_rawgeti(L, t, freelist); + lua_assert(lua_isinteger(L, -1)); + lua_rawseti(L, t, ref); /* t[ref] = t[freelist] */ + lua_pushinteger(L, ref); + lua_rawseti(L, t, freelist); /* t[freelist] = ref */ + } +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Load functions +** ======================================================= +*/ + +typedef struct LoadF { + int n; /* number of pre-read characters */ + FILE *f; /* file being read */ + char buff[BUFSIZ]; /* area for reading file */ +} LoadF; + + +static const char *getF (lua_State *L, void *ud, size_t *size) { + LoadF *lf = (LoadF *)ud; + (void)L; /* not used */ + if (lf->n > 0) { /* are there pre-read characters to be read? */ + *size = lf->n; /* return them (chars already in buffer) */ + lf->n = 0; /* no more pre-read characters */ + } + else { /* read a block from file */ + /* 'fread' can return > 0 *and* set the EOF flag. If next call to + 'getF' called 'fread', it might still wait for user input. + The next check avoids this problem. */ + if (feof(lf->f)) return NULL; + *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f); /* read block */ + } + return lf->buff; +} + + +static int errfile (lua_State *L, const char *what, int fnameindex) { + int err = errno; + const char *filename = lua_tostring(L, fnameindex) + 1; + if (err != 0) + lua_pushfstring(L, "cannot %s %s: %s", what, filename, strerror(err)); + else + lua_pushfstring(L, "cannot %s %s", what, filename); + lua_remove(L, fnameindex); + return LUA_ERRFILE; +} + + +/* +** Skip an optional BOM at the start of a stream. If there is an +** incomplete BOM (the first character is correct but the rest is +** not), returns the first character anyway to force an error +** (as no chunk can start with 0xEF). +*/ +static int skipBOM (FILE *f) { + int c = getc(f); /* read first character */ + if (c == 0xEF && getc(f) == 0xBB && getc(f) == 0xBF) /* correct BOM? */ + return getc(f); /* ignore BOM and return next char */ + else /* no (valid) BOM */ + return c; /* return first character */ +} + + +/* +** reads the first character of file 'f' and skips an optional BOM mark +** in its beginning plus its first line if it starts with '#'. Returns +** true if it skipped the first line. In any case, '*cp' has the +** first "valid" character of the file (after the optional BOM and +** a first-line comment). +*/ +static int skipcomment (FILE *f, int *cp) { + int c = *cp = skipBOM(f); + if (c == '#') { /* first line is a comment (Unix exec. file)? */ + do { /* skip first line */ + c = getc(f); + } while (c != EOF && c != '\n'); + *cp = getc(f); /* next character after comment, if present */ + return 1; /* there was a comment */ + } + else return 0; /* no comment */ +} + + +LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename, + const char *mode) { + LoadF lf; + int status, readstatus; + int c; + int fnameindex = lua_gettop(L) + 1; /* index of filename on the stack */ + if (filename == NULL) { + lua_pushliteral(L, "=stdin"); + lf.f = stdin; + } + else { + lua_pushfstring(L, "@%s", filename); + errno = 0; + lf.f = fopen(filename, "r"); + if (lf.f == NULL) return errfile(L, "open", fnameindex); + } + lf.n = 0; + if (skipcomment(lf.f, &c)) /* read initial portion */ + lf.buff[lf.n++] = '\n'; /* add newline to correct line numbers */ + if (c == LUA_SIGNATURE[0]) { /* binary file? */ + lf.n = 0; /* remove possible newline */ + if (filename) { /* "real" file? */ + errno = 0; + lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */ + if (lf.f == NULL) return errfile(L, "reopen", fnameindex); + skipcomment(lf.f, &c); /* re-read initial portion */ + } + } + if (c != EOF) + lf.buff[lf.n++] = c; /* 'c' is the first character of the stream */ + errno = 0; + status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode); + readstatus = ferror(lf.f); + if (filename) fclose(lf.f); /* close file (even in case of errors) */ + if (readstatus) { + lua_settop(L, fnameindex); /* ignore results from 'lua_load' */ + return errfile(L, "read", fnameindex); + } + lua_remove(L, fnameindex); + return status; +} + + +typedef struct LoadS { + const char *s; + size_t size; +} LoadS; + + +static const char *getS (lua_State *L, void *ud, size_t *size) { + LoadS *ls = (LoadS *)ud; + (void)L; /* not used */ + if (ls->size == 0) return NULL; + *size = ls->size; + ls->size = 0; + return ls->s; +} + + +LUALIB_API int luaL_loadbufferx (lua_State *L, const char *buff, size_t size, + const char *name, const char *mode) { + LoadS ls; + ls.s = buff; + ls.size = size; + return lua_load(L, getS, &ls, name, mode); +} + + +LUALIB_API int luaL_loadstring (lua_State *L, const char *s) { + return luaL_loadbuffer(L, s, strlen(s), s); +} + +/* }====================================================== */ + + + +LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { + if (!lua_getmetatable(L, obj)) /* no metatable? */ + return LUA_TNIL; + else { + int tt; + lua_pushstring(L, event); + tt = lua_rawget(L, -2); + if (tt == LUA_TNIL) /* is metafield nil? */ + lua_pop(L, 2); /* remove metatable and metafield */ + else + lua_remove(L, -2); /* remove only metatable */ + return tt; /* return metafield type */ + } +} + + +LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) { + obj = lua_absindex(L, obj); + if (luaL_getmetafield(L, obj, event) == LUA_TNIL) /* no metafield? */ + return 0; + lua_pushvalue(L, obj); + lua_call(L, 1, 1); + return 1; +} + + +LUALIB_API lua_Integer luaL_len (lua_State *L, int idx) { + lua_Integer l; + int isnum; + lua_len(L, idx); + l = lua_tointegerx(L, -1, &isnum); + if (l_unlikely(!isnum)) + luaL_error(L, "object length is not an integer"); + lua_pop(L, 1); /* remove object */ + return l; +} + + +LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) { + idx = lua_absindex(L,idx); + if (luaL_callmeta(L, idx, "__tostring")) { /* metafield? */ + if (!lua_isstring(L, -1)) + luaL_error(L, "'__tostring' must return a string"); + } + else { + switch (lua_type(L, idx)) { + case LUA_TNUMBER: { + if (lua_isinteger(L, idx)) + lua_pushfstring(L, "%I", (LUAI_UACINT)lua_tointeger(L, idx)); + else + lua_pushfstring(L, "%f", (LUAI_UACNUMBER)lua_tonumber(L, idx)); + break; + } + case LUA_TSTRING: + lua_pushvalue(L, idx); + break; + case LUA_TBOOLEAN: + lua_pushstring(L, (lua_toboolean(L, idx) ? "true" : "false")); + break; + case LUA_TNIL: + lua_pushliteral(L, "nil"); + break; + default: { + int tt = luaL_getmetafield(L, idx, "__name"); /* try name */ + const char *kind = (tt == LUA_TSTRING) ? lua_tostring(L, -1) : + luaL_typename(L, idx); + lua_pushfstring(L, "%s: %p", kind, lua_topointer(L, idx)); + if (tt != LUA_TNIL) + lua_remove(L, -2); /* remove '__name' */ + break; + } + } + } + return lua_tolstring(L, -1, len); +} + + +/* +** set functions from list 'l' into table at top - 'nup'; each +** function gets the 'nup' elements at the top as upvalues. +** Returns with only the table at the stack. +*/ +LUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) { + luaL_checkstack(L, nup, "too many upvalues"); + for (; l->name != NULL; l++) { /* fill the table with given functions */ + if (l->func == NULL) /* placeholder? */ + lua_pushboolean(L, 0); + else { + int i; + for (i = 0; i < nup; i++) /* copy upvalues to the top */ + lua_pushvalue(L, -nup); + lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */ + } + lua_setfield(L, -(nup + 2), l->name); + } + lua_pop(L, nup); /* remove upvalues */ +} + + +/* +** ensure that stack[idx][fname] has a table and push that table +** into the stack +*/ +LUALIB_API int luaL_getsubtable (lua_State *L, int idx, const char *fname) { + if (lua_getfield(L, idx, fname) == LUA_TTABLE) + return 1; /* table already there */ + else { + lua_pop(L, 1); /* remove previous result */ + idx = lua_absindex(L, idx); + lua_newtable(L); + lua_pushvalue(L, -1); /* copy to be left at top */ + lua_setfield(L, idx, fname); /* assign new table to field */ + return 0; /* false, because did not find table there */ + } +} + + +/* +** Stripped-down 'require': After checking "loaded" table, calls 'openf' +** to open a module, registers the result in 'package.loaded' table and, +** if 'glb' is true, also registers the result in the global table. +** Leaves resulting module on the top. +*/ +LUALIB_API void luaL_requiref (lua_State *L, const char *modname, + lua_CFunction openf, int glb) { + luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); + lua_getfield(L, -1, modname); /* LOADED[modname] */ + if (!lua_toboolean(L, -1)) { /* package not already loaded? */ + lua_pop(L, 1); /* remove field */ + lua_pushcfunction(L, openf); + lua_pushstring(L, modname); /* argument to open function */ + lua_call(L, 1, 1); /* call 'openf' to open module */ + lua_pushvalue(L, -1); /* make copy of module (call result) */ + lua_setfield(L, -3, modname); /* LOADED[modname] = module */ + } + lua_remove(L, -2); /* remove LOADED table */ + if (glb) { + lua_pushvalue(L, -1); /* copy of module */ + lua_setglobal(L, modname); /* _G[modname] = module */ + } +} + + +LUALIB_API void luaL_addgsub (luaL_Buffer *b, const char *s, + const char *p, const char *r) { + const char *wild; + size_t l = strlen(p); + while ((wild = strstr(s, p)) != NULL) { + luaL_addlstring(b, s, wild - s); /* push prefix */ + luaL_addstring(b, r); /* push replacement in place of pattern */ + s = wild + l; /* continue after 'p' */ + } + luaL_addstring(b, s); /* push last suffix */ +} + + +LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, + const char *p, const char *r) { + luaL_Buffer b; + luaL_buffinit(L, &b); + luaL_addgsub(&b, s, p, r); + luaL_pushresult(&b); + return lua_tostring(L, -1); +} + + +static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { + (void)ud; (void)osize; /* not used */ + if (nsize == 0) { + free(ptr); + return NULL; + } + else + return realloc(ptr, nsize); +} + + +/* +** Standard panic funcion just prints an error message. The test +** with 'lua_type' avoids possible memory errors in 'lua_tostring'. +*/ +static int panic (lua_State *L) { + const char *msg = (lua_type(L, -1) == LUA_TSTRING) + ? lua_tostring(L, -1) + : "error object is not a string"; + lua_writestringerror("PANIC: unprotected error in call to Lua API (%s)\n", + msg); + return 0; /* return to Lua to abort */ +} + + +/* +** Warning functions: +** warnfoff: warning system is off +** warnfon: ready to start a new message +** warnfcont: previous message is to be continued +*/ +static void warnfoff (void *ud, const char *message, int tocont); +static void warnfon (void *ud, const char *message, int tocont); +static void warnfcont (void *ud, const char *message, int tocont); + + +/* +** Check whether message is a control message. If so, execute the +** control or ignore it if unknown. +*/ +static int checkcontrol (lua_State *L, const char *message, int tocont) { + if (tocont || *(message++) != '@') /* not a control message? */ + return 0; + else { + if (strcmp(message, "off") == 0) + lua_setwarnf(L, warnfoff, L); /* turn warnings off */ + else if (strcmp(message, "on") == 0) + lua_setwarnf(L, warnfon, L); /* turn warnings on */ + return 1; /* it was a control message */ + } +} + + +static void warnfoff (void *ud, const char *message, int tocont) { + checkcontrol((lua_State *)ud, message, tocont); +} + + +/* +** Writes the message and handle 'tocont', finishing the message +** if needed and setting the next warn function. +*/ +static void warnfcont (void *ud, const char *message, int tocont) { + lua_State *L = (lua_State *)ud; + lua_writestringerror("%s", message); /* write message */ + if (tocont) /* not the last part? */ + lua_setwarnf(L, warnfcont, L); /* to be continued */ + else { /* last part */ + lua_writestringerror("%s", "\n"); /* finish message with end-of-line */ + lua_setwarnf(L, warnfon, L); /* next call is a new message */ + } +} + + +static void warnfon (void *ud, const char *message, int tocont) { + if (checkcontrol((lua_State *)ud, message, tocont)) /* control message? */ + return; /* nothing else to be done */ + lua_writestringerror("%s", "Lua warning: "); /* start a new warning */ + warnfcont(ud, message, tocont); /* finish processing */ +} + + +LUALIB_API lua_State *luaL_newstate (void) { + lua_State *L = lua_newstate(l_alloc, NULL); + if (l_likely(L)) { + lua_atpanic(L, &panic); + lua_setwarnf(L, warnfoff, L); /* default is warnings off */ + } + return L; +} + + +LUALIB_API void luaL_checkversion_ (lua_State *L, lua_Number ver, size_t sz) { + lua_Number v = lua_version(L); + if (sz != LUAL_NUMSIZES) /* check numeric types */ + luaL_error(L, "core and library have incompatible numeric types"); + else if (v != ver) + luaL_error(L, "version mismatch: app. needs %f, Lua core provides %f", + (LUAI_UACNUMBER)ver, (LUAI_UACNUMBER)v); +} + diff --git a/LuaSkin/lua-5.3.4/src/lauxlib.h b/LuaSkin/lua-5.4.7/src/lauxlib.h similarity index 85% rename from LuaSkin/lua-5.3.4/src/lauxlib.h rename to LuaSkin/lua-5.4.7/src/lauxlib.h index 9a2e66aa0..5b977e2a3 100644 --- a/LuaSkin/lua-5.3.4/src/lauxlib.h +++ b/LuaSkin/lua-5.4.7/src/lauxlib.h @@ -1,5 +1,5 @@ /* -** $Id: lauxlib.h,v 1.131 2016/12/06 14:54:31 roberto Exp $ +** $Id: lauxlib.h $ ** Auxiliary functions for building Lua libraries ** See Copyright Notice in lua.h */ @@ -12,9 +12,16 @@ #include #include +#include "luaconf.h" #include "lua.h" +/* global table */ +#define LUA_GNAME "_G" + + +typedef struct luaL_Buffer luaL_Buffer; + /* extra error code for 'luaL_loadfilex' */ #define LUA_ERRFILE (LUA_ERRERR+1) @@ -44,6 +51,7 @@ LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e); LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e); LUALIB_API const char *(luaL_tolstring) (lua_State *L, int idx, size_t *len); LUALIB_API int (luaL_argerror) (lua_State *L, int arg, const char *extramsg); +LUALIB_API int (luaL_typeerror) (lua_State *L, int arg, const char *tname); LUALIB_API const char *(luaL_checklstring) (lua_State *L, int arg, size_t *l); LUALIB_API const char *(luaL_optlstring) (lua_State *L, int arg, @@ -73,6 +81,7 @@ LUALIB_API int (luaL_checkoption) (lua_State *L, int arg, const char *def, LUALIB_API int (luaL_fileresult) (lua_State *L, int stat, const char *fname); LUALIB_API int (luaL_execresult) (lua_State *L, int stat); + /* predefined references */ #define LUA_NOREF (-2) #define LUA_REFNIL (-1) @@ -93,8 +102,10 @@ LUALIB_API lua_State *(luaL_newstate) (void); LUALIB_API lua_Integer (luaL_len) (lua_State *L, int idx); -LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, - const char *r); +LUALIB_API void (luaL_addgsub) (luaL_Buffer *b, const char *s, + const char *p, const char *r); +LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, + const char *p, const char *r); LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup); @@ -120,7 +131,11 @@ LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname, (luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0)) #define luaL_argcheck(L, cond,arg,extramsg) \ - ((void)((cond) || luaL_argerror(L, (arg), (extramsg)))) + ((void)(luai_likely(cond) || luaL_argerror(L, (arg), (extramsg)))) + +#define luaL_argexpected(L,cond,arg,tname) \ + ((void)(luai_likely(cond) || luaL_typeerror(L, (arg), (tname)))) + #define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) #define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) @@ -139,19 +154,54 @@ LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname, #define luaL_loadbuffer(L,s,sz,n) luaL_loadbufferx(L,s,sz,n,NULL) +/* +** Perform arithmetic operations on lua_Integer values with wrap-around +** semantics, as the Lua core does. +*/ +#define luaL_intop(op,v1,v2) \ + ((lua_Integer)((lua_Unsigned)(v1) op (lua_Unsigned)(v2))) + + +/* push the value used to represent failure/error */ +#define luaL_pushfail(L) lua_pushnil(L) + + +/* +** Internal assertions for in-house debugging +*/ +#if !defined(lua_assert) + +#if defined LUAI_ASSERT + #include + #define lua_assert(c) assert(c) +#else + #define lua_assert(c) ((void)0) +#endif + +#endif + + + /* ** {====================================================== ** Generic Buffer manipulation ** ======================================================= */ -typedef struct luaL_Buffer { +struct luaL_Buffer { char *b; /* buffer address */ size_t size; /* buffer size */ size_t n; /* number of characters in buffer */ lua_State *L; - char initb[LUAL_BUFFERSIZE]; /* initial buffer */ -} luaL_Buffer; + union { + LUAI_MAXALIGN; /* ensure maximum alignment for buffer */ + char b[LUAL_BUFFERSIZE]; /* initial buffer */ + } init; +}; + + +#define luaL_bufflen(bf) ((bf)->n) +#define luaL_buffaddr(bf) ((bf)->b) #define luaL_addchar(B,c) \ @@ -160,6 +210,8 @@ typedef struct luaL_Buffer { #define luaL_addsize(B,s) ((B)->n += (s)) +#define luaL_buffsub(B,s) ((B)->n -= (s)) + LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); LUALIB_API char *(luaL_prepbuffsize) (luaL_Buffer *B, size_t sz); LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); @@ -197,21 +249,6 @@ typedef struct luaL_Stream { /* }====================================================== */ - - -/* compatibility with old module system */ -#if defined(LUA_COMPAT_MODULE) - -LUALIB_API void (luaL_pushmodule) (lua_State *L, const char *modname, - int sizehint); -LUALIB_API void (luaL_openlib) (lua_State *L, const char *libname, - const luaL_Reg *l, int nup); - -#define luaL_register(L,n,l) (luaL_openlib(L,(n),(l),0)) - -#endif - - /* ** {================================================================== ** "Abstraction Layer" for basic report of messages and errors diff --git a/LuaSkin/lua-5.4.7/src/lbaselib.c b/LuaSkin/lua-5.4.7/src/lbaselib.c new file mode 100644 index 000000000..1d60c9ded --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lbaselib.c @@ -0,0 +1,549 @@ +/* +** $Id: lbaselib.c $ +** Basic library +** See Copyright Notice in lua.h +*/ + +#define lbaselib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +static int luaB_print (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + int i; + for (i = 1; i <= n; i++) { /* for each argument */ + size_t l; + const char *s = luaL_tolstring(L, i, &l); /* convert it to string */ + if (i > 1) /* not the first element? */ + lua_writestring("\t", 1); /* add a tab before it */ + lua_writestring(s, l); /* print it */ + lua_pop(L, 1); /* pop result */ + } + lua_writeline(); + return 0; +} + + +/* +** Creates a warning with all given arguments. +** Check first for errors; otherwise an error may interrupt +** the composition of a warning, leaving it unfinished. +*/ +static int luaB_warn (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + int i; + luaL_checkstring(L, 1); /* at least one argument */ + for (i = 2; i <= n; i++) + luaL_checkstring(L, i); /* make sure all arguments are strings */ + for (i = 1; i < n; i++) /* compose warning */ + lua_warning(L, lua_tostring(L, i), 1); + lua_warning(L, lua_tostring(L, n), 0); /* close warning */ + return 0; +} + + +#define SPACECHARS " \f\n\r\t\v" + +static const char *b_str2int (const char *s, int base, lua_Integer *pn) { + lua_Unsigned n = 0; + int neg = 0; + s += strspn(s, SPACECHARS); /* skip initial spaces */ + if (*s == '-') { s++; neg = 1; } /* handle sign */ + else if (*s == '+') s++; + if (!isalnum((unsigned char)*s)) /* no digit? */ + return NULL; + do { + int digit = (isdigit((unsigned char)*s)) ? *s - '0' + : (toupper((unsigned char)*s) - 'A') + 10; + if (digit >= base) return NULL; /* invalid numeral */ + n = n * base + digit; + s++; + } while (isalnum((unsigned char)*s)); + s += strspn(s, SPACECHARS); /* skip trailing spaces */ + *pn = (lua_Integer)((neg) ? (0u - n) : n); + return s; +} + + +static int luaB_tonumber (lua_State *L) { + if (lua_isnoneornil(L, 2)) { /* standard conversion? */ + if (lua_type(L, 1) == LUA_TNUMBER) { /* already a number? */ + lua_settop(L, 1); /* yes; return it */ + return 1; + } + else { + size_t l; + const char *s = lua_tolstring(L, 1, &l); + if (s != NULL && lua_stringtonumber(L, s) == l + 1) + return 1; /* successful conversion to number */ + /* else not a number */ + luaL_checkany(L, 1); /* (but there must be some parameter) */ + } + } + else { + size_t l; + const char *s; + lua_Integer n = 0; /* to avoid warnings */ + lua_Integer base = luaL_checkinteger(L, 2); + luaL_checktype(L, 1, LUA_TSTRING); /* no numbers as strings */ + s = lua_tolstring(L, 1, &l); + luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range"); + if (b_str2int(s, (int)base, &n) == s + l) { + lua_pushinteger(L, n); + return 1; + } /* else not a number */ + } /* else not a number */ + luaL_pushfail(L); /* not a number */ + return 1; +} + + +static int luaB_error (lua_State *L) { + int level = (int)luaL_optinteger(L, 2, 1); + lua_settop(L, 1); + if (lua_type(L, 1) == LUA_TSTRING && level > 0) { + luaL_where(L, level); /* add extra information */ + lua_pushvalue(L, 1); + lua_concat(L, 2); + } + return lua_error(L); +} + + +static int luaB_getmetatable (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_getmetatable(L, 1)) { + lua_pushnil(L); + return 1; /* no metatable */ + } + luaL_getmetafield(L, 1, "__metatable"); + return 1; /* returns either __metatable field (if present) or metatable */ +} + + +static int luaB_setmetatable (lua_State *L) { + int t = lua_type(L, 2); + luaL_checktype(L, 1, LUA_TTABLE); + luaL_argexpected(L, t == LUA_TNIL || t == LUA_TTABLE, 2, "nil or table"); + if (l_unlikely(luaL_getmetafield(L, 1, "__metatable") != LUA_TNIL)) + return luaL_error(L, "cannot change a protected metatable"); + lua_settop(L, 2); + lua_setmetatable(L, 1); + return 1; +} + + +static int luaB_rawequal (lua_State *L) { + luaL_checkany(L, 1); + luaL_checkany(L, 2); + lua_pushboolean(L, lua_rawequal(L, 1, 2)); + return 1; +} + + +static int luaB_rawlen (lua_State *L) { + int t = lua_type(L, 1); + luaL_argexpected(L, t == LUA_TTABLE || t == LUA_TSTRING, 1, + "table or string"); + lua_pushinteger(L, lua_rawlen(L, 1)); + return 1; +} + + +static int luaB_rawget (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checkany(L, 2); + lua_settop(L, 2); + lua_rawget(L, 1); + return 1; +} + +static int luaB_rawset (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checkany(L, 2); + luaL_checkany(L, 3); + lua_settop(L, 3); + lua_rawset(L, 1); + return 1; +} + + +static int pushmode (lua_State *L, int oldmode) { + if (oldmode == -1) + luaL_pushfail(L); /* invalid call to 'lua_gc' */ + else + lua_pushstring(L, (oldmode == LUA_GCINC) ? "incremental" + : "generational"); + return 1; +} + + +/* +** check whether call to 'lua_gc' was valid (not inside a finalizer) +*/ +#define checkvalres(res) { if (res == -1) break; } + +static int luaB_collectgarbage (lua_State *L) { + static const char *const opts[] = {"stop", "restart", "collect", + "count", "step", "setpause", "setstepmul", + "isrunning", "generational", "incremental", NULL}; + static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, + LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL, + LUA_GCISRUNNING, LUA_GCGEN, LUA_GCINC}; + int o = optsnum[luaL_checkoption(L, 1, "collect", opts)]; + switch (o) { + case LUA_GCCOUNT: { + int k = lua_gc(L, o); + int b = lua_gc(L, LUA_GCCOUNTB); + checkvalres(k); + lua_pushnumber(L, (lua_Number)k + ((lua_Number)b/1024)); + return 1; + } + case LUA_GCSTEP: { + int step = (int)luaL_optinteger(L, 2, 0); + int res = lua_gc(L, o, step); + checkvalres(res); + lua_pushboolean(L, res); + return 1; + } + case LUA_GCSETPAUSE: + case LUA_GCSETSTEPMUL: { + int p = (int)luaL_optinteger(L, 2, 0); + int previous = lua_gc(L, o, p); + checkvalres(previous); + lua_pushinteger(L, previous); + return 1; + } + case LUA_GCISRUNNING: { + int res = lua_gc(L, o); + checkvalres(res); + lua_pushboolean(L, res); + return 1; + } + case LUA_GCGEN: { + int minormul = (int)luaL_optinteger(L, 2, 0); + int majormul = (int)luaL_optinteger(L, 3, 0); + return pushmode(L, lua_gc(L, o, minormul, majormul)); + } + case LUA_GCINC: { + int pause = (int)luaL_optinteger(L, 2, 0); + int stepmul = (int)luaL_optinteger(L, 3, 0); + int stepsize = (int)luaL_optinteger(L, 4, 0); + return pushmode(L, lua_gc(L, o, pause, stepmul, stepsize)); + } + default: { + int res = lua_gc(L, o); + checkvalres(res); + lua_pushinteger(L, res); + return 1; + } + } + luaL_pushfail(L); /* invalid call (inside a finalizer) */ + return 1; +} + + +static int luaB_type (lua_State *L) { + int t = lua_type(L, 1); + luaL_argcheck(L, t != LUA_TNONE, 1, "value expected"); + lua_pushstring(L, lua_typename(L, t)); + return 1; +} + + +static int luaB_next (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + lua_settop(L, 2); /* create a 2nd argument if there isn't one */ + if (lua_next(L, 1)) + return 2; + else { + lua_pushnil(L); + return 1; + } +} + + +static int pairscont (lua_State *L, int status, lua_KContext k) { + (void)L; (void)status; (void)k; /* unused */ + return 3; +} + +static int luaB_pairs (lua_State *L) { + luaL_checkany(L, 1); + if (luaL_getmetafield(L, 1, "__pairs") == LUA_TNIL) { /* no metamethod? */ + lua_pushcfunction(L, luaB_next); /* will return generator, */ + lua_pushvalue(L, 1); /* state, */ + lua_pushnil(L); /* and initial value */ + } + else { + lua_pushvalue(L, 1); /* argument 'self' to metamethod */ + lua_callk(L, 1, 3, 0, pairscont); /* get 3 values from metamethod */ + } + return 3; +} + + +/* +** Traversal function for 'ipairs' +*/ +static int ipairsaux (lua_State *L) { + lua_Integer i = luaL_checkinteger(L, 2); + i = luaL_intop(+, i, 1); + lua_pushinteger(L, i); + return (lua_geti(L, 1, i) == LUA_TNIL) ? 1 : 2; +} + + +/* +** 'ipairs' function. Returns 'ipairsaux', given "table", 0. +** (The given "table" may not be a table.) +*/ +static int luaB_ipairs (lua_State *L) { + luaL_checkany(L, 1); + lua_pushcfunction(L, ipairsaux); /* iteration function */ + lua_pushvalue(L, 1); /* state */ + lua_pushinteger(L, 0); /* initial value */ + return 3; +} + + +static int load_aux (lua_State *L, int status, int envidx) { + if (l_likely(status == LUA_OK)) { + if (envidx != 0) { /* 'env' parameter? */ + lua_pushvalue(L, envidx); /* environment for loaded function */ + if (!lua_setupvalue(L, -2, 1)) /* set it as 1st upvalue */ + lua_pop(L, 1); /* remove 'env' if not used by previous call */ + } + return 1; + } + else { /* error (message is on top of the stack) */ + luaL_pushfail(L); + lua_insert(L, -2); /* put before error message */ + return 2; /* return fail plus error message */ + } +} + + +static int luaB_loadfile (lua_State *L) { + const char *fname = luaL_optstring(L, 1, NULL); + const char *mode = luaL_optstring(L, 2, NULL); + int env = (!lua_isnone(L, 3) ? 3 : 0); /* 'env' index or 0 if no 'env' */ + int status = luaL_loadfilex(L, fname, mode); + return load_aux(L, status, env); +} + + +/* +** {====================================================== +** Generic Read function +** ======================================================= +*/ + + +/* +** reserved slot, above all arguments, to hold a copy of the returned +** string to avoid it being collected while parsed. 'load' has four +** optional arguments (chunk, source name, mode, and environment). +*/ +#define RESERVEDSLOT 5 + + +/* +** Reader for generic 'load' function: 'lua_load' uses the +** stack for internal stuff, so the reader cannot change the +** stack top. Instead, it keeps its resulting string in a +** reserved slot inside the stack. +*/ +static const char *generic_reader (lua_State *L, void *ud, size_t *size) { + (void)(ud); /* not used */ + luaL_checkstack(L, 2, "too many nested functions"); + lua_pushvalue(L, 1); /* get function */ + lua_call(L, 0, 1); /* call it */ + if (lua_isnil(L, -1)) { + lua_pop(L, 1); /* pop result */ + *size = 0; + return NULL; + } + else if (l_unlikely(!lua_isstring(L, -1))) + luaL_error(L, "reader function must return a string"); + lua_replace(L, RESERVEDSLOT); /* save string in reserved slot */ + return lua_tolstring(L, RESERVEDSLOT, size); +} + + +static int luaB_load (lua_State *L) { + int status; + size_t l; + const char *s = lua_tolstring(L, 1, &l); + const char *mode = luaL_optstring(L, 3, "bt"); + int env = (!lua_isnone(L, 4) ? 4 : 0); /* 'env' index or 0 if no 'env' */ + if (s != NULL) { /* loading a string? */ + const char *chunkname = luaL_optstring(L, 2, s); + status = luaL_loadbufferx(L, s, l, chunkname, mode); + } + else { /* loading from a reader function */ + const char *chunkname = luaL_optstring(L, 2, "=(load)"); + luaL_checktype(L, 1, LUA_TFUNCTION); + lua_settop(L, RESERVEDSLOT); /* create reserved slot */ + status = lua_load(L, generic_reader, NULL, chunkname, mode); + } + return load_aux(L, status, env); +} + +/* }====================================================== */ + + +static int dofilecont (lua_State *L, int d1, lua_KContext d2) { + (void)d1; (void)d2; /* only to match 'lua_Kfunction' prototype */ + return lua_gettop(L) - 1; +} + + +static int luaB_dofile (lua_State *L) { + const char *fname = luaL_optstring(L, 1, NULL); + lua_settop(L, 1); + if (l_unlikely(luaL_loadfile(L, fname) != LUA_OK)) + return lua_error(L); + lua_callk(L, 0, LUA_MULTRET, 0, dofilecont); + return dofilecont(L, 0, 0); +} + + +static int luaB_assert (lua_State *L) { + if (l_likely(lua_toboolean(L, 1))) /* condition is true? */ + return lua_gettop(L); /* return all arguments */ + else { /* error */ + luaL_checkany(L, 1); /* there must be a condition */ + lua_remove(L, 1); /* remove it */ + lua_pushliteral(L, "assertion failed!"); /* default message */ + lua_settop(L, 1); /* leave only message (default if no other one) */ + return luaB_error(L); /* call 'error' */ + } +} + + +static int luaB_select (lua_State *L) { + int n = lua_gettop(L); + if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') { + lua_pushinteger(L, n-1); + return 1; + } + else { + lua_Integer i = luaL_checkinteger(L, 1); + if (i < 0) i = n + i; + else if (i > n) i = n; + luaL_argcheck(L, 1 <= i, 1, "index out of range"); + return n - (int)i; + } +} + + +/* +** Continuation function for 'pcall' and 'xpcall'. Both functions +** already pushed a 'true' before doing the call, so in case of success +** 'finishpcall' only has to return everything in the stack minus +** 'extra' values (where 'extra' is exactly the number of items to be +** ignored). +*/ +static int finishpcall (lua_State *L, int status, lua_KContext extra) { + if (l_unlikely(status != LUA_OK && status != LUA_YIELD)) { /* error? */ + lua_pushboolean(L, 0); /* first result (false) */ + lua_pushvalue(L, -2); /* error message */ + return 2; /* return false, msg */ + } + else + return lua_gettop(L) - (int)extra; /* return all results */ +} + + +static int luaB_pcall (lua_State *L) { + int status; + luaL_checkany(L, 1); + lua_pushboolean(L, 1); /* first result if no errors */ + lua_insert(L, 1); /* put it in place */ + status = lua_pcallk(L, lua_gettop(L) - 2, LUA_MULTRET, 0, 0, finishpcall); + return finishpcall(L, status, 0); +} + + +/* +** Do a protected call with error handling. After 'lua_rotate', the +** stack will have ; so, the function passes +** 2 to 'finishpcall' to skip the 2 first values when returning results. +*/ +static int luaB_xpcall (lua_State *L) { + int status; + int n = lua_gettop(L); + luaL_checktype(L, 2, LUA_TFUNCTION); /* check error function */ + lua_pushboolean(L, 1); /* first result */ + lua_pushvalue(L, 1); /* function */ + lua_rotate(L, 3, 2); /* move them below function's arguments */ + status = lua_pcallk(L, n - 2, LUA_MULTRET, 2, 2, finishpcall); + return finishpcall(L, status, 2); +} + + +static int luaB_tostring (lua_State *L) { + luaL_checkany(L, 1); + luaL_tolstring(L, 1, NULL); + return 1; +} + + +static const luaL_Reg base_funcs[] = { + {"assert", luaB_assert}, + {"collectgarbage", luaB_collectgarbage}, + {"dofile", luaB_dofile}, + {"error", luaB_error}, + {"getmetatable", luaB_getmetatable}, + {"ipairs", luaB_ipairs}, + {"loadfile", luaB_loadfile}, + {"load", luaB_load}, + {"next", luaB_next}, + {"pairs", luaB_pairs}, + {"pcall", luaB_pcall}, + {"print", luaB_print}, + {"warn", luaB_warn}, + {"rawequal", luaB_rawequal}, + {"rawlen", luaB_rawlen}, + {"rawget", luaB_rawget}, + {"rawset", luaB_rawset}, + {"select", luaB_select}, + {"setmetatable", luaB_setmetatable}, + {"tonumber", luaB_tonumber}, + {"tostring", luaB_tostring}, + {"type", luaB_type}, + {"xpcall", luaB_xpcall}, + /* placeholders */ + {LUA_GNAME, NULL}, + {"_VERSION", NULL}, + {NULL, NULL} +}; + + +LUAMOD_API int luaopen_base (lua_State *L) { + /* open lib into global table */ + lua_pushglobaltable(L); + luaL_setfuncs(L, base_funcs, 0); + /* set global _G */ + lua_pushvalue(L, -1); + lua_setfield(L, -2, LUA_GNAME); + /* set global _VERSION */ + lua_pushliteral(L, LUA_VERSION); + lua_setfield(L, -2, "_VERSION"); + return 1; +} + diff --git a/LuaSkin/lua-5.4.7/src/lcode.c b/LuaSkin/lua-5.4.7/src/lcode.c new file mode 100644 index 000000000..87616140e --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lcode.c @@ -0,0 +1,1874 @@ +/* +** $Id: lcode.c $ +** Code generator for Lua +** See Copyright Notice in lua.h +*/ + +#define lcode_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include +#include +#include + +#include "lua.h" + +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "llex.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "lstring.h" +#include "ltable.h" +#include "lvm.h" + + +/* Maximum number of registers in a Lua function (must fit in 8 bits) */ +#define MAXREGS 255 + + +#define hasjumps(e) ((e)->t != (e)->f) + + +static int codesJ (FuncState *fs, OpCode o, int sj, int k); + + + +/* semantic error */ +l_noret luaK_semerror (LexState *ls, const char *msg) { + ls->t.token = 0; /* remove "near " from final message */ + luaX_syntaxerror(ls, msg); +} + + +/* +** If expression is a numeric constant, fills 'v' with its value +** and returns 1. Otherwise, returns 0. +*/ +static int tonumeral (const expdesc *e, TValue *v) { + if (hasjumps(e)) + return 0; /* not a numeral */ + switch (e->k) { + case VKINT: + if (v) setivalue(v, e->u.ival); + return 1; + case VKFLT: + if (v) setfltvalue(v, e->u.nval); + return 1; + default: return 0; + } +} + + +/* +** Get the constant value from a constant expression +*/ +static TValue *const2val (FuncState *fs, const expdesc *e) { + lua_assert(e->k == VCONST); + return &fs->ls->dyd->actvar.arr[e->u.info].k; +} + + +/* +** If expression is a constant, fills 'v' with its value +** and returns 1. Otherwise, returns 0. +*/ +int luaK_exp2const (FuncState *fs, const expdesc *e, TValue *v) { + if (hasjumps(e)) + return 0; /* not a constant */ + switch (e->k) { + case VFALSE: + setbfvalue(v); + return 1; + case VTRUE: + setbtvalue(v); + return 1; + case VNIL: + setnilvalue(v); + return 1; + case VKSTR: { + setsvalue(fs->ls->L, v, e->u.strval); + return 1; + } + case VCONST: { + setobj(fs->ls->L, v, const2val(fs, e)); + return 1; + } + default: return tonumeral(e, v); + } +} + + +/* +** Return the previous instruction of the current code. If there +** may be a jump target between the current instruction and the +** previous one, return an invalid instruction (to avoid wrong +** optimizations). +*/ +static Instruction *previousinstruction (FuncState *fs) { + static const Instruction invalidinstruction = ~(Instruction)0; + if (fs->pc > fs->lasttarget) + return &fs->f->code[fs->pc - 1]; /* previous instruction */ + else + return cast(Instruction*, &invalidinstruction); +} + + +/* +** Create a OP_LOADNIL instruction, but try to optimize: if the previous +** instruction is also OP_LOADNIL and ranges are compatible, adjust +** range of previous instruction instead of emitting a new one. (For +** instance, 'local a; local b' will generate a single opcode.) +*/ +void luaK_nil (FuncState *fs, int from, int n) { + int l = from + n - 1; /* last register to set nil */ + Instruction *previous = previousinstruction(fs); + if (GET_OPCODE(*previous) == OP_LOADNIL) { /* previous is LOADNIL? */ + int pfrom = GETARG_A(*previous); /* get previous range */ + int pl = pfrom + GETARG_B(*previous); + if ((pfrom <= from && from <= pl + 1) || + (from <= pfrom && pfrom <= l + 1)) { /* can connect both? */ + if (pfrom < from) from = pfrom; /* from = min(from, pfrom) */ + if (pl > l) l = pl; /* l = max(l, pl) */ + SETARG_A(*previous, from); + SETARG_B(*previous, l - from); + return; + } /* else go through */ + } + luaK_codeABC(fs, OP_LOADNIL, from, n - 1, 0); /* else no optimization */ +} + + +/* +** Gets the destination address of a jump instruction. Used to traverse +** a list of jumps. +*/ +static int getjump (FuncState *fs, int pc) { + int offset = GETARG_sJ(fs->f->code[pc]); + if (offset == NO_JUMP) /* point to itself represents end of list */ + return NO_JUMP; /* end of list */ + else + return (pc+1)+offset; /* turn offset into absolute position */ +} + + +/* +** Fix jump instruction at position 'pc' to jump to 'dest'. +** (Jump addresses are relative in Lua) +*/ +static void fixjump (FuncState *fs, int pc, int dest) { + Instruction *jmp = &fs->f->code[pc]; + int offset = dest - (pc + 1); + lua_assert(dest != NO_JUMP); + if (!(-OFFSET_sJ <= offset && offset <= MAXARG_sJ - OFFSET_sJ)) + luaX_syntaxerror(fs->ls, "control structure too long"); + lua_assert(GET_OPCODE(*jmp) == OP_JMP); + SETARG_sJ(*jmp, offset); +} + + +/* +** Concatenate jump-list 'l2' into jump-list 'l1' +*/ +void luaK_concat (FuncState *fs, int *l1, int l2) { + if (l2 == NO_JUMP) return; /* nothing to concatenate? */ + else if (*l1 == NO_JUMP) /* no original list? */ + *l1 = l2; /* 'l1' points to 'l2' */ + else { + int list = *l1; + int next; + while ((next = getjump(fs, list)) != NO_JUMP) /* find last element */ + list = next; + fixjump(fs, list, l2); /* last element links to 'l2' */ + } +} + + +/* +** Create a jump instruction and return its position, so its destination +** can be fixed later (with 'fixjump'). +*/ +int luaK_jump (FuncState *fs) { + return codesJ(fs, OP_JMP, NO_JUMP, 0); +} + + +/* +** Code a 'return' instruction +*/ +void luaK_ret (FuncState *fs, int first, int nret) { + OpCode op; + switch (nret) { + case 0: op = OP_RETURN0; break; + case 1: op = OP_RETURN1; break; + default: op = OP_RETURN; break; + } + luaK_codeABC(fs, op, first, nret + 1, 0); +} + + +/* +** Code a "conditional jump", that is, a test or comparison opcode +** followed by a jump. Return jump position. +*/ +static int condjump (FuncState *fs, OpCode op, int A, int B, int C, int k) { + luaK_codeABCk(fs, op, A, B, C, k); + return luaK_jump(fs); +} + + +/* +** returns current 'pc' and marks it as a jump target (to avoid wrong +** optimizations with consecutive instructions not in the same basic block). +*/ +int luaK_getlabel (FuncState *fs) { + fs->lasttarget = fs->pc; + return fs->pc; +} + + +/* +** Returns the position of the instruction "controlling" a given +** jump (that is, its condition), or the jump itself if it is +** unconditional. +*/ +static Instruction *getjumpcontrol (FuncState *fs, int pc) { + Instruction *pi = &fs->f->code[pc]; + if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1)))) + return pi-1; + else + return pi; +} + + +/* +** Patch destination register for a TESTSET instruction. +** If instruction in position 'node' is not a TESTSET, return 0 ("fails"). +** Otherwise, if 'reg' is not 'NO_REG', set it as the destination +** register. Otherwise, change instruction to a simple 'TEST' (produces +** no register value) +*/ +static int patchtestreg (FuncState *fs, int node, int reg) { + Instruction *i = getjumpcontrol(fs, node); + if (GET_OPCODE(*i) != OP_TESTSET) + return 0; /* cannot patch other instructions */ + if (reg != NO_REG && reg != GETARG_B(*i)) + SETARG_A(*i, reg); + else { + /* no register to put value or register already has the value; + change instruction to simple test */ + *i = CREATE_ABCk(OP_TEST, GETARG_B(*i), 0, 0, GETARG_k(*i)); + } + return 1; +} + + +/* +** Traverse a list of tests ensuring no one produces a value +*/ +static void removevalues (FuncState *fs, int list) { + for (; list != NO_JUMP; list = getjump(fs, list)) + patchtestreg(fs, list, NO_REG); +} + + +/* +** Traverse a list of tests, patching their destination address and +** registers: tests producing values jump to 'vtarget' (and put their +** values in 'reg'), other tests jump to 'dtarget'. +*/ +static void patchlistaux (FuncState *fs, int list, int vtarget, int reg, + int dtarget) { + while (list != NO_JUMP) { + int next = getjump(fs, list); + if (patchtestreg(fs, list, reg)) + fixjump(fs, list, vtarget); + else + fixjump(fs, list, dtarget); /* jump to default target */ + list = next; + } +} + + +/* +** Path all jumps in 'list' to jump to 'target'. +** (The assert means that we cannot fix a jump to a forward address +** because we only know addresses once code is generated.) +*/ +void luaK_patchlist (FuncState *fs, int list, int target) { + lua_assert(target <= fs->pc); + patchlistaux(fs, list, target, NO_REG, target); +} + + +void luaK_patchtohere (FuncState *fs, int list) { + int hr = luaK_getlabel(fs); /* mark "here" as a jump target */ + luaK_patchlist(fs, list, hr); +} + + +/* limit for difference between lines in relative line info. */ +#define LIMLINEDIFF 0x80 + + +/* +** Save line info for a new instruction. If difference from last line +** does not fit in a byte, of after that many instructions, save a new +** absolute line info; (in that case, the special value 'ABSLINEINFO' +** in 'lineinfo' signals the existence of this absolute information.) +** Otherwise, store the difference from last line in 'lineinfo'. +*/ +static void savelineinfo (FuncState *fs, Proto *f, int line) { + int linedif = line - fs->previousline; + int pc = fs->pc - 1; /* last instruction coded */ + if (abs(linedif) >= LIMLINEDIFF || fs->iwthabs++ >= MAXIWTHABS) { + luaM_growvector(fs->ls->L, f->abslineinfo, fs->nabslineinfo, + f->sizeabslineinfo, AbsLineInfo, MAX_INT, "lines"); + f->abslineinfo[fs->nabslineinfo].pc = pc; + f->abslineinfo[fs->nabslineinfo++].line = line; + linedif = ABSLINEINFO; /* signal that there is absolute information */ + fs->iwthabs = 1; /* restart counter */ + } + luaM_growvector(fs->ls->L, f->lineinfo, pc, f->sizelineinfo, ls_byte, + MAX_INT, "opcodes"); + f->lineinfo[pc] = linedif; + fs->previousline = line; /* last line saved */ +} + + +/* +** Remove line information from the last instruction. +** If line information for that instruction is absolute, set 'iwthabs' +** above its max to force the new (replacing) instruction to have +** absolute line info, too. +*/ +static void removelastlineinfo (FuncState *fs) { + Proto *f = fs->f; + int pc = fs->pc - 1; /* last instruction coded */ + if (f->lineinfo[pc] != ABSLINEINFO) { /* relative line info? */ + fs->previousline -= f->lineinfo[pc]; /* correct last line saved */ + fs->iwthabs--; /* undo previous increment */ + } + else { /* absolute line information */ + lua_assert(f->abslineinfo[fs->nabslineinfo - 1].pc == pc); + fs->nabslineinfo--; /* remove it */ + fs->iwthabs = MAXIWTHABS + 1; /* force next line info to be absolute */ + } +} + + +/* +** Remove the last instruction created, correcting line information +** accordingly. +*/ +static void removelastinstruction (FuncState *fs) { + removelastlineinfo(fs); + fs->pc--; +} + + +/* +** Emit instruction 'i', checking for array sizes and saving also its +** line information. Return 'i' position. +*/ +int luaK_code (FuncState *fs, Instruction i) { + Proto *f = fs->f; + /* put new instruction in code array */ + luaM_growvector(fs->ls->L, f->code, fs->pc, f->sizecode, Instruction, + MAX_INT, "opcodes"); + f->code[fs->pc++] = i; + savelineinfo(fs, f, fs->ls->lastline); + return fs->pc - 1; /* index of new instruction */ +} + + +/* +** Format and emit an 'iABC' instruction. (Assertions check consistency +** of parameters versus opcode.) +*/ +int luaK_codeABCk (FuncState *fs, OpCode o, int a, int b, int c, int k) { + lua_assert(getOpMode(o) == iABC); + lua_assert(a <= MAXARG_A && b <= MAXARG_B && + c <= MAXARG_C && (k & ~1) == 0); + return luaK_code(fs, CREATE_ABCk(o, a, b, c, k)); +} + + +/* +** Format and emit an 'iABx' instruction. +*/ +int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) { + lua_assert(getOpMode(o) == iABx); + lua_assert(a <= MAXARG_A && bc <= MAXARG_Bx); + return luaK_code(fs, CREATE_ABx(o, a, bc)); +} + + +/* +** Format and emit an 'iAsBx' instruction. +*/ +static int codeAsBx (FuncState *fs, OpCode o, int a, int bc) { + unsigned int b = bc + OFFSET_sBx; + lua_assert(getOpMode(o) == iAsBx); + lua_assert(a <= MAXARG_A && b <= MAXARG_Bx); + return luaK_code(fs, CREATE_ABx(o, a, b)); +} + + +/* +** Format and emit an 'isJ' instruction. +*/ +static int codesJ (FuncState *fs, OpCode o, int sj, int k) { + unsigned int j = sj + OFFSET_sJ; + lua_assert(getOpMode(o) == isJ); + lua_assert(j <= MAXARG_sJ && (k & ~1) == 0); + return luaK_code(fs, CREATE_sJ(o, j, k)); +} + + +/* +** Emit an "extra argument" instruction (format 'iAx') +*/ +static int codeextraarg (FuncState *fs, int a) { + lua_assert(a <= MAXARG_Ax); + return luaK_code(fs, CREATE_Ax(OP_EXTRAARG, a)); +} + + +/* +** Emit a "load constant" instruction, using either 'OP_LOADK' +** (if constant index 'k' fits in 18 bits) or an 'OP_LOADKX' +** instruction with "extra argument". +*/ +static int luaK_codek (FuncState *fs, int reg, int k) { + if (k <= MAXARG_Bx) + return luaK_codeABx(fs, OP_LOADK, reg, k); + else { + int p = luaK_codeABx(fs, OP_LOADKX, reg, 0); + codeextraarg(fs, k); + return p; + } +} + + +/* +** Check register-stack level, keeping track of its maximum size +** in field 'maxstacksize' +*/ +void luaK_checkstack (FuncState *fs, int n) { + int newstack = fs->freereg + n; + if (newstack > fs->f->maxstacksize) { + if (newstack >= MAXREGS) + luaX_syntaxerror(fs->ls, + "function or expression needs too many registers"); + fs->f->maxstacksize = cast_byte(newstack); + } +} + + +/* +** Reserve 'n' registers in register stack +*/ +void luaK_reserveregs (FuncState *fs, int n) { + luaK_checkstack(fs, n); + fs->freereg += n; +} + + +/* +** Free register 'reg', if it is neither a constant index nor +** a local variable. +) +*/ +static void freereg (FuncState *fs, int reg) { + if (reg >= luaY_nvarstack(fs)) { + fs->freereg--; + lua_assert(reg == fs->freereg); + } +} + + +/* +** Free two registers in proper order +*/ +static void freeregs (FuncState *fs, int r1, int r2) { + if (r1 > r2) { + freereg(fs, r1); + freereg(fs, r2); + } + else { + freereg(fs, r2); + freereg(fs, r1); + } +} + + +/* +** Free register used by expression 'e' (if any) +*/ +static void freeexp (FuncState *fs, expdesc *e) { + if (e->k == VNONRELOC) + freereg(fs, e->u.info); +} + + +/* +** Free registers used by expressions 'e1' and 'e2' (if any) in proper +** order. +*/ +static void freeexps (FuncState *fs, expdesc *e1, expdesc *e2) { + int r1 = (e1->k == VNONRELOC) ? e1->u.info : -1; + int r2 = (e2->k == VNONRELOC) ? e2->u.info : -1; + freeregs(fs, r1, r2); +} + + +/* +** Add constant 'v' to prototype's list of constants (field 'k'). +** Use scanner's table to cache position of constants in constant list +** and try to reuse constants. Because some values should not be used +** as keys (nil cannot be a key, integer keys can collapse with float +** keys), the caller must provide a useful 'key' for indexing the cache. +** Note that all functions share the same table, so entering or exiting +** a function can make some indices wrong. +*/ +static int addk (FuncState *fs, TValue *key, TValue *v) { + TValue val; + lua_State *L = fs->ls->L; + Proto *f = fs->f; + const TValue *idx = luaH_get(fs->ls->h, key); /* query scanner table */ + int k, oldsize; + if (ttisinteger(idx)) { /* is there an index there? */ + k = cast_int(ivalue(idx)); + /* correct value? (warning: must distinguish floats from integers!) */ + if (k < fs->nk && ttypetag(&f->k[k]) == ttypetag(v) && + luaV_rawequalobj(&f->k[k], v)) + return k; /* reuse index */ + } + /* constant not found; create a new entry */ + oldsize = f->sizek; + k = fs->nk; + /* numerical value does not need GC barrier; + table has no metatable, so it does not need to invalidate cache */ + setivalue(&val, k); + luaH_finishset(L, fs->ls->h, key, idx, &val); + luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Ax, "constants"); + while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]); + setobj(L, &f->k[k], v); + fs->nk++; + luaC_barrier(L, f, v); + return k; +} + + +/* +** Add a string to list of constants and return its index. +*/ +static int stringK (FuncState *fs, TString *s) { + TValue o; + setsvalue(fs->ls->L, &o, s); + return addk(fs, &o, &o); /* use string itself as key */ +} + + +/* +** Add an integer to list of constants and return its index. +*/ +static int luaK_intK (FuncState *fs, lua_Integer n) { + TValue o; + setivalue(&o, n); + return addk(fs, &o, &o); /* use integer itself as key */ +} + +/* +** Add a float to list of constants and return its index. Floats +** with integral values need a different key, to avoid collision +** with actual integers. To that, we add to the number its smaller +** power-of-two fraction that is still significant in its scale. +** For doubles, that would be 1/2^52. +** (This method is not bulletproof: there may be another float +** with that value, and for floats larger than 2^53 the result is +** still an integer. At worst, this only wastes an entry with +** a duplicate.) +*/ +static int luaK_numberK (FuncState *fs, lua_Number r) { + TValue o; + lua_Integer ik; + setfltvalue(&o, r); + if (!luaV_flttointeger(r, &ik, F2Ieq)) /* not an integral value? */ + return addk(fs, &o, &o); /* use number itself as key */ + else { /* must build an alternative key */ + const int nbm = l_floatatt(MANT_DIG); + const lua_Number q = l_mathop(ldexp)(l_mathop(1.0), -nbm + 1); + const lua_Number k = (ik == 0) ? q : r + r*q; /* new key */ + TValue kv; + setfltvalue(&kv, k); + /* result is not an integral value, unless value is too large */ + lua_assert(!luaV_flttointeger(k, &ik, F2Ieq) || + l_mathop(fabs)(r) >= l_mathop(1e6)); + return addk(fs, &kv, &o); + } +} + + +/* +** Add a false to list of constants and return its index. +*/ +static int boolF (FuncState *fs) { + TValue o; + setbfvalue(&o); + return addk(fs, &o, &o); /* use boolean itself as key */ +} + + +/* +** Add a true to list of constants and return its index. +*/ +static int boolT (FuncState *fs) { + TValue o; + setbtvalue(&o); + return addk(fs, &o, &o); /* use boolean itself as key */ +} + + +/* +** Add nil to list of constants and return its index. +*/ +static int nilK (FuncState *fs) { + TValue k, v; + setnilvalue(&v); + /* cannot use nil as key; instead use table itself to represent nil */ + sethvalue(fs->ls->L, &k, fs->ls->h); + return addk(fs, &k, &v); +} + + +/* +** Check whether 'i' can be stored in an 'sC' operand. Equivalent to +** (0 <= int2sC(i) && int2sC(i) <= MAXARG_C) but without risk of +** overflows in the hidden addition inside 'int2sC'. +*/ +static int fitsC (lua_Integer i) { + return (l_castS2U(i) + OFFSET_sC <= cast_uint(MAXARG_C)); +} + + +/* +** Check whether 'i' can be stored in an 'sBx' operand. +*/ +static int fitsBx (lua_Integer i) { + return (-OFFSET_sBx <= i && i <= MAXARG_Bx - OFFSET_sBx); +} + + +void luaK_int (FuncState *fs, int reg, lua_Integer i) { + if (fitsBx(i)) + codeAsBx(fs, OP_LOADI, reg, cast_int(i)); + else + luaK_codek(fs, reg, luaK_intK(fs, i)); +} + + +static void luaK_float (FuncState *fs, int reg, lua_Number f) { + lua_Integer fi; + if (luaV_flttointeger(f, &fi, F2Ieq) && fitsBx(fi)) + codeAsBx(fs, OP_LOADF, reg, cast_int(fi)); + else + luaK_codek(fs, reg, luaK_numberK(fs, f)); +} + + +/* +** Convert a constant in 'v' into an expression description 'e' +*/ +static void const2exp (TValue *v, expdesc *e) { + switch (ttypetag(v)) { + case LUA_VNUMINT: + e->k = VKINT; e->u.ival = ivalue(v); + break; + case LUA_VNUMFLT: + e->k = VKFLT; e->u.nval = fltvalue(v); + break; + case LUA_VFALSE: + e->k = VFALSE; + break; + case LUA_VTRUE: + e->k = VTRUE; + break; + case LUA_VNIL: + e->k = VNIL; + break; + case LUA_VSHRSTR: case LUA_VLNGSTR: + e->k = VKSTR; e->u.strval = tsvalue(v); + break; + default: lua_assert(0); + } +} + + +/* +** Fix an expression to return the number of results 'nresults'. +** 'e' must be a multi-ret expression (function call or vararg). +*/ +void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) { + Instruction *pc = &getinstruction(fs, e); + if (e->k == VCALL) /* expression is an open function call? */ + SETARG_C(*pc, nresults + 1); + else { + lua_assert(e->k == VVARARG); + SETARG_C(*pc, nresults + 1); + SETARG_A(*pc, fs->freereg); + luaK_reserveregs(fs, 1); + } +} + + +/* +** Convert a VKSTR to a VK +*/ +static void str2K (FuncState *fs, expdesc *e) { + lua_assert(e->k == VKSTR); + e->u.info = stringK(fs, e->u.strval); + e->k = VK; +} + + +/* +** Fix an expression to return one result. +** If expression is not a multi-ret expression (function call or +** vararg), it already returns one result, so nothing needs to be done. +** Function calls become VNONRELOC expressions (as its result comes +** fixed in the base register of the call), while vararg expressions +** become VRELOC (as OP_VARARG puts its results where it wants). +** (Calls are created returning one result, so that does not need +** to be fixed.) +*/ +void luaK_setoneret (FuncState *fs, expdesc *e) { + if (e->k == VCALL) { /* expression is an open function call? */ + /* already returns 1 value */ + lua_assert(GETARG_C(getinstruction(fs, e)) == 2); + e->k = VNONRELOC; /* result has fixed position */ + e->u.info = GETARG_A(getinstruction(fs, e)); + } + else if (e->k == VVARARG) { + SETARG_C(getinstruction(fs, e), 2); + e->k = VRELOC; /* can relocate its simple result */ + } +} + + +/* +** Ensure that expression 'e' is not a variable (nor a ). +** (Expression still may have jump lists.) +*/ +void luaK_dischargevars (FuncState *fs, expdesc *e) { + switch (e->k) { + case VCONST: { + const2exp(const2val(fs, e), e); + break; + } + case VLOCAL: { /* already in a register */ + int temp = e->u.var.ridx; + e->u.info = temp; /* (can't do a direct assignment; values overlap) */ + e->k = VNONRELOC; /* becomes a non-relocatable value */ + break; + } + case VUPVAL: { /* move value to some (pending) register */ + e->u.info = luaK_codeABC(fs, OP_GETUPVAL, 0, e->u.info, 0); + e->k = VRELOC; + break; + } + case VINDEXUP: { + e->u.info = luaK_codeABC(fs, OP_GETTABUP, 0, e->u.ind.t, e->u.ind.idx); + e->k = VRELOC; + break; + } + case VINDEXI: { + freereg(fs, e->u.ind.t); + e->u.info = luaK_codeABC(fs, OP_GETI, 0, e->u.ind.t, e->u.ind.idx); + e->k = VRELOC; + break; + } + case VINDEXSTR: { + freereg(fs, e->u.ind.t); + e->u.info = luaK_codeABC(fs, OP_GETFIELD, 0, e->u.ind.t, e->u.ind.idx); + e->k = VRELOC; + break; + } + case VINDEXED: { + freeregs(fs, e->u.ind.t, e->u.ind.idx); + e->u.info = luaK_codeABC(fs, OP_GETTABLE, 0, e->u.ind.t, e->u.ind.idx); + e->k = VRELOC; + break; + } + case VVARARG: case VCALL: { + luaK_setoneret(fs, e); + break; + } + default: break; /* there is one value available (somewhere) */ + } +} + + +/* +** Ensure expression value is in register 'reg', making 'e' a +** non-relocatable expression. +** (Expression still may have jump lists.) +*/ +static void discharge2reg (FuncState *fs, expdesc *e, int reg) { + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: { + luaK_nil(fs, reg, 1); + break; + } + case VFALSE: { + luaK_codeABC(fs, OP_LOADFALSE, reg, 0, 0); + break; + } + case VTRUE: { + luaK_codeABC(fs, OP_LOADTRUE, reg, 0, 0); + break; + } + case VKSTR: { + str2K(fs, e); + } /* FALLTHROUGH */ + case VK: { + luaK_codek(fs, reg, e->u.info); + break; + } + case VKFLT: { + luaK_float(fs, reg, e->u.nval); + break; + } + case VKINT: { + luaK_int(fs, reg, e->u.ival); + break; + } + case VRELOC: { + Instruction *pc = &getinstruction(fs, e); + SETARG_A(*pc, reg); /* instruction will put result in 'reg' */ + break; + } + case VNONRELOC: { + if (reg != e->u.info) + luaK_codeABC(fs, OP_MOVE, reg, e->u.info, 0); + break; + } + default: { + lua_assert(e->k == VJMP); + return; /* nothing to do... */ + } + } + e->u.info = reg; + e->k = VNONRELOC; +} + + +/* +** Ensure expression value is in a register, making 'e' a +** non-relocatable expression. +** (Expression still may have jump lists.) +*/ +static void discharge2anyreg (FuncState *fs, expdesc *e) { + if (e->k != VNONRELOC) { /* no fixed register yet? */ + luaK_reserveregs(fs, 1); /* get a register */ + discharge2reg(fs, e, fs->freereg-1); /* put value there */ + } +} + + +static int code_loadbool (FuncState *fs, int A, OpCode op) { + luaK_getlabel(fs); /* those instructions may be jump targets */ + return luaK_codeABC(fs, op, A, 0, 0); +} + + +/* +** check whether list has any jump that do not produce a value +** or produce an inverted value +*/ +static int need_value (FuncState *fs, int list) { + for (; list != NO_JUMP; list = getjump(fs, list)) { + Instruction i = *getjumpcontrol(fs, list); + if (GET_OPCODE(i) != OP_TESTSET) return 1; + } + return 0; /* not found */ +} + + +/* +** Ensures final expression result (which includes results from its +** jump lists) is in register 'reg'. +** If expression has jumps, need to patch these jumps either to +** its final position or to "load" instructions (for those tests +** that do not produce values). +*/ +static void exp2reg (FuncState *fs, expdesc *e, int reg) { + discharge2reg(fs, e, reg); + if (e->k == VJMP) /* expression itself is a test? */ + luaK_concat(fs, &e->t, e->u.info); /* put this jump in 't' list */ + if (hasjumps(e)) { + int final; /* position after whole expression */ + int p_f = NO_JUMP; /* position of an eventual LOAD false */ + int p_t = NO_JUMP; /* position of an eventual LOAD true */ + if (need_value(fs, e->t) || need_value(fs, e->f)) { + int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs); + p_f = code_loadbool(fs, reg, OP_LFALSESKIP); /* skip next inst. */ + p_t = code_loadbool(fs, reg, OP_LOADTRUE); + /* jump around these booleans if 'e' is not a test */ + luaK_patchtohere(fs, fj); + } + final = luaK_getlabel(fs); + patchlistaux(fs, e->f, final, reg, p_f); + patchlistaux(fs, e->t, final, reg, p_t); + } + e->f = e->t = NO_JUMP; + e->u.info = reg; + e->k = VNONRELOC; +} + + +/* +** Ensures final expression result is in next available register. +*/ +void luaK_exp2nextreg (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + freeexp(fs, e); + luaK_reserveregs(fs, 1); + exp2reg(fs, e, fs->freereg - 1); +} + + +/* +** Ensures final expression result is in some (any) register +** and return that register. +*/ +int luaK_exp2anyreg (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + if (e->k == VNONRELOC) { /* expression already has a register? */ + if (!hasjumps(e)) /* no jumps? */ + return e->u.info; /* result is already in a register */ + if (e->u.info >= luaY_nvarstack(fs)) { /* reg. is not a local? */ + exp2reg(fs, e, e->u.info); /* put final result in it */ + return e->u.info; + } + /* else expression has jumps and cannot change its register + to hold the jump values, because it is a local variable. + Go through to the default case. */ + } + luaK_exp2nextreg(fs, e); /* default: use next available register */ + return e->u.info; +} + + +/* +** Ensures final expression result is either in a register +** or in an upvalue. +*/ +void luaK_exp2anyregup (FuncState *fs, expdesc *e) { + if (e->k != VUPVAL || hasjumps(e)) + luaK_exp2anyreg(fs, e); +} + + +/* +** Ensures final expression result is either in a register +** or it is a constant. +*/ +void luaK_exp2val (FuncState *fs, expdesc *e) { + if (hasjumps(e)) + luaK_exp2anyreg(fs, e); + else + luaK_dischargevars(fs, e); +} + + +/* +** Try to make 'e' a K expression with an index in the range of R/K +** indices. Return true iff succeeded. +*/ +static int luaK_exp2K (FuncState *fs, expdesc *e) { + if (!hasjumps(e)) { + int info; + switch (e->k) { /* move constants to 'k' */ + case VTRUE: info = boolT(fs); break; + case VFALSE: info = boolF(fs); break; + case VNIL: info = nilK(fs); break; + case VKINT: info = luaK_intK(fs, e->u.ival); break; + case VKFLT: info = luaK_numberK(fs, e->u.nval); break; + case VKSTR: info = stringK(fs, e->u.strval); break; + case VK: info = e->u.info; break; + default: return 0; /* not a constant */ + } + if (info <= MAXINDEXRK) { /* does constant fit in 'argC'? */ + e->k = VK; /* make expression a 'K' expression */ + e->u.info = info; + return 1; + } + } + /* else, expression doesn't fit; leave it unchanged */ + return 0; +} + + +/* +** Ensures final expression result is in a valid R/K index +** (that is, it is either in a register or in 'k' with an index +** in the range of R/K indices). +** Returns 1 iff expression is K. +*/ +static int exp2RK (FuncState *fs, expdesc *e) { + if (luaK_exp2K(fs, e)) + return 1; + else { /* not a constant in the right range: put it in a register */ + luaK_exp2anyreg(fs, e); + return 0; + } +} + + +static void codeABRK (FuncState *fs, OpCode o, int a, int b, + expdesc *ec) { + int k = exp2RK(fs, ec); + luaK_codeABCk(fs, o, a, b, ec->u.info, k); +} + + +/* +** Generate code to store result of expression 'ex' into variable 'var'. +*/ +void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) { + switch (var->k) { + case VLOCAL: { + freeexp(fs, ex); + exp2reg(fs, ex, var->u.var.ridx); /* compute 'ex' into proper place */ + return; + } + case VUPVAL: { + int e = luaK_exp2anyreg(fs, ex); + luaK_codeABC(fs, OP_SETUPVAL, e, var->u.info, 0); + break; + } + case VINDEXUP: { + codeABRK(fs, OP_SETTABUP, var->u.ind.t, var->u.ind.idx, ex); + break; + } + case VINDEXI: { + codeABRK(fs, OP_SETI, var->u.ind.t, var->u.ind.idx, ex); + break; + } + case VINDEXSTR: { + codeABRK(fs, OP_SETFIELD, var->u.ind.t, var->u.ind.idx, ex); + break; + } + case VINDEXED: { + codeABRK(fs, OP_SETTABLE, var->u.ind.t, var->u.ind.idx, ex); + break; + } + default: lua_assert(0); /* invalid var kind to store */ + } + freeexp(fs, ex); +} + + +/* +** Emit SELF instruction (convert expression 'e' into 'e:key(e,'). +*/ +void luaK_self (FuncState *fs, expdesc *e, expdesc *key) { + int ereg; + luaK_exp2anyreg(fs, e); + ereg = e->u.info; /* register where 'e' was placed */ + freeexp(fs, e); + e->u.info = fs->freereg; /* base register for op_self */ + e->k = VNONRELOC; /* self expression has a fixed register */ + luaK_reserveregs(fs, 2); /* function and 'self' produced by op_self */ + codeABRK(fs, OP_SELF, e->u.info, ereg, key); + freeexp(fs, key); +} + + +/* +** Negate condition 'e' (where 'e' is a comparison). +*/ +static void negatecondition (FuncState *fs, expdesc *e) { + Instruction *pc = getjumpcontrol(fs, e->u.info); + lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET && + GET_OPCODE(*pc) != OP_TEST); + SETARG_k(*pc, (GETARG_k(*pc) ^ 1)); +} + + +/* +** Emit instruction to jump if 'e' is 'cond' (that is, if 'cond' +** is true, code will jump if 'e' is true.) Return jump position. +** Optimize when 'e' is 'not' something, inverting the condition +** and removing the 'not'. +*/ +static int jumponcond (FuncState *fs, expdesc *e, int cond) { + if (e->k == VRELOC) { + Instruction ie = getinstruction(fs, e); + if (GET_OPCODE(ie) == OP_NOT) { + removelastinstruction(fs); /* remove previous OP_NOT */ + return condjump(fs, OP_TEST, GETARG_B(ie), 0, 0, !cond); + } + /* else go through */ + } + discharge2anyreg(fs, e); + freeexp(fs, e); + return condjump(fs, OP_TESTSET, NO_REG, e->u.info, 0, cond); +} + + +/* +** Emit code to go through if 'e' is true, jump otherwise. +*/ +void luaK_goiftrue (FuncState *fs, expdesc *e) { + int pc; /* pc of new jump */ + luaK_dischargevars(fs, e); + switch (e->k) { + case VJMP: { /* condition? */ + negatecondition(fs, e); /* jump when it is false */ + pc = e->u.info; /* save jump position */ + break; + } + case VK: case VKFLT: case VKINT: case VKSTR: case VTRUE: { + pc = NO_JUMP; /* always true; do nothing */ + break; + } + default: { + pc = jumponcond(fs, e, 0); /* jump when false */ + break; + } + } + luaK_concat(fs, &e->f, pc); /* insert new jump in false list */ + luaK_patchtohere(fs, e->t); /* true list jumps to here (to go through) */ + e->t = NO_JUMP; +} + + +/* +** Emit code to go through if 'e' is false, jump otherwise. +*/ +void luaK_goiffalse (FuncState *fs, expdesc *e) { + int pc; /* pc of new jump */ + luaK_dischargevars(fs, e); + switch (e->k) { + case VJMP: { + pc = e->u.info; /* already jump if true */ + break; + } + case VNIL: case VFALSE: { + pc = NO_JUMP; /* always false; do nothing */ + break; + } + default: { + pc = jumponcond(fs, e, 1); /* jump if true */ + break; + } + } + luaK_concat(fs, &e->t, pc); /* insert new jump in 't' list */ + luaK_patchtohere(fs, e->f); /* false list jumps to here (to go through) */ + e->f = NO_JUMP; +} + + +/* +** Code 'not e', doing constant folding. +*/ +static void codenot (FuncState *fs, expdesc *e) { + switch (e->k) { + case VNIL: case VFALSE: { + e->k = VTRUE; /* true == not nil == not false */ + break; + } + case VK: case VKFLT: case VKINT: case VKSTR: case VTRUE: { + e->k = VFALSE; /* false == not "x" == not 0.5 == not 1 == not true */ + break; + } + case VJMP: { + negatecondition(fs, e); + break; + } + case VRELOC: + case VNONRELOC: { + discharge2anyreg(fs, e); + freeexp(fs, e); + e->u.info = luaK_codeABC(fs, OP_NOT, 0, e->u.info, 0); + e->k = VRELOC; + break; + } + default: lua_assert(0); /* cannot happen */ + } + /* interchange true and false lists */ + { int temp = e->f; e->f = e->t; e->t = temp; } + removevalues(fs, e->f); /* values are useless when negated */ + removevalues(fs, e->t); +} + + +/* +** Check whether expression 'e' is a short literal string +*/ +static int isKstr (FuncState *fs, expdesc *e) { + return (e->k == VK && !hasjumps(e) && e->u.info <= MAXARG_B && + ttisshrstring(&fs->f->k[e->u.info])); +} + +/* +** Check whether expression 'e' is a literal integer. +*/ +static int isKint (expdesc *e) { + return (e->k == VKINT && !hasjumps(e)); +} + + +/* +** Check whether expression 'e' is a literal integer in +** proper range to fit in register C +*/ +static int isCint (expdesc *e) { + return isKint(e) && (l_castS2U(e->u.ival) <= l_castS2U(MAXARG_C)); +} + + +/* +** Check whether expression 'e' is a literal integer in +** proper range to fit in register sC +*/ +static int isSCint (expdesc *e) { + return isKint(e) && fitsC(e->u.ival); +} + + +/* +** Check whether expression 'e' is a literal integer or float in +** proper range to fit in a register (sB or sC). +*/ +static int isSCnumber (expdesc *e, int *pi, int *isfloat) { + lua_Integer i; + if (e->k == VKINT) + i = e->u.ival; + else if (e->k == VKFLT && luaV_flttointeger(e->u.nval, &i, F2Ieq)) + *isfloat = 1; + else + return 0; /* not a number */ + if (!hasjumps(e) && fitsC(i)) { + *pi = int2sC(cast_int(i)); + return 1; + } + else + return 0; +} + + +/* +** Create expression 't[k]'. 't' must have its final result already in a +** register or upvalue. Upvalues can only be indexed by literal strings. +** Keys can be literal strings in the constant table or arbitrary +** values in registers. +*/ +void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) { + if (k->k == VKSTR) + str2K(fs, k); + lua_assert(!hasjumps(t) && + (t->k == VLOCAL || t->k == VNONRELOC || t->k == VUPVAL)); + if (t->k == VUPVAL && !isKstr(fs, k)) /* upvalue indexed by non 'Kstr'? */ + luaK_exp2anyreg(fs, t); /* put it in a register */ + if (t->k == VUPVAL) { + int temp = t->u.info; /* upvalue index */ + lua_assert(isKstr(fs, k)); + t->u.ind.t = temp; /* (can't do a direct assignment; values overlap) */ + t->u.ind.idx = k->u.info; /* literal short string */ + t->k = VINDEXUP; + } + else { + /* register index of the table */ + t->u.ind.t = (t->k == VLOCAL) ? t->u.var.ridx: t->u.info; + if (isKstr(fs, k)) { + t->u.ind.idx = k->u.info; /* literal short string */ + t->k = VINDEXSTR; + } + else if (isCint(k)) { + t->u.ind.idx = cast_int(k->u.ival); /* int. constant in proper range */ + t->k = VINDEXI; + } + else { + t->u.ind.idx = luaK_exp2anyreg(fs, k); /* register */ + t->k = VINDEXED; + } + } +} + + +/* +** Return false if folding can raise an error. +** Bitwise operations need operands convertible to integers; division +** operations cannot have 0 as divisor. +*/ +static int validop (int op, TValue *v1, TValue *v2) { + switch (op) { + case LUA_OPBAND: case LUA_OPBOR: case LUA_OPBXOR: + case LUA_OPSHL: case LUA_OPSHR: case LUA_OPBNOT: { /* conversion errors */ + lua_Integer i; + return (luaV_tointegerns(v1, &i, LUA_FLOORN2I) && + luaV_tointegerns(v2, &i, LUA_FLOORN2I)); + } + case LUA_OPDIV: case LUA_OPIDIV: case LUA_OPMOD: /* division by 0 */ + return (nvalue(v2) != 0); + default: return 1; /* everything else is valid */ + } +} + + +/* +** Try to "constant-fold" an operation; return 1 iff successful. +** (In this case, 'e1' has the final result.) +*/ +static int constfolding (FuncState *fs, int op, expdesc *e1, + const expdesc *e2) { + TValue v1, v2, res; + if (!tonumeral(e1, &v1) || !tonumeral(e2, &v2) || !validop(op, &v1, &v2)) + return 0; /* non-numeric operands or not safe to fold */ + luaO_rawarith(fs->ls->L, op, &v1, &v2, &res); /* does operation */ + if (ttisinteger(&res)) { + e1->k = VKINT; + e1->u.ival = ivalue(&res); + } + else { /* folds neither NaN nor 0.0 (to avoid problems with -0.0) */ + lua_Number n = fltvalue(&res); + if (luai_numisnan(n) || n == 0) + return 0; + e1->k = VKFLT; + e1->u.nval = n; + } + return 1; +} + + +/* +** Convert a BinOpr to an OpCode (ORDER OPR - ORDER OP) +*/ +l_sinline OpCode binopr2op (BinOpr opr, BinOpr baser, OpCode base) { + lua_assert(baser <= opr && + ((baser == OPR_ADD && opr <= OPR_SHR) || + (baser == OPR_LT && opr <= OPR_LE))); + return cast(OpCode, (cast_int(opr) - cast_int(baser)) + cast_int(base)); +} + + +/* +** Convert a UnOpr to an OpCode (ORDER OPR - ORDER OP) +*/ +l_sinline OpCode unopr2op (UnOpr opr) { + return cast(OpCode, (cast_int(opr) - cast_int(OPR_MINUS)) + + cast_int(OP_UNM)); +} + + +/* +** Convert a BinOpr to a tag method (ORDER OPR - ORDER TM) +*/ +l_sinline TMS binopr2TM (BinOpr opr) { + lua_assert(OPR_ADD <= opr && opr <= OPR_SHR); + return cast(TMS, (cast_int(opr) - cast_int(OPR_ADD)) + cast_int(TM_ADD)); +} + + +/* +** Emit code for unary expressions that "produce values" +** (everything but 'not'). +** Expression to produce final result will be encoded in 'e'. +*/ +static void codeunexpval (FuncState *fs, OpCode op, expdesc *e, int line) { + int r = luaK_exp2anyreg(fs, e); /* opcodes operate only on registers */ + freeexp(fs, e); + e->u.info = luaK_codeABC(fs, op, 0, r, 0); /* generate opcode */ + e->k = VRELOC; /* all those operations are relocatable */ + luaK_fixline(fs, line); +} + + +/* +** Emit code for binary expressions that "produce values" +** (everything but logical operators 'and'/'or' and comparison +** operators). +** Expression to produce final result will be encoded in 'e1'. +*/ +static void finishbinexpval (FuncState *fs, expdesc *e1, expdesc *e2, + OpCode op, int v2, int flip, int line, + OpCode mmop, TMS event) { + int v1 = luaK_exp2anyreg(fs, e1); + int pc = luaK_codeABCk(fs, op, 0, v1, v2, 0); + freeexps(fs, e1, e2); + e1->u.info = pc; + e1->k = VRELOC; /* all those operations are relocatable */ + luaK_fixline(fs, line); + luaK_codeABCk(fs, mmop, v1, v2, event, flip); /* to call metamethod */ + luaK_fixline(fs, line); +} + + +/* +** Emit code for binary expressions that "produce values" over +** two registers. +*/ +static void codebinexpval (FuncState *fs, BinOpr opr, + expdesc *e1, expdesc *e2, int line) { + OpCode op = binopr2op(opr, OPR_ADD, OP_ADD); + int v2 = luaK_exp2anyreg(fs, e2); /* make sure 'e2' is in a register */ + /* 'e1' must be already in a register or it is a constant */ + lua_assert((VNIL <= e1->k && e1->k <= VKSTR) || + e1->k == VNONRELOC || e1->k == VRELOC); + lua_assert(OP_ADD <= op && op <= OP_SHR); + finishbinexpval(fs, e1, e2, op, v2, 0, line, OP_MMBIN, binopr2TM(opr)); +} + + +/* +** Code binary operators with immediate operands. +*/ +static void codebini (FuncState *fs, OpCode op, + expdesc *e1, expdesc *e2, int flip, int line, + TMS event) { + int v2 = int2sC(cast_int(e2->u.ival)); /* immediate operand */ + lua_assert(e2->k == VKINT); + finishbinexpval(fs, e1, e2, op, v2, flip, line, OP_MMBINI, event); +} + + +/* +** Code binary operators with K operand. +*/ +static void codebinK (FuncState *fs, BinOpr opr, + expdesc *e1, expdesc *e2, int flip, int line) { + TMS event = binopr2TM(opr); + int v2 = e2->u.info; /* K index */ + OpCode op = binopr2op(opr, OPR_ADD, OP_ADDK); + finishbinexpval(fs, e1, e2, op, v2, flip, line, OP_MMBINK, event); +} + + +/* Try to code a binary operator negating its second operand. +** For the metamethod, 2nd operand must keep its original value. +*/ +static int finishbinexpneg (FuncState *fs, expdesc *e1, expdesc *e2, + OpCode op, int line, TMS event) { + if (!isKint(e2)) + return 0; /* not an integer constant */ + else { + lua_Integer i2 = e2->u.ival; + if (!(fitsC(i2) && fitsC(-i2))) + return 0; /* not in the proper range */ + else { /* operating a small integer constant */ + int v2 = cast_int(i2); + finishbinexpval(fs, e1, e2, op, int2sC(-v2), 0, line, OP_MMBINI, event); + /* correct metamethod argument */ + SETARG_B(fs->f->code[fs->pc - 1], int2sC(v2)); + return 1; /* successfully coded */ + } + } +} + + +static void swapexps (expdesc *e1, expdesc *e2) { + expdesc temp = *e1; *e1 = *e2; *e2 = temp; /* swap 'e1' and 'e2' */ +} + + +/* +** Code binary operators with no constant operand. +*/ +static void codebinNoK (FuncState *fs, BinOpr opr, + expdesc *e1, expdesc *e2, int flip, int line) { + if (flip) + swapexps(e1, e2); /* back to original order */ + codebinexpval(fs, opr, e1, e2, line); /* use standard operators */ +} + + +/* +** Code arithmetic operators ('+', '-', ...). If second operand is a +** constant in the proper range, use variant opcodes with K operands. +*/ +static void codearith (FuncState *fs, BinOpr opr, + expdesc *e1, expdesc *e2, int flip, int line) { + if (tonumeral(e2, NULL) && luaK_exp2K(fs, e2)) /* K operand? */ + codebinK(fs, opr, e1, e2, flip, line); + else /* 'e2' is neither an immediate nor a K operand */ + codebinNoK(fs, opr, e1, e2, flip, line); +} + + +/* +** Code commutative operators ('+', '*'). If first operand is a +** numeric constant, change order of operands to try to use an +** immediate or K operator. +*/ +static void codecommutative (FuncState *fs, BinOpr op, + expdesc *e1, expdesc *e2, int line) { + int flip = 0; + if (tonumeral(e1, NULL)) { /* is first operand a numeric constant? */ + swapexps(e1, e2); /* change order */ + flip = 1; + } + if (op == OPR_ADD && isSCint(e2)) /* immediate operand? */ + codebini(fs, OP_ADDI, e1, e2, flip, line, TM_ADD); + else + codearith(fs, op, e1, e2, flip, line); +} + + +/* +** Code bitwise operations; they are all commutative, so the function +** tries to put an integer constant as the 2nd operand (a K operand). +*/ +static void codebitwise (FuncState *fs, BinOpr opr, + expdesc *e1, expdesc *e2, int line) { + int flip = 0; + if (e1->k == VKINT) { + swapexps(e1, e2); /* 'e2' will be the constant operand */ + flip = 1; + } + if (e2->k == VKINT && luaK_exp2K(fs, e2)) /* K operand? */ + codebinK(fs, opr, e1, e2, flip, line); + else /* no constants */ + codebinNoK(fs, opr, e1, e2, flip, line); +} + + +/* +** Emit code for order comparisons. When using an immediate operand, +** 'isfloat' tells whether the original value was a float. +*/ +static void codeorder (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2) { + int r1, r2; + int im; + int isfloat = 0; + OpCode op; + if (isSCnumber(e2, &im, &isfloat)) { + /* use immediate operand */ + r1 = luaK_exp2anyreg(fs, e1); + r2 = im; + op = binopr2op(opr, OPR_LT, OP_LTI); + } + else if (isSCnumber(e1, &im, &isfloat)) { + /* transform (A < B) to (B > A) and (A <= B) to (B >= A) */ + r1 = luaK_exp2anyreg(fs, e2); + r2 = im; + op = binopr2op(opr, OPR_LT, OP_GTI); + } + else { /* regular case, compare two registers */ + r1 = luaK_exp2anyreg(fs, e1); + r2 = luaK_exp2anyreg(fs, e2); + op = binopr2op(opr, OPR_LT, OP_LT); + } + freeexps(fs, e1, e2); + e1->u.info = condjump(fs, op, r1, r2, isfloat, 1); + e1->k = VJMP; +} + + +/* +** Emit code for equality comparisons ('==', '~='). +** 'e1' was already put as RK by 'luaK_infix'. +*/ +static void codeeq (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2) { + int r1, r2; + int im; + int isfloat = 0; /* not needed here, but kept for symmetry */ + OpCode op; + if (e1->k != VNONRELOC) { + lua_assert(e1->k == VK || e1->k == VKINT || e1->k == VKFLT); + swapexps(e1, e2); + } + r1 = luaK_exp2anyreg(fs, e1); /* 1st expression must be in register */ + if (isSCnumber(e2, &im, &isfloat)) { + op = OP_EQI; + r2 = im; /* immediate operand */ + } + else if (exp2RK(fs, e2)) { /* 2nd expression is constant? */ + op = OP_EQK; + r2 = e2->u.info; /* constant index */ + } + else { + op = OP_EQ; /* will compare two registers */ + r2 = luaK_exp2anyreg(fs, e2); + } + freeexps(fs, e1, e2); + e1->u.info = condjump(fs, op, r1, r2, isfloat, (opr == OPR_EQ)); + e1->k = VJMP; +} + + +/* +** Apply prefix operation 'op' to expression 'e'. +*/ +void luaK_prefix (FuncState *fs, UnOpr opr, expdesc *e, int line) { + static const expdesc ef = {VKINT, {0}, NO_JUMP, NO_JUMP}; + luaK_dischargevars(fs, e); + switch (opr) { + case OPR_MINUS: case OPR_BNOT: /* use 'ef' as fake 2nd operand */ + if (constfolding(fs, opr + LUA_OPUNM, e, &ef)) + break; + /* else */ /* FALLTHROUGH */ + case OPR_LEN: + codeunexpval(fs, unopr2op(opr), e, line); + break; + case OPR_NOT: codenot(fs, e); break; + default: lua_assert(0); + } +} + + +/* +** Process 1st operand 'v' of binary operation 'op' before reading +** 2nd operand. +*/ +void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { + luaK_dischargevars(fs, v); + switch (op) { + case OPR_AND: { + luaK_goiftrue(fs, v); /* go ahead only if 'v' is true */ + break; + } + case OPR_OR: { + luaK_goiffalse(fs, v); /* go ahead only if 'v' is false */ + break; + } + case OPR_CONCAT: { + luaK_exp2nextreg(fs, v); /* operand must be on the stack */ + break; + } + case OPR_ADD: case OPR_SUB: + case OPR_MUL: case OPR_DIV: case OPR_IDIV: + case OPR_MOD: case OPR_POW: + case OPR_BAND: case OPR_BOR: case OPR_BXOR: + case OPR_SHL: case OPR_SHR: { + if (!tonumeral(v, NULL)) + luaK_exp2anyreg(fs, v); + /* else keep numeral, which may be folded or used as an immediate + operand */ + break; + } + case OPR_EQ: case OPR_NE: { + if (!tonumeral(v, NULL)) + exp2RK(fs, v); + /* else keep numeral, which may be an immediate operand */ + break; + } + case OPR_LT: case OPR_LE: + case OPR_GT: case OPR_GE: { + int dummy, dummy2; + if (!isSCnumber(v, &dummy, &dummy2)) + luaK_exp2anyreg(fs, v); + /* else keep numeral, which may be an immediate operand */ + break; + } + default: lua_assert(0); + } +} + +/* +** Create code for '(e1 .. e2)'. +** For '(e1 .. e2.1 .. e2.2)' (which is '(e1 .. (e2.1 .. e2.2))', +** because concatenation is right associative), merge both CONCATs. +*/ +static void codeconcat (FuncState *fs, expdesc *e1, expdesc *e2, int line) { + Instruction *ie2 = previousinstruction(fs); + if (GET_OPCODE(*ie2) == OP_CONCAT) { /* is 'e2' a concatenation? */ + int n = GETARG_B(*ie2); /* # of elements concatenated in 'e2' */ + lua_assert(e1->u.info + 1 == GETARG_A(*ie2)); + freeexp(fs, e2); + SETARG_A(*ie2, e1->u.info); /* correct first element ('e1') */ + SETARG_B(*ie2, n + 1); /* will concatenate one more element */ + } + else { /* 'e2' is not a concatenation */ + luaK_codeABC(fs, OP_CONCAT, e1->u.info, 2, 0); /* new concat opcode */ + freeexp(fs, e2); + luaK_fixline(fs, line); + } +} + + +/* +** Finalize code for binary operation, after reading 2nd operand. +*/ +void luaK_posfix (FuncState *fs, BinOpr opr, + expdesc *e1, expdesc *e2, int line) { + luaK_dischargevars(fs, e2); + if (foldbinop(opr) && constfolding(fs, opr + LUA_OPADD, e1, e2)) + return; /* done by folding */ + switch (opr) { + case OPR_AND: { + lua_assert(e1->t == NO_JUMP); /* list closed by 'luaK_infix' */ + luaK_concat(fs, &e2->f, e1->f); + *e1 = *e2; + break; + } + case OPR_OR: { + lua_assert(e1->f == NO_JUMP); /* list closed by 'luaK_infix' */ + luaK_concat(fs, &e2->t, e1->t); + *e1 = *e2; + break; + } + case OPR_CONCAT: { /* e1 .. e2 */ + luaK_exp2nextreg(fs, e2); + codeconcat(fs, e1, e2, line); + break; + } + case OPR_ADD: case OPR_MUL: { + codecommutative(fs, opr, e1, e2, line); + break; + } + case OPR_SUB: { + if (finishbinexpneg(fs, e1, e2, OP_ADDI, line, TM_SUB)) + break; /* coded as (r1 + -I) */ + /* ELSE */ + } /* FALLTHROUGH */ + case OPR_DIV: case OPR_IDIV: case OPR_MOD: case OPR_POW: { + codearith(fs, opr, e1, e2, 0, line); + break; + } + case OPR_BAND: case OPR_BOR: case OPR_BXOR: { + codebitwise(fs, opr, e1, e2, line); + break; + } + case OPR_SHL: { + if (isSCint(e1)) { + swapexps(e1, e2); + codebini(fs, OP_SHLI, e1, e2, 1, line, TM_SHL); /* I << r2 */ + } + else if (finishbinexpneg(fs, e1, e2, OP_SHRI, line, TM_SHL)) { + /* coded as (r1 >> -I) */; + } + else /* regular case (two registers) */ + codebinexpval(fs, opr, e1, e2, line); + break; + } + case OPR_SHR: { + if (isSCint(e2)) + codebini(fs, OP_SHRI, e1, e2, 0, line, TM_SHR); /* r1 >> I */ + else /* regular case (two registers) */ + codebinexpval(fs, opr, e1, e2, line); + break; + } + case OPR_EQ: case OPR_NE: { + codeeq(fs, opr, e1, e2); + break; + } + case OPR_GT: case OPR_GE: { + /* '(a > b)' <=> '(b < a)'; '(a >= b)' <=> '(b <= a)' */ + swapexps(e1, e2); + opr = cast(BinOpr, (opr - OPR_GT) + OPR_LT); + } /* FALLTHROUGH */ + case OPR_LT: case OPR_LE: { + codeorder(fs, opr, e1, e2); + break; + } + default: lua_assert(0); + } +} + + +/* +** Change line information associated with current position, by removing +** previous info and adding it again with new line. +*/ +void luaK_fixline (FuncState *fs, int line) { + removelastlineinfo(fs); + savelineinfo(fs, fs->f, line); +} + + +void luaK_settablesize (FuncState *fs, int pc, int ra, int asize, int hsize) { + Instruction *inst = &fs->f->code[pc]; + int rb = (hsize != 0) ? luaO_ceillog2(hsize) + 1 : 0; /* hash size */ + int extra = asize / (MAXARG_C + 1); /* higher bits of array size */ + int rc = asize % (MAXARG_C + 1); /* lower bits of array size */ + int k = (extra > 0); /* true iff needs extra argument */ + *inst = CREATE_ABCk(OP_NEWTABLE, ra, rb, rc, k); + *(inst + 1) = CREATE_Ax(OP_EXTRAARG, extra); +} + + +/* +** Emit a SETLIST instruction. +** 'base' is register that keeps table; +** 'nelems' is #table plus those to be stored now; +** 'tostore' is number of values (in registers 'base + 1',...) to add to +** table (or LUA_MULTRET to add up to stack top). +*/ +void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { + lua_assert(tostore != 0 && tostore <= LFIELDS_PER_FLUSH); + if (tostore == LUA_MULTRET) + tostore = 0; + if (nelems <= MAXARG_C) + luaK_codeABC(fs, OP_SETLIST, base, tostore, nelems); + else { + int extra = nelems / (MAXARG_C + 1); + nelems %= (MAXARG_C + 1); + luaK_codeABCk(fs, OP_SETLIST, base, tostore, nelems, 1); + codeextraarg(fs, extra); + } + fs->freereg = base + 1; /* free registers with list values */ +} + + +/* +** return the final target of a jump (skipping jumps to jumps) +*/ +static int finaltarget (Instruction *code, int i) { + int count; + for (count = 0; count < 100; count++) { /* avoid infinite loops */ + Instruction pc = code[i]; + if (GET_OPCODE(pc) != OP_JMP) + break; + else + i += GETARG_sJ(pc) + 1; + } + return i; +} + + +/* +** Do a final pass over the code of a function, doing small peephole +** optimizations and adjustments. +*/ +void luaK_finish (FuncState *fs) { + int i; + Proto *p = fs->f; + for (i = 0; i < fs->pc; i++) { + Instruction *pc = &p->code[i]; + lua_assert(i == 0 || isOT(*(pc - 1)) == isIT(*pc)); + switch (GET_OPCODE(*pc)) { + case OP_RETURN0: case OP_RETURN1: { + if (!(fs->needclose || p->is_vararg)) + break; /* no extra work */ + /* else use OP_RETURN to do the extra work */ + SET_OPCODE(*pc, OP_RETURN); + } /* FALLTHROUGH */ + case OP_RETURN: case OP_TAILCALL: { + if (fs->needclose) + SETARG_k(*pc, 1); /* signal that it needs to close */ + if (p->is_vararg) + SETARG_C(*pc, p->numparams + 1); /* signal that it is vararg */ + break; + } + case OP_JMP: { + int target = finaltarget(p->code, i); + fixjump(fs, i, target); + break; + } + default: break; + } + } +} diff --git a/LuaSkin/lua-5.3.4/src/lcode.h b/LuaSkin/lua-5.4.7/src/lcode.h similarity index 75% rename from LuaSkin/lua-5.3.4/src/lcode.h rename to LuaSkin/lua-5.4.7/src/lcode.h index cd306d573..0b971fc43 100644 --- a/LuaSkin/lua-5.3.4/src/lcode.h +++ b/LuaSkin/lua-5.4.7/src/lcode.h @@ -1,5 +1,5 @@ /* -** $Id: lcode.h,v 1.64 2016/01/05 16:22:37 roberto Exp $ +** $Id: lcode.h $ ** Code generator for Lua ** See Copyright Notice in lua.h */ @@ -24,46 +24,56 @@ ** grep "ORDER OPR" if you change these enums (ORDER OP) */ typedef enum BinOpr { + /* arithmetic operators */ OPR_ADD, OPR_SUB, OPR_MUL, OPR_MOD, OPR_POW, - OPR_DIV, - OPR_IDIV, + OPR_DIV, OPR_IDIV, + /* bitwise operators */ OPR_BAND, OPR_BOR, OPR_BXOR, OPR_SHL, OPR_SHR, + /* string operator */ OPR_CONCAT, + /* comparison operators */ OPR_EQ, OPR_LT, OPR_LE, OPR_NE, OPR_GT, OPR_GE, + /* logical operators */ OPR_AND, OPR_OR, OPR_NOBINOPR } BinOpr; +/* true if operation is foldable (that is, it is arithmetic or bitwise) */ +#define foldbinop(op) ((op) <= OPR_SHR) + + +#define luaK_codeABC(fs,o,a,b,c) luaK_codeABCk(fs,o,a,b,c,0) + + typedef enum UnOpr { OPR_MINUS, OPR_BNOT, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; /* get (pointer to) instruction of given 'expdesc' */ #define getinstruction(fs,e) ((fs)->f->code[(e)->u.info]) -#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx) #define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) #define luaK_jumpto(fs,t) luaK_patchlist(fs, luaK_jump(fs), t) +LUAI_FUNC int luaK_code (FuncState *fs, Instruction i); LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); -LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C); -LUAI_FUNC int luaK_codek (FuncState *fs, int reg, int k); +LUAI_FUNC int luaK_codeABCk (FuncState *fs, OpCode o, int A, + int B, int C, int k); +LUAI_FUNC int luaK_exp2const (FuncState *fs, const expdesc *e, TValue *v); LUAI_FUNC void luaK_fixline (FuncState *fs, int line); LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n); LUAI_FUNC void luaK_checkstack (FuncState *fs, int n); -LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s); -LUAI_FUNC int luaK_intK (FuncState *fs, lua_Integer n); +LUAI_FUNC void luaK_int (FuncState *fs, int reg, lua_Integer n); LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e); LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e); LUAI_FUNC void luaK_exp2anyregup (FuncState *fs, expdesc *e); LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e); LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e); -LUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e); LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key); LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k); LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e); @@ -75,14 +85,17 @@ LUAI_FUNC int luaK_jump (FuncState *fs); LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret); LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target); LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list); -LUAI_FUNC void luaK_patchclose (FuncState *fs, int list, int level); LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2); LUAI_FUNC int luaK_getlabel (FuncState *fs); LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v, int line); LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v); LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2, int line); +LUAI_FUNC void luaK_settablesize (FuncState *fs, int pc, + int ra, int asize, int hsize); LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore); +LUAI_FUNC void luaK_finish (FuncState *fs); +LUAI_FUNC l_noret luaK_semerror (LexState *ls, const char *msg); #endif diff --git a/LuaSkin/lua-5.4.7/src/lcorolib.c b/LuaSkin/lua-5.4.7/src/lcorolib.c new file mode 100644 index 000000000..c64adf08a --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lcorolib.c @@ -0,0 +1,210 @@ +/* +** $Id: lcorolib.c $ +** Coroutine Library +** See Copyright Notice in lua.h +*/ + +#define lcorolib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +static lua_State *getco (lua_State *L) { + lua_State *co = lua_tothread(L, 1); + luaL_argexpected(L, co, 1, "thread"); + return co; +} + + +/* +** Resumes a coroutine. Returns the number of results for non-error +** cases or -1 for errors. +*/ +static int auxresume (lua_State *L, lua_State *co, int narg) { + int status, nres; + if (l_unlikely(!lua_checkstack(co, narg))) { + lua_pushliteral(L, "too many arguments to resume"); + return -1; /* error flag */ + } + lua_xmove(L, co, narg); + status = lua_resume(co, L, narg, &nres); + if (l_likely(status == LUA_OK || status == LUA_YIELD)) { + if (l_unlikely(!lua_checkstack(L, nres + 1))) { + lua_pop(co, nres); /* remove results anyway */ + lua_pushliteral(L, "too many results to resume"); + return -1; /* error flag */ + } + lua_xmove(co, L, nres); /* move yielded values */ + return nres; + } + else { + lua_xmove(co, L, 1); /* move error message */ + return -1; /* error flag */ + } +} + + +static int luaB_coresume (lua_State *L) { + lua_State *co = getco(L); + int r; + r = auxresume(L, co, lua_gettop(L) - 1); + if (l_unlikely(r < 0)) { + lua_pushboolean(L, 0); + lua_insert(L, -2); + return 2; /* return false + error message */ + } + else { + lua_pushboolean(L, 1); + lua_insert(L, -(r + 1)); + return r + 1; /* return true + 'resume' returns */ + } +} + + +static int luaB_auxwrap (lua_State *L) { + lua_State *co = lua_tothread(L, lua_upvalueindex(1)); + int r = auxresume(L, co, lua_gettop(L)); + if (l_unlikely(r < 0)) { /* error? */ + int stat = lua_status(co); + if (stat != LUA_OK && stat != LUA_YIELD) { /* error in the coroutine? */ + stat = lua_closethread(co, L); /* close its tbc variables */ + lua_assert(stat != LUA_OK); + lua_xmove(co, L, 1); /* move error message to the caller */ + } + if (stat != LUA_ERRMEM && /* not a memory error and ... */ + lua_type(L, -1) == LUA_TSTRING) { /* ... error object is a string? */ + luaL_where(L, 1); /* add extra info, if available */ + lua_insert(L, -2); + lua_concat(L, 2); + } + return lua_error(L); /* propagate error */ + } + return r; +} + + +static int luaB_cocreate (lua_State *L) { + lua_State *NL; + luaL_checktype(L, 1, LUA_TFUNCTION); + NL = lua_newthread(L); + lua_pushvalue(L, 1); /* move function to top */ + lua_xmove(L, NL, 1); /* move function from L to NL */ + return 1; +} + + +static int luaB_cowrap (lua_State *L) { + luaB_cocreate(L); + lua_pushcclosure(L, luaB_auxwrap, 1); + return 1; +} + + +static int luaB_yield (lua_State *L) { + return lua_yield(L, lua_gettop(L)); +} + + +#define COS_RUN 0 +#define COS_DEAD 1 +#define COS_YIELD 2 +#define COS_NORM 3 + + +static const char *const statname[] = + {"running", "dead", "suspended", "normal"}; + + +static int auxstatus (lua_State *L, lua_State *co) { + if (L == co) return COS_RUN; + else { + switch (lua_status(co)) { + case LUA_YIELD: + return COS_YIELD; + case LUA_OK: { + lua_Debug ar; + if (lua_getstack(co, 0, &ar)) /* does it have frames? */ + return COS_NORM; /* it is running */ + else if (lua_gettop(co) == 0) + return COS_DEAD; + else + return COS_YIELD; /* initial state */ + } + default: /* some error occurred */ + return COS_DEAD; + } + } +} + + +static int luaB_costatus (lua_State *L) { + lua_State *co = getco(L); + lua_pushstring(L, statname[auxstatus(L, co)]); + return 1; +} + + +static int luaB_yieldable (lua_State *L) { + lua_State *co = lua_isnone(L, 1) ? L : getco(L); + lua_pushboolean(L, lua_isyieldable(co)); + return 1; +} + + +static int luaB_corunning (lua_State *L) { + int ismain = lua_pushthread(L); + lua_pushboolean(L, ismain); + return 2; +} + + +static int luaB_close (lua_State *L) { + lua_State *co = getco(L); + int status = auxstatus(L, co); + switch (status) { + case COS_DEAD: case COS_YIELD: { + status = lua_closethread(co, L); + if (status == LUA_OK) { + lua_pushboolean(L, 1); + return 1; + } + else { + lua_pushboolean(L, 0); + lua_xmove(co, L, 1); /* move error message */ + return 2; + } + } + default: /* normal or running coroutine */ + return luaL_error(L, "cannot close a %s coroutine", statname[status]); + } +} + + +static const luaL_Reg co_funcs[] = { + {"create", luaB_cocreate}, + {"resume", luaB_coresume}, + {"running", luaB_corunning}, + {"status", luaB_costatus}, + {"wrap", luaB_cowrap}, + {"yield", luaB_yield}, + {"isyieldable", luaB_yieldable}, + {"close", luaB_close}, + {NULL, NULL} +}; + + + +LUAMOD_API int luaopen_coroutine (lua_State *L) { + luaL_newlib(L, co_funcs); + return 1; +} + diff --git a/LuaSkin/lua-5.4.7/src/lctype.c b/LuaSkin/lua-5.4.7/src/lctype.c new file mode 100644 index 000000000..954228094 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lctype.c @@ -0,0 +1,64 @@ +/* +** $Id: lctype.c $ +** 'ctype' functions for Lua +** See Copyright Notice in lua.h +*/ + +#define lctype_c +#define LUA_CORE + +#include "lprefix.h" + + +#include "lctype.h" + +#if !LUA_USE_CTYPE /* { */ + +#include + + +#if defined (LUA_UCID) /* accept UniCode IDentifiers? */ +/* consider all non-ascii codepoints to be alphabetic */ +#define NONA 0x01 +#else +#define NONA 0x00 /* default */ +#endif + + +LUAI_DDEF const lu_byte luai_ctype_[UCHAR_MAX + 2] = { + 0x00, /* EOZ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0. */ + 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 1. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, /* 2. */ + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, /* 3. */ + 0x16, 0x16, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 4. */ + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 5. */ + 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x05, + 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 6. */ + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 7. */ + 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x00, + NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* 8. */ + NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, + NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* 9. */ + NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, + NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* a. */ + NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, + NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* b. */ + NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, + 0x00, 0x00, NONA, NONA, NONA, NONA, NONA, NONA, /* c. */ + NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, + NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* d. */ + NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, + NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* e. */ + NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, + NONA, NONA, NONA, NONA, NONA, 0x00, 0x00, 0x00, /* f. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +#endif /* } */ diff --git a/LuaSkin/lua-5.4.7/src/lctype.h b/LuaSkin/lua-5.4.7/src/lctype.h new file mode 100644 index 000000000..864e19018 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lctype.h @@ -0,0 +1,101 @@ +/* +** $Id: lctype.h $ +** 'ctype' functions for Lua +** See Copyright Notice in lua.h +*/ + +#ifndef lctype_h +#define lctype_h + +#include "lua.h" + + +/* +** WARNING: the functions defined here do not necessarily correspond +** to the similar functions in the standard C ctype.h. They are +** optimized for the specific needs of Lua. +*/ + +#if !defined(LUA_USE_CTYPE) + +#if 'A' == 65 && '0' == 48 +/* ASCII case: can use its own tables; faster and fixed */ +#define LUA_USE_CTYPE 0 +#else +/* must use standard C ctype */ +#define LUA_USE_CTYPE 1 +#endif + +#endif + + +#if !LUA_USE_CTYPE /* { */ + +#include + +#include "llimits.h" + + +#define ALPHABIT 0 +#define DIGITBIT 1 +#define PRINTBIT 2 +#define SPACEBIT 3 +#define XDIGITBIT 4 + + +#define MASK(B) (1 << (B)) + + +/* +** add 1 to char to allow index -1 (EOZ) +*/ +#define testprop(c,p) (luai_ctype_[(c)+1] & (p)) + +/* +** 'lalpha' (Lua alphabetic) and 'lalnum' (Lua alphanumeric) both include '_' +*/ +#define lislalpha(c) testprop(c, MASK(ALPHABIT)) +#define lislalnum(c) testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))) +#define lisdigit(c) testprop(c, MASK(DIGITBIT)) +#define lisspace(c) testprop(c, MASK(SPACEBIT)) +#define lisprint(c) testprop(c, MASK(PRINTBIT)) +#define lisxdigit(c) testprop(c, MASK(XDIGITBIT)) + + +/* +** In ASCII, this 'ltolower' is correct for alphabetic characters and +** for '.'. That is enough for Lua needs. ('check_exp' ensures that +** the character either is an upper-case letter or is unchanged by +** the transformation, which holds for lower-case letters and '.'.) +*/ +#define ltolower(c) \ + check_exp(('A' <= (c) && (c) <= 'Z') || (c) == ((c) | ('A' ^ 'a')), \ + (c) | ('A' ^ 'a')) + + +/* one entry for each character and for -1 (EOZ) */ +LUAI_DDEC(const lu_byte luai_ctype_[UCHAR_MAX + 2];) + + +#else /* }{ */ + +/* +** use standard C ctypes +*/ + +#include + + +#define lislalpha(c) (isalpha(c) || (c) == '_') +#define lislalnum(c) (isalnum(c) || (c) == '_') +#define lisdigit(c) (isdigit(c)) +#define lisspace(c) (isspace(c)) +#define lisprint(c) (isprint(c)) +#define lisxdigit(c) (isxdigit(c)) + +#define ltolower(c) (tolower(c)) + +#endif /* } */ + +#endif + diff --git a/LuaSkin/lua-5.3.4/src/ldblib.c b/LuaSkin/lua-5.4.7/src/ldblib.c similarity index 82% rename from LuaSkin/lua-5.3.4/src/ldblib.c rename to LuaSkin/lua-5.4.7/src/ldblib.c index 786f6cd95..6dcbaa982 100644 --- a/LuaSkin/lua-5.3.4/src/ldblib.c +++ b/LuaSkin/lua-5.4.7/src/ldblib.c @@ -1,5 +1,5 @@ /* -** $Id: ldblib.c,v 1.151 2015/11/23 11:29:43 roberto Exp $ +** $Id: ldblib.c $ ** Interface from Lua to its debug API ** See Copyright Notice in lua.h */ @@ -21,10 +21,10 @@ /* -** The hook table at registry[&HOOKKEY] maps threads to their current -** hook function. (We only need the unique address of 'HOOKKEY'.) +** The hook table at registry[HOOKKEY] maps threads to their current +** hook function. */ -static const int HOOKKEY = 0; +static const char *const HOOKKEY = "_HOOKKEY"; /* @@ -33,7 +33,7 @@ static const int HOOKKEY = 0; ** checked. */ static void checkstack (lua_State *L, lua_State *L1, int n) { - if (L != L1 && !lua_checkstack(L1, n)) + if (l_unlikely(L != L1 && !lua_checkstack(L1, n))) luaL_error(L, "stack overflow"); } @@ -55,8 +55,7 @@ static int db_getmetatable (lua_State *L) { static int db_setmetatable (lua_State *L) { int t = lua_type(L, 2); - luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, - "nil or table expected"); + luaL_argexpected(L, t == LUA_TNIL || t == LUA_TTABLE, 2, "nil or table"); lua_settop(L, 2); lua_setmetatable(L, 1); return 1; /* return 1st argument */ @@ -64,19 +63,24 @@ static int db_setmetatable (lua_State *L) { static int db_getuservalue (lua_State *L) { + int n = (int)luaL_optinteger(L, 2, 1); if (lua_type(L, 1) != LUA_TUSERDATA) - lua_pushnil(L); - else - lua_getuservalue(L, 1); + luaL_pushfail(L); + else if (lua_getiuservalue(L, 1, n) != LUA_TNONE) { + lua_pushboolean(L, 1); + return 2; + } return 1; } static int db_setuservalue (lua_State *L) { + int n = (int)luaL_optinteger(L, 3, 1); luaL_checktype(L, 1, LUA_TUSERDATA); luaL_checkany(L, 2); lua_settop(L, 2); - lua_setuservalue(L, 1); + if (!lua_setiuservalue(L, 1, n)) + luaL_pushfail(L); return 1; } @@ -146,8 +150,9 @@ static int db_getinfo (lua_State *L) { lua_Debug ar; int arg; lua_State *L1 = getthread(L, &arg); - const char *options = luaL_optstring(L, arg+2, "flnStu"); + const char *options = luaL_optstring(L, arg+2, "flnSrtu"); checkstack(L, L1, 3); + luaL_argcheck(L, options[0] != '>', arg + 2, "invalid option '>'"); if (lua_isfunction(L, arg + 1)) { /* info about a function? */ options = lua_pushfstring(L, ">%s", options); /* add '>' to 'options' */ lua_pushvalue(L, arg + 1); /* move function to 'L1' stack */ @@ -155,7 +160,7 @@ static int db_getinfo (lua_State *L) { } else { /* stack level */ if (!lua_getstack(L1, (int)luaL_checkinteger(L, arg + 1), &ar)) { - lua_pushnil(L); /* level out of range */ + luaL_pushfail(L); /* level out of range */ return 1; } } @@ -163,7 +168,8 @@ static int db_getinfo (lua_State *L) { return luaL_argerror(L, arg+2, "invalid option"); lua_newtable(L); /* table to collect results */ if (strchr(options, 'S')) { - settabss(L, "source", ar.source); + lua_pushlstring(L, ar.source, ar.srclen); + lua_setfield(L, -2, "source"); settabss(L, "short_src", ar.short_src); settabsi(L, "linedefined", ar.linedefined); settabsi(L, "lastlinedefined", ar.lastlinedefined); @@ -180,6 +186,10 @@ static int db_getinfo (lua_State *L) { settabss(L, "name", ar.name); settabss(L, "namewhat", ar.namewhat); } + if (strchr(options, 'r')) { + settabsi(L, "ftransfer", ar.ftransfer); + settabsi(L, "ntransfer", ar.ntransfer); + } if (strchr(options, 't')) settabsb(L, "istailcall", ar.istailcall); if (strchr(options, 'L')) @@ -193,8 +203,6 @@ static int db_getinfo (lua_State *L) { static int db_getlocal (lua_State *L) { int arg; lua_State *L1 = getthread(L, &arg); - lua_Debug ar; - const char *name; int nvar = (int)luaL_checkinteger(L, arg + 2); /* local-variable index */ if (lua_isfunction(L, arg + 1)) { /* function argument? */ lua_pushvalue(L, arg + 1); /* push function */ @@ -202,8 +210,10 @@ static int db_getlocal (lua_State *L) { return 1; /* return only name (there is no value) */ } else { /* stack-level argument */ + lua_Debug ar; + const char *name; int level = (int)luaL_checkinteger(L, arg + 1); - if (!lua_getstack(L1, level, &ar)) /* out of range? */ + if (l_unlikely(!lua_getstack(L1, level, &ar))) /* out of range? */ return luaL_argerror(L, arg+1, "level out of range"); checkstack(L, L1, 1); name = lua_getlocal(L1, &ar, nvar); @@ -214,7 +224,7 @@ static int db_getlocal (lua_State *L) { return 2; } else { - lua_pushnil(L); /* no name (nor value) */ + luaL_pushfail(L); /* no name (nor value) */ return 1; } } @@ -228,7 +238,7 @@ static int db_setlocal (lua_State *L) { lua_Debug ar; int level = (int)luaL_checkinteger(L, arg + 1); int nvar = (int)luaL_checkinteger(L, arg + 2); - if (!lua_getstack(L1, level, &ar)) /* out of range? */ + if (l_unlikely(!lua_getstack(L1, level, &ar))) /* out of range? */ return luaL_argerror(L, arg+1, "level out of range"); luaL_checkany(L, arg+3); lua_settop(L, arg+3); @@ -272,25 +282,33 @@ static int db_setupvalue (lua_State *L) { ** Check whether a given upvalue from a given closure exists and ** returns its index */ -static int checkupval (lua_State *L, int argf, int argnup) { +static void *checkupval (lua_State *L, int argf, int argnup, int *pnup) { + void *id; int nup = (int)luaL_checkinteger(L, argnup); /* upvalue index */ luaL_checktype(L, argf, LUA_TFUNCTION); /* closure */ - luaL_argcheck(L, (lua_getupvalue(L, argf, nup) != NULL), argnup, - "invalid upvalue index"); - return nup; + id = lua_upvalueid(L, argf, nup); + if (pnup) { + luaL_argcheck(L, id != NULL, argnup, "invalid upvalue index"); + *pnup = nup; + } + return id; } static int db_upvalueid (lua_State *L) { - int n = checkupval(L, 1, 2); - lua_pushlightuserdata(L, lua_upvalueid(L, 1, n)); + void *id = checkupval(L, 1, 2, NULL); + if (id != NULL) + lua_pushlightuserdata(L, id); + else + luaL_pushfail(L); return 1; } static int db_upvaluejoin (lua_State *L) { - int n1 = checkupval(L, 1, 2); - int n2 = checkupval(L, 3, 4); + int n1, n2; + checkupval(L, 1, 2, &n1); + checkupval(L, 3, 4, &n2); luaL_argcheck(L, !lua_iscfunction(L, 1), 1, "Lua function expected"); luaL_argcheck(L, !lua_iscfunction(L, 3), 3, "Lua function expected"); lua_upvaluejoin(L, 1, n1, 3, n2); @@ -305,7 +323,7 @@ static int db_upvaluejoin (lua_State *L) { static void hookf (lua_State *L, lua_Debug *ar) { static const char *const hooknames[] = {"call", "return", "line", "count", "tail call"}; - lua_rawgetp(L, LUA_REGISTRYINDEX, &HOOKKEY); + lua_getfield(L, LUA_REGISTRYINDEX, HOOKKEY); lua_pushthread(L); if (lua_rawget(L, -2) == LUA_TFUNCTION) { /* is there a hook function? */ lua_pushstring(L, hooknames[(int)ar->event]); /* push event name */ @@ -358,14 +376,12 @@ static int db_sethook (lua_State *L) { count = (int)luaL_optinteger(L, arg + 3, 0); func = hookf; mask = makemask(smask, count); } - if (lua_rawgetp(L, LUA_REGISTRYINDEX, &HOOKKEY) == LUA_TNIL) { - lua_createtable(L, 0, 2); /* create a hook table */ - lua_pushvalue(L, -1); - lua_rawsetp(L, LUA_REGISTRYINDEX, &HOOKKEY); /* set it in position */ - lua_pushstring(L, "k"); + if (!luaL_getsubtable(L, LUA_REGISTRYINDEX, HOOKKEY)) { + /* table just created; initialize it */ + lua_pushliteral(L, "k"); lua_setfield(L, -2, "__mode"); /** hooktable.__mode = "k" */ lua_pushvalue(L, -1); - lua_setmetatable(L, -2); /* setmetatable(hooktable) = hooktable */ + lua_setmetatable(L, -2); /* metatable(hooktable) = hooktable */ } checkstack(L, L1, 1); lua_pushthread(L1); lua_xmove(L1, L, 1); /* key (thread) */ @@ -382,12 +398,14 @@ static int db_gethook (lua_State *L) { char buff[5]; int mask = lua_gethookmask(L1); lua_Hook hook = lua_gethook(L1); - if (hook == NULL) /* no hook? */ - lua_pushnil(L); + if (hook == NULL) { /* no hook? */ + luaL_pushfail(L); + return 1; + } else if (hook != hookf) /* external hook? */ lua_pushliteral(L, "external hook"); else { /* hook table must exist */ - lua_rawgetp(L, LUA_REGISTRYINDEX, &HOOKKEY); + lua_getfield(L, LUA_REGISTRYINDEX, HOOKKEY); checkstack(L, L1, 1); lua_pushthread(L1); lua_xmove(L1, L, 1); lua_rawget(L, -2); /* 1st result = hooktable[L1] */ @@ -403,12 +421,12 @@ static int db_debug (lua_State *L) { for (;;) { char buffer[250]; lua_writestringerror("%s", "lua_debug> "); - if (fgets(buffer, sizeof(buffer), stdin) == 0 || + if (fgets(buffer, sizeof(buffer), stdin) == NULL || strcmp(buffer, "cont\n") == 0) return 0; if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") || lua_pcall(L, 0, 0, 0)) - lua_writestringerror("%s\n", lua_tostring(L, -1)); + lua_writestringerror("%s\n", luaL_tolstring(L, -1, NULL)); lua_settop(L, 0); /* remove eventual returns */ } } @@ -428,6 +446,14 @@ static int db_traceback (lua_State *L) { } +static int db_setcstacklimit (lua_State *L) { + int limit = (int)luaL_checkinteger(L, 1); + int res = lua_setcstacklimit(L, limit); + lua_pushinteger(L, res); + return 1; +} + + static const luaL_Reg dblib[] = { {"debug", db_debug}, {"getuservalue", db_getuservalue}, @@ -445,6 +471,7 @@ static const luaL_Reg dblib[] = { {"setmetatable", db_setmetatable}, {"setupvalue", db_setupvalue}, {"traceback", db_traceback}, + {"setcstacklimit", db_setcstacklimit}, {NULL, NULL} }; diff --git a/LuaSkin/lua-5.4.7/src/ldebug.c b/LuaSkin/lua-5.4.7/src/ldebug.c new file mode 100644 index 000000000..591b3528a --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/ldebug.c @@ -0,0 +1,962 @@ +/* +** $Id: ldebug.c $ +** Debug Interface +** See Copyright Notice in lua.h +*/ + +#define ldebug_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include +#include + +#include "lua.h" + +#include "lapi.h" +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lvm.h" + + + +#define LuaClosure(f) ((f) != NULL && (f)->c.tt == LUA_VLCL) + + +static const char *funcnamefromcall (lua_State *L, CallInfo *ci, + const char **name); + + +static int currentpc (CallInfo *ci) { + lua_assert(isLua(ci)); + return pcRel(ci->u.l.savedpc, ci_func(ci)->p); +} + + +/* +** Get a "base line" to find the line corresponding to an instruction. +** Base lines are regularly placed at MAXIWTHABS intervals, so usually +** an integer division gets the right place. When the source file has +** large sequences of empty/comment lines, it may need extra entries, +** so the original estimate needs a correction. +** If the original estimate is -1, the initial 'if' ensures that the +** 'while' will run at least once. +** The assertion that the estimate is a lower bound for the correct base +** is valid as long as the debug info has been generated with the same +** value for MAXIWTHABS or smaller. (Previous releases use a little +** smaller value.) +*/ +static int getbaseline (const Proto *f, int pc, int *basepc) { + if (f->sizeabslineinfo == 0 || pc < f->abslineinfo[0].pc) { + *basepc = -1; /* start from the beginning */ + return f->linedefined; + } + else { + int i = cast_uint(pc) / MAXIWTHABS - 1; /* get an estimate */ + /* estimate must be a lower bound of the correct base */ + lua_assert(i < 0 || + (i < f->sizeabslineinfo && f->abslineinfo[i].pc <= pc)); + while (i + 1 < f->sizeabslineinfo && pc >= f->abslineinfo[i + 1].pc) + i++; /* low estimate; adjust it */ + *basepc = f->abslineinfo[i].pc; + return f->abslineinfo[i].line; + } +} + + +/* +** Get the line corresponding to instruction 'pc' in function 'f'; +** first gets a base line and from there does the increments until +** the desired instruction. +*/ +int luaG_getfuncline (const Proto *f, int pc) { + if (f->lineinfo == NULL) /* no debug information? */ + return -1; + else { + int basepc; + int baseline = getbaseline(f, pc, &basepc); + while (basepc++ < pc) { /* walk until given instruction */ + lua_assert(f->lineinfo[basepc] != ABSLINEINFO); + baseline += f->lineinfo[basepc]; /* correct line */ + } + return baseline; + } +} + + +static int getcurrentline (CallInfo *ci) { + return luaG_getfuncline(ci_func(ci)->p, currentpc(ci)); +} + + +/* +** Set 'trap' for all active Lua frames. +** This function can be called during a signal, under "reasonable" +** assumptions. A new 'ci' is completely linked in the list before it +** becomes part of the "active" list, and we assume that pointers are +** atomic; see comment in next function. +** (A compiler doing interprocedural optimizations could, theoretically, +** reorder memory writes in such a way that the list could be +** temporarily broken while inserting a new element. We simply assume it +** has no good reasons to do that.) +*/ +static void settraps (CallInfo *ci) { + for (; ci != NULL; ci = ci->previous) + if (isLua(ci)) + ci->u.l.trap = 1; +} + + +/* +** This function can be called during a signal, under "reasonable" +** assumptions. +** Fields 'basehookcount' and 'hookcount' (set by 'resethookcount') +** are for debug only, and it is no problem if they get arbitrary +** values (causes at most one wrong hook call). 'hookmask' is an atomic +** value. We assume that pointers are atomic too (e.g., gcc ensures that +** for all platforms where it runs). Moreover, 'hook' is always checked +** before being called (see 'luaD_hook'). +*/ +LUA_API void lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { + if (func == NULL || mask == 0) { /* turn off hooks? */ + mask = 0; + func = NULL; + } + L->hook = func; + L->basehookcount = count; + resethookcount(L); + L->hookmask = cast_byte(mask); + if (mask) + settraps(L->ci); /* to trace inside 'luaV_execute' */ +} + + +LUA_API lua_Hook lua_gethook (lua_State *L) { + return L->hook; +} + + +LUA_API int lua_gethookmask (lua_State *L) { + return L->hookmask; +} + + +LUA_API int lua_gethookcount (lua_State *L) { + return L->basehookcount; +} + + +LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { + int status; + CallInfo *ci; + if (level < 0) return 0; /* invalid (negative) level */ + lua_lock(L); + for (ci = L->ci; level > 0 && ci != &L->base_ci; ci = ci->previous) + level--; + if (level == 0 && ci != &L->base_ci) { /* level found? */ + status = 1; + ar->i_ci = ci; + } + else status = 0; /* no such level */ + lua_unlock(L); + return status; +} + + +static const char *upvalname (const Proto *p, int uv) { + TString *s = check_exp(uv < p->sizeupvalues, p->upvalues[uv].name); + if (s == NULL) return "?"; + else return getstr(s); +} + + +static const char *findvararg (CallInfo *ci, int n, StkId *pos) { + if (clLvalue(s2v(ci->func.p))->p->is_vararg) { + int nextra = ci->u.l.nextraargs; + if (n >= -nextra) { /* 'n' is negative */ + *pos = ci->func.p - nextra - (n + 1); + return "(vararg)"; /* generic name for any vararg */ + } + } + return NULL; /* no such vararg */ +} + + +const char *luaG_findlocal (lua_State *L, CallInfo *ci, int n, StkId *pos) { + StkId base = ci->func.p + 1; + const char *name = NULL; + if (isLua(ci)) { + if (n < 0) /* access to vararg values? */ + return findvararg(ci, n, pos); + else + name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci)); + } + if (name == NULL) { /* no 'standard' name? */ + StkId limit = (ci == L->ci) ? L->top.p : ci->next->func.p; + if (limit - base >= n && n > 0) { /* is 'n' inside 'ci' stack? */ + /* generic name for any valid slot */ + name = isLua(ci) ? "(temporary)" : "(C temporary)"; + } + else + return NULL; /* no name */ + } + if (pos) + *pos = base + (n - 1); + return name; +} + + +LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { + const char *name; + lua_lock(L); + if (ar == NULL) { /* information about non-active function? */ + if (!isLfunction(s2v(L->top.p - 1))) /* not a Lua function? */ + name = NULL; + else /* consider live variables at function start (parameters) */ + name = luaF_getlocalname(clLvalue(s2v(L->top.p - 1))->p, n, 0); + } + else { /* active function; get information through 'ar' */ + StkId pos = NULL; /* to avoid warnings */ + name = luaG_findlocal(L, ar->i_ci, n, &pos); + if (name) { + setobjs2s(L, L->top.p, pos); + api_incr_top(L); + } + } + lua_unlock(L); + return name; +} + + +LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { + StkId pos = NULL; /* to avoid warnings */ + const char *name; + lua_lock(L); + name = luaG_findlocal(L, ar->i_ci, n, &pos); + if (name) { + setobjs2s(L, pos, L->top.p - 1); + L->top.p--; /* pop value */ + } + lua_unlock(L); + return name; +} + + +static void funcinfo (lua_Debug *ar, Closure *cl) { + if (!LuaClosure(cl)) { + ar->source = "=[C]"; + ar->srclen = LL("=[C]"); + ar->linedefined = -1; + ar->lastlinedefined = -1; + ar->what = "C"; + } + else { + const Proto *p = cl->l.p; + if (p->source) { + ar->source = getstr(p->source); + ar->srclen = tsslen(p->source); + } + else { + ar->source = "=?"; + ar->srclen = LL("=?"); + } + ar->linedefined = p->linedefined; + ar->lastlinedefined = p->lastlinedefined; + ar->what = (ar->linedefined == 0) ? "main" : "Lua"; + } + luaO_chunkid(ar->short_src, ar->source, ar->srclen); +} + + +static int nextline (const Proto *p, int currentline, int pc) { + if (p->lineinfo[pc] != ABSLINEINFO) + return currentline + p->lineinfo[pc]; + else + return luaG_getfuncline(p, pc); +} + + +static void collectvalidlines (lua_State *L, Closure *f) { + if (!LuaClosure(f)) { + setnilvalue(s2v(L->top.p)); + api_incr_top(L); + } + else { + const Proto *p = f->l.p; + int currentline = p->linedefined; + Table *t = luaH_new(L); /* new table to store active lines */ + sethvalue2s(L, L->top.p, t); /* push it on stack */ + api_incr_top(L); + if (p->lineinfo != NULL) { /* proto with debug information? */ + int i; + TValue v; + setbtvalue(&v); /* boolean 'true' to be the value of all indices */ + if (!p->is_vararg) /* regular function? */ + i = 0; /* consider all instructions */ + else { /* vararg function */ + lua_assert(GET_OPCODE(p->code[0]) == OP_VARARGPREP); + currentline = nextline(p, currentline, 0); + i = 1; /* skip first instruction (OP_VARARGPREP) */ + } + for (; i < p->sizelineinfo; i++) { /* for each instruction */ + currentline = nextline(p, currentline, i); /* get its line */ + luaH_setint(L, t, currentline, &v); /* table[line] = true */ + } + } + } +} + + +static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { + /* calling function is a known function? */ + if (ci != NULL && !(ci->callstatus & CIST_TAIL)) + return funcnamefromcall(L, ci->previous, name); + else return NULL; /* no way to find a name */ +} + + +static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, + Closure *f, CallInfo *ci) { + int status = 1; + for (; *what; what++) { + switch (*what) { + case 'S': { + funcinfo(ar, f); + break; + } + case 'l': { + ar->currentline = (ci && isLua(ci)) ? getcurrentline(ci) : -1; + break; + } + case 'u': { + ar->nups = (f == NULL) ? 0 : f->c.nupvalues; + if (!LuaClosure(f)) { + ar->isvararg = 1; + ar->nparams = 0; + } + else { + ar->isvararg = f->l.p->is_vararg; + ar->nparams = f->l.p->numparams; + } + break; + } + case 't': { + ar->istailcall = (ci) ? ci->callstatus & CIST_TAIL : 0; + break; + } + case 'n': { + ar->namewhat = getfuncname(L, ci, &ar->name); + if (ar->namewhat == NULL) { + ar->namewhat = ""; /* not found */ + ar->name = NULL; + } + break; + } + case 'r': { + if (ci == NULL || !(ci->callstatus & CIST_TRAN)) + ar->ftransfer = ar->ntransfer = 0; + else { + ar->ftransfer = ci->u2.transferinfo.ftransfer; + ar->ntransfer = ci->u2.transferinfo.ntransfer; + } + break; + } + case 'L': + case 'f': /* handled by lua_getinfo */ + break; + default: status = 0; /* invalid option */ + } + } + return status; +} + + +LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { + int status; + Closure *cl; + CallInfo *ci; + TValue *func; + lua_lock(L); + if (*what == '>') { + ci = NULL; + func = s2v(L->top.p - 1); + api_check(L, ttisfunction(func), "function expected"); + what++; /* skip the '>' */ + L->top.p--; /* pop function */ + } + else { + ci = ar->i_ci; + func = s2v(ci->func.p); + lua_assert(ttisfunction(func)); + } + cl = ttisclosure(func) ? clvalue(func) : NULL; + status = auxgetinfo(L, what, ar, cl, ci); + if (strchr(what, 'f')) { + setobj2s(L, L->top.p, func); + api_incr_top(L); + } + if (strchr(what, 'L')) + collectvalidlines(L, cl); + lua_unlock(L); + return status; +} + + +/* +** {====================================================== +** Symbolic Execution +** ======================================================= +*/ + + +static int filterpc (int pc, int jmptarget) { + if (pc < jmptarget) /* is code conditional (inside a jump)? */ + return -1; /* cannot know who sets that register */ + else return pc; /* current position sets that register */ +} + + +/* +** Try to find last instruction before 'lastpc' that modified register 'reg'. +*/ +static int findsetreg (const Proto *p, int lastpc, int reg) { + int pc; + int setreg = -1; /* keep last instruction that changed 'reg' */ + int jmptarget = 0; /* any code before this address is conditional */ + if (testMMMode(GET_OPCODE(p->code[lastpc]))) + lastpc--; /* previous instruction was not actually executed */ + for (pc = 0; pc < lastpc; pc++) { + Instruction i = p->code[pc]; + OpCode op = GET_OPCODE(i); + int a = GETARG_A(i); + int change; /* true if current instruction changed 'reg' */ + switch (op) { + case OP_LOADNIL: { /* set registers from 'a' to 'a+b' */ + int b = GETARG_B(i); + change = (a <= reg && reg <= a + b); + break; + } + case OP_TFORCALL: { /* affect all regs above its base */ + change = (reg >= a + 2); + break; + } + case OP_CALL: + case OP_TAILCALL: { /* affect all registers above base */ + change = (reg >= a); + break; + } + case OP_JMP: { /* doesn't change registers, but changes 'jmptarget' */ + int b = GETARG_sJ(i); + int dest = pc + 1 + b; + /* jump does not skip 'lastpc' and is larger than current one? */ + if (dest <= lastpc && dest > jmptarget) + jmptarget = dest; /* update 'jmptarget' */ + change = 0; + break; + } + default: /* any instruction that sets A */ + change = (testAMode(op) && reg == a); + break; + } + if (change) + setreg = filterpc(pc, jmptarget); + } + return setreg; +} + + +/* +** Find a "name" for the constant 'c'. +*/ +static const char *kname (const Proto *p, int index, const char **name) { + TValue *kvalue = &p->k[index]; + if (ttisstring(kvalue)) { + *name = getstr(tsvalue(kvalue)); + return "constant"; + } + else { + *name = "?"; + return NULL; + } +} + + +static const char *basicgetobjname (const Proto *p, int *ppc, int reg, + const char **name) { + int pc = *ppc; + *name = luaF_getlocalname(p, reg + 1, pc); + if (*name) /* is a local? */ + return "local"; + /* else try symbolic execution */ + *ppc = pc = findsetreg(p, pc, reg); + if (pc != -1) { /* could find instruction? */ + Instruction i = p->code[pc]; + OpCode op = GET_OPCODE(i); + switch (op) { + case OP_MOVE: { + int b = GETARG_B(i); /* move from 'b' to 'a' */ + if (b < GETARG_A(i)) + return basicgetobjname(p, ppc, b, name); /* get name for 'b' */ + break; + } + case OP_GETUPVAL: { + *name = upvalname(p, GETARG_B(i)); + return "upvalue"; + } + case OP_LOADK: return kname(p, GETARG_Bx(i), name); + case OP_LOADKX: return kname(p, GETARG_Ax(p->code[pc + 1]), name); + default: break; + } + } + return NULL; /* could not find reasonable name */ +} + + +/* +** Find a "name" for the register 'c'. +*/ +static void rname (const Proto *p, int pc, int c, const char **name) { + const char *what = basicgetobjname(p, &pc, c, name); /* search for 'c' */ + if (!(what && *what == 'c')) /* did not find a constant name? */ + *name = "?"; +} + + +/* +** Find a "name" for a 'C' value in an RK instruction. +*/ +static void rkname (const Proto *p, int pc, Instruction i, const char **name) { + int c = GETARG_C(i); /* key index */ + if (GETARG_k(i)) /* is 'c' a constant? */ + kname(p, c, name); + else /* 'c' is a register */ + rname(p, pc, c, name); +} + + +/* +** Check whether table being indexed by instruction 'i' is the +** environment '_ENV' +*/ +static const char *isEnv (const Proto *p, int pc, Instruction i, int isup) { + int t = GETARG_B(i); /* table index */ + const char *name; /* name of indexed variable */ + if (isup) /* is 't' an upvalue? */ + name = upvalname(p, t); + else /* 't' is a register */ + basicgetobjname(p, &pc, t, &name); + return (name && strcmp(name, LUA_ENV) == 0) ? "global" : "field"; +} + + +/* +** Extend 'basicgetobjname' to handle table accesses +*/ +static const char *getobjname (const Proto *p, int lastpc, int reg, + const char **name) { + const char *kind = basicgetobjname(p, &lastpc, reg, name); + if (kind != NULL) + return kind; + else if (lastpc != -1) { /* could find instruction? */ + Instruction i = p->code[lastpc]; + OpCode op = GET_OPCODE(i); + switch (op) { + case OP_GETTABUP: { + int k = GETARG_C(i); /* key index */ + kname(p, k, name); + return isEnv(p, lastpc, i, 1); + } + case OP_GETTABLE: { + int k = GETARG_C(i); /* key index */ + rname(p, lastpc, k, name); + return isEnv(p, lastpc, i, 0); + } + case OP_GETI: { + *name = "integer index"; + return "field"; + } + case OP_GETFIELD: { + int k = GETARG_C(i); /* key index */ + kname(p, k, name); + return isEnv(p, lastpc, i, 0); + } + case OP_SELF: { + rkname(p, lastpc, i, name); + return "method"; + } + default: break; /* go through to return NULL */ + } + } + return NULL; /* could not find reasonable name */ +} + + +/* +** Try to find a name for a function based on the code that called it. +** (Only works when function was called by a Lua function.) +** Returns what the name is (e.g., "for iterator", "method", +** "metamethod") and sets '*name' to point to the name. +*/ +static const char *funcnamefromcode (lua_State *L, const Proto *p, + int pc, const char **name) { + TMS tm = (TMS)0; /* (initial value avoids warnings) */ + Instruction i = p->code[pc]; /* calling instruction */ + switch (GET_OPCODE(i)) { + case OP_CALL: + case OP_TAILCALL: + return getobjname(p, pc, GETARG_A(i), name); /* get function name */ + case OP_TFORCALL: { /* for iterator */ + *name = "for iterator"; + return "for iterator"; + } + /* other instructions can do calls through metamethods */ + case OP_SELF: case OP_GETTABUP: case OP_GETTABLE: + case OP_GETI: case OP_GETFIELD: + tm = TM_INDEX; + break; + case OP_SETTABUP: case OP_SETTABLE: case OP_SETI: case OP_SETFIELD: + tm = TM_NEWINDEX; + break; + case OP_MMBIN: case OP_MMBINI: case OP_MMBINK: { + tm = cast(TMS, GETARG_C(i)); + break; + } + case OP_UNM: tm = TM_UNM; break; + case OP_BNOT: tm = TM_BNOT; break; + case OP_LEN: tm = TM_LEN; break; + case OP_CONCAT: tm = TM_CONCAT; break; + case OP_EQ: tm = TM_EQ; break; + /* no cases for OP_EQI and OP_EQK, as they don't call metamethods */ + case OP_LT: case OP_LTI: case OP_GTI: tm = TM_LT; break; + case OP_LE: case OP_LEI: case OP_GEI: tm = TM_LE; break; + case OP_CLOSE: case OP_RETURN: tm = TM_CLOSE; break; + default: + return NULL; /* cannot find a reasonable name */ + } + *name = getshrstr(G(L)->tmname[tm]) + 2; + return "metamethod"; +} + + +/* +** Try to find a name for a function based on how it was called. +*/ +static const char *funcnamefromcall (lua_State *L, CallInfo *ci, + const char **name) { + if (ci->callstatus & CIST_HOOKED) { /* was it called inside a hook? */ + *name = "?"; + return "hook"; + } + else if (ci->callstatus & CIST_FIN) { /* was it called as a finalizer? */ + *name = "__gc"; + return "metamethod"; /* report it as such */ + } + else if (isLua(ci)) + return funcnamefromcode(L, ci_func(ci)->p, currentpc(ci), name); + else + return NULL; +} + +/* }====================================================== */ + + + +/* +** Check whether pointer 'o' points to some value in the stack frame of +** the current function and, if so, returns its index. Because 'o' may +** not point to a value in this stack, we cannot compare it with the +** region boundaries (undefined behavior in ISO C). +*/ +static int instack (CallInfo *ci, const TValue *o) { + int pos; + StkId base = ci->func.p + 1; + for (pos = 0; base + pos < ci->top.p; pos++) { + if (o == s2v(base + pos)) + return pos; + } + return -1; /* not found */ +} + + +/* +** Checks whether value 'o' came from an upvalue. (That can only happen +** with instructions OP_GETTABUP/OP_SETTABUP, which operate directly on +** upvalues.) +*/ +static const char *getupvalname (CallInfo *ci, const TValue *o, + const char **name) { + LClosure *c = ci_func(ci); + int i; + for (i = 0; i < c->nupvalues; i++) { + if (c->upvals[i]->v.p == o) { + *name = upvalname(c->p, i); + return "upvalue"; + } + } + return NULL; +} + + +static const char *formatvarinfo (lua_State *L, const char *kind, + const char *name) { + if (kind == NULL) + return ""; /* no information */ + else + return luaO_pushfstring(L, " (%s '%s')", kind, name); +} + +/* +** Build a string with a "description" for the value 'o', such as +** "variable 'x'" or "upvalue 'y'". +*/ +static const char *varinfo (lua_State *L, const TValue *o) { + CallInfo *ci = L->ci; + const char *name = NULL; /* to avoid warnings */ + const char *kind = NULL; + if (isLua(ci)) { + kind = getupvalname(ci, o, &name); /* check whether 'o' is an upvalue */ + if (!kind) { /* not an upvalue? */ + int reg = instack(ci, o); /* try a register */ + if (reg >= 0) /* is 'o' a register? */ + kind = getobjname(ci_func(ci)->p, currentpc(ci), reg, &name); + } + } + return formatvarinfo(L, kind, name); +} + + +/* +** Raise a type error +*/ +static l_noret typeerror (lua_State *L, const TValue *o, const char *op, + const char *extra) { + const char *t = luaT_objtypename(L, o); + luaG_runerror(L, "attempt to %s a %s value%s", op, t, extra); +} + + +/* +** Raise a type error with "standard" information about the faulty +** object 'o' (using 'varinfo'). +*/ +l_noret luaG_typeerror (lua_State *L, const TValue *o, const char *op) { + typeerror(L, o, op, varinfo(L, o)); +} + + +/* +** Raise an error for calling a non-callable object. Try to find a name +** for the object based on how it was called ('funcnamefromcall'); if it +** cannot get a name there, try 'varinfo'. +*/ +l_noret luaG_callerror (lua_State *L, const TValue *o) { + CallInfo *ci = L->ci; + const char *name = NULL; /* to avoid warnings */ + const char *kind = funcnamefromcall(L, ci, &name); + const char *extra = kind ? formatvarinfo(L, kind, name) : varinfo(L, o); + typeerror(L, o, "call", extra); +} + + +l_noret luaG_forerror (lua_State *L, const TValue *o, const char *what) { + luaG_runerror(L, "bad 'for' %s (number expected, got %s)", + what, luaT_objtypename(L, o)); +} + + +l_noret luaG_concaterror (lua_State *L, const TValue *p1, const TValue *p2) { + if (ttisstring(p1) || cvt2str(p1)) p1 = p2; + luaG_typeerror(L, p1, "concatenate"); +} + + +l_noret luaG_opinterror (lua_State *L, const TValue *p1, + const TValue *p2, const char *msg) { + if (!ttisnumber(p1)) /* first operand is wrong? */ + p2 = p1; /* now second is wrong */ + luaG_typeerror(L, p2, msg); +} + + +/* +** Error when both values are convertible to numbers, but not to integers +*/ +l_noret luaG_tointerror (lua_State *L, const TValue *p1, const TValue *p2) { + lua_Integer temp; + if (!luaV_tointegerns(p1, &temp, LUA_FLOORN2I)) + p2 = p1; + luaG_runerror(L, "number%s has no integer representation", varinfo(L, p2)); +} + + +l_noret luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { + const char *t1 = luaT_objtypename(L, p1); + const char *t2 = luaT_objtypename(L, p2); + if (strcmp(t1, t2) == 0) + luaG_runerror(L, "attempt to compare two %s values", t1); + else + luaG_runerror(L, "attempt to compare %s with %s", t1, t2); +} + + +/* add src:line information to 'msg' */ +const char *luaG_addinfo (lua_State *L, const char *msg, TString *src, + int line) { + char buff[LUA_IDSIZE]; + if (src) + luaO_chunkid(buff, getstr(src), tsslen(src)); + else { /* no source available; use "?" instead */ + buff[0] = '?'; buff[1] = '\0'; + } + return luaO_pushfstring(L, "%s:%d: %s", buff, line, msg); +} + + +l_noret luaG_errormsg (lua_State *L) { + if (L->errfunc != 0) { /* is there an error handling function? */ + StkId errfunc = restorestack(L, L->errfunc); + lua_assert(ttisfunction(s2v(errfunc))); + setobjs2s(L, L->top.p, L->top.p - 1); /* move argument */ + setobjs2s(L, L->top.p - 1, errfunc); /* push function */ + L->top.p++; /* assume EXTRA_STACK */ + luaD_callnoyield(L, L->top.p - 2, 1); /* call it */ + } + luaD_throw(L, LUA_ERRRUN); +} + + +l_noret luaG_runerror (lua_State *L, const char *fmt, ...) { + CallInfo *ci = L->ci; + const char *msg; + va_list argp; + luaC_checkGC(L); /* error message uses memory */ + va_start(argp, fmt); + msg = luaO_pushvfstring(L, fmt, argp); /* format message */ + va_end(argp); + if (isLua(ci)) { /* if Lua function, add source:line information */ + luaG_addinfo(L, msg, ci_func(ci)->p->source, getcurrentline(ci)); + setobjs2s(L, L->top.p - 2, L->top.p - 1); /* remove 'msg' */ + L->top.p--; + } + luaG_errormsg(L); +} + + +/* +** Check whether new instruction 'newpc' is in a different line from +** previous instruction 'oldpc'. More often than not, 'newpc' is only +** one or a few instructions after 'oldpc' (it must be after, see +** caller), so try to avoid calling 'luaG_getfuncline'. If they are +** too far apart, there is a good chance of a ABSLINEINFO in the way, +** so it goes directly to 'luaG_getfuncline'. +*/ +static int changedline (const Proto *p, int oldpc, int newpc) { + if (p->lineinfo == NULL) /* no debug information? */ + return 0; + if (newpc - oldpc < MAXIWTHABS / 2) { /* not too far apart? */ + int delta = 0; /* line difference */ + int pc = oldpc; + for (;;) { + int lineinfo = p->lineinfo[++pc]; + if (lineinfo == ABSLINEINFO) + break; /* cannot compute delta; fall through */ + delta += lineinfo; + if (pc == newpc) + return (delta != 0); /* delta computed successfully */ + } + } + /* either instructions are too far apart or there is an absolute line + info in the way; compute line difference explicitly */ + return (luaG_getfuncline(p, oldpc) != luaG_getfuncline(p, newpc)); +} + + +/* +** Traces Lua calls. If code is running the first instruction of a function, +** and function is not vararg, and it is not coming from an yield, +** calls 'luaD_hookcall'. (Vararg functions will call 'luaD_hookcall' +** after adjusting its variable arguments; otherwise, they could call +** a line/count hook before the call hook. Functions coming from +** an yield already called 'luaD_hookcall' before yielding.) +*/ +int luaG_tracecall (lua_State *L) { + CallInfo *ci = L->ci; + Proto *p = ci_func(ci)->p; + ci->u.l.trap = 1; /* ensure hooks will be checked */ + if (ci->u.l.savedpc == p->code) { /* first instruction (not resuming)? */ + if (p->is_vararg) + return 0; /* hooks will start at VARARGPREP instruction */ + else if (!(ci->callstatus & CIST_HOOKYIELD)) /* not yieded? */ + luaD_hookcall(L, ci); /* check 'call' hook */ + } + return 1; /* keep 'trap' on */ +} + + +/* +** Traces the execution of a Lua function. Called before the execution +** of each opcode, when debug is on. 'L->oldpc' stores the last +** instruction traced, to detect line changes. When entering a new +** function, 'npci' will be zero and will test as a new line whatever +** the value of 'oldpc'. Some exceptional conditions may return to +** a function without setting 'oldpc'. In that case, 'oldpc' may be +** invalid; if so, use zero as a valid value. (A wrong but valid 'oldpc' +** at most causes an extra call to a line hook.) +** This function is not "Protected" when called, so it should correct +** 'L->top.p' before calling anything that can run the GC. +*/ +int luaG_traceexec (lua_State *L, const Instruction *pc) { + CallInfo *ci = L->ci; + lu_byte mask = L->hookmask; + const Proto *p = ci_func(ci)->p; + int counthook; + if (!(mask & (LUA_MASKLINE | LUA_MASKCOUNT))) { /* no hooks? */ + ci->u.l.trap = 0; /* don't need to stop again */ + return 0; /* turn off 'trap' */ + } + pc++; /* reference is always next instruction */ + ci->u.l.savedpc = pc; /* save 'pc' */ + counthook = (mask & LUA_MASKCOUNT) && (--L->hookcount == 0); + if (counthook) + resethookcount(L); /* reset count */ + else if (!(mask & LUA_MASKLINE)) + return 1; /* no line hook and count != 0; nothing to be done now */ + if (ci->callstatus & CIST_HOOKYIELD) { /* hook yielded last time? */ + ci->callstatus &= ~CIST_HOOKYIELD; /* erase mark */ + return 1; /* do not call hook again (VM yielded, so it did not move) */ + } + if (!isIT(*(ci->u.l.savedpc - 1))) /* top not being used? */ + L->top.p = ci->top.p; /* correct top */ + if (counthook) + luaD_hook(L, LUA_HOOKCOUNT, -1, 0, 0); /* call count hook */ + if (mask & LUA_MASKLINE) { + /* 'L->oldpc' may be invalid; use zero in this case */ + int oldpc = (L->oldpc < p->sizecode) ? L->oldpc : 0; + int npci = pcRel(pc, p); + if (npci <= oldpc || /* call hook when jump back (loop), */ + changedline(p, oldpc, npci)) { /* or when enter new line */ + int newline = luaG_getfuncline(p, npci); + luaD_hook(L, LUA_HOOKLINE, newline, 0, 0); /* call line hook */ + } + L->oldpc = npci; /* 'pc' of last call to line hook */ + } + if (L->status == LUA_YIELD) { /* did hook yield? */ + if (counthook) + L->hookcount = 1; /* undo decrement to zero */ + ci->callstatus |= CIST_HOOKYIELD; /* mark that it yielded */ + luaD_throw(L, LUA_YIELD); + } + return 1; /* keep 'trap' on */ +} + diff --git a/LuaSkin/lua-5.4.7/src/ldebug.h b/LuaSkin/lua-5.4.7/src/ldebug.h new file mode 100644 index 000000000..2bfce3cb5 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/ldebug.h @@ -0,0 +1,64 @@ +/* +** $Id: ldebug.h $ +** Auxiliary functions from Debug Interface module +** See Copyright Notice in lua.h +*/ + +#ifndef ldebug_h +#define ldebug_h + + +#include "lstate.h" + + +#define pcRel(pc, p) (cast_int((pc) - (p)->code) - 1) + + +/* Active Lua function (given call info) */ +#define ci_func(ci) (clLvalue(s2v((ci)->func.p))) + + +#define resethookcount(L) (L->hookcount = L->basehookcount) + +/* +** mark for entries in 'lineinfo' array that has absolute information in +** 'abslineinfo' array +*/ +#define ABSLINEINFO (-0x80) + + +/* +** MAXimum number of successive Instructions WiTHout ABSolute line +** information. (A power of two allows fast divisions.) +*/ +#if !defined(MAXIWTHABS) +#define MAXIWTHABS 128 +#endif + + +LUAI_FUNC int luaG_getfuncline (const Proto *f, int pc); +LUAI_FUNC const char *luaG_findlocal (lua_State *L, CallInfo *ci, int n, + StkId *pos); +LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o, + const char *opname); +LUAI_FUNC l_noret luaG_callerror (lua_State *L, const TValue *o); +LUAI_FUNC l_noret luaG_forerror (lua_State *L, const TValue *o, + const char *what); +LUAI_FUNC l_noret luaG_concaterror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC l_noret luaG_opinterror (lua_State *L, const TValue *p1, + const TValue *p2, + const char *msg); +LUAI_FUNC l_noret luaG_tointerror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC l_noret luaG_runerror (lua_State *L, const char *fmt, ...); +LUAI_FUNC const char *luaG_addinfo (lua_State *L, const char *msg, + TString *src, int line); +LUAI_FUNC l_noret luaG_errormsg (lua_State *L); +LUAI_FUNC int luaG_traceexec (lua_State *L, const Instruction *pc); +LUAI_FUNC int luaG_tracecall (lua_State *L); + + +#endif diff --git a/LuaSkin/lua-5.4.7/src/ldo.c b/LuaSkin/lua-5.4.7/src/ldo.c new file mode 100644 index 000000000..9ecb8a652 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/ldo.c @@ -0,0 +1,1044 @@ +/* +** $Id: ldo.c $ +** Stack and Call structure of Lua +** See Copyright Notice in lua.h +*/ + +#define ldo_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include +#include + +#include "lua.h" + +#include "lapi.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lundump.h" +#include "lvm.h" +#include "lzio.h" + + + +#define errorstatus(s) ((s) > LUA_YIELD) + + +/* +** {====================================================== +** Error-recovery functions +** ======================================================= +*/ + +/* +** LUAI_THROW/LUAI_TRY define how Lua does exception handling. By +** default, Lua handles errors with exceptions when compiling as +** C++ code, with _longjmp/_setjmp when asked to use them, and with +** longjmp/setjmp otherwise. +*/ +#if !defined(LUAI_THROW) /* { */ + +#if defined(LUA_USE_OBJC_EXCEPTIONS) +/* Requires additional Obj-C file to be compiled in to avoid forcing all of Lua to be compiled as Obj-C. + * lobjectivec_exceptions must be compiled as Obj-C. + * It is used to try to shelter Obj-C from the main Lua core. + */ +#include "lobjectivec_exceptions.h" + +#elif defined(__cplusplus) && !defined(LUA_USE_LONGJMP) /* { */ +/* C++ exceptions */ +#define LUAI_THROW(L,c) throw(c) +#define LUAI_TRY(L,c,a) \ + try { a } catch(...) { if ((c)->status == 0) (c)->status = -1; } +#define luai_jmpbuf int /* dummy variable */ + +#elif defined(LUA_USE_POSIX) /* }{ */ + +/* in POSIX, try _longjmp/_setjmp (more efficient) */ +#define LUAI_THROW(L,c) _longjmp((c)->b, 1) +#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } +#define luai_jmpbuf jmp_buf + +#else /* }{ */ + +/* ISO C handling with long jumps */ +#define LUAI_THROW(L,c) longjmp((c)->b, 1) +#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } +#define luai_jmpbuf jmp_buf + +#endif /* } */ + +#endif /* } */ + + +/* LUA_USE_OBJC_EXCEPTIONS needs to define this struct in its header. + * So avoid redefining for that case, but define for every other case. + */ +#if !defined(LUA_USE_OBJC_EXCEPTIONS) +/* chain list of long jump buffers */ +struct lua_longjmp { + struct lua_longjmp *previous; + luai_jmpbuf b; + volatile int status; /* error code */ +}; +#endif + +void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) { + switch (errcode) { + case LUA_ERRMEM: { /* memory error? */ + setsvalue2s(L, oldtop, G(L)->memerrmsg); /* reuse preregistered msg. */ + break; + } + case LUA_ERRERR: { + setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling")); + break; + } + case LUA_OK: { /* special case only for closing upvalues */ + setnilvalue(s2v(oldtop)); /* no error message */ + break; + } + default: { + lua_assert(errorstatus(errcode)); /* real error */ + setobjs2s(L, oldtop, L->top.p - 1); /* error message on current top */ + break; + } + } + L->top.p = oldtop + 1; +} + + +l_noret luaD_throw (lua_State *L, int errcode) { + if (L->errorJmp) { /* thread has an error handler? */ + L->errorJmp->status = errcode; /* set status */ + LUAI_THROW(L, L->errorJmp); /* jump to it */ + } + else { /* thread has no error handler */ + global_State *g = G(L); + errcode = luaE_resetthread(L, errcode); /* close all upvalues */ + if (g->mainthread->errorJmp) { /* main thread has a handler? */ + setobjs2s(L, g->mainthread->top.p++, L->top.p - 1); /* copy error obj. */ + luaD_throw(g->mainthread, errcode); /* re-throw in main thread */ + } + else { /* no handler at all; abort */ + if (g->panic) { /* panic function? */ + lua_unlock(L); + g->panic(L); /* call panic function (last chance to jump out) */ + } + abort(); + } + } +} + + +int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { + l_uint32 oldnCcalls = L->nCcalls; + struct lua_longjmp lj; + lj.status = LUA_OK; + lj.previous = L->errorJmp; /* chain new error handler */ + L->errorJmp = &lj; +#if defined(LUA_USE_OBJC_EXCEPTIONS) + /* Unfortunately, either the macro signature needed to change or this file has to be compiled as Obj-C. + * I'm not sure which is worse. + */ + LUAI_TRY(L, &lj, f, ud); +#else + LUAI_TRY(L, &lj, + (*f)(L, ud); + ); +#endif + L->errorJmp = lj.previous; /* restore old error handler */ + L->nCcalls = oldnCcalls; + return lj.status; +} + +/* }====================================================== */ + + +/* +** {================================================================== +** Stack reallocation +** =================================================================== +*/ + + +/* +** Change all pointers to the stack into offsets. +*/ +static void relstack (lua_State *L) { + CallInfo *ci; + UpVal *up; + L->top.offset = savestack(L, L->top.p); + L->tbclist.offset = savestack(L, L->tbclist.p); + for (up = L->openupval; up != NULL; up = up->u.open.next) + up->v.offset = savestack(L, uplevel(up)); + for (ci = L->ci; ci != NULL; ci = ci->previous) { + ci->top.offset = savestack(L, ci->top.p); + ci->func.offset = savestack(L, ci->func.p); + } +} + + +/* +** Change back all offsets into pointers. +*/ +static void correctstack (lua_State *L) { + CallInfo *ci; + UpVal *up; + L->top.p = restorestack(L, L->top.offset); + L->tbclist.p = restorestack(L, L->tbclist.offset); + for (up = L->openupval; up != NULL; up = up->u.open.next) + up->v.p = s2v(restorestack(L, up->v.offset)); + for (ci = L->ci; ci != NULL; ci = ci->previous) { + ci->top.p = restorestack(L, ci->top.offset); + ci->func.p = restorestack(L, ci->func.offset); + if (isLua(ci)) + ci->u.l.trap = 1; /* signal to update 'trap' in 'luaV_execute' */ + } +} + + +/* some space for error handling */ +#define ERRORSTACKSIZE (LUAI_MAXSTACK + 200) + +/* +** Reallocate the stack to a new size, correcting all pointers into it. +** In ISO C, any pointer use after the pointer has been deallocated is +** undefined behavior. So, before the reallocation, all pointers are +** changed to offsets, and after the reallocation they are changed back +** to pointers. As during the reallocation the pointers are invalid, the +** reallocation cannot run emergency collections. +** +** In case of allocation error, raise an error or return false according +** to 'raiseerror'. +*/ +int luaD_reallocstack (lua_State *L, int newsize, int raiseerror) { + int oldsize = stacksize(L); + int i; + StkId newstack; + int oldgcstop = G(L)->gcstopem; + lua_assert(newsize <= LUAI_MAXSTACK || newsize == ERRORSTACKSIZE); + relstack(L); /* change pointers to offsets */ + G(L)->gcstopem = 1; /* stop emergency collection */ + newstack = luaM_reallocvector(L, L->stack.p, oldsize + EXTRA_STACK, + newsize + EXTRA_STACK, StackValue); + G(L)->gcstopem = oldgcstop; /* restore emergency collection */ + if (l_unlikely(newstack == NULL)) { /* reallocation failed? */ + correctstack(L); /* change offsets back to pointers */ + if (raiseerror) + luaM_error(L); + else return 0; /* do not raise an error */ + } + L->stack.p = newstack; + correctstack(L); /* change offsets back to pointers */ + L->stack_last.p = L->stack.p + newsize; + for (i = oldsize + EXTRA_STACK; i < newsize + EXTRA_STACK; i++) + setnilvalue(s2v(newstack + i)); /* erase new segment */ + return 1; +} + + +/* +** Try to grow the stack by at least 'n' elements. When 'raiseerror' +** is true, raises any error; otherwise, return 0 in case of errors. +*/ +int luaD_growstack (lua_State *L, int n, int raiseerror) { + int size = stacksize(L); + if (l_unlikely(size > LUAI_MAXSTACK)) { + /* if stack is larger than maximum, thread is already using the + extra space reserved for errors, that is, thread is handling + a stack error; cannot grow further than that. */ + lua_assert(stacksize(L) == ERRORSTACKSIZE); + if (raiseerror) + luaD_throw(L, LUA_ERRERR); /* error inside message handler */ + return 0; /* if not 'raiseerror', just signal it */ + } + else if (n < LUAI_MAXSTACK) { /* avoids arithmetic overflows */ + int newsize = 2 * size; /* tentative new size */ + int needed = cast_int(L->top.p - L->stack.p) + n; + if (newsize > LUAI_MAXSTACK) /* cannot cross the limit */ + newsize = LUAI_MAXSTACK; + if (newsize < needed) /* but must respect what was asked for */ + newsize = needed; + if (l_likely(newsize <= LUAI_MAXSTACK)) + return luaD_reallocstack(L, newsize, raiseerror); + } + /* else stack overflow */ + /* add extra size to be able to handle the error message */ + luaD_reallocstack(L, ERRORSTACKSIZE, raiseerror); + if (raiseerror) + luaG_runerror(L, "stack overflow"); + return 0; +} + + +/* +** Compute how much of the stack is being used, by computing the +** maximum top of all call frames in the stack and the current top. +*/ +static int stackinuse (lua_State *L) { + CallInfo *ci; + int res; + StkId lim = L->top.p; + for (ci = L->ci; ci != NULL; ci = ci->previous) { + if (lim < ci->top.p) lim = ci->top.p; + } + lua_assert(lim <= L->stack_last.p + EXTRA_STACK); + res = cast_int(lim - L->stack.p) + 1; /* part of stack in use */ + if (res < LUA_MINSTACK) + res = LUA_MINSTACK; /* ensure a minimum size */ + return res; +} + + +/* +** If stack size is more than 3 times the current use, reduce that size +** to twice the current use. (So, the final stack size is at most 2/3 the +** previous size, and half of its entries are empty.) +** As a particular case, if stack was handling a stack overflow and now +** it is not, 'max' (limited by LUAI_MAXSTACK) will be smaller than +** stacksize (equal to ERRORSTACKSIZE in this case), and so the stack +** will be reduced to a "regular" size. +*/ +void luaD_shrinkstack (lua_State *L) { + int inuse = stackinuse(L); + int max = (inuse > LUAI_MAXSTACK / 3) ? LUAI_MAXSTACK : inuse * 3; + /* if thread is currently not handling a stack overflow and its + size is larger than maximum "reasonable" size, shrink it */ + if (inuse <= LUAI_MAXSTACK && stacksize(L) > max) { + int nsize = (inuse > LUAI_MAXSTACK / 2) ? LUAI_MAXSTACK : inuse * 2; + luaD_reallocstack(L, nsize, 0); /* ok if that fails */ + } + else /* don't change stack */ + condmovestack(L,{},{}); /* (change only for debugging) */ + luaE_shrinkCI(L); /* shrink CI list */ +} + + +void luaD_inctop (lua_State *L) { + luaD_checkstack(L, 1); + L->top.p++; +} + +/* }================================================================== */ + + +/* +** Call a hook for the given event. Make sure there is a hook to be +** called. (Both 'L->hook' and 'L->hookmask', which trigger this +** function, can be changed asynchronously by signals.) +*/ +void luaD_hook (lua_State *L, int event, int line, + int ftransfer, int ntransfer) { + lua_Hook hook = L->hook; + if (hook && L->allowhook) { /* make sure there is a hook */ + int mask = CIST_HOOKED; + CallInfo *ci = L->ci; + ptrdiff_t top = savestack(L, L->top.p); /* preserve original 'top' */ + ptrdiff_t ci_top = savestack(L, ci->top.p); /* idem for 'ci->top' */ + lua_Debug ar; + ar.event = event; + ar.currentline = line; + ar.i_ci = ci; + if (ntransfer != 0) { + mask |= CIST_TRAN; /* 'ci' has transfer information */ + ci->u2.transferinfo.ftransfer = ftransfer; + ci->u2.transferinfo.ntransfer = ntransfer; + } + if (isLua(ci) && L->top.p < ci->top.p) + L->top.p = ci->top.p; /* protect entire activation register */ + luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ + if (ci->top.p < L->top.p + LUA_MINSTACK) + ci->top.p = L->top.p + LUA_MINSTACK; + L->allowhook = 0; /* cannot call hooks inside a hook */ + ci->callstatus |= mask; + lua_unlock(L); + (*hook)(L, &ar); + lua_lock(L); + lua_assert(!L->allowhook); + L->allowhook = 1; + ci->top.p = restorestack(L, ci_top); + L->top.p = restorestack(L, top); + ci->callstatus &= ~mask; + } +} + + +/* +** Executes a call hook for Lua functions. This function is called +** whenever 'hookmask' is not zero, so it checks whether call hooks are +** active. +*/ +void luaD_hookcall (lua_State *L, CallInfo *ci) { + L->oldpc = 0; /* set 'oldpc' for new function */ + if (L->hookmask & LUA_MASKCALL) { /* is call hook on? */ + int event = (ci->callstatus & CIST_TAIL) ? LUA_HOOKTAILCALL + : LUA_HOOKCALL; + Proto *p = ci_func(ci)->p; + ci->u.l.savedpc++; /* hooks assume 'pc' is already incremented */ + luaD_hook(L, event, -1, 1, p->numparams); + ci->u.l.savedpc--; /* correct 'pc' */ + } +} + + +/* +** Executes a return hook for Lua and C functions and sets/corrects +** 'oldpc'. (Note that this correction is needed by the line hook, so it +** is done even when return hooks are off.) +*/ +static void rethook (lua_State *L, CallInfo *ci, int nres) { + if (L->hookmask & LUA_MASKRET) { /* is return hook on? */ + StkId firstres = L->top.p - nres; /* index of first result */ + int delta = 0; /* correction for vararg functions */ + int ftransfer; + if (isLua(ci)) { + Proto *p = ci_func(ci)->p; + if (p->is_vararg) + delta = ci->u.l.nextraargs + p->numparams + 1; + } + ci->func.p += delta; /* if vararg, back to virtual 'func' */ + ftransfer = cast(unsigned short, firstres - ci->func.p); + luaD_hook(L, LUA_HOOKRET, -1, ftransfer, nres); /* call it */ + ci->func.p -= delta; + } + if (isLua(ci = ci->previous)) + L->oldpc = pcRel(ci->u.l.savedpc, ci_func(ci)->p); /* set 'oldpc' */ +} + + +/* +** Check whether 'func' has a '__call' metafield. If so, put it in the +** stack, below original 'func', so that 'luaD_precall' can call it. Raise +** an error if there is no '__call' metafield. +*/ +static StkId tryfuncTM (lua_State *L, StkId func) { + const TValue *tm; + StkId p; + checkstackGCp(L, 1, func); /* space for metamethod */ + tm = luaT_gettmbyobj(L, s2v(func), TM_CALL); /* (after previous GC) */ + if (l_unlikely(ttisnil(tm))) + luaG_callerror(L, s2v(func)); /* nothing to call */ + for (p = L->top.p; p > func; p--) /* open space for metamethod */ + setobjs2s(L, p, p-1); + L->top.p++; /* stack space pre-allocated by the caller */ + setobj2s(L, func, tm); /* metamethod is the new function to be called */ + return func; +} + + +/* +** Given 'nres' results at 'firstResult', move 'wanted' of them to 'res'. +** Handle most typical cases (zero results for commands, one result for +** expressions, multiple results for tail calls/single parameters) +** separated. +*/ +l_sinline void moveresults (lua_State *L, StkId res, int nres, int wanted) { + StkId firstresult; + int i; + switch (wanted) { /* handle typical cases separately */ + case 0: /* no values needed */ + L->top.p = res; + return; + case 1: /* one value needed */ + if (nres == 0) /* no results? */ + setnilvalue(s2v(res)); /* adjust with nil */ + else /* at least one result */ + setobjs2s(L, res, L->top.p - nres); /* move it to proper place */ + L->top.p = res + 1; + return; + case LUA_MULTRET: + wanted = nres; /* we want all results */ + break; + default: /* two/more results and/or to-be-closed variables */ + if (hastocloseCfunc(wanted)) { /* to-be-closed variables? */ + L->ci->callstatus |= CIST_CLSRET; /* in case of yields */ + L->ci->u2.nres = nres; + res = luaF_close(L, res, CLOSEKTOP, 1); + L->ci->callstatus &= ~CIST_CLSRET; + if (L->hookmask) { /* if needed, call hook after '__close's */ + ptrdiff_t savedres = savestack(L, res); + rethook(L, L->ci, nres); + res = restorestack(L, savedres); /* hook can move stack */ + } + wanted = decodeNresults(wanted); + if (wanted == LUA_MULTRET) + wanted = nres; /* we want all results */ + } + break; + } + /* generic case */ + firstresult = L->top.p - nres; /* index of first result */ + if (nres > wanted) /* extra results? */ + nres = wanted; /* don't need them */ + for (i = 0; i < nres; i++) /* move all results to correct place */ + setobjs2s(L, res + i, firstresult + i); + for (; i < wanted; i++) /* complete wanted number of results */ + setnilvalue(s2v(res + i)); + L->top.p = res + wanted; /* top points after the last result */ +} + + +/* +** Finishes a function call: calls hook if necessary, moves current +** number of results to proper place, and returns to previous call +** info. If function has to close variables, hook must be called after +** that. +*/ +void luaD_poscall (lua_State *L, CallInfo *ci, int nres) { + int wanted = ci->nresults; + if (l_unlikely(L->hookmask && !hastocloseCfunc(wanted))) + rethook(L, ci, nres); + /* move results to proper place */ + moveresults(L, ci->func.p, nres, wanted); + /* function cannot be in any of these cases when returning */ + lua_assert(!(ci->callstatus & + (CIST_HOOKED | CIST_YPCALL | CIST_FIN | CIST_TRAN | CIST_CLSRET))); + L->ci = ci->previous; /* back to caller (after closing variables) */ +} + + + +#define next_ci(L) (L->ci->next ? L->ci->next : luaE_extendCI(L)) + + +l_sinline CallInfo *prepCallInfo (lua_State *L, StkId func, int nret, + int mask, StkId top) { + CallInfo *ci = L->ci = next_ci(L); /* new frame */ + ci->func.p = func; + ci->nresults = nret; + ci->callstatus = mask; + ci->top.p = top; + return ci; +} + + +/* +** precall for C functions +*/ +l_sinline int precallC (lua_State *L, StkId func, int nresults, + lua_CFunction f) { + int n; /* number of returns */ + CallInfo *ci; + checkstackGCp(L, LUA_MINSTACK, func); /* ensure minimum stack size */ + L->ci = ci = prepCallInfo(L, func, nresults, CIST_C, + L->top.p + LUA_MINSTACK); + lua_assert(ci->top.p <= L->stack_last.p); + if (l_unlikely(L->hookmask & LUA_MASKCALL)) { + int narg = cast_int(L->top.p - func) - 1; + luaD_hook(L, LUA_HOOKCALL, -1, 1, narg); + } + lua_unlock(L); + n = (*f)(L); /* do the actual call */ + lua_lock(L); + api_checknelems(L, n); + luaD_poscall(L, ci, n); + return n; +} + + +/* +** Prepare a function for a tail call, building its call info on top +** of the current call info. 'narg1' is the number of arguments plus 1 +** (so that it includes the function itself). Return the number of +** results, if it was a C function, or -1 for a Lua function. +*/ +int luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, + int narg1, int delta) { + retry: + switch (ttypetag(s2v(func))) { + case LUA_VCCL: /* C closure */ + return precallC(L, func, LUA_MULTRET, clCvalue(s2v(func))->f); + case LUA_VLCF: /* light C function */ + return precallC(L, func, LUA_MULTRET, fvalue(s2v(func))); + case LUA_VLCL: { /* Lua function */ + Proto *p = clLvalue(s2v(func))->p; + int fsize = p->maxstacksize; /* frame size */ + int nfixparams = p->numparams; + int i; + checkstackGCp(L, fsize - delta, func); + ci->func.p -= delta; /* restore 'func' (if vararg) */ + for (i = 0; i < narg1; i++) /* move down function and arguments */ + setobjs2s(L, ci->func.p + i, func + i); + func = ci->func.p; /* moved-down function */ + for (; narg1 <= nfixparams; narg1++) + setnilvalue(s2v(func + narg1)); /* complete missing arguments */ + ci->top.p = func + 1 + fsize; /* top for new function */ + lua_assert(ci->top.p <= L->stack_last.p); + ci->u.l.savedpc = p->code; /* starting point */ + ci->callstatus |= CIST_TAIL; + L->top.p = func + narg1; /* set top */ + return -1; + } + default: { /* not a function */ + func = tryfuncTM(L, func); /* try to get '__call' metamethod */ + /* return luaD_pretailcall(L, ci, func, narg1 + 1, delta); */ + narg1++; + goto retry; /* try again */ + } + } +} + + +/* +** Prepares the call to a function (C or Lua). For C functions, also do +** the call. The function to be called is at '*func'. The arguments +** are on the stack, right after the function. Returns the CallInfo +** to be executed, if it was a Lua function. Otherwise (a C function) +** returns NULL, with all the results on the stack, starting at the +** original function position. +*/ +CallInfo *luaD_precall (lua_State *L, StkId func, int nresults) { + retry: + switch (ttypetag(s2v(func))) { + case LUA_VCCL: /* C closure */ + precallC(L, func, nresults, clCvalue(s2v(func))->f); + return NULL; + case LUA_VLCF: /* light C function */ + precallC(L, func, nresults, fvalue(s2v(func))); + return NULL; + case LUA_VLCL: { /* Lua function */ + CallInfo *ci; + Proto *p = clLvalue(s2v(func))->p; + int narg = cast_int(L->top.p - func) - 1; /* number of real arguments */ + int nfixparams = p->numparams; + int fsize = p->maxstacksize; /* frame size */ + checkstackGCp(L, fsize, func); + L->ci = ci = prepCallInfo(L, func, nresults, 0, func + 1 + fsize); + ci->u.l.savedpc = p->code; /* starting point */ + for (; narg < nfixparams; narg++) + setnilvalue(s2v(L->top.p++)); /* complete missing arguments */ + lua_assert(ci->top.p <= L->stack_last.p); + return ci; + } + default: { /* not a function */ + func = tryfuncTM(L, func); /* try to get '__call' metamethod */ + /* return luaD_precall(L, func, nresults); */ + goto retry; /* try again with metamethod */ + } + } +} + + +/* +** Call a function (C or Lua) through C. 'inc' can be 1 (increment +** number of recursive invocations in the C stack) or nyci (the same +** plus increment number of non-yieldable calls). +** This function can be called with some use of EXTRA_STACK, so it should +** check the stack before doing anything else. 'luaD_precall' already +** does that. +*/ +l_sinline void ccall (lua_State *L, StkId func, int nResults, l_uint32 inc) { + CallInfo *ci; + L->nCcalls += inc; + if (l_unlikely(getCcalls(L) >= LUAI_MAXCCALLS)) { + checkstackp(L, 0, func); /* free any use of EXTRA_STACK */ + luaE_checkcstack(L); + } + if ((ci = luaD_precall(L, func, nResults)) != NULL) { /* Lua function? */ + ci->callstatus = CIST_FRESH; /* mark that it is a "fresh" execute */ + luaV_execute(L, ci); /* call it */ + } + L->nCcalls -= inc; +} + + +/* +** External interface for 'ccall' +*/ +void luaD_call (lua_State *L, StkId func, int nResults) { + ccall(L, func, nResults, 1); +} + + +/* +** Similar to 'luaD_call', but does not allow yields during the call. +*/ +void luaD_callnoyield (lua_State *L, StkId func, int nResults) { + ccall(L, func, nResults, nyci); +} + + +/* +** Finish the job of 'lua_pcallk' after it was interrupted by an yield. +** (The caller, 'finishCcall', does the final call to 'adjustresults'.) +** The main job is to complete the 'luaD_pcall' called by 'lua_pcallk'. +** If a '__close' method yields here, eventually control will be back +** to 'finishCcall' (when that '__close' method finally returns) and +** 'finishpcallk' will run again and close any still pending '__close' +** methods. Similarly, if a '__close' method errs, 'precover' calls +** 'unroll' which calls ''finishCcall' and we are back here again, to +** close any pending '__close' methods. +** Note that, up to the call to 'luaF_close', the corresponding +** 'CallInfo' is not modified, so that this repeated run works like the +** first one (except that it has at least one less '__close' to do). In +** particular, field CIST_RECST preserves the error status across these +** multiple runs, changing only if there is a new error. +*/ +static int finishpcallk (lua_State *L, CallInfo *ci) { + int status = getcistrecst(ci); /* get original status */ + if (l_likely(status == LUA_OK)) /* no error? */ + status = LUA_YIELD; /* was interrupted by an yield */ + else { /* error */ + StkId func = restorestack(L, ci->u2.funcidx); + L->allowhook = getoah(ci->callstatus); /* restore 'allowhook' */ + func = luaF_close(L, func, status, 1); /* can yield or raise an error */ + luaD_seterrorobj(L, status, func); + luaD_shrinkstack(L); /* restore stack size in case of overflow */ + setcistrecst(ci, LUA_OK); /* clear original status */ + } + ci->callstatus &= ~CIST_YPCALL; + L->errfunc = ci->u.c.old_errfunc; + /* if it is here, there were errors or yields; unlike 'lua_pcallk', + do not change status */ + return status; +} + + +/* +** Completes the execution of a C function interrupted by an yield. +** The interruption must have happened while the function was either +** closing its tbc variables in 'moveresults' or executing +** 'lua_callk'/'lua_pcallk'. In the first case, it just redoes +** 'luaD_poscall'. In the second case, the call to 'finishpcallk' +** finishes the interrupted execution of 'lua_pcallk'. After that, it +** calls the continuation of the interrupted function and finally it +** completes the job of the 'luaD_call' that called the function. In +** the call to 'adjustresults', we do not know the number of results +** of the function called by 'lua_callk'/'lua_pcallk', so we are +** conservative and use LUA_MULTRET (always adjust). +*/ +static void finishCcall (lua_State *L, CallInfo *ci) { + int n; /* actual number of results from C function */ + if (ci->callstatus & CIST_CLSRET) { /* was returning? */ + lua_assert(hastocloseCfunc(ci->nresults)); + n = ci->u2.nres; /* just redo 'luaD_poscall' */ + /* don't need to reset CIST_CLSRET, as it will be set again anyway */ + } + else { + int status = LUA_YIELD; /* default if there were no errors */ + /* must have a continuation and must be able to call it */ + lua_assert(ci->u.c.k != NULL && yieldable(L)); + if (ci->callstatus & CIST_YPCALL) /* was inside a 'lua_pcallk'? */ + status = finishpcallk(L, ci); /* finish it */ + adjustresults(L, LUA_MULTRET); /* finish 'lua_callk' */ + lua_unlock(L); + n = (*ci->u.c.k)(L, status, ci->u.c.ctx); /* call continuation */ + lua_lock(L); + api_checknelems(L, n); + } + luaD_poscall(L, ci, n); /* finish 'luaD_call' */ +} + + +/* +** Executes "full continuation" (everything in the stack) of a +** previously interrupted coroutine until the stack is empty (or another +** interruption long-jumps out of the loop). +*/ +static void unroll (lua_State *L, void *ud) { + CallInfo *ci; + UNUSED(ud); + while ((ci = L->ci) != &L->base_ci) { /* something in the stack */ + if (!isLua(ci)) /* C function? */ + finishCcall(L, ci); /* complete its execution */ + else { /* Lua function */ + luaV_finishOp(L); /* finish interrupted instruction */ + luaV_execute(L, ci); /* execute down to higher C 'boundary' */ + } + } +} + + +/* +** Try to find a suspended protected call (a "recover point") for the +** given thread. +*/ +static CallInfo *findpcall (lua_State *L) { + CallInfo *ci; + for (ci = L->ci; ci != NULL; ci = ci->previous) { /* search for a pcall */ + if (ci->callstatus & CIST_YPCALL) + return ci; + } + return NULL; /* no pending pcall */ +} + + +/* +** Signal an error in the call to 'lua_resume', not in the execution +** of the coroutine itself. (Such errors should not be handled by any +** coroutine error handler and should not kill the coroutine.) +*/ +static int resume_error (lua_State *L, const char *msg, int narg) { + L->top.p -= narg; /* remove args from the stack */ + setsvalue2s(L, L->top.p, luaS_new(L, msg)); /* push error message */ + api_incr_top(L); + lua_unlock(L); + return LUA_ERRRUN; +} + + +/* +** Do the work for 'lua_resume' in protected mode. Most of the work +** depends on the status of the coroutine: initial state, suspended +** inside a hook, or regularly suspended (optionally with a continuation +** function), plus erroneous cases: non-suspended coroutine or dead +** coroutine. +*/ +static void resume (lua_State *L, void *ud) { + int n = *(cast(int*, ud)); /* number of arguments */ + StkId firstArg = L->top.p - n; /* first argument */ + CallInfo *ci = L->ci; + if (L->status == LUA_OK) /* starting a coroutine? */ + ccall(L, firstArg - 1, LUA_MULTRET, 0); /* just call its body */ + else { /* resuming from previous yield */ + lua_assert(L->status == LUA_YIELD); + L->status = LUA_OK; /* mark that it is running (again) */ + if (isLua(ci)) { /* yielded inside a hook? */ + /* undo increment made by 'luaG_traceexec': instruction was not + executed yet */ + lua_assert(ci->callstatus & CIST_HOOKYIELD); + ci->u.l.savedpc--; + L->top.p = firstArg; /* discard arguments */ + luaV_execute(L, ci); /* just continue running Lua code */ + } + else { /* 'common' yield */ + if (ci->u.c.k != NULL) { /* does it have a continuation function? */ + lua_unlock(L); + n = (*ci->u.c.k)(L, LUA_YIELD, ci->u.c.ctx); /* call continuation */ + lua_lock(L); + api_checknelems(L, n); + } + luaD_poscall(L, ci, n); /* finish 'luaD_call' */ + } + unroll(L, NULL); /* run continuation */ + } +} + + +/* +** Unrolls a coroutine in protected mode while there are recoverable +** errors, that is, errors inside a protected call. (Any error +** interrupts 'unroll', and this loop protects it again so it can +** continue.) Stops with a normal end (status == LUA_OK), an yield +** (status == LUA_YIELD), or an unprotected error ('findpcall' doesn't +** find a recover point). +*/ +static int precover (lua_State *L, int status) { + CallInfo *ci; + while (errorstatus(status) && (ci = findpcall(L)) != NULL) { + L->ci = ci; /* go down to recovery functions */ + setcistrecst(ci, status); /* status to finish 'pcall' */ + status = luaD_rawrunprotected(L, unroll, NULL); + } + return status; +} + + +LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs, + int *nresults) { + int status; + lua_lock(L); + if (L->status == LUA_OK) { /* may be starting a coroutine */ + if (L->ci != &L->base_ci) /* not in base level? */ + return resume_error(L, "cannot resume non-suspended coroutine", nargs); + else if (L->top.p - (L->ci->func.p + 1) == nargs) /* no function? */ + return resume_error(L, "cannot resume dead coroutine", nargs); + } + else if (L->status != LUA_YIELD) /* ended with errors? */ + return resume_error(L, "cannot resume dead coroutine", nargs); + L->nCcalls = (from) ? getCcalls(from) : 0; + if (getCcalls(L) >= LUAI_MAXCCALLS) + return resume_error(L, "C stack overflow", nargs); + L->nCcalls++; + luai_userstateresume(L, nargs); + api_checknelems(L, (L->status == LUA_OK) ? nargs + 1 : nargs); + status = luaD_rawrunprotected(L, resume, &nargs); + /* continue running after recoverable errors */ + status = precover(L, status); + if (l_likely(!errorstatus(status))) + lua_assert(status == L->status); /* normal end or yield */ + else { /* unrecoverable error */ + L->status = cast_byte(status); /* mark thread as 'dead' */ + luaD_seterrorobj(L, status, L->top.p); /* push error message */ + L->ci->top.p = L->top.p; + } + *nresults = (status == LUA_YIELD) ? L->ci->u2.nyield + : cast_int(L->top.p - (L->ci->func.p + 1)); + lua_unlock(L); + return status; +} + + +LUA_API int lua_isyieldable (lua_State *L) { + return yieldable(L); +} + + +LUA_API int lua_yieldk (lua_State *L, int nresults, lua_KContext ctx, + lua_KFunction k) { + CallInfo *ci; + luai_userstateyield(L, nresults); + lua_lock(L); + ci = L->ci; + api_checknelems(L, nresults); + if (l_unlikely(!yieldable(L))) { + if (L != G(L)->mainthread) + luaG_runerror(L, "attempt to yield across a C-call boundary"); + else + luaG_runerror(L, "attempt to yield from outside a coroutine"); + } + L->status = LUA_YIELD; + ci->u2.nyield = nresults; /* save number of results */ + if (isLua(ci)) { /* inside a hook? */ + lua_assert(!isLuacode(ci)); + api_check(L, nresults == 0, "hooks cannot yield values"); + api_check(L, k == NULL, "hooks cannot continue after yielding"); + } + else { + if ((ci->u.c.k = k) != NULL) /* is there a continuation? */ + ci->u.c.ctx = ctx; /* save context */ + luaD_throw(L, LUA_YIELD); + } + lua_assert(ci->callstatus & CIST_HOOKED); /* must be inside a hook */ + lua_unlock(L); + return 0; /* return to 'luaD_hook' */ +} + + +/* +** Auxiliary structure to call 'luaF_close' in protected mode. +*/ +struct CloseP { + StkId level; + int status; +}; + + +/* +** Auxiliary function to call 'luaF_close' in protected mode. +*/ +static void closepaux (lua_State *L, void *ud) { + struct CloseP *pcl = cast(struct CloseP *, ud); + luaF_close(L, pcl->level, pcl->status, 0); +} + + +/* +** Calls 'luaF_close' in protected mode. Return the original status +** or, in case of errors, the new status. +*/ +int luaD_closeprotected (lua_State *L, ptrdiff_t level, int status) { + CallInfo *old_ci = L->ci; + lu_byte old_allowhooks = L->allowhook; + for (;;) { /* keep closing upvalues until no more errors */ + struct CloseP pcl; + pcl.level = restorestack(L, level); pcl.status = status; + status = luaD_rawrunprotected(L, &closepaux, &pcl); + if (l_likely(status == LUA_OK)) /* no more errors? */ + return pcl.status; + else { /* an error occurred; restore saved state and repeat */ + L->ci = old_ci; + L->allowhook = old_allowhooks; + } + } +} + + +/* +** Call the C function 'func' in protected mode, restoring basic +** thread information ('allowhook', etc.) and in particular +** its stack level in case of errors. +*/ +int luaD_pcall (lua_State *L, Pfunc func, void *u, + ptrdiff_t old_top, ptrdiff_t ef) { + int status; + CallInfo *old_ci = L->ci; + lu_byte old_allowhooks = L->allowhook; + ptrdiff_t old_errfunc = L->errfunc; + L->errfunc = ef; + status = luaD_rawrunprotected(L, func, u); + if (l_unlikely(status != LUA_OK)) { /* an error occurred? */ + L->ci = old_ci; + L->allowhook = old_allowhooks; + status = luaD_closeprotected(L, old_top, status); + luaD_seterrorobj(L, status, restorestack(L, old_top)); + luaD_shrinkstack(L); /* restore stack size in case of overflow */ + } + L->errfunc = old_errfunc; + return status; +} + + + +/* +** Execute a protected parser. +*/ +struct SParser { /* data to 'f_parser' */ + ZIO *z; + Mbuffer buff; /* dynamic structure used by the scanner */ + Dyndata dyd; /* dynamic structures used by the parser */ + const char *mode; + const char *name; +}; + + +static void checkmode (lua_State *L, const char *mode, const char *x) { + if (mode && strchr(mode, x[0]) == NULL) { + luaO_pushfstring(L, + "attempt to load a %s chunk (mode is '%s')", x, mode); + luaD_throw(L, LUA_ERRSYNTAX); + } +} + + +static void f_parser (lua_State *L, void *ud) { + LClosure *cl; + struct SParser *p = cast(struct SParser *, ud); + int c = zgetc(p->z); /* read first character */ + if (c == LUA_SIGNATURE[0]) { + checkmode(L, p->mode, "binary"); + cl = luaU_undump(L, p->z, p->name); + } + else { + checkmode(L, p->mode, "text"); + cl = luaY_parser(L, p->z, &p->buff, &p->dyd, p->name, c); + } + lua_assert(cl->nupvalues == cl->p->sizeupvalues); + luaF_initupvals(L, cl); +} + + +int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, + const char *mode) { + struct SParser p; + int status; + incnny(L); /* cannot yield during parsing */ + p.z = z; p.name = name; p.mode = mode; + p.dyd.actvar.arr = NULL; p.dyd.actvar.size = 0; + p.dyd.gt.arr = NULL; p.dyd.gt.size = 0; + p.dyd.label.arr = NULL; p.dyd.label.size = 0; + luaZ_initbuffer(L, &p.buff); + status = luaD_pcall(L, f_parser, &p, savestack(L, L->top.p), L->errfunc); + luaZ_freebuffer(L, &p.buff); + luaM_freearray(L, p.dyd.actvar.arr, p.dyd.actvar.size); + luaM_freearray(L, p.dyd.gt.arr, p.dyd.gt.size); + luaM_freearray(L, p.dyd.label.arr, p.dyd.label.size); + decnny(L); + return status; +} + + diff --git a/LuaSkin/lua-5.4.7/src/ldo.h b/LuaSkin/lua-5.4.7/src/ldo.h new file mode 100644 index 000000000..56008ab30 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/ldo.h @@ -0,0 +1,87 @@ +/* +** $Id: ldo.h $ +** Stack and Call structure of Lua +** See Copyright Notice in lua.h +*/ + +#ifndef ldo_h +#define ldo_h + + +#include "llimits.h" +#include "lobject.h" +#include "lstate.h" +#include "lzio.h" + + +/* +** Macro to check stack size and grow stack if needed. Parameters +** 'pre'/'pos' allow the macro to preserve a pointer into the +** stack across reallocations, doing the work only when needed. +** It also allows the running of one GC step when the stack is +** reallocated. +** 'condmovestack' is used in heavy tests to force a stack reallocation +** at every check. +*/ +#define luaD_checkstackaux(L,n,pre,pos) \ + if (l_unlikely(L->stack_last.p - L->top.p <= (n))) \ + { pre; luaD_growstack(L, n, 1); pos; } \ + else { condmovestack(L,pre,pos); } + +/* In general, 'pre'/'pos' are empty (nothing to save) */ +#define luaD_checkstack(L,n) luaD_checkstackaux(L,n,(void)0,(void)0) + + + +#define savestack(L,pt) (cast_charp(pt) - cast_charp(L->stack.p)) +#define restorestack(L,n) cast(StkId, cast_charp(L->stack.p) + (n)) + + +/* macro to check stack size, preserving 'p' */ +#define checkstackp(L,n,p) \ + luaD_checkstackaux(L, n, \ + ptrdiff_t t__ = savestack(L, p), /* save 'p' */ \ + p = restorestack(L, t__)) /* 'pos' part: restore 'p' */ + + +/* macro to check stack size and GC, preserving 'p' */ +#define checkstackGCp(L,n,p) \ + luaD_checkstackaux(L, n, \ + ptrdiff_t t__ = savestack(L, p); /* save 'p' */ \ + luaC_checkGC(L), /* stack grow uses memory */ \ + p = restorestack(L, t__)) /* 'pos' part: restore 'p' */ + + +/* macro to check stack size and GC */ +#define checkstackGC(L,fsize) \ + luaD_checkstackaux(L, (fsize), luaC_checkGC(L), (void)0) + + +/* type of protected functions, to be ran by 'runprotected' */ +typedef void (*Pfunc) (lua_State *L, void *ud); + +LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop); +LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, + const char *mode); +LUAI_FUNC void luaD_hook (lua_State *L, int event, int line, + int fTransfer, int nTransfer); +LUAI_FUNC void luaD_hookcall (lua_State *L, CallInfo *ci); +LUAI_FUNC int luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, + int narg1, int delta); +LUAI_FUNC CallInfo *luaD_precall (lua_State *L, StkId func, int nResults); +LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); +LUAI_FUNC void luaD_callnoyield (lua_State *L, StkId func, int nResults); +LUAI_FUNC int luaD_closeprotected (lua_State *L, ptrdiff_t level, int status); +LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, + ptrdiff_t oldtop, ptrdiff_t ef); +LUAI_FUNC void luaD_poscall (lua_State *L, CallInfo *ci, int nres); +LUAI_FUNC int luaD_reallocstack (lua_State *L, int newsize, int raiseerror); +LUAI_FUNC int luaD_growstack (lua_State *L, int n, int raiseerror); +LUAI_FUNC void luaD_shrinkstack (lua_State *L); +LUAI_FUNC void luaD_inctop (lua_State *L); + +LUAI_FUNC l_noret luaD_throw (lua_State *L, int errcode); +LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); + +#endif + diff --git a/LuaSkin/lua-5.4.7/src/ldump.c b/LuaSkin/lua-5.4.7/src/ldump.c new file mode 100644 index 000000000..f231691b7 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/ldump.c @@ -0,0 +1,230 @@ +/* +** $Id: ldump.c $ +** save precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#define ldump_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include + +#include "lua.h" + +#include "lobject.h" +#include "lstate.h" +#include "lundump.h" + + +typedef struct { + lua_State *L; + lua_Writer writer; + void *data; + int strip; + int status; +} DumpState; + + +/* +** All high-level dumps go through dumpVector; you can change it to +** change the endianness of the result +*/ +#define dumpVector(D,v,n) dumpBlock(D,v,(n)*sizeof((v)[0])) + +#define dumpLiteral(D, s) dumpBlock(D,s,sizeof(s) - sizeof(char)) + + +static void dumpBlock (DumpState *D, const void *b, size_t size) { + if (D->status == 0 && size > 0) { + lua_unlock(D->L); + D->status = (*D->writer)(D->L, b, size, D->data); + lua_lock(D->L); + } +} + + +#define dumpVar(D,x) dumpVector(D,&x,1) + + +static void dumpByte (DumpState *D, int y) { + lu_byte x = (lu_byte)y; + dumpVar(D, x); +} + + +/* +** 'dumpSize' buffer size: each byte can store up to 7 bits. (The "+6" +** rounds up the division.) +*/ +#define DIBS ((sizeof(size_t) * CHAR_BIT + 6) / 7) + +static void dumpSize (DumpState *D, size_t x) { + lu_byte buff[DIBS]; + int n = 0; + do { + buff[DIBS - (++n)] = x & 0x7f; /* fill buffer in reverse order */ + x >>= 7; + } while (x != 0); + buff[DIBS - 1] |= 0x80; /* mark last byte */ + dumpVector(D, buff + DIBS - n, n); +} + + +static void dumpInt (DumpState *D, int x) { + dumpSize(D, x); +} + + +static void dumpNumber (DumpState *D, lua_Number x) { + dumpVar(D, x); +} + + +static void dumpInteger (DumpState *D, lua_Integer x) { + dumpVar(D, x); +} + + +static void dumpString (DumpState *D, const TString *s) { + if (s == NULL) + dumpSize(D, 0); + else { + size_t size = tsslen(s); + const char *str = getstr(s); + dumpSize(D, size + 1); + dumpVector(D, str, size); + } +} + + +static void dumpCode (DumpState *D, const Proto *f) { + dumpInt(D, f->sizecode); + dumpVector(D, f->code, f->sizecode); +} + + +static void dumpFunction(DumpState *D, const Proto *f, TString *psource); + +static void dumpConstants (DumpState *D, const Proto *f) { + int i; + int n = f->sizek; + dumpInt(D, n); + for (i = 0; i < n; i++) { + const TValue *o = &f->k[i]; + int tt = ttypetag(o); + dumpByte(D, tt); + switch (tt) { + case LUA_VNUMFLT: + dumpNumber(D, fltvalue(o)); + break; + case LUA_VNUMINT: + dumpInteger(D, ivalue(o)); + break; + case LUA_VSHRSTR: + case LUA_VLNGSTR: + dumpString(D, tsvalue(o)); + break; + default: + lua_assert(tt == LUA_VNIL || tt == LUA_VFALSE || tt == LUA_VTRUE); + } + } +} + + +static void dumpProtos (DumpState *D, const Proto *f) { + int i; + int n = f->sizep; + dumpInt(D, n); + for (i = 0; i < n; i++) + dumpFunction(D, f->p[i], f->source); +} + + +static void dumpUpvalues (DumpState *D, const Proto *f) { + int i, n = f->sizeupvalues; + dumpInt(D, n); + for (i = 0; i < n; i++) { + dumpByte(D, f->upvalues[i].instack); + dumpByte(D, f->upvalues[i].idx); + dumpByte(D, f->upvalues[i].kind); + } +} + + +static void dumpDebug (DumpState *D, const Proto *f) { + int i, n; + n = (D->strip) ? 0 : f->sizelineinfo; + dumpInt(D, n); + dumpVector(D, f->lineinfo, n); + n = (D->strip) ? 0 : f->sizeabslineinfo; + dumpInt(D, n); + for (i = 0; i < n; i++) { + dumpInt(D, f->abslineinfo[i].pc); + dumpInt(D, f->abslineinfo[i].line); + } + n = (D->strip) ? 0 : f->sizelocvars; + dumpInt(D, n); + for (i = 0; i < n; i++) { + dumpString(D, f->locvars[i].varname); + dumpInt(D, f->locvars[i].startpc); + dumpInt(D, f->locvars[i].endpc); + } + n = (D->strip) ? 0 : f->sizeupvalues; + dumpInt(D, n); + for (i = 0; i < n; i++) + dumpString(D, f->upvalues[i].name); +} + + +static void dumpFunction (DumpState *D, const Proto *f, TString *psource) { + if (D->strip || f->source == psource) + dumpString(D, NULL); /* no debug info or same source as its parent */ + else + dumpString(D, f->source); + dumpInt(D, f->linedefined); + dumpInt(D, f->lastlinedefined); + dumpByte(D, f->numparams); + dumpByte(D, f->is_vararg); + dumpByte(D, f->maxstacksize); + dumpCode(D, f); + dumpConstants(D, f); + dumpUpvalues(D, f); + dumpProtos(D, f); + dumpDebug(D, f); +} + + +static void dumpHeader (DumpState *D) { + dumpLiteral(D, LUA_SIGNATURE); + dumpByte(D, LUAC_VERSION); + dumpByte(D, LUAC_FORMAT); + dumpLiteral(D, LUAC_DATA); + dumpByte(D, sizeof(Instruction)); + dumpByte(D, sizeof(lua_Integer)); + dumpByte(D, sizeof(lua_Number)); + dumpInteger(D, LUAC_INT); + dumpNumber(D, LUAC_NUM); +} + + +/* +** dump Lua function as precompiled chunk +*/ +int luaU_dump(lua_State *L, const Proto *f, lua_Writer w, void *data, + int strip) { + DumpState D; + D.L = L; + D.writer = w; + D.data = data; + D.strip = strip; + D.status = 0; + dumpHeader(&D); + dumpByte(&D, f->sizeupvalues); + dumpFunction(&D, f, NULL); + return D.status; +} + diff --git a/LuaSkin/lua-5.4.7/src/lfunc.c b/LuaSkin/lua-5.4.7/src/lfunc.c new file mode 100644 index 000000000..0945f241d --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lfunc.c @@ -0,0 +1,294 @@ +/* +** $Id: lfunc.c $ +** Auxiliary functions to manipulate prototypes and closures +** See Copyright Notice in lua.h +*/ + +#define lfunc_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" + + + +CClosure *luaF_newCclosure (lua_State *L, int nupvals) { + GCObject *o = luaC_newobj(L, LUA_VCCL, sizeCclosure(nupvals)); + CClosure *c = gco2ccl(o); + c->nupvalues = cast_byte(nupvals); + return c; +} + + +LClosure *luaF_newLclosure (lua_State *L, int nupvals) { + GCObject *o = luaC_newobj(L, LUA_VLCL, sizeLclosure(nupvals)); + LClosure *c = gco2lcl(o); + c->p = NULL; + c->nupvalues = cast_byte(nupvals); + while (nupvals--) c->upvals[nupvals] = NULL; + return c; +} + + +/* +** fill a closure with new closed upvalues +*/ +void luaF_initupvals (lua_State *L, LClosure *cl) { + int i; + for (i = 0; i < cl->nupvalues; i++) { + GCObject *o = luaC_newobj(L, LUA_VUPVAL, sizeof(UpVal)); + UpVal *uv = gco2upv(o); + uv->v.p = &uv->u.value; /* make it closed */ + setnilvalue(uv->v.p); + cl->upvals[i] = uv; + luaC_objbarrier(L, cl, uv); + } +} + + +/* +** Create a new upvalue at the given level, and link it to the list of +** open upvalues of 'L' after entry 'prev'. +**/ +static UpVal *newupval (lua_State *L, StkId level, UpVal **prev) { + GCObject *o = luaC_newobj(L, LUA_VUPVAL, sizeof(UpVal)); + UpVal *uv = gco2upv(o); + UpVal *next = *prev; + uv->v.p = s2v(level); /* current value lives in the stack */ + uv->u.open.next = next; /* link it to list of open upvalues */ + uv->u.open.previous = prev; + if (next) + next->u.open.previous = &uv->u.open.next; + *prev = uv; + if (!isintwups(L)) { /* thread not in list of threads with upvalues? */ + L->twups = G(L)->twups; /* link it to the list */ + G(L)->twups = L; + } + return uv; +} + + +/* +** Find and reuse, or create if it does not exist, an upvalue +** at the given level. +*/ +UpVal *luaF_findupval (lua_State *L, StkId level) { + UpVal **pp = &L->openupval; + UpVal *p; + lua_assert(isintwups(L) || L->openupval == NULL); + while ((p = *pp) != NULL && uplevel(p) >= level) { /* search for it */ + lua_assert(!isdead(G(L), p)); + if (uplevel(p) == level) /* corresponding upvalue? */ + return p; /* return it */ + pp = &p->u.open.next; + } + /* not found: create a new upvalue after 'pp' */ + return newupval(L, level, pp); +} + + +/* +** Call closing method for object 'obj' with error message 'err'. The +** boolean 'yy' controls whether the call is yieldable. +** (This function assumes EXTRA_STACK.) +*/ +static void callclosemethod (lua_State *L, TValue *obj, TValue *err, int yy) { + StkId top = L->top.p; + const TValue *tm = luaT_gettmbyobj(L, obj, TM_CLOSE); + setobj2s(L, top, tm); /* will call metamethod... */ + setobj2s(L, top + 1, obj); /* with 'self' as the 1st argument */ + setobj2s(L, top + 2, err); /* and error msg. as 2nd argument */ + L->top.p = top + 3; /* add function and arguments */ + if (yy) + luaD_call(L, top, 0); + else + luaD_callnoyield(L, top, 0); +} + + +/* +** Check whether object at given level has a close metamethod and raise +** an error if not. +*/ +static void checkclosemth (lua_State *L, StkId level) { + const TValue *tm = luaT_gettmbyobj(L, s2v(level), TM_CLOSE); + if (ttisnil(tm)) { /* no metamethod? */ + int idx = cast_int(level - L->ci->func.p); /* variable index */ + const char *vname = luaG_findlocal(L, L->ci, idx, NULL); + if (vname == NULL) vname = "?"; + luaG_runerror(L, "variable '%s' got a non-closable value", vname); + } +} + + +/* +** Prepare and call a closing method. +** If status is CLOSEKTOP, the call to the closing method will be pushed +** at the top of the stack. Otherwise, values can be pushed right after +** the 'level' of the upvalue being closed, as everything after that +** won't be used again. +*/ +static void prepcallclosemth (lua_State *L, StkId level, int status, int yy) { + TValue *uv = s2v(level); /* value being closed */ + TValue *errobj; + if (status == CLOSEKTOP) + errobj = &G(L)->nilvalue; /* error object is nil */ + else { /* 'luaD_seterrorobj' will set top to level + 2 */ + errobj = s2v(level + 1); /* error object goes after 'uv' */ + luaD_seterrorobj(L, status, level + 1); /* set error object */ + } + callclosemethod(L, uv, errobj, yy); +} + + +/* +** Maximum value for deltas in 'tbclist', dependent on the type +** of delta. (This macro assumes that an 'L' is in scope where it +** is used.) +*/ +#define MAXDELTA \ + ((256ul << ((sizeof(L->stack.p->tbclist.delta) - 1) * 8)) - 1) + + +/* +** Insert a variable in the list of to-be-closed variables. +*/ +void luaF_newtbcupval (lua_State *L, StkId level) { + lua_assert(level > L->tbclist.p); + if (l_isfalse(s2v(level))) + return; /* false doesn't need to be closed */ + checkclosemth(L, level); /* value must have a close method */ + while (cast_uint(level - L->tbclist.p) > MAXDELTA) { + L->tbclist.p += MAXDELTA; /* create a dummy node at maximum delta */ + L->tbclist.p->tbclist.delta = 0; + } + level->tbclist.delta = cast(unsigned short, level - L->tbclist.p); + L->tbclist.p = level; +} + + +void luaF_unlinkupval (UpVal *uv) { + lua_assert(upisopen(uv)); + *uv->u.open.previous = uv->u.open.next; + if (uv->u.open.next) + uv->u.open.next->u.open.previous = uv->u.open.previous; +} + + +/* +** Close all upvalues up to the given stack level. +*/ +void luaF_closeupval (lua_State *L, StkId level) { + UpVal *uv; + StkId upl; /* stack index pointed by 'uv' */ + while ((uv = L->openupval) != NULL && (upl = uplevel(uv)) >= level) { + TValue *slot = &uv->u.value; /* new position for value */ + lua_assert(uplevel(uv) < L->top.p); + luaF_unlinkupval(uv); /* remove upvalue from 'openupval' list */ + setobj(L, slot, uv->v.p); /* move value to upvalue slot */ + uv->v.p = slot; /* now current value lives here */ + if (!iswhite(uv)) { /* neither white nor dead? */ + nw2black(uv); /* closed upvalues cannot be gray */ + luaC_barrier(L, uv, slot); + } + } +} + + +/* +** Remove first element from the tbclist plus its dummy nodes. +*/ +static void poptbclist (lua_State *L) { + StkId tbc = L->tbclist.p; + lua_assert(tbc->tbclist.delta > 0); /* first element cannot be dummy */ + tbc -= tbc->tbclist.delta; + while (tbc > L->stack.p && tbc->tbclist.delta == 0) + tbc -= MAXDELTA; /* remove dummy nodes */ + L->tbclist.p = tbc; +} + + +/* +** Close all upvalues and to-be-closed variables up to the given stack +** level. Return restored 'level'. +*/ +StkId luaF_close (lua_State *L, StkId level, int status, int yy) { + ptrdiff_t levelrel = savestack(L, level); + luaF_closeupval(L, level); /* first, close the upvalues */ + while (L->tbclist.p >= level) { /* traverse tbc's down to that level */ + StkId tbc = L->tbclist.p; /* get variable index */ + poptbclist(L); /* remove it from list */ + prepcallclosemth(L, tbc, status, yy); /* close variable */ + level = restorestack(L, levelrel); + } + return level; +} + + +Proto *luaF_newproto (lua_State *L) { + GCObject *o = luaC_newobj(L, LUA_VPROTO, sizeof(Proto)); + Proto *f = gco2p(o); + f->k = NULL; + f->sizek = 0; + f->p = NULL; + f->sizep = 0; + f->code = NULL; + f->sizecode = 0; + f->lineinfo = NULL; + f->sizelineinfo = 0; + f->abslineinfo = NULL; + f->sizeabslineinfo = 0; + f->upvalues = NULL; + f->sizeupvalues = 0; + f->numparams = 0; + f->is_vararg = 0; + f->maxstacksize = 0; + f->locvars = NULL; + f->sizelocvars = 0; + f->linedefined = 0; + f->lastlinedefined = 0; + f->source = NULL; + return f; +} + + +void luaF_freeproto (lua_State *L, Proto *f) { + luaM_freearray(L, f->code, f->sizecode); + luaM_freearray(L, f->p, f->sizep); + luaM_freearray(L, f->k, f->sizek); + luaM_freearray(L, f->lineinfo, f->sizelineinfo); + luaM_freearray(L, f->abslineinfo, f->sizeabslineinfo); + luaM_freearray(L, f->locvars, f->sizelocvars); + luaM_freearray(L, f->upvalues, f->sizeupvalues); + luaM_free(L, f); +} + + +/* +** Look for n-th local variable at line 'line' in function 'func'. +** Returns NULL if not found. +*/ +const char *luaF_getlocalname (const Proto *f, int local_number, int pc) { + int i; + for (i = 0; isizelocvars && f->locvars[i].startpc <= pc; i++) { + if (pc < f->locvars[i].endpc) { /* is variable active? */ + local_number--; + if (local_number == 0) + return getstr(f->locvars[i].varname); + } + } + return NULL; /* not found */ +} + diff --git a/LuaSkin/lua-5.4.7/src/lfunc.h b/LuaSkin/lua-5.4.7/src/lfunc.h new file mode 100644 index 000000000..3be265efb --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lfunc.h @@ -0,0 +1,64 @@ +/* +** $Id: lfunc.h $ +** Auxiliary functions to manipulate prototypes and closures +** See Copyright Notice in lua.h +*/ + +#ifndef lfunc_h +#define lfunc_h + + +#include "lobject.h" + + +#define sizeCclosure(n) (cast_int(offsetof(CClosure, upvalue)) + \ + cast_int(sizeof(TValue)) * (n)) + +#define sizeLclosure(n) (cast_int(offsetof(LClosure, upvals)) + \ + cast_int(sizeof(TValue *)) * (n)) + + +/* test whether thread is in 'twups' list */ +#define isintwups(L) (L->twups != L) + + +/* +** maximum number of upvalues in a closure (both C and Lua). (Value +** must fit in a VM register.) +*/ +#define MAXUPVAL 255 + + +#define upisopen(up) ((up)->v.p != &(up)->u.value) + + +#define uplevel(up) check_exp(upisopen(up), cast(StkId, (up)->v.p)) + + +/* +** maximum number of misses before giving up the cache of closures +** in prototypes +*/ +#define MAXMISS 10 + + + +/* special status to close upvalues preserving the top of the stack */ +#define CLOSEKTOP (-1) + + +LUAI_FUNC Proto *luaF_newproto (lua_State *L); +LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nupvals); +LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nupvals); +LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); +LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); +LUAI_FUNC void luaF_newtbcupval (lua_State *L, StkId level); +LUAI_FUNC void luaF_closeupval (lua_State *L, StkId level); +LUAI_FUNC StkId luaF_close (lua_State *L, StkId level, int status, int yy); +LUAI_FUNC void luaF_unlinkupval (UpVal *uv); +LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); +LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, + int pc); + + +#endif diff --git a/LuaSkin/lua-5.4.7/src/lgc.c b/LuaSkin/lua-5.4.7/src/lgc.c new file mode 100644 index 000000000..5817f9eec --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lgc.c @@ -0,0 +1,1743 @@ +/* +** $Id: lgc.c $ +** Garbage Collector +** See Copyright Notice in lua.h +*/ + +#define lgc_c +#define LUA_CORE + +#include "lprefix.h" + +#include +#include + + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + +/* +** Maximum number of elements to sweep in each single step. +** (Large enough to dissipate fixed overheads but small enough +** to allow small steps for the collector.) +*/ +#define GCSWEEPMAX 100 + +/* +** Maximum number of finalizers to call in each single step. +*/ +#define GCFINMAX 10 + + +/* +** Cost of calling one finalizer. +*/ +#define GCFINALIZECOST 50 + + +/* +** The equivalent, in bytes, of one unit of "work" (visiting a slot, +** sweeping an object, etc.) +*/ +#define WORK2MEM sizeof(TValue) + + +/* +** macro to adjust 'pause': 'pause' is actually used like +** 'pause / PAUSEADJ' (value chosen by tests) +*/ +#define PAUSEADJ 100 + + +/* mask with all color bits */ +#define maskcolors (bitmask(BLACKBIT) | WHITEBITS) + +/* mask with all GC bits */ +#define maskgcbits (maskcolors | AGEBITS) + + +/* macro to erase all color bits then set only the current white bit */ +#define makewhite(g,x) \ + (x->marked = cast_byte((x->marked & ~maskcolors) | luaC_white(g))) + +/* make an object gray (neither white nor black) */ +#define set2gray(x) resetbits(x->marked, maskcolors) + + +/* make an object black (coming from any color) */ +#define set2black(x) \ + (x->marked = cast_byte((x->marked & ~WHITEBITS) | bitmask(BLACKBIT))) + + +#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) + +#define keyiswhite(n) (keyiscollectable(n) && iswhite(gckey(n))) + + +/* +** Protected access to objects in values +*/ +#define gcvalueN(o) (iscollectable(o) ? gcvalue(o) : NULL) + + +#define markvalue(g,o) { checkliveness(g->mainthread,o); \ + if (valiswhite(o)) reallymarkobject(g,gcvalue(o)); } + +#define markkey(g, n) { if keyiswhite(n) reallymarkobject(g,gckey(n)); } + +#define markobject(g,t) { if (iswhite(t)) reallymarkobject(g, obj2gco(t)); } + +/* +** mark an object that can be NULL (either because it is really optional, +** or it was stripped as debug info, or inside an uncompleted structure) +*/ +#define markobjectN(g,t) { if (t) markobject(g,t); } + +static void reallymarkobject (global_State *g, GCObject *o); +static lu_mem atomic (lua_State *L); +static void entersweep (lua_State *L); + + +/* +** {====================================================== +** Generic functions +** ======================================================= +*/ + + +/* +** one after last element in a hash array +*/ +#define gnodelast(h) gnode(h, cast_sizet(sizenode(h))) + + +static GCObject **getgclist (GCObject *o) { + switch (o->tt) { + case LUA_VTABLE: return &gco2t(o)->gclist; + case LUA_VLCL: return &gco2lcl(o)->gclist; + case LUA_VCCL: return &gco2ccl(o)->gclist; + case LUA_VTHREAD: return &gco2th(o)->gclist; + case LUA_VPROTO: return &gco2p(o)->gclist; + case LUA_VUSERDATA: { + Udata *u = gco2u(o); + lua_assert(u->nuvalue > 0); + return &u->gclist; + } + default: lua_assert(0); return 0; + } +} + + +/* +** Link a collectable object 'o' with a known type into the list 'p'. +** (Must be a macro to access the 'gclist' field in different types.) +*/ +#define linkgclist(o,p) linkgclist_(obj2gco(o), &(o)->gclist, &(p)) + +static void linkgclist_ (GCObject *o, GCObject **pnext, GCObject **list) { + lua_assert(!isgray(o)); /* cannot be in a gray list */ + *pnext = *list; + *list = o; + set2gray(o); /* now it is */ +} + + +/* +** Link a generic collectable object 'o' into the list 'p'. +*/ +#define linkobjgclist(o,p) linkgclist_(obj2gco(o), getgclist(o), &(p)) + + + +/* +** Clear keys for empty entries in tables. If entry is empty, mark its +** entry as dead. This allows the collection of the key, but keeps its +** entry in the table: its removal could break a chain and could break +** a table traversal. Other places never manipulate dead keys, because +** its associated empty value is enough to signal that the entry is +** logically empty. +*/ +static void clearkey (Node *n) { + lua_assert(isempty(gval(n))); + if (keyiscollectable(n)) + setdeadkey(n); /* unused key; remove it */ +} + + +/* +** tells whether a key or value can be cleared from a weak +** table. Non-collectable objects are never removed from weak +** tables. Strings behave as 'values', so are never removed too. for +** other objects: if really collected, cannot keep them; for objects +** being finalized, keep them in keys, but not in values +*/ +static int iscleared (global_State *g, const GCObject *o) { + if (o == NULL) return 0; /* non-collectable value */ + else if (novariant(o->tt) == LUA_TSTRING) { + markobject(g, o); /* strings are 'values', so are never weak */ + return 0; + } + else return iswhite(o); +} + + +/* +** Barrier that moves collector forward, that is, marks the white object +** 'v' being pointed by the black object 'o'. In the generational +** mode, 'v' must also become old, if 'o' is old; however, it cannot +** be changed directly to OLD, because it may still point to non-old +** objects. So, it is marked as OLD0. In the next cycle it will become +** OLD1, and in the next it will finally become OLD (regular old). By +** then, any object it points to will also be old. If called in the +** incremental sweep phase, it clears the black object to white (sweep +** it) to avoid other barrier calls for this same object. (That cannot +** be done is generational mode, as its sweep does not distinguish +** whites from deads.) +*/ +void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v) { + global_State *g = G(L); + lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); + if (keepinvariant(g)) { /* must keep invariant? */ + reallymarkobject(g, v); /* restore invariant */ + if (isold(o)) { + lua_assert(!isold(v)); /* white object could not be old */ + setage(v, G_OLD0); /* restore generational invariant */ + } + } + else { /* sweep phase */ + lua_assert(issweepphase(g)); + if (g->gckind == KGC_INC) /* incremental mode? */ + makewhite(g, o); /* mark 'o' as white to avoid other barriers */ + } +} + + +/* +** barrier that moves collector backward, that is, mark the black object +** pointing to a white object as gray again. +*/ +void luaC_barrierback_ (lua_State *L, GCObject *o) { + global_State *g = G(L); + lua_assert(isblack(o) && !isdead(g, o)); + lua_assert((g->gckind == KGC_GEN) == (isold(o) && getage(o) != G_TOUCHED1)); + if (getage(o) == G_TOUCHED2) /* already in gray list? */ + set2gray(o); /* make it gray to become touched1 */ + else /* link it in 'grayagain' and paint it gray */ + linkobjgclist(o, g->grayagain); + if (isold(o)) /* generational mode? */ + setage(o, G_TOUCHED1); /* touched in current cycle */ +} + + +void luaC_fix (lua_State *L, GCObject *o) { + global_State *g = G(L); + lua_assert(g->allgc == o); /* object must be 1st in 'allgc' list! */ + set2gray(o); /* they will be gray forever */ + setage(o, G_OLD); /* and old forever */ + g->allgc = o->next; /* remove object from 'allgc' list */ + o->next = g->fixedgc; /* link it to 'fixedgc' list */ + g->fixedgc = o; +} + + +/* +** create a new collectable object (with given type, size, and offset) +** and link it to 'allgc' list. +*/ +GCObject *luaC_newobjdt (lua_State *L, int tt, size_t sz, size_t offset) { + global_State *g = G(L); + char *p = cast_charp(luaM_newobject(L, novariant(tt), sz)); + GCObject *o = cast(GCObject *, p + offset); + o->marked = luaC_white(g); + o->tt = tt; + o->next = g->allgc; + g->allgc = o; + return o; +} + + +GCObject *luaC_newobj (lua_State *L, int tt, size_t sz) { + return luaC_newobjdt(L, tt, sz, 0); +} + +/* }====================================================== */ + + + +/* +** {====================================================== +** Mark functions +** ======================================================= +*/ + + +/* +** Mark an object. Userdata with no user values, strings, and closed +** upvalues are visited and turned black here. Open upvalues are +** already indirectly linked through their respective threads in the +** 'twups' list, so they don't go to the gray list; nevertheless, they +** are kept gray to avoid barriers, as their values will be revisited +** by the thread or by 'remarkupvals'. Other objects are added to the +** gray list to be visited (and turned black) later. Both userdata and +** upvalues can call this function recursively, but this recursion goes +** for at most two levels: An upvalue cannot refer to another upvalue +** (only closures can), and a userdata's metatable must be a table. +*/ +static void reallymarkobject (global_State *g, GCObject *o) { + switch (o->tt) { + case LUA_VSHRSTR: + case LUA_VLNGSTR: { + set2black(o); /* nothing to visit */ + break; + } + case LUA_VUPVAL: { + UpVal *uv = gco2upv(o); + if (upisopen(uv)) + set2gray(uv); /* open upvalues are kept gray */ + else + set2black(uv); /* closed upvalues are visited here */ + markvalue(g, uv->v.p); /* mark its content */ + break; + } + case LUA_VUSERDATA: { + Udata *u = gco2u(o); + if (u->nuvalue == 0) { /* no user values? */ + markobjectN(g, u->metatable); /* mark its metatable */ + set2black(u); /* nothing else to mark */ + break; + } + /* else... */ + } /* FALLTHROUGH */ + case LUA_VLCL: case LUA_VCCL: case LUA_VTABLE: + case LUA_VTHREAD: case LUA_VPROTO: { + linkobjgclist(o, g->gray); /* to be visited later */ + break; + } + default: lua_assert(0); break; + } +} + + +/* +** mark metamethods for basic types +*/ +static void markmt (global_State *g) { + int i; + for (i=0; i < LUA_NUMTAGS; i++) + markobjectN(g, g->mt[i]); +} + + +/* +** mark all objects in list of being-finalized +*/ +static lu_mem markbeingfnz (global_State *g) { + GCObject *o; + lu_mem count = 0; + for (o = g->tobefnz; o != NULL; o = o->next) { + count++; + markobject(g, o); + } + return count; +} + + +/* +** For each non-marked thread, simulates a barrier between each open +** upvalue and its value. (If the thread is collected, the value will be +** assigned to the upvalue, but then it can be too late for the barrier +** to act. The "barrier" does not need to check colors: A non-marked +** thread must be young; upvalues cannot be older than their threads; so +** any visited upvalue must be young too.) Also removes the thread from +** the list, as it was already visited. Removes also threads with no +** upvalues, as they have nothing to be checked. (If the thread gets an +** upvalue later, it will be linked in the list again.) +*/ +static int remarkupvals (global_State *g) { + lua_State *thread; + lua_State **p = &g->twups; + int work = 0; /* estimate of how much work was done here */ + while ((thread = *p) != NULL) { + work++; + if (!iswhite(thread) && thread->openupval != NULL) + p = &thread->twups; /* keep marked thread with upvalues in the list */ + else { /* thread is not marked or without upvalues */ + UpVal *uv; + lua_assert(!isold(thread) || thread->openupval == NULL); + *p = thread->twups; /* remove thread from the list */ + thread->twups = thread; /* mark that it is out of list */ + for (uv = thread->openupval; uv != NULL; uv = uv->u.open.next) { + lua_assert(getage(uv) <= getage(thread)); + work++; + if (!iswhite(uv)) { /* upvalue already visited? */ + lua_assert(upisopen(uv) && isgray(uv)); + markvalue(g, uv->v.p); /* mark its value */ + } + } + } + } + return work; +} + + +static void cleargraylists (global_State *g) { + g->gray = g->grayagain = NULL; + g->weak = g->allweak = g->ephemeron = NULL; +} + + +/* +** mark root set and reset all gray lists, to start a new collection +*/ +static void restartcollection (global_State *g) { + cleargraylists(g); + markobject(g, g->mainthread); + markvalue(g, &g->l_registry); + markmt(g); + markbeingfnz(g); /* mark any finalizing object left from previous cycle */ +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Traverse functions +** ======================================================= +*/ + + +/* +** Check whether object 'o' should be kept in the 'grayagain' list for +** post-processing by 'correctgraylist'. (It could put all old objects +** in the list and leave all the work to 'correctgraylist', but it is +** more efficient to avoid adding elements that will be removed.) Only +** TOUCHED1 objects need to be in the list. TOUCHED2 doesn't need to go +** back to a gray list, but then it must become OLD. (That is what +** 'correctgraylist' does when it finds a TOUCHED2 object.) +*/ +static void genlink (global_State *g, GCObject *o) { + lua_assert(isblack(o)); + if (getage(o) == G_TOUCHED1) { /* touched in this cycle? */ + linkobjgclist(o, g->grayagain); /* link it back in 'grayagain' */ + } /* everything else do not need to be linked back */ + else if (getage(o) == G_TOUCHED2) + changeage(o, G_TOUCHED2, G_OLD); /* advance age */ +} + + +/* +** Traverse a table with weak values and link it to proper list. During +** propagate phase, keep it in 'grayagain' list, to be revisited in the +** atomic phase. In the atomic phase, if table has any white value, +** put it in 'weak' list, to be cleared. +*/ +static void traverseweakvalue (global_State *g, Table *h) { + Node *n, *limit = gnodelast(h); + /* if there is array part, assume it may have white values (it is not + worth traversing it now just to check) */ + int hasclears = (h->alimit > 0); + for (n = gnode(h, 0); n < limit; n++) { /* traverse hash part */ + if (isempty(gval(n))) /* entry is empty? */ + clearkey(n); /* clear its key */ + else { + lua_assert(!keyisnil(n)); + markkey(g, n); + if (!hasclears && iscleared(g, gcvalueN(gval(n)))) /* a white value? */ + hasclears = 1; /* table will have to be cleared */ + } + } + if (g->gcstate == GCSatomic && hasclears) + linkgclist(h, g->weak); /* has to be cleared later */ + else + linkgclist(h, g->grayagain); /* must retraverse it in atomic phase */ +} + + +/* +** Traverse an ephemeron table and link it to proper list. Returns true +** iff any object was marked during this traversal (which implies that +** convergence has to continue). During propagation phase, keep table +** in 'grayagain' list, to be visited again in the atomic phase. In +** the atomic phase, if table has any white->white entry, it has to +** be revisited during ephemeron convergence (as that key may turn +** black). Otherwise, if it has any white key, table has to be cleared +** (in the atomic phase). In generational mode, some tables +** must be kept in some gray list for post-processing; this is done +** by 'genlink'. +*/ +static int traverseephemeron (global_State *g, Table *h, int inv) { + int marked = 0; /* true if an object is marked in this traversal */ + int hasclears = 0; /* true if table has white keys */ + int hasww = 0; /* true if table has entry "white-key -> white-value" */ + unsigned int i; + unsigned int asize = luaH_realasize(h); + unsigned int nsize = sizenode(h); + /* traverse array part */ + for (i = 0; i < asize; i++) { + if (valiswhite(&h->array[i])) { + marked = 1; + reallymarkobject(g, gcvalue(&h->array[i])); + } + } + /* traverse hash part; if 'inv', traverse descending + (see 'convergeephemerons') */ + for (i = 0; i < nsize; i++) { + Node *n = inv ? gnode(h, nsize - 1 - i) : gnode(h, i); + if (isempty(gval(n))) /* entry is empty? */ + clearkey(n); /* clear its key */ + else if (iscleared(g, gckeyN(n))) { /* key is not marked (yet)? */ + hasclears = 1; /* table must be cleared */ + if (valiswhite(gval(n))) /* value not marked yet? */ + hasww = 1; /* white-white entry */ + } + else if (valiswhite(gval(n))) { /* value not marked yet? */ + marked = 1; + reallymarkobject(g, gcvalue(gval(n))); /* mark it now */ + } + } + /* link table into proper list */ + if (g->gcstate == GCSpropagate) + linkgclist(h, g->grayagain); /* must retraverse it in atomic phase */ + else if (hasww) /* table has white->white entries? */ + linkgclist(h, g->ephemeron); /* have to propagate again */ + else if (hasclears) /* table has white keys? */ + linkgclist(h, g->allweak); /* may have to clean white keys */ + else + genlink(g, obj2gco(h)); /* check whether collector still needs to see it */ + return marked; +} + + +static void traversestrongtable (global_State *g, Table *h) { + Node *n, *limit = gnodelast(h); + unsigned int i; + unsigned int asize = luaH_realasize(h); + for (i = 0; i < asize; i++) /* traverse array part */ + markvalue(g, &h->array[i]); + for (n = gnode(h, 0); n < limit; n++) { /* traverse hash part */ + if (isempty(gval(n))) /* entry is empty? */ + clearkey(n); /* clear its key */ + else { + lua_assert(!keyisnil(n)); + markkey(g, n); + markvalue(g, gval(n)); + } + } + genlink(g, obj2gco(h)); +} + + +static lu_mem traversetable (global_State *g, Table *h) { + const char *weakkey, *weakvalue; + const TValue *mode = gfasttm(g, h->metatable, TM_MODE); + TString *smode; + markobjectN(g, h->metatable); + if (mode && ttisshrstring(mode) && /* is there a weak mode? */ + (cast_void(smode = tsvalue(mode)), + cast_void(weakkey = strchr(getshrstr(smode), 'k')), + cast_void(weakvalue = strchr(getshrstr(smode), 'v')), + (weakkey || weakvalue))) { /* is really weak? */ + if (!weakkey) /* strong keys? */ + traverseweakvalue(g, h); + else if (!weakvalue) /* strong values? */ + traverseephemeron(g, h, 0); + else /* all weak */ + linkgclist(h, g->allweak); /* nothing to traverse now */ + } + else /* not weak */ + traversestrongtable(g, h); + return 1 + h->alimit + 2 * allocsizenode(h); +} + + +static int traverseudata (global_State *g, Udata *u) { + int i; + markobjectN(g, u->metatable); /* mark its metatable */ + for (i = 0; i < u->nuvalue; i++) + markvalue(g, &u->uv[i].uv); + genlink(g, obj2gco(u)); + return 1 + u->nuvalue; +} + + +/* +** Traverse a prototype. (While a prototype is being build, its +** arrays can be larger than needed; the extra slots are filled with +** NULL, so the use of 'markobjectN') +*/ +static int traverseproto (global_State *g, Proto *f) { + int i; + markobjectN(g, f->source); + for (i = 0; i < f->sizek; i++) /* mark literals */ + markvalue(g, &f->k[i]); + for (i = 0; i < f->sizeupvalues; i++) /* mark upvalue names */ + markobjectN(g, f->upvalues[i].name); + for (i = 0; i < f->sizep; i++) /* mark nested protos */ + markobjectN(g, f->p[i]); + for (i = 0; i < f->sizelocvars; i++) /* mark local-variable names */ + markobjectN(g, f->locvars[i].varname); + return 1 + f->sizek + f->sizeupvalues + f->sizep + f->sizelocvars; +} + + +static int traverseCclosure (global_State *g, CClosure *cl) { + int i; + for (i = 0; i < cl->nupvalues; i++) /* mark its upvalues */ + markvalue(g, &cl->upvalue[i]); + return 1 + cl->nupvalues; +} + +/* +** Traverse a Lua closure, marking its prototype and its upvalues. +** (Both can be NULL while closure is being created.) +*/ +static int traverseLclosure (global_State *g, LClosure *cl) { + int i; + markobjectN(g, cl->p); /* mark its prototype */ + for (i = 0; i < cl->nupvalues; i++) { /* visit its upvalues */ + UpVal *uv = cl->upvals[i]; + markobjectN(g, uv); /* mark upvalue */ + } + return 1 + cl->nupvalues; +} + + +/* +** Traverse a thread, marking the elements in the stack up to its top +** and cleaning the rest of the stack in the final traversal. That +** ensures that the entire stack have valid (non-dead) objects. +** Threads have no barriers. In gen. mode, old threads must be visited +** at every cycle, because they might point to young objects. In inc. +** mode, the thread can still be modified before the end of the cycle, +** and therefore it must be visited again in the atomic phase. To ensure +** these visits, threads must return to a gray list if they are not new +** (which can only happen in generational mode) or if the traverse is in +** the propagate phase (which can only happen in incremental mode). +*/ +static int traversethread (global_State *g, lua_State *th) { + UpVal *uv; + StkId o = th->stack.p; + if (isold(th) || g->gcstate == GCSpropagate) + linkgclist(th, g->grayagain); /* insert into 'grayagain' list */ + if (o == NULL) + return 1; /* stack not completely built yet */ + lua_assert(g->gcstate == GCSatomic || + th->openupval == NULL || isintwups(th)); + for (; o < th->top.p; o++) /* mark live elements in the stack */ + markvalue(g, s2v(o)); + for (uv = th->openupval; uv != NULL; uv = uv->u.open.next) + markobject(g, uv); /* open upvalues cannot be collected */ + if (g->gcstate == GCSatomic) { /* final traversal? */ + if (!g->gcemergency) + luaD_shrinkstack(th); /* do not change stack in emergency cycle */ + for (o = th->top.p; o < th->stack_last.p + EXTRA_STACK; o++) + setnilvalue(s2v(o)); /* clear dead stack slice */ + /* 'remarkupvals' may have removed thread from 'twups' list */ + if (!isintwups(th) && th->openupval != NULL) { + th->twups = g->twups; /* link it back to the list */ + g->twups = th; + } + } + return 1 + stacksize(th); +} + + +/* +** traverse one gray object, turning it to black. +*/ +static lu_mem propagatemark (global_State *g) { + GCObject *o = g->gray; + nw2black(o); + g->gray = *getgclist(o); /* remove from 'gray' list */ + switch (o->tt) { + case LUA_VTABLE: return traversetable(g, gco2t(o)); + case LUA_VUSERDATA: return traverseudata(g, gco2u(o)); + case LUA_VLCL: return traverseLclosure(g, gco2lcl(o)); + case LUA_VCCL: return traverseCclosure(g, gco2ccl(o)); + case LUA_VPROTO: return traverseproto(g, gco2p(o)); + case LUA_VTHREAD: return traversethread(g, gco2th(o)); + default: lua_assert(0); return 0; + } +} + + +static lu_mem propagateall (global_State *g) { + lu_mem tot = 0; + while (g->gray) + tot += propagatemark(g); + return tot; +} + + +/* +** Traverse all ephemeron tables propagating marks from keys to values. +** Repeat until it converges, that is, nothing new is marked. 'dir' +** inverts the direction of the traversals, trying to speed up +** convergence on chains in the same table. +** +*/ +static void convergeephemerons (global_State *g) { + int changed; + int dir = 0; + do { + GCObject *w; + GCObject *next = g->ephemeron; /* get ephemeron list */ + g->ephemeron = NULL; /* tables may return to this list when traversed */ + changed = 0; + while ((w = next) != NULL) { /* for each ephemeron table */ + Table *h = gco2t(w); + next = h->gclist; /* list is rebuilt during loop */ + nw2black(h); /* out of the list (for now) */ + if (traverseephemeron(g, h, dir)) { /* marked some value? */ + propagateall(g); /* propagate changes */ + changed = 1; /* will have to revisit all ephemeron tables */ + } + } + dir = !dir; /* invert direction next time */ + } while (changed); /* repeat until no more changes */ +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Sweep Functions +** ======================================================= +*/ + + +/* +** clear entries with unmarked keys from all weaktables in list 'l' +*/ +static void clearbykeys (global_State *g, GCObject *l) { + for (; l; l = gco2t(l)->gclist) { + Table *h = gco2t(l); + Node *limit = gnodelast(h); + Node *n; + for (n = gnode(h, 0); n < limit; n++) { + if (iscleared(g, gckeyN(n))) /* unmarked key? */ + setempty(gval(n)); /* remove entry */ + if (isempty(gval(n))) /* is entry empty? */ + clearkey(n); /* clear its key */ + } + } +} + + +/* +** clear entries with unmarked values from all weaktables in list 'l' up +** to element 'f' +*/ +static void clearbyvalues (global_State *g, GCObject *l, GCObject *f) { + for (; l != f; l = gco2t(l)->gclist) { + Table *h = gco2t(l); + Node *n, *limit = gnodelast(h); + unsigned int i; + unsigned int asize = luaH_realasize(h); + for (i = 0; i < asize; i++) { + TValue *o = &h->array[i]; + if (iscleared(g, gcvalueN(o))) /* value was collected? */ + setempty(o); /* remove entry */ + } + for (n = gnode(h, 0); n < limit; n++) { + if (iscleared(g, gcvalueN(gval(n)))) /* unmarked value? */ + setempty(gval(n)); /* remove entry */ + if (isempty(gval(n))) /* is entry empty? */ + clearkey(n); /* clear its key */ + } + } +} + + +static void freeupval (lua_State *L, UpVal *uv) { + if (upisopen(uv)) + luaF_unlinkupval(uv); + luaM_free(L, uv); +} + + +static void freeobj (lua_State *L, GCObject *o) { + switch (o->tt) { + case LUA_VPROTO: + luaF_freeproto(L, gco2p(o)); + break; + case LUA_VUPVAL: + freeupval(L, gco2upv(o)); + break; + case LUA_VLCL: { + LClosure *cl = gco2lcl(o); + luaM_freemem(L, cl, sizeLclosure(cl->nupvalues)); + break; + } + case LUA_VCCL: { + CClosure *cl = gco2ccl(o); + luaM_freemem(L, cl, sizeCclosure(cl->nupvalues)); + break; + } + case LUA_VTABLE: + luaH_free(L, gco2t(o)); + break; + case LUA_VTHREAD: + luaE_freethread(L, gco2th(o)); + break; + case LUA_VUSERDATA: { + Udata *u = gco2u(o); + luaM_freemem(L, o, sizeudata(u->nuvalue, u->len)); + break; + } + case LUA_VSHRSTR: { + TString *ts = gco2ts(o); + luaS_remove(L, ts); /* remove it from hash table */ + luaM_freemem(L, ts, sizelstring(ts->shrlen)); + break; + } + case LUA_VLNGSTR: { + TString *ts = gco2ts(o); + luaM_freemem(L, ts, sizelstring(ts->u.lnglen)); + break; + } + default: lua_assert(0); + } +} + + +/* +** sweep at most 'countin' elements from a list of GCObjects erasing dead +** objects, where a dead object is one marked with the old (non current) +** white; change all non-dead objects back to white, preparing for next +** collection cycle. Return where to continue the traversal or NULL if +** list is finished. ('*countout' gets the number of elements traversed.) +*/ +static GCObject **sweeplist (lua_State *L, GCObject **p, int countin, + int *countout) { + global_State *g = G(L); + int ow = otherwhite(g); + int i; + int white = luaC_white(g); /* current white */ + for (i = 0; *p != NULL && i < countin; i++) { + GCObject *curr = *p; + int marked = curr->marked; + if (isdeadm(ow, marked)) { /* is 'curr' dead? */ + *p = curr->next; /* remove 'curr' from list */ + freeobj(L, curr); /* erase 'curr' */ + } + else { /* change mark to 'white' */ + curr->marked = cast_byte((marked & ~maskgcbits) | white); + p = &curr->next; /* go to next element */ + } + } + if (countout) + *countout = i; /* number of elements traversed */ + return (*p == NULL) ? NULL : p; +} + + +/* +** sweep a list until a live object (or end of list) +*/ +static GCObject **sweeptolive (lua_State *L, GCObject **p) { + GCObject **old = p; + do { + p = sweeplist(L, p, 1, NULL); + } while (p == old); + return p; +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Finalization +** ======================================================= +*/ + +/* +** If possible, shrink string table. +*/ +static void checkSizes (lua_State *L, global_State *g) { + if (!g->gcemergency) { + if (g->strt.nuse < g->strt.size / 4) { /* string table too big? */ + l_mem olddebt = g->GCdebt; + luaS_resize(L, g->strt.size / 2); + g->GCestimate += g->GCdebt - olddebt; /* correct estimate */ + } + } +} + + +/* +** Get the next udata to be finalized from the 'tobefnz' list, and +** link it back into the 'allgc' list. +*/ +static GCObject *udata2finalize (global_State *g) { + GCObject *o = g->tobefnz; /* get first element */ + lua_assert(tofinalize(o)); + g->tobefnz = o->next; /* remove it from 'tobefnz' list */ + o->next = g->allgc; /* return it to 'allgc' list */ + g->allgc = o; + resetbit(o->marked, FINALIZEDBIT); /* object is "normal" again */ + if (issweepphase(g)) + makewhite(g, o); /* "sweep" object */ + else if (getage(o) == G_OLD1) + g->firstold1 = o; /* it is the first OLD1 object in the list */ + return o; +} + + +static void dothecall (lua_State *L, void *ud) { + UNUSED(ud); + luaD_callnoyield(L, L->top.p - 2, 0); +} + + +static void GCTM (lua_State *L) { + global_State *g = G(L); + const TValue *tm; + TValue v; + lua_assert(!g->gcemergency); + setgcovalue(L, &v, udata2finalize(g)); + tm = luaT_gettmbyobj(L, &v, TM_GC); + if (!notm(tm)) { /* is there a finalizer? */ + int status; + lu_byte oldah = L->allowhook; + int oldgcstp = g->gcstp; + g->gcstp |= GCSTPGC; /* avoid GC steps */ + L->allowhook = 0; /* stop debug hooks during GC metamethod */ + setobj2s(L, L->top.p++, tm); /* push finalizer... */ + setobj2s(L, L->top.p++, &v); /* ... and its argument */ + L->ci->callstatus |= CIST_FIN; /* will run a finalizer */ + status = luaD_pcall(L, dothecall, NULL, savestack(L, L->top.p - 2), 0); + L->ci->callstatus &= ~CIST_FIN; /* not running a finalizer anymore */ + L->allowhook = oldah; /* restore hooks */ + g->gcstp = oldgcstp; /* restore state */ + if (l_unlikely(status != LUA_OK)) { /* error while running __gc? */ + luaE_warnerror(L, "__gc"); + L->top.p--; /* pops error object */ + } + } +} + + +/* +** Call a few finalizers +*/ +static int runafewfinalizers (lua_State *L, int n) { + global_State *g = G(L); + int i; + for (i = 0; i < n && g->tobefnz; i++) + GCTM(L); /* call one finalizer */ + return i; +} + + +/* +** call all pending finalizers +*/ +static void callallpendingfinalizers (lua_State *L) { + global_State *g = G(L); + while (g->tobefnz) + GCTM(L); +} + + +/* +** find last 'next' field in list 'p' list (to add elements in its end) +*/ +static GCObject **findlast (GCObject **p) { + while (*p != NULL) + p = &(*p)->next; + return p; +} + + +/* +** Move all unreachable objects (or 'all' objects) that need +** finalization from list 'finobj' to list 'tobefnz' (to be finalized). +** (Note that objects after 'finobjold1' cannot be white, so they +** don't need to be traversed. In incremental mode, 'finobjold1' is NULL, +** so the whole list is traversed.) +*/ +static void separatetobefnz (global_State *g, int all) { + GCObject *curr; + GCObject **p = &g->finobj; + GCObject **lastnext = findlast(&g->tobefnz); + while ((curr = *p) != g->finobjold1) { /* traverse all finalizable objects */ + lua_assert(tofinalize(curr)); + if (!(iswhite(curr) || all)) /* not being collected? */ + p = &curr->next; /* don't bother with it */ + else { + if (curr == g->finobjsur) /* removing 'finobjsur'? */ + g->finobjsur = curr->next; /* correct it */ + *p = curr->next; /* remove 'curr' from 'finobj' list */ + curr->next = *lastnext; /* link at the end of 'tobefnz' list */ + *lastnext = curr; + lastnext = &curr->next; + } + } +} + + +/* +** If pointer 'p' points to 'o', move it to the next element. +*/ +static void checkpointer (GCObject **p, GCObject *o) { + if (o == *p) + *p = o->next; +} + + +/* +** Correct pointers to objects inside 'allgc' list when +** object 'o' is being removed from the list. +*/ +static void correctpointers (global_State *g, GCObject *o) { + checkpointer(&g->survival, o); + checkpointer(&g->old1, o); + checkpointer(&g->reallyold, o); + checkpointer(&g->firstold1, o); +} + + +/* +** if object 'o' has a finalizer, remove it from 'allgc' list (must +** search the list to find it) and link it in 'finobj' list. +*/ +void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) { + global_State *g = G(L); + if (tofinalize(o) || /* obj. is already marked... */ + gfasttm(g, mt, TM_GC) == NULL || /* or has no finalizer... */ + (g->gcstp & GCSTPCLS)) /* or closing state? */ + return; /* nothing to be done */ + else { /* move 'o' to 'finobj' list */ + GCObject **p; + if (issweepphase(g)) { + makewhite(g, o); /* "sweep" object 'o' */ + if (g->sweepgc == &o->next) /* should not remove 'sweepgc' object */ + g->sweepgc = sweeptolive(L, g->sweepgc); /* change 'sweepgc' */ + } + else + correctpointers(g, o); + /* search for pointer pointing to 'o' */ + for (p = &g->allgc; *p != o; p = &(*p)->next) { /* empty */ } + *p = o->next; /* remove 'o' from 'allgc' list */ + o->next = g->finobj; /* link it in 'finobj' list */ + g->finobj = o; + l_setbit(o->marked, FINALIZEDBIT); /* mark it as such */ + } +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Generational Collector +** ======================================================= +*/ + + +/* +** Set the "time" to wait before starting a new GC cycle; cycle will +** start when memory use hits the threshold of ('estimate' * pause / +** PAUSEADJ). (Division by 'estimate' should be OK: it cannot be zero, +** because Lua cannot even start with less than PAUSEADJ bytes). +*/ +static void setpause (global_State *g) { + l_mem threshold, debt; + int pause = getgcparam(g->gcpause); + l_mem estimate = g->GCestimate / PAUSEADJ; /* adjust 'estimate' */ + lua_assert(estimate > 0); + threshold = (pause < MAX_LMEM / estimate) /* overflow? */ + ? estimate * pause /* no overflow */ + : MAX_LMEM; /* overflow; truncate to maximum */ + debt = gettotalbytes(g) - threshold; + if (debt > 0) debt = 0; + luaE_setdebt(g, debt); +} + + +/* +** Sweep a list of objects to enter generational mode. Deletes dead +** objects and turns the non dead to old. All non-dead threads---which +** are now old---must be in a gray list. Everything else is not in a +** gray list. Open upvalues are also kept gray. +*/ +static void sweep2old (lua_State *L, GCObject **p) { + GCObject *curr; + global_State *g = G(L); + while ((curr = *p) != NULL) { + if (iswhite(curr)) { /* is 'curr' dead? */ + lua_assert(isdead(g, curr)); + *p = curr->next; /* remove 'curr' from list */ + freeobj(L, curr); /* erase 'curr' */ + } + else { /* all surviving objects become old */ + setage(curr, G_OLD); + if (curr->tt == LUA_VTHREAD) { /* threads must be watched */ + lua_State *th = gco2th(curr); + linkgclist(th, g->grayagain); /* insert into 'grayagain' list */ + } + else if (curr->tt == LUA_VUPVAL && upisopen(gco2upv(curr))) + set2gray(curr); /* open upvalues are always gray */ + else /* everything else is black */ + nw2black(curr); + p = &curr->next; /* go to next element */ + } + } +} + + +/* +** Sweep for generational mode. Delete dead objects. (Because the +** collection is not incremental, there are no "new white" objects +** during the sweep. So, any white object must be dead.) For +** non-dead objects, advance their ages and clear the color of +** new objects. (Old objects keep their colors.) +** The ages of G_TOUCHED1 and G_TOUCHED2 objects cannot be advanced +** here, because these old-generation objects are usually not swept +** here. They will all be advanced in 'correctgraylist'. That function +** will also remove objects turned white here from any gray list. +*/ +static GCObject **sweepgen (lua_State *L, global_State *g, GCObject **p, + GCObject *limit, GCObject **pfirstold1) { + static const lu_byte nextage[] = { + G_SURVIVAL, /* from G_NEW */ + G_OLD1, /* from G_SURVIVAL */ + G_OLD1, /* from G_OLD0 */ + G_OLD, /* from G_OLD1 */ + G_OLD, /* from G_OLD (do not change) */ + G_TOUCHED1, /* from G_TOUCHED1 (do not change) */ + G_TOUCHED2 /* from G_TOUCHED2 (do not change) */ + }; + int white = luaC_white(g); + GCObject *curr; + while ((curr = *p) != limit) { + if (iswhite(curr)) { /* is 'curr' dead? */ + lua_assert(!isold(curr) && isdead(g, curr)); + *p = curr->next; /* remove 'curr' from list */ + freeobj(L, curr); /* erase 'curr' */ + } + else { /* correct mark and age */ + if (getage(curr) == G_NEW) { /* new objects go back to white */ + int marked = curr->marked & ~maskgcbits; /* erase GC bits */ + curr->marked = cast_byte(marked | G_SURVIVAL | white); + } + else { /* all other objects will be old, and so keep their color */ + setage(curr, nextage[getage(curr)]); + if (getage(curr) == G_OLD1 && *pfirstold1 == NULL) + *pfirstold1 = curr; /* first OLD1 object in the list */ + } + p = &curr->next; /* go to next element */ + } + } + return p; +} + + +/* +** Traverse a list making all its elements white and clearing their +** age. In incremental mode, all objects are 'new' all the time, +** except for fixed strings (which are always old). +*/ +static void whitelist (global_State *g, GCObject *p) { + int white = luaC_white(g); + for (; p != NULL; p = p->next) + p->marked = cast_byte((p->marked & ~maskgcbits) | white); +} + + +/* +** Correct a list of gray objects. Return pointer to where rest of the +** list should be linked. +** Because this correction is done after sweeping, young objects might +** be turned white and still be in the list. They are only removed. +** 'TOUCHED1' objects are advanced to 'TOUCHED2' and remain on the list; +** Non-white threads also remain on the list; 'TOUCHED2' objects become +** regular old; they and anything else are removed from the list. +*/ +static GCObject **correctgraylist (GCObject **p) { + GCObject *curr; + while ((curr = *p) != NULL) { + GCObject **next = getgclist(curr); + if (iswhite(curr)) + goto remove; /* remove all white objects */ + else if (getage(curr) == G_TOUCHED1) { /* touched in this cycle? */ + lua_assert(isgray(curr)); + nw2black(curr); /* make it black, for next barrier */ + changeage(curr, G_TOUCHED1, G_TOUCHED2); + goto remain; /* keep it in the list and go to next element */ + } + else if (curr->tt == LUA_VTHREAD) { + lua_assert(isgray(curr)); + goto remain; /* keep non-white threads on the list */ + } + else { /* everything else is removed */ + lua_assert(isold(curr)); /* young objects should be white here */ + if (getage(curr) == G_TOUCHED2) /* advance from TOUCHED2... */ + changeage(curr, G_TOUCHED2, G_OLD); /* ... to OLD */ + nw2black(curr); /* make object black (to be removed) */ + goto remove; + } + remove: *p = *next; continue; + remain: p = next; continue; + } + return p; +} + + +/* +** Correct all gray lists, coalescing them into 'grayagain'. +*/ +static void correctgraylists (global_State *g) { + GCObject **list = correctgraylist(&g->grayagain); + *list = g->weak; g->weak = NULL; + list = correctgraylist(list); + *list = g->allweak; g->allweak = NULL; + list = correctgraylist(list); + *list = g->ephemeron; g->ephemeron = NULL; + correctgraylist(list); +} + + +/* +** Mark black 'OLD1' objects when starting a new young collection. +** Gray objects are already in some gray list, and so will be visited +** in the atomic step. +*/ +static void markold (global_State *g, GCObject *from, GCObject *to) { + GCObject *p; + for (p = from; p != to; p = p->next) { + if (getage(p) == G_OLD1) { + lua_assert(!iswhite(p)); + changeage(p, G_OLD1, G_OLD); /* now they are old */ + if (isblack(p)) + reallymarkobject(g, p); + } + } +} + + +/* +** Finish a young-generation collection. +*/ +static void finishgencycle (lua_State *L, global_State *g) { + correctgraylists(g); + checkSizes(L, g); + g->gcstate = GCSpropagate; /* skip restart */ + if (!g->gcemergency) + callallpendingfinalizers(L); +} + + +/* +** Does a young collection. First, mark 'OLD1' objects. Then does the +** atomic step. Then, sweep all lists and advance pointers. Finally, +** finish the collection. +*/ +static void youngcollection (lua_State *L, global_State *g) { + GCObject **psurvival; /* to point to first non-dead survival object */ + GCObject *dummy; /* dummy out parameter to 'sweepgen' */ + lua_assert(g->gcstate == GCSpropagate); + if (g->firstold1) { /* are there regular OLD1 objects? */ + markold(g, g->firstold1, g->reallyold); /* mark them */ + g->firstold1 = NULL; /* no more OLD1 objects (for now) */ + } + markold(g, g->finobj, g->finobjrold); + markold(g, g->tobefnz, NULL); + atomic(L); + + /* sweep nursery and get a pointer to its last live element */ + g->gcstate = GCSswpallgc; + psurvival = sweepgen(L, g, &g->allgc, g->survival, &g->firstold1); + /* sweep 'survival' */ + sweepgen(L, g, psurvival, g->old1, &g->firstold1); + g->reallyold = g->old1; + g->old1 = *psurvival; /* 'survival' survivals are old now */ + g->survival = g->allgc; /* all news are survivals */ + + /* repeat for 'finobj' lists */ + dummy = NULL; /* no 'firstold1' optimization for 'finobj' lists */ + psurvival = sweepgen(L, g, &g->finobj, g->finobjsur, &dummy); + /* sweep 'survival' */ + sweepgen(L, g, psurvival, g->finobjold1, &dummy); + g->finobjrold = g->finobjold1; + g->finobjold1 = *psurvival; /* 'survival' survivals are old now */ + g->finobjsur = g->finobj; /* all news are survivals */ + + sweepgen(L, g, &g->tobefnz, NULL, &dummy); + finishgencycle(L, g); +} + + +/* +** Clears all gray lists, sweeps objects, and prepare sublists to enter +** generational mode. The sweeps remove dead objects and turn all +** surviving objects to old. Threads go back to 'grayagain'; everything +** else is turned black (not in any gray list). +*/ +static void atomic2gen (lua_State *L, global_State *g) { + cleargraylists(g); + /* sweep all elements making them old */ + g->gcstate = GCSswpallgc; + sweep2old(L, &g->allgc); + /* everything alive now is old */ + g->reallyold = g->old1 = g->survival = g->allgc; + g->firstold1 = NULL; /* there are no OLD1 objects anywhere */ + + /* repeat for 'finobj' lists */ + sweep2old(L, &g->finobj); + g->finobjrold = g->finobjold1 = g->finobjsur = g->finobj; + + sweep2old(L, &g->tobefnz); + + g->gckind = KGC_GEN; + g->lastatomic = 0; + g->GCestimate = gettotalbytes(g); /* base for memory control */ + finishgencycle(L, g); +} + + +/* +** Set debt for the next minor collection, which will happen when +** memory grows 'genminormul'%. +*/ +static void setminordebt (global_State *g) { + luaE_setdebt(g, -(cast(l_mem, (gettotalbytes(g) / 100)) * g->genminormul)); +} + + +/* +** Enter generational mode. Must go until the end of an atomic cycle +** to ensure that all objects are correctly marked and weak tables +** are cleared. Then, turn all objects into old and finishes the +** collection. +*/ +static lu_mem entergen (lua_State *L, global_State *g) { + lu_mem numobjs; + luaC_runtilstate(L, bitmask(GCSpause)); /* prepare to start a new cycle */ + luaC_runtilstate(L, bitmask(GCSpropagate)); /* start new cycle */ + numobjs = atomic(L); /* propagates all and then do the atomic stuff */ + atomic2gen(L, g); + setminordebt(g); /* set debt assuming next cycle will be minor */ + return numobjs; +} + + +/* +** Enter incremental mode. Turn all objects white, make all +** intermediate lists point to NULL (to avoid invalid pointers), +** and go to the pause state. +*/ +static void enterinc (global_State *g) { + whitelist(g, g->allgc); + g->reallyold = g->old1 = g->survival = NULL; + whitelist(g, g->finobj); + whitelist(g, g->tobefnz); + g->finobjrold = g->finobjold1 = g->finobjsur = NULL; + g->gcstate = GCSpause; + g->gckind = KGC_INC; + g->lastatomic = 0; +} + + +/* +** Change collector mode to 'newmode'. +*/ +void luaC_changemode (lua_State *L, int newmode) { + global_State *g = G(L); + if (newmode != g->gckind) { + if (newmode == KGC_GEN) /* entering generational mode? */ + entergen(L, g); + else + enterinc(g); /* entering incremental mode */ + } + g->lastatomic = 0; +} + + +/* +** Does a full collection in generational mode. +*/ +static lu_mem fullgen (lua_State *L, global_State *g) { + enterinc(g); + return entergen(L, g); +} + + +/* +** Does a major collection after last collection was a "bad collection". +** +** When the program is building a big structure, it allocates lots of +** memory but generates very little garbage. In those scenarios, +** the generational mode just wastes time doing small collections, and +** major collections are frequently what we call a "bad collection", a +** collection that frees too few objects. To avoid the cost of switching +** between generational mode and the incremental mode needed for full +** (major) collections, the collector tries to stay in incremental mode +** after a bad collection, and to switch back to generational mode only +** after a "good" collection (one that traverses less than 9/8 objects +** of the previous one). +** The collector must choose whether to stay in incremental mode or to +** switch back to generational mode before sweeping. At this point, it +** does not know the real memory in use, so it cannot use memory to +** decide whether to return to generational mode. Instead, it uses the +** number of objects traversed (returned by 'atomic') as a proxy. The +** field 'g->lastatomic' keeps this count from the last collection. +** ('g->lastatomic != 0' also means that the last collection was bad.) +*/ +static void stepgenfull (lua_State *L, global_State *g) { + lu_mem newatomic; /* count of traversed objects */ + lu_mem lastatomic = g->lastatomic; /* count from last collection */ + if (g->gckind == KGC_GEN) /* still in generational mode? */ + enterinc(g); /* enter incremental mode */ + luaC_runtilstate(L, bitmask(GCSpropagate)); /* start new cycle */ + newatomic = atomic(L); /* mark everybody */ + if (newatomic < lastatomic + (lastatomic >> 3)) { /* good collection? */ + atomic2gen(L, g); /* return to generational mode */ + setminordebt(g); + } + else { /* another bad collection; stay in incremental mode */ + g->GCestimate = gettotalbytes(g); /* first estimate */ + entersweep(L); + luaC_runtilstate(L, bitmask(GCSpause)); /* finish collection */ + setpause(g); + g->lastatomic = newatomic; + } +} + + +/* +** Does a generational "step". +** Usually, this means doing a minor collection and setting the debt to +** make another collection when memory grows 'genminormul'% larger. +** +** However, there are exceptions. If memory grows 'genmajormul'% +** larger than it was at the end of the last major collection (kept +** in 'g->GCestimate'), the function does a major collection. At the +** end, it checks whether the major collection was able to free a +** decent amount of memory (at least half the growth in memory since +** previous major collection). If so, the collector keeps its state, +** and the next collection will probably be minor again. Otherwise, +** we have what we call a "bad collection". In that case, set the field +** 'g->lastatomic' to signal that fact, so that the next collection will +** go to 'stepgenfull'. +** +** 'GCdebt <= 0' means an explicit call to GC step with "size" zero; +** in that case, do a minor collection. +*/ +static void genstep (lua_State *L, global_State *g) { + if (g->lastatomic != 0) /* last collection was a bad one? */ + stepgenfull(L, g); /* do a full step */ + else { + lu_mem majorbase = g->GCestimate; /* memory after last major collection */ + lu_mem majorinc = (majorbase / 100) * getgcparam(g->genmajormul); + if (g->GCdebt > 0 && gettotalbytes(g) > majorbase + majorinc) { + lu_mem numobjs = fullgen(L, g); /* do a major collection */ + if (gettotalbytes(g) < majorbase + (majorinc / 2)) { + /* collected at least half of memory growth since last major + collection; keep doing minor collections. */ + lua_assert(g->lastatomic == 0); + } + else { /* bad collection */ + g->lastatomic = numobjs; /* signal that last collection was bad */ + setpause(g); /* do a long wait for next (major) collection */ + } + } + else { /* regular case; do a minor collection */ + youngcollection(L, g); + setminordebt(g); + g->GCestimate = majorbase; /* preserve base value */ + } + } + lua_assert(isdecGCmodegen(g)); +} + +/* }====================================================== */ + + +/* +** {====================================================== +** GC control +** ======================================================= +*/ + + +/* +** Enter first sweep phase. +** The call to 'sweeptolive' makes the pointer point to an object +** inside the list (instead of to the header), so that the real sweep do +** not need to skip objects created between "now" and the start of the +** real sweep. +*/ +static void entersweep (lua_State *L) { + global_State *g = G(L); + g->gcstate = GCSswpallgc; + lua_assert(g->sweepgc == NULL); + g->sweepgc = sweeptolive(L, &g->allgc); +} + + +/* +** Delete all objects in list 'p' until (but not including) object +** 'limit'. +*/ +static void deletelist (lua_State *L, GCObject *p, GCObject *limit) { + while (p != limit) { + GCObject *next = p->next; + freeobj(L, p); + p = next; + } +} + + +/* +** Call all finalizers of the objects in the given Lua state, and +** then free all objects, except for the main thread. +*/ +void luaC_freeallobjects (lua_State *L) { + global_State *g = G(L); + g->gcstp = GCSTPCLS; /* no extra finalizers after here */ + luaC_changemode(L, KGC_INC); + separatetobefnz(g, 1); /* separate all objects with finalizers */ + lua_assert(g->finobj == NULL); + callallpendingfinalizers(L); + deletelist(L, g->allgc, obj2gco(g->mainthread)); + lua_assert(g->finobj == NULL); /* no new finalizers */ + deletelist(L, g->fixedgc, NULL); /* collect fixed objects */ + lua_assert(g->strt.nuse == 0); +} + + +static lu_mem atomic (lua_State *L) { + global_State *g = G(L); + lu_mem work = 0; + GCObject *origweak, *origall; + GCObject *grayagain = g->grayagain; /* save original list */ + g->grayagain = NULL; + lua_assert(g->ephemeron == NULL && g->weak == NULL); + lua_assert(!iswhite(g->mainthread)); + g->gcstate = GCSatomic; + markobject(g, L); /* mark running thread */ + /* registry and global metatables may be changed by API */ + markvalue(g, &g->l_registry); + markmt(g); /* mark global metatables */ + work += propagateall(g); /* empties 'gray' list */ + /* remark occasional upvalues of (maybe) dead threads */ + work += remarkupvals(g); + work += propagateall(g); /* propagate changes */ + g->gray = grayagain; + work += propagateall(g); /* traverse 'grayagain' list */ + convergeephemerons(g); + /* at this point, all strongly accessible objects are marked. */ + /* Clear values from weak tables, before checking finalizers */ + clearbyvalues(g, g->weak, NULL); + clearbyvalues(g, g->allweak, NULL); + origweak = g->weak; origall = g->allweak; + separatetobefnz(g, 0); /* separate objects to be finalized */ + work += markbeingfnz(g); /* mark objects that will be finalized */ + work += propagateall(g); /* remark, to propagate 'resurrection' */ + convergeephemerons(g); + /* at this point, all resurrected objects are marked. */ + /* remove dead objects from weak tables */ + clearbykeys(g, g->ephemeron); /* clear keys from all ephemeron tables */ + clearbykeys(g, g->allweak); /* clear keys from all 'allweak' tables */ + /* clear values from resurrected weak tables */ + clearbyvalues(g, g->weak, origweak); + clearbyvalues(g, g->allweak, origall); + luaS_clearcache(g); + g->currentwhite = cast_byte(otherwhite(g)); /* flip current white */ + lua_assert(g->gray == NULL); + return work; /* estimate of slots marked by 'atomic' */ +} + + +static int sweepstep (lua_State *L, global_State *g, + int nextstate, GCObject **nextlist) { + if (g->sweepgc) { + l_mem olddebt = g->GCdebt; + int count; + g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX, &count); + g->GCestimate += g->GCdebt - olddebt; /* update estimate */ + return count; + } + else { /* enter next state */ + g->gcstate = nextstate; + g->sweepgc = nextlist; + return 0; /* no work done */ + } +} + + +static lu_mem singlestep (lua_State *L) { + global_State *g = G(L); + lu_mem work; + lua_assert(!g->gcstopem); /* collector is not reentrant */ + g->gcstopem = 1; /* no emergency collections while collecting */ + switch (g->gcstate) { + case GCSpause: { + restartcollection(g); + g->gcstate = GCSpropagate; + work = 1; + break; + } + case GCSpropagate: { + if (g->gray == NULL) { /* no more gray objects? */ + g->gcstate = GCSenteratomic; /* finish propagate phase */ + work = 0; + } + else + work = propagatemark(g); /* traverse one gray object */ + break; + } + case GCSenteratomic: { + work = atomic(L); /* work is what was traversed by 'atomic' */ + entersweep(L); + g->GCestimate = gettotalbytes(g); /* first estimate */ + break; + } + case GCSswpallgc: { /* sweep "regular" objects */ + work = sweepstep(L, g, GCSswpfinobj, &g->finobj); + break; + } + case GCSswpfinobj: { /* sweep objects with finalizers */ + work = sweepstep(L, g, GCSswptobefnz, &g->tobefnz); + break; + } + case GCSswptobefnz: { /* sweep objects to be finalized */ + work = sweepstep(L, g, GCSswpend, NULL); + break; + } + case GCSswpend: { /* finish sweeps */ + checkSizes(L, g); + g->gcstate = GCScallfin; + work = 0; + break; + } + case GCScallfin: { /* call remaining finalizers */ + if (g->tobefnz && !g->gcemergency) { + g->gcstopem = 0; /* ok collections during finalizers */ + work = runafewfinalizers(L, GCFINMAX) * GCFINALIZECOST; + } + else { /* emergency mode or no more finalizers */ + g->gcstate = GCSpause; /* finish collection */ + work = 0; + } + break; + } + default: lua_assert(0); return 0; + } + g->gcstopem = 0; + return work; +} + + +/* +** advances the garbage collector until it reaches a state allowed +** by 'statemask' +*/ +void luaC_runtilstate (lua_State *L, int statesmask) { + global_State *g = G(L); + while (!testbit(statesmask, g->gcstate)) + singlestep(L); +} + + + +/* +** Performs a basic incremental step. The debt and step size are +** converted from bytes to "units of work"; then the function loops +** running single steps until adding that many units of work or +** finishing a cycle (pause state). Finally, it sets the debt that +** controls when next step will be performed. +*/ +static void incstep (lua_State *L, global_State *g) { + int stepmul = (getgcparam(g->gcstepmul) | 1); /* avoid division by 0 */ + l_mem debt = (g->GCdebt / WORK2MEM) * stepmul; + l_mem stepsize = (g->gcstepsize <= log2maxs(l_mem)) + ? ((cast(l_mem, 1) << g->gcstepsize) / WORK2MEM) * stepmul + : MAX_LMEM; /* overflow; keep maximum value */ + do { /* repeat until pause or enough "credit" (negative debt) */ + lu_mem work = singlestep(L); /* perform one single step */ + debt -= work; + } while (debt > -stepsize && g->gcstate != GCSpause); + if (g->gcstate == GCSpause) + setpause(g); /* pause until next cycle */ + else { + debt = (debt / stepmul) * WORK2MEM; /* convert 'work units' to bytes */ + luaE_setdebt(g, debt); + } +} + +/* +** Performs a basic GC step if collector is running. (If collector is +** not running, set a reasonable debt to avoid it being called at +** every single check.) +*/ +void luaC_step (lua_State *L) { + global_State *g = G(L); + if (!gcrunning(g)) /* not running? */ + luaE_setdebt(g, -2000); + else { + if(isdecGCmodegen(g)) + genstep(L, g); + else + incstep(L, g); + } +} + + +/* +** Perform a full collection in incremental mode. +** Before running the collection, check 'keepinvariant'; if it is true, +** there may be some objects marked as black, so the collector has +** to sweep all objects to turn them back to white (as white has not +** changed, nothing will be collected). +*/ +static void fullinc (lua_State *L, global_State *g) { + if (keepinvariant(g)) /* black objects? */ + entersweep(L); /* sweep everything to turn them back to white */ + /* finish any pending sweep phase to start a new cycle */ + luaC_runtilstate(L, bitmask(GCSpause)); + luaC_runtilstate(L, bitmask(GCSpropagate)); /* start new cycle */ + g->gcstate = GCSenteratomic; /* go straight to atomic phase */ + luaC_runtilstate(L, bitmask(GCScallfin)); /* run up to finalizers */ + /* estimate must be correct after a full GC cycle */ + lua_assert(g->GCestimate == gettotalbytes(g)); + luaC_runtilstate(L, bitmask(GCSpause)); /* finish collection */ + setpause(g); +} + + +/* +** Performs a full GC cycle; if 'isemergency', set a flag to avoid +** some operations which could change the interpreter state in some +** unexpected ways (running finalizers and shrinking some structures). +*/ +void luaC_fullgc (lua_State *L, int isemergency) { + global_State *g = G(L); + lua_assert(!g->gcemergency); + g->gcemergency = isemergency; /* set flag */ + if (g->gckind == KGC_INC) + fullinc(L, g); + else + fullgen(L, g); + g->gcemergency = 0; +} + +/* }====================================================== */ + + diff --git a/LuaSkin/lua-5.4.7/src/lgc.h b/LuaSkin/lua-5.4.7/src/lgc.h new file mode 100644 index 000000000..538f6edcc --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lgc.h @@ -0,0 +1,202 @@ +/* +** $Id: lgc.h $ +** Garbage Collector +** See Copyright Notice in lua.h +*/ + +#ifndef lgc_h +#define lgc_h + + +#include "lobject.h" +#include "lstate.h" + +/* +** Collectable objects may have one of three colors: white, which means +** the object is not marked; gray, which means the object is marked, but +** its references may be not marked; and black, which means that the +** object and all its references are marked. The main invariant of the +** garbage collector, while marking objects, is that a black object can +** never point to a white one. Moreover, any gray object must be in a +** "gray list" (gray, grayagain, weak, allweak, ephemeron) so that it +** can be visited again before finishing the collection cycle. (Open +** upvalues are an exception to this rule.) These lists have no meaning +** when the invariant is not being enforced (e.g., sweep phase). +*/ + + +/* +** Possible states of the Garbage Collector +*/ +#define GCSpropagate 0 +#define GCSenteratomic 1 +#define GCSatomic 2 +#define GCSswpallgc 3 +#define GCSswpfinobj 4 +#define GCSswptobefnz 5 +#define GCSswpend 6 +#define GCScallfin 7 +#define GCSpause 8 + + +#define issweepphase(g) \ + (GCSswpallgc <= (g)->gcstate && (g)->gcstate <= GCSswpend) + + +/* +** macro to tell when main invariant (white objects cannot point to black +** ones) must be kept. During a collection, the sweep +** phase may break the invariant, as objects turned white may point to +** still-black objects. The invariant is restored when sweep ends and +** all objects are white again. +*/ + +#define keepinvariant(g) ((g)->gcstate <= GCSatomic) + + +/* +** some useful bit tricks +*/ +#define resetbits(x,m) ((x) &= cast_byte(~(m))) +#define setbits(x,m) ((x) |= (m)) +#define testbits(x,m) ((x) & (m)) +#define bitmask(b) (1<<(b)) +#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) +#define l_setbit(x,b) setbits(x, bitmask(b)) +#define resetbit(x,b) resetbits(x, bitmask(b)) +#define testbit(x,b) testbits(x, bitmask(b)) + + +/* +** Layout for bit use in 'marked' field. First three bits are +** used for object "age" in generational mode. Last bit is used +** by tests. +*/ +#define WHITE0BIT 3 /* object is white (type 0) */ +#define WHITE1BIT 4 /* object is white (type 1) */ +#define BLACKBIT 5 /* object is black */ +#define FINALIZEDBIT 6 /* object has been marked for finalization */ + +#define TESTBIT 7 + + + +#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) + + +#define iswhite(x) testbits((x)->marked, WHITEBITS) +#define isblack(x) testbit((x)->marked, BLACKBIT) +#define isgray(x) /* neither white nor black */ \ + (!testbits((x)->marked, WHITEBITS | bitmask(BLACKBIT))) + +#define tofinalize(x) testbit((x)->marked, FINALIZEDBIT) + +#define otherwhite(g) ((g)->currentwhite ^ WHITEBITS) +#define isdeadm(ow,m) ((m) & (ow)) +#define isdead(g,v) isdeadm(otherwhite(g), (v)->marked) + +#define changewhite(x) ((x)->marked ^= WHITEBITS) +#define nw2black(x) \ + check_exp(!iswhite(x), l_setbit((x)->marked, BLACKBIT)) + +#define luaC_white(g) cast_byte((g)->currentwhite & WHITEBITS) + + +/* object age in generational mode */ +#define G_NEW 0 /* created in current cycle */ +#define G_SURVIVAL 1 /* created in previous cycle */ +#define G_OLD0 2 /* marked old by frw. barrier in this cycle */ +#define G_OLD1 3 /* first full cycle as old */ +#define G_OLD 4 /* really old object (not to be visited) */ +#define G_TOUCHED1 5 /* old object touched this cycle */ +#define G_TOUCHED2 6 /* old object touched in previous cycle */ + +#define AGEBITS 7 /* all age bits (111) */ + +#define getage(o) ((o)->marked & AGEBITS) +#define setage(o,a) ((o)->marked = cast_byte(((o)->marked & (~AGEBITS)) | a)) +#define isold(o) (getage(o) > G_SURVIVAL) + +#define changeage(o,f,t) \ + check_exp(getage(o) == (f), (o)->marked ^= ((f)^(t))) + + +/* Default Values for GC parameters */ +#define LUAI_GENMAJORMUL 100 +#define LUAI_GENMINORMUL 20 + +/* wait memory to double before starting new cycle */ +#define LUAI_GCPAUSE 200 + +/* +** some gc parameters are stored divided by 4 to allow a maximum value +** up to 1023 in a 'lu_byte'. +*/ +#define getgcparam(p) ((p) * 4) +#define setgcparam(p,v) ((p) = (v) / 4) + +#define LUAI_GCMUL 100 + +/* how much to allocate before next GC step (log2) */ +#define LUAI_GCSTEPSIZE 13 /* 8 KB */ + + +/* +** Check whether the declared GC mode is generational. While in +** generational mode, the collector can go temporarily to incremental +** mode to improve performance. This is signaled by 'g->lastatomic != 0'. +*/ +#define isdecGCmodegen(g) (g->gckind == KGC_GEN || g->lastatomic != 0) + + +/* +** Control when GC is running: +*/ +#define GCSTPUSR 1 /* bit true when GC stopped by user */ +#define GCSTPGC 2 /* bit true when GC stopped by itself */ +#define GCSTPCLS 4 /* bit true when closing Lua state */ +#define gcrunning(g) ((g)->gcstp == 0) + + +/* +** Does one step of collection when debt becomes positive. 'pre'/'pos' +** allows some adjustments to be done only when needed. macro +** 'condchangemem' is used only for heavy tests (forcing a full +** GC cycle on every opportunity) +*/ +#define luaC_condGC(L,pre,pos) \ + { if (G(L)->GCdebt > 0) { pre; luaC_step(L); pos;}; \ + condchangemem(L,pre,pos); } + +/* more often than not, 'pre'/'pos' are empty */ +#define luaC_checkGC(L) luaC_condGC(L,(void)0,(void)0) + + +#define luaC_objbarrier(L,p,o) ( \ + (isblack(p) && iswhite(o)) ? \ + luaC_barrier_(L,obj2gco(p),obj2gco(o)) : cast_void(0)) + +#define luaC_barrier(L,p,v) ( \ + iscollectable(v) ? luaC_objbarrier(L,p,gcvalue(v)) : cast_void(0)) + +#define luaC_objbarrierback(L,p,o) ( \ + (isblack(p) && iswhite(o)) ? luaC_barrierback_(L,p) : cast_void(0)) + +#define luaC_barrierback(L,p,v) ( \ + iscollectable(v) ? luaC_objbarrierback(L, p, gcvalue(v)) : cast_void(0)) + +LUAI_FUNC void luaC_fix (lua_State *L, GCObject *o); +LUAI_FUNC void luaC_freeallobjects (lua_State *L); +LUAI_FUNC void luaC_step (lua_State *L); +LUAI_FUNC void luaC_runtilstate (lua_State *L, int statesmask); +LUAI_FUNC void luaC_fullgc (lua_State *L, int isemergency); +LUAI_FUNC GCObject *luaC_newobj (lua_State *L, int tt, size_t sz); +LUAI_FUNC GCObject *luaC_newobjdt (lua_State *L, int tt, size_t sz, + size_t offset); +LUAI_FUNC void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v); +LUAI_FUNC void luaC_barrierback_ (lua_State *L, GCObject *o); +LUAI_FUNC void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt); +LUAI_FUNC void luaC_changemode (lua_State *L, int newmode); + + +#endif diff --git a/LuaSkin/lua-5.3.4/src/linit.c b/LuaSkin/lua-5.4.7/src/linit.c similarity index 91% rename from LuaSkin/lua-5.3.4/src/linit.c rename to LuaSkin/lua-5.4.7/src/linit.c index afcaf98b2..69808f84f 100644 --- a/LuaSkin/lua-5.3.4/src/linit.c +++ b/LuaSkin/lua-5.4.7/src/linit.c @@ -1,5 +1,5 @@ /* -** $Id: linit.c,v 1.39 2016/12/04 20:17:24 roberto Exp $ +** $Id: linit.c $ ** Initialization of libraries for lua.c and other clients ** See Copyright Notice in lua.h */ @@ -40,7 +40,7 @@ ** program */ static const luaL_Reg loadedlibs[] = { - {"_G", luaopen_base}, + {LUA_GNAME, luaopen_base}, {LUA_LOADLIBNAME, luaopen_package}, {LUA_COLIBNAME, luaopen_coroutine}, {LUA_TABLIBNAME, luaopen_table}, @@ -50,9 +50,6 @@ static const luaL_Reg loadedlibs[] = { {LUA_MATHLIBNAME, luaopen_math}, {LUA_UTF8LIBNAME, luaopen_utf8}, {LUA_DBLIBNAME, luaopen_debug}, -#if defined(LUA_COMPAT_BITLIB) - {LUA_BITLIBNAME, luaopen_bit32}, -#endif {NULL, NULL} }; diff --git a/LuaSkin/lua-5.3.4/src/liolib.c b/LuaSkin/lua-5.4.7/src/liolib.c similarity index 81% rename from LuaSkin/lua-5.3.4/src/liolib.c rename to LuaSkin/lua-5.4.7/src/liolib.c index 156840358..c5075f3e7 100644 --- a/LuaSkin/lua-5.3.4/src/liolib.c +++ b/LuaSkin/lua-5.4.7/src/liolib.c @@ -1,5 +1,5 @@ /* -** $Id: liolib.c,v 2.151 2016/12/20 18:37:00 roberto Exp $ +** $Id: liolib.c $ ** Standard I/O (and system) library ** See Copyright Notice in lua.h */ @@ -39,7 +39,7 @@ /* Check whether 'mode' matches '[rwa]%+?[L_MODEEXT]*' */ static int l_checkmode (const char *mode) { return (*mode != '\0' && strchr("rwa", *(mode++)) != NULL && - (*mode != '+' || (++mode, 1)) && /* skip if char is '+' */ + (*mode != '+' || ((void)(++mode), 1)) && /* skip if char is '+' */ (strspn(mode, L_MODEEXT) == strlen(mode))); /* check extensions */ } @@ -64,11 +64,17 @@ static int l_checkmode (const char *mode) { #define l_popen(L,c,m) (_popen(c,m)) #define l_pclose(L,file) (_pclose(file)) +#if !defined(l_checkmodep) +/* Windows accepts "[rw][bt]?" as valid modes */ +#define l_checkmodep(m) ((m[0] == 'r' || m[0] == 'w') && \ + (m[1] == '\0' || ((m[1] == 'b' || m[1] == 't') && m[2] == '\0'))) +#endif + #else /* }{ */ /* ISO C definitions */ #define l_popen(L,c,m) \ - ((void)((void)c, m), \ + ((void)c, (void)m, \ luaL_error(L, "'popen' not supported"), \ (FILE*)0) #define l_pclose(L,file) ((void)L, (void)file, -1) @@ -77,6 +83,12 @@ static int l_checkmode (const char *mode) { #endif /* } */ + +#if !defined(l_checkmodep) +/* By default, Lua accepts only "r" or "w" as valid modes */ +#define l_checkmodep(m) ((m[0] == 'r' || m[0] == 'w') && m[1] == '\0') +#endif + /* }====================================================== */ @@ -133,6 +145,7 @@ static int l_checkmode (const char *mode) { /* }====================================================== */ + #define IO_PREFIX "_IO_" #define IOPREF_LEN (sizeof(IO_PREFIX)/sizeof(char) - 1) #define IO_INPUT (IO_PREFIX "input") @@ -152,7 +165,7 @@ static int io_type (lua_State *L) { luaL_checkany(L, 1); p = (LStream *)luaL_testudata(L, 1, LUA_FILEHANDLE); if (p == NULL) - lua_pushnil(L); /* not a file */ + luaL_pushfail(L); /* not a file */ else if (isclosed(p)) lua_pushliteral(L, "closed file"); else @@ -173,7 +186,7 @@ static int f_tostring (lua_State *L) { static FILE *tofile (lua_State *L) { LStream *p = tolstream(L); - if (isclosed(p)) + if (l_unlikely(isclosed(p))) luaL_error(L, "attempt to use a closed file"); lua_assert(p->f); return p->f; @@ -186,7 +199,7 @@ static FILE *tofile (lua_State *L) { ** handle is in a consistent state. */ static LStream *newprefile (lua_State *L) { - LStream *p = (LStream *)lua_newuserdata(L, sizeof(LStream)); + LStream *p = (LStream *)lua_newuserdatauv(L, sizeof(LStream), 0); p->closef = NULL; /* mark file handle as 'closed' */ luaL_setmetatable(L, LUA_FILEHANDLE); return p; @@ -206,14 +219,19 @@ static int aux_close (lua_State *L) { } -static int io_close (lua_State *L) { - if (lua_isnone(L, 1)) /* no argument? */ - lua_getfield(L, LUA_REGISTRYINDEX, IO_OUTPUT); /* use standard output */ +static int f_close (lua_State *L) { tofile(L); /* make sure argument is an open stream */ return aux_close(L); } +static int io_close (lua_State *L) { + if (lua_isnone(L, 1)) /* no argument? */ + lua_getfield(L, LUA_REGISTRYINDEX, IO_OUTPUT); /* use default output */ + return f_close(L); +} + + static int f_gc (lua_State *L) { LStream *p = tolstream(L); if (!isclosed(p) && p->f != NULL) @@ -227,8 +245,8 @@ static int f_gc (lua_State *L) { */ static int io_fclose (lua_State *L) { LStream *p = tolstream(L); - int res = fclose(p->f); - return luaL_fileresult(L, (res == 0), NULL); + errno = 0; + return luaL_fileresult(L, (fclose(p->f) == 0), NULL); } @@ -243,7 +261,7 @@ static LStream *newfile (lua_State *L) { static void opencheck (lua_State *L, const char *fname, const char *mode) { LStream *p = newfile(L); p->f = fopen(fname, mode); - if (p->f == NULL) + if (l_unlikely(p->f == NULL)) luaL_error(L, "cannot open file '%s' (%s)", fname, strerror(errno)); } @@ -254,6 +272,7 @@ static int io_open (lua_State *L) { LStream *p = newfile(L); const char *md = mode; /* to traverse/check mode */ luaL_argcheck(L, l_checkmode(md), 2, "invalid mode"); + errno = 0; p->f = fopen(filename, mode); return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; } @@ -264,6 +283,7 @@ static int io_open (lua_State *L) { */ static int io_pclose (lua_State *L) { LStream *p = tolstream(L); + errno = 0; return luaL_execresult(L, l_pclose(L, p->f)); } @@ -272,6 +292,8 @@ static int io_popen (lua_State *L) { const char *filename = luaL_checkstring(L, 1); const char *mode = luaL_optstring(L, 2, "r"); LStream *p = newprefile(L); + luaL_argcheck(L, l_checkmodep(mode), 2, "invalid mode"); + errno = 0; p->f = l_popen(L, filename, mode); p->closef = &io_pclose; return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; @@ -280,6 +302,7 @@ static int io_popen (lua_State *L) { static int io_tmpfile (lua_State *L) { LStream *p = newfile(L); + errno = 0; p->f = tmpfile(); return (p->f == NULL) ? luaL_fileresult(L, 0, NULL) : 1; } @@ -289,8 +312,8 @@ static FILE *getiofile (lua_State *L, const char *findex) { LStream *p; lua_getfield(L, LUA_REGISTRYINDEX, findex); p = (LStream *)lua_touserdata(L, -1); - if (isclosed(p)) - luaL_error(L, "standard %s file is closed", findex + IOPREF_LEN); + if (l_unlikely(isclosed(p))) + luaL_error(L, "default %s file is closed", findex + IOPREF_LEN); return p->f; } @@ -331,12 +354,22 @@ static int io_readline (lua_State *L); */ #define MAXARGLINE 250 +/* +** Auxiliary function to create the iteration function for 'lines'. +** The iteration function is a closure over 'io_readline', with +** the following upvalues: +** 1) The file being read (first value in the stack) +** 2) the number of arguments to read +** 3) a boolean, true iff file has to be closed when finished ('toclose') +** *) a variable number of format arguments (rest of the stack) +*/ static void aux_lines (lua_State *L, int toclose) { int n = lua_gettop(L) - 1; /* number of arguments to read */ luaL_argcheck(L, n <= MAXARGLINE, MAXARGLINE + 2, "too many arguments"); + lua_pushvalue(L, 1); /* file */ lua_pushinteger(L, n); /* number of arguments to read */ lua_pushboolean(L, toclose); /* close/not close file when finished */ - lua_rotate(L, 2, 2); /* move 'n' and 'toclose' to their positions */ + lua_rotate(L, 2, 3); /* move the three values to their positions */ lua_pushcclosure(L, io_readline, 3 + n); } @@ -348,6 +381,11 @@ static int f_lines (lua_State *L) { } +/* +** Return an iteration function for 'io.lines'. If file has to be +** closed, also returns the file itself as a second result (to be +** closed as the state at the exit of a generic for). +*/ static int io_lines (lua_State *L) { int toclose; if (lua_isnone(L, 1)) lua_pushnil(L); /* at least one argument */ @@ -363,8 +401,15 @@ static int io_lines (lua_State *L) { lua_replace(L, 1); /* put file at index 1 */ toclose = 1; /* close it after iteration */ } - aux_lines(L, toclose); - return 1; + aux_lines(L, toclose); /* push iteration function */ + if (toclose) { + lua_pushnil(L); /* state */ + lua_pushnil(L); /* control */ + lua_pushvalue(L, 1); /* file is the to-be-closed variable (4th result) */ + return 4; + } + else + return 1; } @@ -394,7 +439,7 @@ typedef struct { ** Add current char to buffer (if not out of space) and read next one */ static int nextc (RN *rn) { - if (rn->n >= L_MAXLENNUM) { /* buffer overflow? */ + if (l_unlikely(rn->n >= L_MAXLENNUM)) { /* buffer overflow? */ rn->buff[0] = '\0'; /* invalidate result */ return 0; /* fail */ } @@ -430,7 +475,7 @@ static int readdigits (RN *rn, int hex) { /* ** Read a number: first reads a valid prefix of a numeral into a buffer. ** Then it calls 'lua_stringtonumber' to check whether the format is -** correct and to convert it to a Lua number +** correct and to convert it to a Lua number. */ static int read_number (lua_State *L, FILE *f) { RN rn; @@ -442,7 +487,7 @@ static int read_number (lua_State *L, FILE *f) { decp[1] = '.'; /* always accept a dot */ l_lockfile(rn.f); do { rn.c = l_getc(rn.f); } while (isspace(rn.c)); /* skip spaces */ - test2(&rn, "-+"); /* optional signal */ + test2(&rn, "-+"); /* optional sign */ if (test2(&rn, "00")) { if (test2(&rn, "xX")) hex = 1; /* numeral is hexadecimal */ else count = 1; /* count initial '0' as a valid digit */ @@ -451,14 +496,14 @@ static int read_number (lua_State *L, FILE *f) { if (test2(&rn, decp)) /* decimal point? */ count += readdigits(&rn, hex); /* fractional part */ if (count > 0 && test2(&rn, (hex ? "pP" : "eE"))) { /* exponent mark? */ - test2(&rn, "-+"); /* exponent signal */ + test2(&rn, "-+"); /* exponent sign */ readdigits(&rn, 0); /* exponent digits */ } ungetc(rn.c, rn.f); /* unread look-ahead char */ l_unlockfile(rn.f); rn.buff[rn.n] = '\0'; /* finish string */ - if (lua_stringtonumber(L, rn.buff)) /* is this a valid number? */ - return 1; /* ok */ + if (l_likely(lua_stringtonumber(L, rn.buff))) + return 1; /* ok, it is a valid number */ else { /* invalid format */ lua_pushnil(L); /* "result" to be removed */ return 0; /* read fails */ @@ -476,17 +521,17 @@ static int test_eof (lua_State *L, FILE *f) { static int read_line (lua_State *L, FILE *f, int chop) { luaL_Buffer b; - int c = '\0'; + int c; luaL_buffinit(L, &b); - while (c != EOF && c != '\n') { /* repeat until end of line */ - char *buff = luaL_prepbuffer(&b); /* preallocate buffer */ + do { /* may need to read several chunks to get whole line */ + char *buff = luaL_prepbuffer(&b); /* preallocate buffer space */ int i = 0; l_lockfile(f); /* no memory errors can happen inside the lock */ while (i < LUAL_BUFFERSIZE && (c = l_getc(f)) != EOF && c != '\n') - buff[i++] = c; + buff[i++] = c; /* read up to end of line or buffer limit */ l_unlockfile(f); luaL_addsize(&b, i); - } + } while (c != EOF && c != '\n'); /* repeat until end of line */ if (!chop && c == '\n') /* want a newline and have one? */ luaL_addchar(&b, c); /* add ending newline to result */ luaL_pushresult(&b); /* close buffer */ @@ -523,14 +568,15 @@ static int read_chars (lua_State *L, FILE *f, size_t n) { static int g_read (lua_State *L, FILE *f, int first) { int nargs = lua_gettop(L) - 1; - int success; - int n; + int n, success; clearerr(f); + errno = 0; if (nargs == 0) { /* no arguments? */ success = read_line(L, f, 1); - n = first+1; /* to return 1 result */ + n = first + 1; /* to return 1 result */ } - else { /* ensure stack space for all results and for auxlib's buffer */ + else { + /* ensure stack space for all results and for auxlib's buffer */ luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments"); success = 1; for (n = first; nargs-- && success; n++) { @@ -565,7 +611,7 @@ static int g_read (lua_State *L, FILE *f, int first) { return luaL_fileresult(L, 0, NULL); if (!success) { lua_pop(L, 1); /* remove last result */ - lua_pushnil(L); /* push nil instead */ + luaL_pushfail(L); /* push nil instead */ } return n - first; } @@ -581,6 +627,9 @@ static int f_read (lua_State *L) { } +/* +** Iteration function for 'lines'. +*/ static int io_readline (lua_State *L) { LStream *p = (LStream *)lua_touserdata(L, lua_upvalueindex(1)); int i; @@ -595,14 +644,14 @@ static int io_readline (lua_State *L) { lua_assert(n > 0); /* should return at least a nil */ if (lua_toboolean(L, -n)) /* read at least one value? */ return n; /* return them */ - else { /* first result is nil: EOF or error */ + else { /* first result is false: EOF or error */ if (n > 1) { /* is there error information? */ /* 2nd result is error message */ return luaL_error(L, "%s", lua_tostring(L, -n + 1)); } if (lua_toboolean(L, lua_upvalueindex(3))) { /* generator created file? */ - lua_settop(L, 0); - lua_pushvalue(L, lua_upvalueindex(1)); + lua_settop(L, 0); /* clear stack */ + lua_pushvalue(L, lua_upvalueindex(1)); /* push file at index 1 */ aux_close(L); /* close it */ } return 0; @@ -615,6 +664,7 @@ static int io_readline (lua_State *L) { static int g_write (lua_State *L, FILE *f, int arg) { int nargs = lua_gettop(L) - arg; int status = 1; + errno = 0; for (; nargs--; arg++) { if (lua_type(L, arg) == LUA_TNUMBER) { /* optimization: could be done exactly as for strings */ @@ -631,8 +681,10 @@ static int g_write (lua_State *L, FILE *f, int arg) { status = status && (fwrite(s, sizeof(char), l, f) == l); } } - if (status) return 1; /* file handle already on stack top */ - else return luaL_fileresult(L, status, NULL); + if (l_likely(status)) + return 1; /* file handle already on stack top */ + else + return luaL_fileresult(L, status, NULL); } @@ -657,8 +709,9 @@ static int f_seek (lua_State *L) { l_seeknum offset = (l_seeknum)p3; luaL_argcheck(L, (lua_Integer)offset == p3, 3, "not an integer in proper range"); + errno = 0; op = l_fseek(f, offset, mode[op]); - if (op) + if (l_unlikely(op)) return luaL_fileresult(L, 0, NULL); /* error */ else { lua_pushinteger(L, (lua_Integer)l_ftell(f)); @@ -673,19 +726,25 @@ static int f_setvbuf (lua_State *L) { FILE *f = tofile(L); int op = luaL_checkoption(L, 2, NULL, modenames); lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE); - int res = setvbuf(f, NULL, mode[op], (size_t)sz); + int res; + errno = 0; + res = setvbuf(f, NULL, mode[op], (size_t)sz); return luaL_fileresult(L, res == 0, NULL); } static int io_flush (lua_State *L) { - return luaL_fileresult(L, fflush(getiofile(L, IO_OUTPUT)) == 0, NULL); + FILE *f = getiofile(L, IO_OUTPUT); + errno = 0; + return luaL_fileresult(L, fflush(f) == 0, NULL); } static int f_flush (lua_State *L) { - return luaL_fileresult(L, fflush(tofile(L)) == 0, NULL); + FILE *f = tofile(L); + errno = 0; + return luaL_fileresult(L, fflush(f) == 0, NULL); } @@ -711,26 +770,37 @@ static const luaL_Reg iolib[] = { /* ** methods for file handles */ -static const luaL_Reg flib[] = { - {"close", io_close}, - {"flush", f_flush}, - {"lines", f_lines}, +static const luaL_Reg meth[] = { {"read", f_read}, + {"write", f_write}, + {"lines", f_lines}, + {"flush", f_flush}, {"seek", f_seek}, + {"close", f_close}, {"setvbuf", f_setvbuf}, - {"write", f_write}, + {NULL, NULL} +}; + + +/* +** metamethods for file handles +*/ +static const luaL_Reg metameth[] = { + {"__index", NULL}, /* placeholder */ {"__gc", f_gc}, + {"__close", f_gc}, {"__tostring", f_tostring}, {NULL, NULL} }; static void createmeta (lua_State *L) { - luaL_newmetatable(L, LUA_FILEHANDLE); /* create metatable for file handles */ - lua_pushvalue(L, -1); /* push metatable */ - lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */ - luaL_setfuncs(L, flib, 0); /* add file methods to new metatable */ - lua_pop(L, 1); /* pop new metatable */ + luaL_newmetatable(L, LUA_FILEHANDLE); /* metatable for file handles */ + luaL_setfuncs(L, metameth, 0); /* add metamethods to new metatable */ + luaL_newlibtable(L, meth); /* create method table */ + luaL_setfuncs(L, meth, 0); /* add file methods to method table */ + lua_setfield(L, -2, "__index"); /* metatable.__index = method table */ + lua_pop(L, 1); /* pop metatable */ } @@ -740,7 +810,7 @@ static void createmeta (lua_State *L) { static int io_noclose (lua_State *L) { LStream *p = tolstream(L); p->closef = &io_noclose; /* keep file opened */ - lua_pushnil(L); + luaL_pushfail(L); lua_pushliteral(L, "cannot close standard file"); return 2; } diff --git a/LuaSkin/lua-5.4.7/src/ljumptab.h b/LuaSkin/lua-5.4.7/src/ljumptab.h new file mode 100644 index 000000000..8306f250c --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/ljumptab.h @@ -0,0 +1,112 @@ +/* +** $Id: ljumptab.h $ +** Jump Table for the Lua interpreter +** See Copyright Notice in lua.h +*/ + + +#undef vmdispatch +#undef vmcase +#undef vmbreak + +#define vmdispatch(x) goto *disptab[x]; + +#define vmcase(l) L_##l: + +#define vmbreak vmfetch(); vmdispatch(GET_OPCODE(i)); + + +static const void *const disptab[NUM_OPCODES] = { + +#if 0 +** you can update the following list with this command: +** +** sed -n '/^OP_/\!d; s/OP_/\&\&L_OP_/ ; s/,.*/,/ ; s/\/.*// ; p' lopcodes.h +** +#endif + +&&L_OP_MOVE, +&&L_OP_LOADI, +&&L_OP_LOADF, +&&L_OP_LOADK, +&&L_OP_LOADKX, +&&L_OP_LOADFALSE, +&&L_OP_LFALSESKIP, +&&L_OP_LOADTRUE, +&&L_OP_LOADNIL, +&&L_OP_GETUPVAL, +&&L_OP_SETUPVAL, +&&L_OP_GETTABUP, +&&L_OP_GETTABLE, +&&L_OP_GETI, +&&L_OP_GETFIELD, +&&L_OP_SETTABUP, +&&L_OP_SETTABLE, +&&L_OP_SETI, +&&L_OP_SETFIELD, +&&L_OP_NEWTABLE, +&&L_OP_SELF, +&&L_OP_ADDI, +&&L_OP_ADDK, +&&L_OP_SUBK, +&&L_OP_MULK, +&&L_OP_MODK, +&&L_OP_POWK, +&&L_OP_DIVK, +&&L_OP_IDIVK, +&&L_OP_BANDK, +&&L_OP_BORK, +&&L_OP_BXORK, +&&L_OP_SHRI, +&&L_OP_SHLI, +&&L_OP_ADD, +&&L_OP_SUB, +&&L_OP_MUL, +&&L_OP_MOD, +&&L_OP_POW, +&&L_OP_DIV, +&&L_OP_IDIV, +&&L_OP_BAND, +&&L_OP_BOR, +&&L_OP_BXOR, +&&L_OP_SHL, +&&L_OP_SHR, +&&L_OP_MMBIN, +&&L_OP_MMBINI, +&&L_OP_MMBINK, +&&L_OP_UNM, +&&L_OP_BNOT, +&&L_OP_NOT, +&&L_OP_LEN, +&&L_OP_CONCAT, +&&L_OP_CLOSE, +&&L_OP_TBC, +&&L_OP_JMP, +&&L_OP_EQ, +&&L_OP_LT, +&&L_OP_LE, +&&L_OP_EQK, +&&L_OP_EQI, +&&L_OP_LTI, +&&L_OP_LEI, +&&L_OP_GTI, +&&L_OP_GEI, +&&L_OP_TEST, +&&L_OP_TESTSET, +&&L_OP_CALL, +&&L_OP_TAILCALL, +&&L_OP_RETURN, +&&L_OP_RETURN0, +&&L_OP_RETURN1, +&&L_OP_FORLOOP, +&&L_OP_FORPREP, +&&L_OP_TFORPREP, +&&L_OP_TFORCALL, +&&L_OP_TFORLOOP, +&&L_OP_SETLIST, +&&L_OP_CLOSURE, +&&L_OP_VARARG, +&&L_OP_VARARGPREP, +&&L_OP_EXTRAARG + +}; diff --git a/LuaSkin/lua-5.3.4/src/llex.c b/LuaSkin/lua-5.4.7/src/llex.c similarity index 79% rename from LuaSkin/lua-5.3.4/src/llex.c rename to LuaSkin/lua-5.4.7/src/llex.c index 70328273f..5fc39a5cd 100644 --- a/LuaSkin/lua-5.3.4/src/llex.c +++ b/LuaSkin/lua-5.4.7/src/llex.c @@ -1,5 +1,5 @@ /* -** $Id: llex.c,v 2.96 2016/05/02 14:02:12 roberto Exp $ +** $Id: llex.c $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ @@ -29,7 +29,7 @@ -#define next(ls) (ls->current = zgetc(ls->z)) +#define next(ls) (ls->current = zgetc(ls->z)) @@ -63,7 +63,7 @@ static void save (LexState *ls, int c) { newsize = luaZ_sizebuffer(b) * 2; luaZ_resizebuffer(ls->L, b, newsize); } - b->buffer[luaZ_bufflen(b)++] = cast(char, c); + b->buffer[luaZ_bufflen(b)++] = cast_char(c); } @@ -81,8 +81,10 @@ void luaX_init (lua_State *L) { const char *luaX_token2str (LexState *ls, int token) { if (token < FIRST_RESERVED) { /* single-byte symbols? */ - lua_assert(token == cast_uchar(token)); - return luaO_pushfstring(ls->L, "'%c'", token); + if (lisprint(token)) + return luaO_pushfstring(ls->L, "'%c'", token); + else /* control character */ + return luaO_pushfstring(ls->L, "'<\\%d>'", token); } else { const char *s = luaX_tokens[token - FIRST_RESERVED]; @@ -120,26 +122,29 @@ l_noret luaX_syntaxerror (LexState *ls, const char *msg) { /* -** creates a new string and anchors it in scanner's table so that -** it will not be collected until the end of the compilation -** (by that time it should be anchored somewhere) +** Creates a new string and anchors it in scanner's table so that it +** will not be collected until the end of the compilation; by that time +** it should be anchored somewhere. It also internalizes long strings, +** ensuring there is only one copy of each unique string. The table +** here is used as a set: the string enters as the key, while its value +** is irrelevant. We use the string itself as the value only because it +** is a TValue readily available. Later, the code generation can change +** this value. */ TString *luaX_newstring (LexState *ls, const char *str, size_t l) { lua_State *L = ls->L; - TValue *o; /* entry for 'str' */ TString *ts = luaS_newlstr(L, str, l); /* create new string */ - setsvalue2s(L, L->top++, ts); /* temporarily anchor it in stack */ - o = luaH_set(L, ls->h, L->top - 1); - if (ttisnil(o)) { /* not in use yet? */ - /* boolean value does not need GC barrier; - table has no metatable, so it does not need to invalidate cache */ - setbvalue(o, 1); /* t[string] = true */ + const TValue *o = luaH_getstr(ls->h, ts); + if (!ttisnil(o)) /* string already present? */ + ts = keystrval(nodefromval(o)); /* get saved copy */ + else { /* not in use yet */ + TValue *stv = s2v(L->top.p++); /* reserve stack space for string */ + setsvalue(L, stv, ts); /* temporarily anchor the string */ + luaH_finishset(L, ls->h, stv, o, stv); /* t[string] = string */ + /* table is not a metatable, so it does not need to invalidate cache */ luaC_checkGC(L); + L->top.p--; /* remove string from stack */ } - else { /* string already present */ - ts = tsvalue(keyfromval(o)); /* re-use value previously stored */ - } - L->top--; /* remove string from stack */ return ts; } @@ -208,8 +213,16 @@ static int check_next2 (LexState *ls, const char *set) { /* LUA_NUMBER */ /* -** this function is quite liberal in what it accepts, as 'luaO_str2num' -** will reject ill-formed numerals. +** This function is quite liberal in what it accepts, as 'luaO_str2num' +** will reject ill-formed numerals. Roughly, it accepts the following +** pattern: +** +** %d(%x|%.|([Ee][+-]?))* | 0[Xx](%x|%.|([Pp][+-]?))* +** +** The only tricky part is to accept [+-] only after a valid exponent +** mark, to avoid reading '3-4' or '0xe+1' as a single number. +** +** The caller might have already read an initial dot. */ static int read_numeral (LexState *ls, SemInfo *seminfo) { TValue obj; @@ -220,14 +233,14 @@ static int read_numeral (LexState *ls, SemInfo *seminfo) { if (first == '0' && check_next2(ls, "xX")) /* hexadecimal? */ expo = "Pp"; for (;;) { - if (check_next2(ls, expo)) /* exponent part? */ + if (check_next2(ls, expo)) /* exponent mark? */ check_next2(ls, "-+"); /* optional exponent sign */ - if (lisxdigit(ls->current)) - save_and_next(ls); - else if (ls->current == '.') + else if (lisxdigit(ls->current) || ls->current == '.') /* '%x|%.' */ save_and_next(ls); else break; } + if (lislalpha(ls->current)) /* is numeral touching a letter? */ + save_and_next(ls); /* force an error */ save(ls, '\0'); if (luaO_str2num(luaZ_buffer(ls->buff), &obj) == 0) /* format error? */ lexerror(ls, "malformed number", TK_FLT); @@ -244,12 +257,13 @@ static int read_numeral (LexState *ls, SemInfo *seminfo) { /* -** skip a sequence '[=*[' or ']=*]'; if sequence is well formed, return -** its number of '='s; otherwise, return a negative number (-1 iff there -** are no '='s after initial bracket) +** read a sequence '[=*[' or ']=*]', leaving the last bracket. If +** sequence is well formed, return its number of '='s + 2; otherwise, +** return 1 if it is a single bracket (no '='s and no 2nd bracket); +** otherwise (an unfinished '[==...') return 0. */ -static int skip_sep (LexState *ls) { - int count = 0; +static size_t skip_sep (LexState *ls) { + size_t count = 0; int s = ls->current; lua_assert(s == '[' || s == ']'); save_and_next(ls); @@ -257,11 +271,13 @@ static int skip_sep (LexState *ls) { save_and_next(ls); count++; } - return (ls->current == s) ? count : (-count) - 1; + return (ls->current == s) ? count + 2 + : (count == 0) ? 1 + : 0; } -static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { +static void read_long_string (LexState *ls, SemInfo *seminfo, size_t sep) { int line = ls->linenumber; /* initial line (for error message) */ save_and_next(ls); /* skip 2nd '[' */ if (currIsNewline(ls)) /* string starts with a newline? */ @@ -295,8 +311,8 @@ static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { } } endloop: if (seminfo) - seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep), - luaZ_bufflen(ls->buff) - 2*(2 + sep)); + seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + sep, + luaZ_bufflen(ls->buff) - 2 * sep); } @@ -330,10 +346,10 @@ static unsigned long readutf8esc (LexState *ls) { save_and_next(ls); /* skip 'u' */ esccheck(ls, ls->current == '{', "missing '{'"); r = gethexa(ls); /* must have at least one digit */ - while ((save_and_next(ls), lisxdigit(ls->current))) { + while (cast_void(save_and_next(ls)), lisxdigit(ls->current)) { i++; + esccheck(ls, r <= (0x7FFFFFFFu >> 4), "UTF-8 value too large"); r = (r << 4) + luaO_hexavalue(ls->current); - esccheck(ls, r <= 0x10FFFF, "UTF-8 value too large"); } esccheck(ls, ls->current == '}', "missing '}'"); next(ls); /* skip '}' */ @@ -444,9 +460,9 @@ static int llex (LexState *ls, SemInfo *seminfo) { /* else is a comment */ next(ls); if (ls->current == '[') { /* long comment? */ - int sep = skip_sep(ls); + size_t sep = skip_sep(ls); luaZ_resetbuffer(ls->buff); /* 'skip_sep' may dirty the buffer */ - if (sep >= 0) { + if (sep >= 2) { read_long_string(ls, NULL, sep); /* skip long comment */ luaZ_resetbuffer(ls->buff); /* previous call may dirty the buff. */ break; @@ -458,45 +474,45 @@ static int llex (LexState *ls, SemInfo *seminfo) { break; } case '[': { /* long string or simply '[' */ - int sep = skip_sep(ls); - if (sep >= 0) { + size_t sep = skip_sep(ls); + if (sep >= 2) { read_long_string(ls, seminfo, sep); return TK_STRING; } - else if (sep != -1) /* '[=...' missing second bracket */ + else if (sep == 0) /* '[=...' missing second bracket? */ lexerror(ls, "invalid long string delimiter", TK_STRING); return '['; } case '=': { next(ls); - if (check_next1(ls, '=')) return TK_EQ; + if (check_next1(ls, '=')) return TK_EQ; /* '==' */ else return '='; } case '<': { next(ls); - if (check_next1(ls, '=')) return TK_LE; - else if (check_next1(ls, '<')) return TK_SHL; + if (check_next1(ls, '=')) return TK_LE; /* '<=' */ + else if (check_next1(ls, '<')) return TK_SHL; /* '<<' */ else return '<'; } case '>': { next(ls); - if (check_next1(ls, '=')) return TK_GE; - else if (check_next1(ls, '>')) return TK_SHR; + if (check_next1(ls, '=')) return TK_GE; /* '>=' */ + else if (check_next1(ls, '>')) return TK_SHR; /* '>>' */ else return '>'; } case '/': { next(ls); - if (check_next1(ls, '/')) return TK_IDIV; + if (check_next1(ls, '/')) return TK_IDIV; /* '//' */ else return '/'; } case '~': { next(ls); - if (check_next1(ls, '=')) return TK_NE; + if (check_next1(ls, '=')) return TK_NE; /* '~=' */ else return '~'; } case ':': { next(ls); - if (check_next1(ls, ':')) return TK_DBCOLON; + if (check_next1(ls, ':')) return TK_DBCOLON; /* '::' */ else return ':'; } case '"': case '\'': { /* short literal strings */ @@ -535,7 +551,7 @@ static int llex (LexState *ls, SemInfo *seminfo) { return TK_NAME; } } - else { /* single-char tokens (+ - / ...) */ + else { /* single-char tokens ('+', '*', '%', '{', '}', ...) */ int c = ls->current; next(ls); return c; diff --git a/LuaSkin/lua-5.3.4/src/llex.h b/LuaSkin/lua-5.4.7/src/llex.h similarity index 88% rename from LuaSkin/lua-5.3.4/src/llex.h rename to LuaSkin/lua-5.4.7/src/llex.h index 2363d87e4..389d2f863 100644 --- a/LuaSkin/lua-5.3.4/src/llex.h +++ b/LuaSkin/lua-5.4.7/src/llex.h @@ -1,5 +1,5 @@ /* -** $Id: llex.h,v 1.79 2016/05/02 14:02:12 roberto Exp $ +** $Id: llex.h $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ @@ -7,11 +7,17 @@ #ifndef llex_h #define llex_h +#include + #include "lobject.h" #include "lzio.h" -#define FIRST_RESERVED 257 +/* +** Single-char tokens (terminal symbols) are represented by their own +** numeric code. Other tokens start at the following value. +*/ +#define FIRST_RESERVED (UCHAR_MAX + 1) #if !defined(LUA_ENV) @@ -37,7 +43,7 @@ enum RESERVED { }; /* number of reserved words */ -#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) +#define NUM_RESERVED (cast_int(TK_WHILE-FIRST_RESERVED + 1)) typedef union { diff --git a/LuaSkin/lua-5.4.7/src/llimits.h b/LuaSkin/lua-5.4.7/src/llimits.h new file mode 100644 index 000000000..1c826f7be --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/llimits.h @@ -0,0 +1,380 @@ +/* +** $Id: llimits.h $ +** Limits, basic types, and some other 'installation-dependent' definitions +** See Copyright Notice in lua.h +*/ + +#ifndef llimits_h +#define llimits_h + + +#include +#include + + +#include "lua.h" + + +/* +** 'lu_mem' and 'l_mem' are unsigned/signed integers big enough to count +** the total memory used by Lua (in bytes). Usually, 'size_t' and +** 'ptrdiff_t' should work, but we use 'long' for 16-bit machines. +*/ +#if defined(LUAI_MEM) /* { external definitions? */ +typedef LUAI_UMEM lu_mem; +typedef LUAI_MEM l_mem; +#elif LUAI_IS32INT /* }{ */ +typedef size_t lu_mem; +typedef ptrdiff_t l_mem; +#else /* 16-bit ints */ /* }{ */ +typedef unsigned long lu_mem; +typedef long l_mem; +#endif /* } */ + + +/* chars used as small naturals (so that 'char' is reserved for characters) */ +typedef unsigned char lu_byte; +typedef signed char ls_byte; + + +/* maximum value for size_t */ +#define MAX_SIZET ((size_t)(~(size_t)0)) + +/* maximum size visible for Lua (must be representable in a lua_Integer) */ +#define MAX_SIZE (sizeof(size_t) < sizeof(lua_Integer) ? MAX_SIZET \ + : (size_t)(LUA_MAXINTEGER)) + + +#define MAX_LUMEM ((lu_mem)(~(lu_mem)0)) + +#define MAX_LMEM ((l_mem)(MAX_LUMEM >> 1)) + + +#define MAX_INT INT_MAX /* maximum value of an int */ + + +/* +** floor of the log2 of the maximum signed value for integral type 't'. +** (That is, maximum 'n' such that '2^n' fits in the given signed type.) +*/ +#define log2maxs(t) (sizeof(t) * 8 - 2) + + +/* +** test whether an unsigned value is a power of 2 (or zero) +*/ +#define ispow2(x) (((x) & ((x) - 1)) == 0) + + +/* number of chars of a literal string without the ending \0 */ +#define LL(x) (sizeof(x)/sizeof(char) - 1) + + +/* +** conversion of pointer to unsigned integer: this is for hashing only; +** there is no problem if the integer cannot hold the whole pointer +** value. (In strict ISO C this may cause undefined behavior, but no +** actual machine seems to bother.) +*/ +#if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \ + __STDC_VERSION__ >= 199901L +#include +#if defined(UINTPTR_MAX) /* even in C99 this type is optional */ +#define L_P2I uintptr_t +#else /* no 'intptr'? */ +#define L_P2I uintmax_t /* use the largest available integer */ +#endif +#else /* C89 option */ +#define L_P2I size_t +#endif + +#define point2uint(p) ((unsigned int)((L_P2I)(p) & UINT_MAX)) + + + +/* types of 'usual argument conversions' for lua_Number and lua_Integer */ +typedef LUAI_UACNUMBER l_uacNumber; +typedef LUAI_UACINT l_uacInt; + + +/* +** Internal assertions for in-house debugging +*/ +#if defined LUAI_ASSERT +#undef NDEBUG +#include +#define lua_assert(c) assert(c) +#endif + +#if defined(lua_assert) +#define check_exp(c,e) (lua_assert(c), (e)) +/* to avoid problems with conditions too long */ +#define lua_longassert(c) ((c) ? (void)0 : lua_assert(0)) +#else +#define lua_assert(c) ((void)0) +#define check_exp(c,e) (e) +#define lua_longassert(c) ((void)0) +#endif + +/* +** assertion for checking API calls +*/ +#if !defined(luai_apicheck) +#define luai_apicheck(l,e) ((void)l, lua_assert(e)) +#endif + +#define api_check(l,e,msg) luai_apicheck(l,(e) && msg) + + +/* macro to avoid warnings about unused variables */ +#if !defined(UNUSED) +#define UNUSED(x) ((void)(x)) +#endif + + +/* type casts (a macro highlights casts in the code) */ +#define cast(t, exp) ((t)(exp)) + +#define cast_void(i) cast(void, (i)) +#define cast_voidp(i) cast(void *, (i)) +#define cast_num(i) cast(lua_Number, (i)) +#define cast_int(i) cast(int, (i)) +#define cast_uint(i) cast(unsigned int, (i)) +#define cast_byte(i) cast(lu_byte, (i)) +#define cast_uchar(i) cast(unsigned char, (i)) +#define cast_char(i) cast(char, (i)) +#define cast_charp(i) cast(char *, (i)) +#define cast_sizet(i) cast(size_t, (i)) + + +/* cast a signed lua_Integer to lua_Unsigned */ +#if !defined(l_castS2U) +#define l_castS2U(i) ((lua_Unsigned)(i)) +#endif + +/* +** cast a lua_Unsigned to a signed lua_Integer; this cast is +** not strict ISO C, but two-complement architectures should +** work fine. +*/ +#if !defined(l_castU2S) +#define l_castU2S(i) ((lua_Integer)(i)) +#endif + + +/* +** non-return type +*/ +#if !defined(l_noret) + +#if defined(__GNUC__) +#define l_noret void __attribute__((noreturn)) +#elif defined(_MSC_VER) && _MSC_VER >= 1200 +#define l_noret void __declspec(noreturn) +#else +#define l_noret void +#endif + +#endif + + +/* +** Inline functions +*/ +#if !defined(LUA_USE_C89) +#define l_inline inline +#elif defined(__GNUC__) +#define l_inline __inline__ +#else +#define l_inline /* empty */ +#endif + +#define l_sinline static l_inline + + +/* +** type for virtual-machine instructions; +** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) +*/ +#if LUAI_IS32INT +typedef unsigned int l_uint32; +#else +typedef unsigned long l_uint32; +#endif + +typedef l_uint32 Instruction; + + + +/* +** Maximum length for short strings, that is, strings that are +** internalized. (Cannot be smaller than reserved words or tags for +** metamethods, as these strings must be internalized; +** #("function") = 8, #("__newindex") = 10.) +*/ +#if !defined(LUAI_MAXSHORTLEN) +#define LUAI_MAXSHORTLEN 40 +#endif + + +/* +** Initial size for the string table (must be power of 2). +** The Lua core alone registers ~50 strings (reserved words + +** metaevent keys + a few others). Libraries would typically add +** a few dozens more. +*/ +#if !defined(MINSTRTABSIZE) +#define MINSTRTABSIZE 128 +#endif + + +/* +** Size of cache for strings in the API. 'N' is the number of +** sets (better be a prime) and "M" is the size of each set (M == 1 +** makes a direct cache.) +*/ +#if !defined(STRCACHE_N) +#define STRCACHE_N 53 +#define STRCACHE_M 2 +#endif + + +/* minimum size for string buffer */ +#if !defined(LUA_MINBUFFER) +#define LUA_MINBUFFER 32 +#endif + + +/* +** Maximum depth for nested C calls, syntactical nested non-terminals, +** and other features implemented through recursion in C. (Value must +** fit in a 16-bit unsigned integer. It must also be compatible with +** the size of the C stack.) +*/ +#if !defined(LUAI_MAXCCALLS) +#define LUAI_MAXCCALLS 200 +#endif + + +/* +** macros that are executed whenever program enters the Lua core +** ('lua_lock') and leaves the core ('lua_unlock') +*/ +#if !defined(lua_lock) +#define lua_lock(L) ((void) 0) +#define lua_unlock(L) ((void) 0) +#endif + +/* +** macro executed during Lua functions at points where the +** function can yield. +*/ +#if !defined(luai_threadyield) +#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} +#endif + + +/* +** these macros allow user-specific actions when a thread is +** created/deleted/resumed/yielded. +*/ +#if !defined(luai_userstateopen) +#define luai_userstateopen(L) ((void)L) +#endif + +#if !defined(luai_userstateclose) +#define luai_userstateclose(L) ((void)L) +#endif + +#if !defined(luai_userstatethread) +#define luai_userstatethread(L,L1) ((void)L) +#endif + +#if !defined(luai_userstatefree) +#define luai_userstatefree(L,L1) ((void)L) +#endif + +#if !defined(luai_userstateresume) +#define luai_userstateresume(L,n) ((void)L) +#endif + +#if !defined(luai_userstateyield) +#define luai_userstateyield(L,n) ((void)L) +#endif + + + +/* +** The luai_num* macros define the primitive operations over numbers. +*/ + +/* floor division (defined as 'floor(a/b)') */ +#if !defined(luai_numidiv) +#define luai_numidiv(L,a,b) ((void)L, l_floor(luai_numdiv(L,a,b))) +#endif + +/* float division */ +#if !defined(luai_numdiv) +#define luai_numdiv(L,a,b) ((a)/(b)) +#endif + +/* +** modulo: defined as 'a - floor(a/b)*b'; the direct computation +** using this definition has several problems with rounding errors, +** so it is better to use 'fmod'. 'fmod' gives the result of +** 'a - trunc(a/b)*b', and therefore must be corrected when +** 'trunc(a/b) ~= floor(a/b)'. That happens when the division has a +** non-integer negative result: non-integer result is equivalent to +** a non-zero remainder 'm'; negative result is equivalent to 'a' and +** 'b' with different signs, or 'm' and 'b' with different signs +** (as the result 'm' of 'fmod' has the same sign of 'a'). +*/ +#if !defined(luai_nummod) +#define luai_nummod(L,a,b,m) \ + { (void)L; (m) = l_mathop(fmod)(a,b); \ + if (((m) > 0) ? (b) < 0 : ((m) < 0 && (b) > 0)) (m) += (b); } +#endif + +/* exponentiation */ +#if !defined(luai_numpow) +#define luai_numpow(L,a,b) \ + ((void)L, (b == 2) ? (a)*(a) : l_mathop(pow)(a,b)) +#endif + +/* the others are quite standard operations */ +#if !defined(luai_numadd) +#define luai_numadd(L,a,b) ((a)+(b)) +#define luai_numsub(L,a,b) ((a)-(b)) +#define luai_nummul(L,a,b) ((a)*(b)) +#define luai_numunm(L,a) (-(a)) +#define luai_numeq(a,b) ((a)==(b)) +#define luai_numlt(a,b) ((a)<(b)) +#define luai_numle(a,b) ((a)<=(b)) +#define luai_numgt(a,b) ((a)>(b)) +#define luai_numge(a,b) ((a)>=(b)) +#define luai_numisnan(a) (!luai_numeq((a), (a))) +#endif + + + + + +/* +** macro to control inclusion of some hard tests on stack reallocation +*/ +#if !defined(HARDSTACKTESTS) +#define condmovestack(L,pre,pos) ((void)0) +#else +/* realloc stack keeping its size */ +#define condmovestack(L,pre,pos) \ + { int sz_ = stacksize(L); pre; luaD_reallocstack((L), sz_, 0); pos; } +#endif + +#if !defined(HARDMEMTESTS) +#define condchangemem(L,pre,pos) ((void)0) +#else +#define condchangemem(L,pre,pos) \ + { if (gcrunning(G(L))) { pre; luaC_fullgc(L, 0); pos; } } +#endif + +#endif diff --git a/LuaSkin/lua-5.4.7/src/lmathlib.c b/LuaSkin/lua-5.4.7/src/lmathlib.c new file mode 100644 index 000000000..438106348 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lmathlib.c @@ -0,0 +1,781 @@ +/* +** $Id: lmathlib.c $ +** Standard mathematical library +** See Copyright Notice in lua.h +*/ + +#define lmathlib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +#undef PI +#define PI (l_mathop(3.141592653589793238462643383279502884)) + + +static int math_abs (lua_State *L) { + if (lua_isinteger(L, 1)) { + lua_Integer n = lua_tointeger(L, 1); + if (n < 0) n = (lua_Integer)(0u - (lua_Unsigned)n); + lua_pushinteger(L, n); + } + else + lua_pushnumber(L, l_mathop(fabs)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_sin (lua_State *L) { + lua_pushnumber(L, l_mathop(sin)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_cos (lua_State *L) { + lua_pushnumber(L, l_mathop(cos)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_tan (lua_State *L) { + lua_pushnumber(L, l_mathop(tan)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_asin (lua_State *L) { + lua_pushnumber(L, l_mathop(asin)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_acos (lua_State *L) { + lua_pushnumber(L, l_mathop(acos)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_atan (lua_State *L) { + lua_Number y = luaL_checknumber(L, 1); + lua_Number x = luaL_optnumber(L, 2, 1); + lua_pushnumber(L, l_mathop(atan2)(y, x)); + return 1; +} + + +static int math_toint (lua_State *L) { + int valid; + lua_Integer n = lua_tointegerx(L, 1, &valid); + if (l_likely(valid)) + lua_pushinteger(L, n); + else { + luaL_checkany(L, 1); + luaL_pushfail(L); /* value is not convertible to integer */ + } + return 1; +} + + +static void pushnumint (lua_State *L, lua_Number d) { + lua_Integer n; + if (lua_numbertointeger(d, &n)) /* does 'd' fit in an integer? */ + lua_pushinteger(L, n); /* result is integer */ + else + lua_pushnumber(L, d); /* result is float */ +} + + +static int math_floor (lua_State *L) { + if (lua_isinteger(L, 1)) + lua_settop(L, 1); /* integer is its own floor */ + else { + lua_Number d = l_mathop(floor)(luaL_checknumber(L, 1)); + pushnumint(L, d); + } + return 1; +} + + +static int math_ceil (lua_State *L) { + if (lua_isinteger(L, 1)) + lua_settop(L, 1); /* integer is its own ceil */ + else { + lua_Number d = l_mathop(ceil)(luaL_checknumber(L, 1)); + pushnumint(L, d); + } + return 1; +} + + +static int math_fmod (lua_State *L) { + if (lua_isinteger(L, 1) && lua_isinteger(L, 2)) { + lua_Integer d = lua_tointeger(L, 2); + if ((lua_Unsigned)d + 1u <= 1u) { /* special cases: -1 or 0 */ + luaL_argcheck(L, d != 0, 2, "zero"); + lua_pushinteger(L, 0); /* avoid overflow with 0x80000... / -1 */ + } + else + lua_pushinteger(L, lua_tointeger(L, 1) % d); + } + else + lua_pushnumber(L, l_mathop(fmod)(luaL_checknumber(L, 1), + luaL_checknumber(L, 2))); + return 1; +} + + +/* +** next function does not use 'modf', avoiding problems with 'double*' +** (which is not compatible with 'float*') when lua_Number is not +** 'double'. +*/ +static int math_modf (lua_State *L) { + if (lua_isinteger(L ,1)) { + lua_settop(L, 1); /* number is its own integer part */ + lua_pushnumber(L, 0); /* no fractional part */ + } + else { + lua_Number n = luaL_checknumber(L, 1); + /* integer part (rounds toward zero) */ + lua_Number ip = (n < 0) ? l_mathop(ceil)(n) : l_mathop(floor)(n); + pushnumint(L, ip); + /* fractional part (test needed for inf/-inf) */ + lua_pushnumber(L, (n == ip) ? l_mathop(0.0) : (n - ip)); + } + return 2; +} + + +static int math_sqrt (lua_State *L) { + lua_pushnumber(L, l_mathop(sqrt)(luaL_checknumber(L, 1))); + return 1; +} + + +static int math_ult (lua_State *L) { + lua_Integer a = luaL_checkinteger(L, 1); + lua_Integer b = luaL_checkinteger(L, 2); + lua_pushboolean(L, (lua_Unsigned)a < (lua_Unsigned)b); + return 1; +} + +static int math_log (lua_State *L) { + lua_Number x = luaL_checknumber(L, 1); + lua_Number res; + if (lua_isnoneornil(L, 2)) + res = l_mathop(log)(x); + else { + lua_Number base = luaL_checknumber(L, 2); +#if !defined(LUA_USE_C89) + if (base == l_mathop(2.0)) + res = l_mathop(log2)(x); + else +#endif + if (base == l_mathop(10.0)) + res = l_mathop(log10)(x); + else + res = l_mathop(log)(x)/l_mathop(log)(base); + } + lua_pushnumber(L, res); + return 1; +} + +static int math_exp (lua_State *L) { + lua_pushnumber(L, l_mathop(exp)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_deg (lua_State *L) { + lua_pushnumber(L, luaL_checknumber(L, 1) * (l_mathop(180.0) / PI)); + return 1; +} + +static int math_rad (lua_State *L) { + lua_pushnumber(L, luaL_checknumber(L, 1) * (PI / l_mathop(180.0))); + return 1; +} + + +static int math_min (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + int imin = 1; /* index of current minimum value */ + int i; + luaL_argcheck(L, n >= 1, 1, "value expected"); + for (i = 2; i <= n; i++) { + if (lua_compare(L, i, imin, LUA_OPLT)) + imin = i; + } + lua_pushvalue(L, imin); + return 1; +} + + +static int math_max (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + int imax = 1; /* index of current maximum value */ + int i; + luaL_argcheck(L, n >= 1, 1, "value expected"); + for (i = 2; i <= n; i++) { + if (lua_compare(L, imax, i, LUA_OPLT)) + imax = i; + } + lua_pushvalue(L, imax); + return 1; +} + + +static int math_type (lua_State *L) { + if (lua_type(L, 1) == LUA_TNUMBER) + lua_pushstring(L, (lua_isinteger(L, 1)) ? "integer" : "float"); + else { + luaL_checkany(L, 1); + luaL_pushfail(L); + } + return 1; +} + + + +/* +** {================================================================== +** Pseudo-Random Number Generator based on 'xoshiro256**'. +** =================================================================== +*/ + +/* +** This code uses lots of shifts. ANSI C does not allow shifts greater +** than or equal to the width of the type being shifted, so some shifts +** are written in convoluted ways to match that restriction. For +** preprocessor tests, it assumes a width of 32 bits, so the maximum +** shift there is 31 bits. +*/ + + +/* number of binary digits in the mantissa of a float */ +#define FIGS l_floatatt(MANT_DIG) + +#if FIGS > 64 +/* there are only 64 random bits; use them all */ +#undef FIGS +#define FIGS 64 +#endif + + +/* +** LUA_RAND32 forces the use of 32-bit integers in the implementation +** of the PRN generator (mainly for testing). +*/ +#if !defined(LUA_RAND32) && !defined(Rand64) + +/* try to find an integer type with at least 64 bits */ + +#if ((ULONG_MAX >> 31) >> 31) >= 3 + +/* 'long' has at least 64 bits */ +#define Rand64 unsigned long +#define SRand64 long + +#elif !defined(LUA_USE_C89) && defined(LLONG_MAX) + +/* there is a 'long long' type (which must have at least 64 bits) */ +#define Rand64 unsigned long long +#define SRand64 long long + +#elif ((LUA_MAXUNSIGNED >> 31) >> 31) >= 3 + +/* 'lua_Unsigned' has at least 64 bits */ +#define Rand64 lua_Unsigned +#define SRand64 lua_Integer + +#endif + +#endif + + +#if defined(Rand64) /* { */ + +/* +** Standard implementation, using 64-bit integers. +** If 'Rand64' has more than 64 bits, the extra bits do not interfere +** with the 64 initial bits, except in a right shift. Moreover, the +** final result has to discard the extra bits. +*/ + +/* avoid using extra bits when needed */ +#define trim64(x) ((x) & 0xffffffffffffffffu) + + +/* rotate left 'x' by 'n' bits */ +static Rand64 rotl (Rand64 x, int n) { + return (x << n) | (trim64(x) >> (64 - n)); +} + +static Rand64 nextrand (Rand64 *state) { + Rand64 state0 = state[0]; + Rand64 state1 = state[1]; + Rand64 state2 = state[2] ^ state0; + Rand64 state3 = state[3] ^ state1; + Rand64 res = rotl(state1 * 5, 7) * 9; + state[0] = state0 ^ state3; + state[1] = state1 ^ state2; + state[2] = state2 ^ (state1 << 17); + state[3] = rotl(state3, 45); + return res; +} + + +/* +** Convert bits from a random integer into a float in the +** interval [0,1), getting the higher FIG bits from the +** random unsigned integer and converting that to a float. +** Some old Microsoft compilers cannot cast an unsigned long +** to a floating-point number, so we use a signed long as an +** intermediary. When lua_Number is float or double, the shift ensures +** that 'sx' is non negative; in that case, a good compiler will remove +** the correction. +*/ + +/* must throw out the extra (64 - FIGS) bits */ +#define shift64_FIG (64 - FIGS) + +/* 2^(-FIGS) == 2^-1 / 2^(FIGS-1) */ +#define scaleFIG (l_mathop(0.5) / ((Rand64)1 << (FIGS - 1))) + +static lua_Number I2d (Rand64 x) { + SRand64 sx = (SRand64)(trim64(x) >> shift64_FIG); + lua_Number res = (lua_Number)(sx) * scaleFIG; + if (sx < 0) + res += l_mathop(1.0); /* correct the two's complement if negative */ + lua_assert(0 <= res && res < 1); + return res; +} + +/* convert a 'Rand64' to a 'lua_Unsigned' */ +#define I2UInt(x) ((lua_Unsigned)trim64(x)) + +/* convert a 'lua_Unsigned' to a 'Rand64' */ +#define Int2I(x) ((Rand64)(x)) + + +#else /* no 'Rand64' }{ */ + +/* get an integer with at least 32 bits */ +#if LUAI_IS32INT +typedef unsigned int lu_int32; +#else +typedef unsigned long lu_int32; +#endif + + +/* +** Use two 32-bit integers to represent a 64-bit quantity. +*/ +typedef struct Rand64 { + lu_int32 h; /* higher half */ + lu_int32 l; /* lower half */ +} Rand64; + + +/* +** If 'lu_int32' has more than 32 bits, the extra bits do not interfere +** with the 32 initial bits, except in a right shift and comparisons. +** Moreover, the final result has to discard the extra bits. +*/ + +/* avoid using extra bits when needed */ +#define trim32(x) ((x) & 0xffffffffu) + + +/* +** basic operations on 'Rand64' values +*/ + +/* build a new Rand64 value */ +static Rand64 packI (lu_int32 h, lu_int32 l) { + Rand64 result; + result.h = h; + result.l = l; + return result; +} + +/* return i << n */ +static Rand64 Ishl (Rand64 i, int n) { + lua_assert(n > 0 && n < 32); + return packI((i.h << n) | (trim32(i.l) >> (32 - n)), i.l << n); +} + +/* i1 ^= i2 */ +static void Ixor (Rand64 *i1, Rand64 i2) { + i1->h ^= i2.h; + i1->l ^= i2.l; +} + +/* return i1 + i2 */ +static Rand64 Iadd (Rand64 i1, Rand64 i2) { + Rand64 result = packI(i1.h + i2.h, i1.l + i2.l); + if (trim32(result.l) < trim32(i1.l)) /* carry? */ + result.h++; + return result; +} + +/* return i * 5 */ +static Rand64 times5 (Rand64 i) { + return Iadd(Ishl(i, 2), i); /* i * 5 == (i << 2) + i */ +} + +/* return i * 9 */ +static Rand64 times9 (Rand64 i) { + return Iadd(Ishl(i, 3), i); /* i * 9 == (i << 3) + i */ +} + +/* return 'i' rotated left 'n' bits */ +static Rand64 rotl (Rand64 i, int n) { + lua_assert(n > 0 && n < 32); + return packI((i.h << n) | (trim32(i.l) >> (32 - n)), + (trim32(i.h) >> (32 - n)) | (i.l << n)); +} + +/* for offsets larger than 32, rotate right by 64 - offset */ +static Rand64 rotl1 (Rand64 i, int n) { + lua_assert(n > 32 && n < 64); + n = 64 - n; + return packI((trim32(i.h) >> n) | (i.l << (32 - n)), + (i.h << (32 - n)) | (trim32(i.l) >> n)); +} + +/* +** implementation of 'xoshiro256**' algorithm on 'Rand64' values +*/ +static Rand64 nextrand (Rand64 *state) { + Rand64 res = times9(rotl(times5(state[1]), 7)); + Rand64 t = Ishl(state[1], 17); + Ixor(&state[2], state[0]); + Ixor(&state[3], state[1]); + Ixor(&state[1], state[2]); + Ixor(&state[0], state[3]); + Ixor(&state[2], t); + state[3] = rotl1(state[3], 45); + return res; +} + + +/* +** Converts a 'Rand64' into a float. +*/ + +/* an unsigned 1 with proper type */ +#define UONE ((lu_int32)1) + + +#if FIGS <= 32 + +/* 2^(-FIGS) */ +#define scaleFIG (l_mathop(0.5) / (UONE << (FIGS - 1))) + +/* +** get up to 32 bits from higher half, shifting right to +** throw out the extra bits. +*/ +static lua_Number I2d (Rand64 x) { + lua_Number h = (lua_Number)(trim32(x.h) >> (32 - FIGS)); + return h * scaleFIG; +} + +#else /* 32 < FIGS <= 64 */ + +/* 2^(-FIGS) = 1.0 / 2^30 / 2^3 / 2^(FIGS-33) */ +#define scaleFIG \ + (l_mathop(1.0) / (UONE << 30) / l_mathop(8.0) / (UONE << (FIGS - 33))) + +/* +** use FIGS - 32 bits from lower half, throwing out the other +** (32 - (FIGS - 32)) = (64 - FIGS) bits +*/ +#define shiftLOW (64 - FIGS) + +/* +** higher 32 bits go after those (FIGS - 32) bits: shiftHI = 2^(FIGS - 32) +*/ +#define shiftHI ((lua_Number)(UONE << (FIGS - 33)) * l_mathop(2.0)) + + +static lua_Number I2d (Rand64 x) { + lua_Number h = (lua_Number)trim32(x.h) * shiftHI; + lua_Number l = (lua_Number)(trim32(x.l) >> shiftLOW); + return (h + l) * scaleFIG; +} + +#endif + + +/* convert a 'Rand64' to a 'lua_Unsigned' */ +static lua_Unsigned I2UInt (Rand64 x) { + return (((lua_Unsigned)trim32(x.h) << 31) << 1) | (lua_Unsigned)trim32(x.l); +} + +/* convert a 'lua_Unsigned' to a 'Rand64' */ +static Rand64 Int2I (lua_Unsigned n) { + return packI((lu_int32)((n >> 31) >> 1), (lu_int32)n); +} + +#endif /* } */ + + +/* +** A state uses four 'Rand64' values. +*/ +typedef struct { + Rand64 s[4]; +} RanState; + + +/* +** Project the random integer 'ran' into the interval [0, n]. +** Because 'ran' has 2^B possible values, the projection can only be +** uniform when the size of the interval is a power of 2 (exact +** division). Otherwise, to get a uniform projection into [0, n], we +** first compute 'lim', the smallest Mersenne number not smaller than +** 'n'. We then project 'ran' into the interval [0, lim]. If the result +** is inside [0, n], we are done. Otherwise, we try with another 'ran', +** until we have a result inside the interval. +*/ +static lua_Unsigned project (lua_Unsigned ran, lua_Unsigned n, + RanState *state) { + if ((n & (n + 1)) == 0) /* is 'n + 1' a power of 2? */ + return ran & n; /* no bias */ + else { + lua_Unsigned lim = n; + /* compute the smallest (2^b - 1) not smaller than 'n' */ + lim |= (lim >> 1); + lim |= (lim >> 2); + lim |= (lim >> 4); + lim |= (lim >> 8); + lim |= (lim >> 16); +#if (LUA_MAXUNSIGNED >> 31) >= 3 + lim |= (lim >> 32); /* integer type has more than 32 bits */ +#endif + lua_assert((lim & (lim + 1)) == 0 /* 'lim + 1' is a power of 2, */ + && lim >= n /* not smaller than 'n', */ + && (lim >> 1) < n); /* and it is the smallest one */ + while ((ran &= lim) > n) /* project 'ran' into [0..lim] */ + ran = I2UInt(nextrand(state->s)); /* not inside [0..n]? try again */ + return ran; + } +} + + +static int math_random (lua_State *L) { + lua_Integer low, up; + lua_Unsigned p; + RanState *state = (RanState *)lua_touserdata(L, lua_upvalueindex(1)); + Rand64 rv = nextrand(state->s); /* next pseudo-random value */ + switch (lua_gettop(L)) { /* check number of arguments */ + case 0: { /* no arguments */ + lua_pushnumber(L, I2d(rv)); /* float between 0 and 1 */ + return 1; + } + case 1: { /* only upper limit */ + low = 1; + up = luaL_checkinteger(L, 1); + if (up == 0) { /* single 0 as argument? */ + lua_pushinteger(L, I2UInt(rv)); /* full random integer */ + return 1; + } + break; + } + case 2: { /* lower and upper limits */ + low = luaL_checkinteger(L, 1); + up = luaL_checkinteger(L, 2); + break; + } + default: return luaL_error(L, "wrong number of arguments"); + } + /* random integer in the interval [low, up] */ + luaL_argcheck(L, low <= up, 1, "interval is empty"); + /* project random integer into the interval [0, up - low] */ + p = project(I2UInt(rv), (lua_Unsigned)up - (lua_Unsigned)low, state); + lua_pushinteger(L, p + (lua_Unsigned)low); + return 1; +} + + +static void setseed (lua_State *L, Rand64 *state, + lua_Unsigned n1, lua_Unsigned n2) { + int i; + state[0] = Int2I(n1); + state[1] = Int2I(0xff); /* avoid a zero state */ + state[2] = Int2I(n2); + state[3] = Int2I(0); + for (i = 0; i < 16; i++) + nextrand(state); /* discard initial values to "spread" seed */ + lua_pushinteger(L, n1); + lua_pushinteger(L, n2); +} + + +/* +** Set a "random" seed. To get some randomness, use the current time +** and the address of 'L' (in case the machine does address space layout +** randomization). +*/ +static void randseed (lua_State *L, RanState *state) { + lua_Unsigned seed1 = (lua_Unsigned)time(NULL); + lua_Unsigned seed2 = (lua_Unsigned)(size_t)L; + setseed(L, state->s, seed1, seed2); +} + + +static int math_randomseed (lua_State *L) { + RanState *state = (RanState *)lua_touserdata(L, lua_upvalueindex(1)); + if (lua_isnone(L, 1)) { + randseed(L, state); + } + else { + lua_Integer n1 = luaL_checkinteger(L, 1); + lua_Integer n2 = luaL_optinteger(L, 2, 0); + setseed(L, state->s, n1, n2); + } + return 2; /* return seeds */ +} + + +static const luaL_Reg randfuncs[] = { + {"random", math_random}, + {"randomseed", math_randomseed}, + {NULL, NULL} +}; + + +/* +** Register the random functions and initialize their state. +*/ +static void setrandfunc (lua_State *L) { + RanState *state = (RanState *)lua_newuserdatauv(L, sizeof(RanState), 0); + randseed(L, state); /* initialize with a "random" seed */ + lua_pop(L, 2); /* remove pushed seeds */ + luaL_setfuncs(L, randfuncs, 1); +} + +/* }================================================================== */ + + +/* +** {================================================================== +** Deprecated functions (for compatibility only) +** =================================================================== +*/ +#if defined(LUA_COMPAT_MATHLIB) + +static int math_cosh (lua_State *L) { + lua_pushnumber(L, l_mathop(cosh)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_sinh (lua_State *L) { + lua_pushnumber(L, l_mathop(sinh)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_tanh (lua_State *L) { + lua_pushnumber(L, l_mathop(tanh)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_pow (lua_State *L) { + lua_Number x = luaL_checknumber(L, 1); + lua_Number y = luaL_checknumber(L, 2); + lua_pushnumber(L, l_mathop(pow)(x, y)); + return 1; +} + +static int math_frexp (lua_State *L) { + int e; + lua_pushnumber(L, l_mathop(frexp)(luaL_checknumber(L, 1), &e)); + lua_pushinteger(L, e); + return 2; +} + +static int math_ldexp (lua_State *L) { + lua_Number x = luaL_checknumber(L, 1); + int ep = (int)luaL_checkinteger(L, 2); + lua_pushnumber(L, l_mathop(ldexp)(x, ep)); + return 1; +} + +static int math_log10 (lua_State *L) { + lua_pushnumber(L, l_mathop(log10)(luaL_checknumber(L, 1))); + return 1; +} + +#endif +/* }================================================================== */ + + + +static const luaL_Reg mathlib[] = { + {"abs", math_abs}, + {"acos", math_acos}, + {"asin", math_asin}, + {"atan", math_atan}, + {"ceil", math_ceil}, + {"cos", math_cos}, + {"deg", math_deg}, + {"exp", math_exp}, + {"tointeger", math_toint}, + {"floor", math_floor}, + {"fmod", math_fmod}, + {"ult", math_ult}, + {"log", math_log}, + {"max", math_max}, + {"min", math_min}, + {"modf", math_modf}, + {"rad", math_rad}, + {"sin", math_sin}, + {"sqrt", math_sqrt}, + {"tan", math_tan}, + {"type", math_type}, +#if defined(LUA_COMPAT_MATHLIB) + {"atan2", math_atan}, + {"cosh", math_cosh}, + {"sinh", math_sinh}, + {"tanh", math_tanh}, + {"pow", math_pow}, + {"frexp", math_frexp}, + {"ldexp", math_ldexp}, + {"log10", math_log10}, +#endif + /* placeholders */ + {"random", NULL}, + {"randomseed", NULL}, + {"pi", NULL}, + {"huge", NULL}, + {"maxinteger", NULL}, + {"mininteger", NULL}, + {NULL, NULL} +}; + + +/* +** Open math library +*/ +LUAMOD_API int luaopen_math (lua_State *L) { + luaL_newlib(L, mathlib); + lua_pushnumber(L, PI); + lua_setfield(L, -2, "pi"); + lua_pushnumber(L, (lua_Number)HUGE_VAL); + lua_setfield(L, -2, "huge"); + lua_pushinteger(L, LUA_MAXINTEGER); + lua_setfield(L, -2, "maxinteger"); + lua_pushinteger(L, LUA_MININTEGER); + lua_setfield(L, -2, "mininteger"); + setrandfunc(L); + return 1; +} + diff --git a/LuaSkin/lua-5.4.7/src/lmem.c b/LuaSkin/lua-5.4.7/src/lmem.c new file mode 100644 index 000000000..9800a86fc --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lmem.c @@ -0,0 +1,215 @@ +/* +** $Id: lmem.c $ +** Interface to Memory Manager +** See Copyright Notice in lua.h +*/ + +#define lmem_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" + + + +/* +** About the realloc function: +** void *frealloc (void *ud, void *ptr, size_t osize, size_t nsize); +** ('osize' is the old size, 'nsize' is the new size) +** +** - frealloc(ud, p, x, 0) frees the block 'p' and returns NULL. +** Particularly, frealloc(ud, NULL, 0, 0) does nothing, +** which is equivalent to free(NULL) in ISO C. +** +** - frealloc(ud, NULL, x, s) creates a new block of size 's' +** (no matter 'x'). Returns NULL if it cannot create the new block. +** +** - otherwise, frealloc(ud, b, x, y) reallocates the block 'b' from +** size 'x' to size 'y'. Returns NULL if it cannot reallocate the +** block to the new size. +*/ + + +/* +** Macro to call the allocation function. +*/ +#define callfrealloc(g,block,os,ns) ((*g->frealloc)(g->ud, block, os, ns)) + + +/* +** When an allocation fails, it will try again after an emergency +** collection, except when it cannot run a collection. The GC should +** not be called while the state is not fully built, as the collector +** is not yet fully initialized. Also, it should not be called when +** 'gcstopem' is true, because then the interpreter is in the middle of +** a collection step. +*/ +#define cantryagain(g) (completestate(g) && !g->gcstopem) + + + + +#if defined(EMERGENCYGCTESTS) +/* +** First allocation will fail except when freeing a block (frees never +** fail) and when it cannot try again; this fail will trigger 'tryagain' +** and a full GC cycle at every allocation. +*/ +static void *firsttry (global_State *g, void *block, size_t os, size_t ns) { + if (ns > 0 && cantryagain(g)) + return NULL; /* fail */ + else /* normal allocation */ + return callfrealloc(g, block, os, ns); +} +#else +#define firsttry(g,block,os,ns) callfrealloc(g, block, os, ns) +#endif + + + + + +/* +** {================================================================== +** Functions to allocate/deallocate arrays for the Parser +** =================================================================== +*/ + +/* +** Minimum size for arrays during parsing, to avoid overhead of +** reallocating to size 1, then 2, and then 4. All these arrays +** will be reallocated to exact sizes or erased when parsing ends. +*/ +#define MINSIZEARRAY 4 + + +void *luaM_growaux_ (lua_State *L, void *block, int nelems, int *psize, + int size_elems, int limit, const char *what) { + void *newblock; + int size = *psize; + if (nelems + 1 <= size) /* does one extra element still fit? */ + return block; /* nothing to be done */ + if (size >= limit / 2) { /* cannot double it? */ + if (l_unlikely(size >= limit)) /* cannot grow even a little? */ + luaG_runerror(L, "too many %s (limit is %d)", what, limit); + size = limit; /* still have at least one free place */ + } + else { + size *= 2; + if (size < MINSIZEARRAY) + size = MINSIZEARRAY; /* minimum size */ + } + lua_assert(nelems + 1 <= size && size <= limit); + /* 'limit' ensures that multiplication will not overflow */ + newblock = luaM_saferealloc_(L, block, cast_sizet(*psize) * size_elems, + cast_sizet(size) * size_elems); + *psize = size; /* update only when everything else is OK */ + return newblock; +} + + +/* +** In prototypes, the size of the array is also its number of +** elements (to save memory). So, if it cannot shrink an array +** to its number of elements, the only option is to raise an +** error. +*/ +void *luaM_shrinkvector_ (lua_State *L, void *block, int *size, + int final_n, int size_elem) { + void *newblock; + size_t oldsize = cast_sizet((*size) * size_elem); + size_t newsize = cast_sizet(final_n * size_elem); + lua_assert(newsize <= oldsize); + newblock = luaM_saferealloc_(L, block, oldsize, newsize); + *size = final_n; + return newblock; +} + +/* }================================================================== */ + + +l_noret luaM_toobig (lua_State *L) { + luaG_runerror(L, "memory allocation error: block too big"); +} + + +/* +** Free memory +*/ +void luaM_free_ (lua_State *L, void *block, size_t osize) { + global_State *g = G(L); + lua_assert((osize == 0) == (block == NULL)); + callfrealloc(g, block, osize, 0); + g->GCdebt -= osize; +} + + +/* +** In case of allocation fail, this function will do an emergency +** collection to free some memory and then try the allocation again. +*/ +static void *tryagain (lua_State *L, void *block, + size_t osize, size_t nsize) { + global_State *g = G(L); + if (cantryagain(g)) { + luaC_fullgc(L, 1); /* try to free some memory... */ + return callfrealloc(g, block, osize, nsize); /* try again */ + } + else return NULL; /* cannot run an emergency collection */ +} + + +/* +** Generic allocation routine. +*/ +void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { + void *newblock; + global_State *g = G(L); + lua_assert((osize == 0) == (block == NULL)); + newblock = firsttry(g, block, osize, nsize); + if (l_unlikely(newblock == NULL && nsize > 0)) { + newblock = tryagain(L, block, osize, nsize); + if (newblock == NULL) /* still no memory? */ + return NULL; /* do not update 'GCdebt' */ + } + lua_assert((nsize == 0) == (newblock == NULL)); + g->GCdebt = (g->GCdebt + nsize) - osize; + return newblock; +} + + +void *luaM_saferealloc_ (lua_State *L, void *block, size_t osize, + size_t nsize) { + void *newblock = luaM_realloc_(L, block, osize, nsize); + if (l_unlikely(newblock == NULL && nsize > 0)) /* allocation failed? */ + luaM_error(L); + return newblock; +} + + +void *luaM_malloc_ (lua_State *L, size_t size, int tag) { + if (size == 0) + return NULL; /* that's all */ + else { + global_State *g = G(L); + void *newblock = firsttry(g, NULL, tag, size); + if (l_unlikely(newblock == NULL)) { + newblock = tryagain(L, NULL, tag, size); + if (newblock == NULL) + luaM_error(L); + } + g->GCdebt += size; + return newblock; + } +} diff --git a/LuaSkin/lua-5.4.7/src/lmem.h b/LuaSkin/lua-5.4.7/src/lmem.h new file mode 100644 index 000000000..8c75a44be --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lmem.h @@ -0,0 +1,93 @@ +/* +** $Id: lmem.h $ +** Interface to Memory Manager +** See Copyright Notice in lua.h +*/ + +#ifndef lmem_h +#define lmem_h + + +#include + +#include "llimits.h" +#include "lua.h" + + +#define luaM_error(L) luaD_throw(L, LUA_ERRMEM) + + +/* +** This macro tests whether it is safe to multiply 'n' by the size of +** type 't' without overflows. Because 'e' is always constant, it avoids +** the runtime division MAX_SIZET/(e). +** (The macro is somewhat complex to avoid warnings: The 'sizeof' +** comparison avoids a runtime comparison when overflow cannot occur. +** The compiler should be able to optimize the real test by itself, but +** when it does it, it may give a warning about "comparison is always +** false due to limited range of data type"; the +1 tricks the compiler, +** avoiding this warning but also this optimization.) +*/ +#define luaM_testsize(n,e) \ + (sizeof(n) >= sizeof(size_t) && cast_sizet((n)) + 1 > MAX_SIZET/(e)) + +#define luaM_checksize(L,n,e) \ + (luaM_testsize(n,e) ? luaM_toobig(L) : cast_void(0)) + + +/* +** Computes the minimum between 'n' and 'MAX_SIZET/sizeof(t)', so that +** the result is not larger than 'n' and cannot overflow a 'size_t' +** when multiplied by the size of type 't'. (Assumes that 'n' is an +** 'int' or 'unsigned int' and that 'int' is not larger than 'size_t'.) +*/ +#define luaM_limitN(n,t) \ + ((cast_sizet(n) <= MAX_SIZET/sizeof(t)) ? (n) : \ + cast_uint((MAX_SIZET/sizeof(t)))) + + +/* +** Arrays of chars do not need any test +*/ +#define luaM_reallocvchar(L,b,on,n) \ + cast_charp(luaM_saferealloc_(L, (b), (on)*sizeof(char), (n)*sizeof(char))) + +#define luaM_freemem(L, b, s) luaM_free_(L, (b), (s)) +#define luaM_free(L, b) luaM_free_(L, (b), sizeof(*(b))) +#define luaM_freearray(L, b, n) luaM_free_(L, (b), (n)*sizeof(*(b))) + +#define luaM_new(L,t) cast(t*, luaM_malloc_(L, sizeof(t), 0)) +#define luaM_newvector(L,n,t) cast(t*, luaM_malloc_(L, (n)*sizeof(t), 0)) +#define luaM_newvectorchecked(L,n,t) \ + (luaM_checksize(L,n,sizeof(t)), luaM_newvector(L,n,t)) + +#define luaM_newobject(L,tag,s) luaM_malloc_(L, (s), tag) + +#define luaM_growvector(L,v,nelems,size,t,limit,e) \ + ((v)=cast(t *, luaM_growaux_(L,v,nelems,&(size),sizeof(t), \ + luaM_limitN(limit,t),e))) + +#define luaM_reallocvector(L, v,oldn,n,t) \ + (cast(t *, luaM_realloc_(L, v, cast_sizet(oldn) * sizeof(t), \ + cast_sizet(n) * sizeof(t)))) + +#define luaM_shrinkvector(L,v,size,fs,t) \ + ((v)=cast(t *, luaM_shrinkvector_(L, v, &(size), fs, sizeof(t)))) + +LUAI_FUNC l_noret luaM_toobig (lua_State *L); + +/* not to be called directly */ +LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, + size_t size); +LUAI_FUNC void *luaM_saferealloc_ (lua_State *L, void *block, size_t oldsize, + size_t size); +LUAI_FUNC void luaM_free_ (lua_State *L, void *block, size_t osize); +LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int nelems, + int *size, int size_elem, int limit, + const char *what); +LUAI_FUNC void *luaM_shrinkvector_ (lua_State *L, void *block, int *nelem, + int final_n, int size_elem); +LUAI_FUNC void *luaM_malloc_ (lua_State *L, size_t size, int tag); + +#endif + diff --git a/LuaSkin/lua-5.3.4/src/loadlib.c b/LuaSkin/lua-5.4.7/src/loadlib.c similarity index 75% rename from LuaSkin/lua-5.3.4/src/loadlib.c rename to LuaSkin/lua-5.4.7/src/loadlib.c index 4791e748b..6d289fceb 100644 --- a/LuaSkin/lua-5.3.4/src/loadlib.c +++ b/LuaSkin/lua-5.4.7/src/loadlib.c @@ -1,5 +1,5 @@ /* -** $Id: loadlib.c,v 1.130 2017/01/12 17:14:26 roberto Exp $ +** $Id: loadlib.c $ ** Dynamic library loader for Lua ** See Copyright Notice in lua.h ** @@ -24,15 +24,6 @@ #include "lualib.h" -/* -** LUA_IGMARK is a mark to ignore all before it when building the -** luaopen_ function name. -*/ -#if !defined (LUA_IGMARK) -#define LUA_IGMARK "-" -#endif - - /* ** LUA_CSUBSEP is the character that replaces dots in submodule names ** when searching for a C loader. @@ -56,10 +47,10 @@ /* -** unique key for table in the registry that keeps handles +** key for table in the registry that keeps handles ** for all loaded C libraries */ -static const int CLIBS = 0; +static const char *const CLIBS = "_CLIBS"; #define LIB_FAIL "open" @@ -67,6 +58,13 @@ static const int CLIBS = 0; #define setprogdir(L) ((void)0) +/* +** Special type equivalent to '(void*)' for functions in gcc +** (to suppress warnings when converting function pointers) +*/ +typedef void (*voidf)(void); + + /* ** system-dependent functions */ @@ -125,14 +123,16 @@ static void lsys_unloadlib (void *lib) { static void *lsys_load (lua_State *L, const char *path, int seeglb) { void *lib = dlopen(path, RTLD_NOW | (seeglb ? RTLD_GLOBAL : RTLD_LOCAL)); - if (lib == NULL) lua_pushstring(L, dlerror()); + if (l_unlikely(lib == NULL)) + lua_pushstring(L, dlerror()); return lib; } static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) { lua_CFunction f = cast_func(dlsym(lib, sym)); - if (f == NULL) lua_pushstring(L, dlerror()); + if (l_unlikely(f == NULL)) + lua_pushstring(L, dlerror()); return f; } @@ -206,7 +206,7 @@ static void *lsys_load (lua_State *L, const char *path, int seeglb) { static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) { - lua_CFunction f = (lua_CFunction)GetProcAddress((HMODULE)lib, sym); + lua_CFunction f = (lua_CFunction)(voidf)GetProcAddress((HMODULE)lib, sym); if (f == NULL) pusherror(L); return f; } @@ -269,8 +269,6 @@ static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) { #endif -#define AUXMARK "\1" /* auxiliary mark */ - /* ** return registry.LUA_NOENV as a boolean @@ -290,22 +288,33 @@ static int noenv (lua_State *L) { static void setpath (lua_State *L, const char *fieldname, const char *envname, const char *dft) { + const char *dftmark; const char *nver = lua_pushfstring(L, "%s%s", envname, LUA_VERSUFFIX); - const char *path = getenv(nver); /* use versioned name */ - if (path == NULL) /* no environment variable? */ + const char *path = getenv(nver); /* try versioned name */ + if (path == NULL) /* no versioned environment variable? */ path = getenv(envname); /* try unversioned name */ if (path == NULL || noenv(L)) /* no environment variable? */ lua_pushstring(L, dft); /* use default */ - else { - /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */ - path = luaL_gsub(L, path, LUA_PATH_SEP LUA_PATH_SEP, - LUA_PATH_SEP AUXMARK LUA_PATH_SEP); - luaL_gsub(L, path, AUXMARK, dft); - lua_remove(L, -2); /* remove result from 1st 'gsub' */ + else if ((dftmark = strstr(path, LUA_PATH_SEP LUA_PATH_SEP)) == NULL) + lua_pushstring(L, path); /* nothing to change */ + else { /* path contains a ";;": insert default path in its place */ + size_t len = strlen(path); + luaL_Buffer b; + luaL_buffinit(L, &b); + if (path < dftmark) { /* is there a prefix before ';;'? */ + luaL_addlstring(&b, path, dftmark - path); /* add it */ + luaL_addchar(&b, *LUA_PATH_SEP); + } + luaL_addstring(&b, dft); /* add default */ + if (dftmark < path + len - 2) { /* is there a suffix after ';;'? */ + luaL_addchar(&b, *LUA_PATH_SEP); + luaL_addlstring(&b, dftmark + 2, (path + len - 2) - dftmark); + } + luaL_pushresult(&b); } setprogdir(L); lua_setfield(L, -3, fieldname); /* package[fieldname] = path value */ - lua_pop(L, 1); /* pop versioned variable name */ + lua_pop(L, 1); /* pop versioned variable name ('nver') */ } /* }================================================================== */ @@ -316,7 +325,7 @@ static void setpath (lua_State *L, const char *fieldname, */ static void *checkclib (lua_State *L, const char *path) { void *plib; - lua_rawgetp(L, LUA_REGISTRYINDEX, &CLIBS); + lua_getfield(L, LUA_REGISTRYINDEX, CLIBS); lua_getfield(L, -1, path); plib = lua_touserdata(L, -1); /* plib = CLIBS[path] */ lua_pop(L, 2); /* pop CLIBS table and 'plib' */ @@ -329,7 +338,7 @@ static void *checkclib (lua_State *L, const char *path) { ** registry.CLIBS[#CLIBS + 1] = plib -- also keep a list of all libraries */ static void addtoclib (lua_State *L, const char *path, void *plib) { - lua_rawgetp(L, LUA_REGISTRYINDEX, &CLIBS); + lua_getfield(L, LUA_REGISTRYINDEX, CLIBS); lua_pushlightuserdata(L, plib); lua_pushvalue(L, -1); lua_setfield(L, -3, path); /* CLIBS[path] = plib */ @@ -394,13 +403,13 @@ static int ll_loadlib (lua_State *L) { const char *path = luaL_checkstring(L, 1); const char *init = luaL_checkstring(L, 2); int stat = lookforfunc(L, path, init); - if (stat == 0) /* no errors? */ + if (l_likely(stat == 0)) /* no errors? */ return 1; /* return the loaded function */ else { /* error; error message is on stack top */ - lua_pushnil(L); + luaL_pushfail(L); lua_insert(L, -2); lua_pushstring(L, (stat == ERRLIB) ? LIB_FAIL : "init"); - return 3; /* return nil, error message, and where */ + return 3; /* return fail, error message, and where */ } } @@ -421,14 +430,42 @@ static int readable (const char *filename) { } -static const char *pushnexttemplate (lua_State *L, const char *path) { - const char *l; - while (*path == *LUA_PATH_SEP) path++; /* skip separators */ - if (*path == '\0') return NULL; /* no more templates */ - l = strchr(path, *LUA_PATH_SEP); /* find next separator */ - if (l == NULL) l = path + strlen(path); - lua_pushlstring(L, path, l - path); /* template */ - return l; +/* +** Get the next name in '*path' = 'name1;name2;name3;...', changing +** the ending ';' to '\0' to create a zero-terminated string. Return +** NULL when list ends. +*/ +static const char *getnextfilename (char **path, char *end) { + char *sep; + char *name = *path; + if (name == end) + return NULL; /* no more names */ + else if (*name == '\0') { /* from previous iteration? */ + *name = *LUA_PATH_SEP; /* restore separator */ + name++; /* skip it */ + } + sep = strchr(name, *LUA_PATH_SEP); /* find next separator */ + if (sep == NULL) /* separator not found? */ + sep = end; /* name goes until the end */ + *sep = '\0'; /* finish file name */ + *path = sep; /* will start next search from here */ + return name; +} + + +/* +** Given a path such as ";blabla.so;blublu.so", pushes the string +** +** no file 'blabla.so' +** no file 'blublu.so' +*/ +static void pusherrornotfound (lua_State *L, const char *path) { + luaL_Buffer b; + luaL_buffinit(L, &b); + luaL_addstring(&b, "no file '"); + luaL_addgsub(&b, path, LUA_PATH_SEP, "'\n\tno file '"); + luaL_addstring(&b, "'"); + luaL_pushresult(&b); } @@ -436,21 +473,25 @@ static const char *searchpath (lua_State *L, const char *name, const char *path, const char *sep, const char *dirsep) { - luaL_Buffer msg; /* to build error message */ - luaL_buffinit(L, &msg); - if (*sep != '\0') /* non-empty separator? */ + luaL_Buffer buff; + char *pathname; /* path with name inserted */ + char *endpathname; /* its end */ + const char *filename; + /* separator is non-empty and appears in 'name'? */ + if (*sep != '\0' && strchr(name, *sep) != NULL) name = luaL_gsub(L, name, sep, dirsep); /* replace it by 'dirsep' */ - while ((path = pushnexttemplate(L, path)) != NULL) { - const char *filename = luaL_gsub(L, lua_tostring(L, -1), - LUA_PATH_MARK, name); - lua_remove(L, -2); /* remove path template */ + luaL_buffinit(L, &buff); + /* add path to the buffer, replacing marks ('?') with the file name */ + luaL_addgsub(&buff, path, LUA_PATH_MARK, name); + luaL_addchar(&buff, '\0'); + pathname = luaL_buffaddr(&buff); /* writable list of file names */ + endpathname = pathname + luaL_bufflen(&buff) - 1; + while ((filename = getnextfilename(&pathname, endpathname)) != NULL) { if (readable(filename)) /* does file exist and is readable? */ - return filename; /* return that file name */ - lua_pushfstring(L, "\n\tno file '%s'", filename); - lua_remove(L, -2); /* remove file name */ - luaL_addvalue(&msg); /* concatenate error msg. entry */ + return lua_pushstring(L, filename); /* save and return name */ } - luaL_pushresult(&msg); /* create error message */ + luaL_pushresult(&buff); /* push path to create error message */ + pusherrornotfound(L, lua_tostring(L, -1)); /* create error message */ return NULL; /* not found */ } @@ -462,9 +503,9 @@ static int ll_searchpath (lua_State *L) { luaL_optstring(L, 4, LUA_DIRSEP)); if (f != NULL) return 1; else { /* error message is on top of the stack */ - lua_pushnil(L); + luaL_pushfail(L); lua_insert(L, -2); - return 2; /* return nil + error message */ + return 2; /* return fail + error message */ } } @@ -475,14 +516,14 @@ static const char *findfile (lua_State *L, const char *name, const char *path; lua_getfield(L, lua_upvalueindex(1), pname); path = lua_tostring(L, -1); - if (path == NULL) + if (l_unlikely(path == NULL)) luaL_error(L, "'package.%s' must be a string", pname); return searchpath(L, name, path, ".", dirsep); } static int checkload (lua_State *L, int stat, const char *filename) { - if (stat) { /* module loaded successfully? */ + if (l_likely(stat)) { /* module loaded successfully? */ lua_pushstring(L, filename); /* will be 2nd argument to module */ return 2; /* return open function and file name */ } @@ -548,7 +589,7 @@ static int searcher_Croot (lua_State *L) { if (stat != ERRFUNC) return checkload(L, 0, filename); /* real error */ else { /* open function not found */ - lua_pushfstring(L, "\n\tno module '%s' in file '%s'", name, filename); + lua_pushfstring(L, "no module '%s' in file '%s'", name, filename); return 1; } } @@ -560,23 +601,31 @@ static int searcher_Croot (lua_State *L) { static int searcher_preload (lua_State *L) { const char *name = luaL_checkstring(L, 1); lua_getfield(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE); - if (lua_getfield(L, -1, name) == LUA_TNIL) /* not found? */ - lua_pushfstring(L, "\n\tno field package.preload['%s']", name); - return 1; + if (lua_getfield(L, -1, name) == LUA_TNIL) { /* not found? */ + lua_pushfstring(L, "no field package.preload['%s']", name); + return 1; + } + else { + lua_pushliteral(L, ":preload:"); + return 2; + } } static void findloader (lua_State *L, const char *name) { int i; luaL_Buffer msg; /* to build error message */ - luaL_buffinit(L, &msg); /* push 'package.searchers' to index 3 in the stack */ - if (lua_getfield(L, lua_upvalueindex(1), "searchers") != LUA_TTABLE) + if (l_unlikely(lua_getfield(L, lua_upvalueindex(1), "searchers") + != LUA_TTABLE)) luaL_error(L, "'package.searchers' must be a table"); + luaL_buffinit(L, &msg); /* iterate over available searchers to find a loader */ for (i = 1; ; i++) { - if (lua_rawgeti(L, 3, i) == LUA_TNIL) { /* no more searchers? */ + luaL_addstring(&msg, "\n\t"); /* error-message prefix */ + if (l_unlikely(lua_rawgeti(L, 3, i) == LUA_TNIL)) { /* no more searchers? */ lua_pop(L, 1); /* remove nil */ + luaL_buffsub(&msg, 2); /* remove prefix */ luaL_pushresult(&msg); /* create error message */ luaL_error(L, "module '%s' not found:%s", name, lua_tostring(L, -1)); } @@ -588,8 +637,10 @@ static void findloader (lua_State *L, const char *name) { lua_pop(L, 1); /* remove extra return */ luaL_addvalue(&msg); /* concatenate error message */ } - else + else { /* no error message */ lua_pop(L, 2); /* remove both returns */ + luaL_buffsub(&msg, 2); /* remove prefix */ + } } } @@ -604,113 +655,33 @@ static int ll_require (lua_State *L) { /* else must load package */ lua_pop(L, 1); /* remove 'getfield' result */ findloader(L, name); - lua_pushstring(L, name); /* pass name as argument to module loader */ - lua_insert(L, -2); /* name is 1st argument (before search data) */ + lua_rotate(L, -2, 1); /* function <-> loader data */ + lua_pushvalue(L, 1); /* name is 1st argument to module loader */ + lua_pushvalue(L, -3); /* loader data is 2nd argument */ + /* stack: ...; loader data; loader function; mod. name; loader data */ lua_call(L, 2, 1); /* run loader to load module */ + /* stack: ...; loader data; result from loader */ if (!lua_isnil(L, -1)) /* non-nil return? */ lua_setfield(L, 2, name); /* LOADED[name] = returned value */ + else + lua_pop(L, 1); /* pop nil */ if (lua_getfield(L, 2, name) == LUA_TNIL) { /* module set no value? */ lua_pushboolean(L, 1); /* use true as result */ - lua_pushvalue(L, -1); /* extra copy to be returned */ + lua_copy(L, -1, -2); /* replace loader result */ lua_setfield(L, 2, name); /* LOADED[name] = true */ } - return 1; + lua_rotate(L, -2, 1); /* loader data <-> module result */ + return 2; /* return module result and loader data */ } /* }====================================================== */ -/* -** {====================================================== -** 'module' function -** ======================================================= -*/ -#if defined(LUA_COMPAT_MODULE) - -/* -** changes the environment variable of calling function -*/ -static void set_env (lua_State *L) { - lua_Debug ar; - if (lua_getstack(L, 1, &ar) == 0 || - lua_getinfo(L, "f", &ar) == 0 || /* get calling function */ - lua_iscfunction(L, -1)) - luaL_error(L, "'module' not called from a Lua function"); - lua_pushvalue(L, -2); /* copy new environment table to top */ - lua_setupvalue(L, -2, 1); - lua_pop(L, 1); /* remove function */ -} - - -static void dooptions (lua_State *L, int n) { - int i; - for (i = 2; i <= n; i++) { - if (lua_isfunction(L, i)) { /* avoid 'calling' extra info. */ - lua_pushvalue(L, i); /* get option (a function) */ - lua_pushvalue(L, -2); /* module */ - lua_call(L, 1, 0); - } - } -} - - -static void modinit (lua_State *L, const char *modname) { - const char *dot; - lua_pushvalue(L, -1); - lua_setfield(L, -2, "_M"); /* module._M = module */ - lua_pushstring(L, modname); - lua_setfield(L, -2, "_NAME"); - dot = strrchr(modname, '.'); /* look for last dot in module name */ - if (dot == NULL) dot = modname; - else dot++; - /* set _PACKAGE as package name (full module name minus last part) */ - lua_pushlstring(L, modname, dot - modname); - lua_setfield(L, -2, "_PACKAGE"); -} - - -static int ll_module (lua_State *L) { - const char *modname = luaL_checkstring(L, 1); - int lastarg = lua_gettop(L); /* last parameter */ - luaL_pushmodule(L, modname, 1); /* get/create module table */ - /* check whether table already has a _NAME field */ - if (lua_getfield(L, -1, "_NAME") != LUA_TNIL) - lua_pop(L, 1); /* table is an initialized module */ - else { /* no; initialize it */ - lua_pop(L, 1); - modinit(L, modname); - } - lua_pushvalue(L, -1); - set_env(L); - dooptions(L, lastarg); - return 1; -} - - -static int ll_seeall (lua_State *L) { - luaL_checktype(L, 1, LUA_TTABLE); - if (!lua_getmetatable(L, 1)) { - lua_createtable(L, 0, 1); /* create new metatable */ - lua_pushvalue(L, -1); - lua_setmetatable(L, 1); - } - lua_pushglobaltable(L); - lua_setfield(L, -2, "__index"); /* mt.__index = _G */ - return 0; -} - -#endif -/* }====================================================== */ - - static const luaL_Reg pk_funcs[] = { {"loadlib", ll_loadlib}, {"searchpath", ll_searchpath}, -#if defined(LUA_COMPAT_MODULE) - {"seeall", ll_seeall}, -#endif /* placeholders */ {"preload", NULL}, {"cpath", NULL}, @@ -722,17 +693,19 @@ static const luaL_Reg pk_funcs[] = { static const luaL_Reg ll_funcs[] = { -#if defined(LUA_COMPAT_MODULE) - {"module", ll_module}, -#endif {"require", ll_require}, {NULL, NULL} }; static void createsearcherstable (lua_State *L) { - static const lua_CFunction searchers[] = - {searcher_preload, searcher_Lua, searcher_C, searcher_Croot, NULL}; + static const lua_CFunction searchers[] = { + searcher_preload, + searcher_Lua, + searcher_C, + searcher_Croot, + NULL + }; int i; /* create 'searchers' table */ lua_createtable(L, sizeof(searchers)/sizeof(searchers[0]) - 1, 0); @@ -742,10 +715,6 @@ static void createsearcherstable (lua_State *L) { lua_pushcclosure(L, searchers[i], 1); lua_rawseti(L, -2, i+1); } -#if defined(LUA_COMPAT_LOADERS) - lua_pushvalue(L, -1); /* make a copy of 'searchers' table */ - lua_setfield(L, -3, "loaders"); /* put it in field 'loaders' */ -#endif lua_setfield(L, -2, "searchers"); /* put it in field 'searchers' */ } @@ -755,12 +724,11 @@ static void createsearcherstable (lua_State *L) { ** setting a finalizer to close all libraries when closing state. */ static void createclibstable (lua_State *L) { - lua_newtable(L); /* create CLIBS table */ + luaL_getsubtable(L, LUA_REGISTRYINDEX, CLIBS); /* create CLIBS table */ lua_createtable(L, 0, 1); /* create metatable for CLIBS */ lua_pushcfunction(L, gctm); lua_setfield(L, -2, "__gc"); /* set finalizer for CLIBS table */ lua_setmetatable(L, -2); - lua_rawsetp(L, LUA_REGISTRYINDEX, &CLIBS); /* set CLIBS table in registry */ } diff --git a/LuaSkin/lua-5.4.7/src/lobject.c b/LuaSkin/lua-5.4.7/src/lobject.c new file mode 100644 index 000000000..9cfa5227e --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lobject.c @@ -0,0 +1,602 @@ +/* +** $Id: lobject.c $ +** Some generic functions over Lua objects +** See Copyright Notice in lua.h +*/ + +#define lobject_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include +#include +#include +#include +#include + +#include "lua.h" + +#include "lctype.h" +#include "ldebug.h" +#include "ldo.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "lvm.h" + + +/* +** Computes ceil(log2(x)) +*/ +int luaO_ceillog2 (unsigned int x) { + static const lu_byte log_2[256] = { /* log_2[i] = ceil(log2(i - 1)) */ + 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 + }; + int l = 0; + x--; + while (x >= 256) { l += 8; x >>= 8; } + return l + log_2[x]; +} + + +static lua_Integer intarith (lua_State *L, int op, lua_Integer v1, + lua_Integer v2) { + switch (op) { + case LUA_OPADD: return intop(+, v1, v2); + case LUA_OPSUB:return intop(-, v1, v2); + case LUA_OPMUL:return intop(*, v1, v2); + case LUA_OPMOD: return luaV_mod(L, v1, v2); + case LUA_OPIDIV: return luaV_idiv(L, v1, v2); + case LUA_OPBAND: return intop(&, v1, v2); + case LUA_OPBOR: return intop(|, v1, v2); + case LUA_OPBXOR: return intop(^, v1, v2); + case LUA_OPSHL: return luaV_shiftl(v1, v2); + case LUA_OPSHR: return luaV_shiftr(v1, v2); + case LUA_OPUNM: return intop(-, 0, v1); + case LUA_OPBNOT: return intop(^, ~l_castS2U(0), v1); + default: lua_assert(0); return 0; + } +} + + +static lua_Number numarith (lua_State *L, int op, lua_Number v1, + lua_Number v2) { + switch (op) { + case LUA_OPADD: return luai_numadd(L, v1, v2); + case LUA_OPSUB: return luai_numsub(L, v1, v2); + case LUA_OPMUL: return luai_nummul(L, v1, v2); + case LUA_OPDIV: return luai_numdiv(L, v1, v2); + case LUA_OPPOW: return luai_numpow(L, v1, v2); + case LUA_OPIDIV: return luai_numidiv(L, v1, v2); + case LUA_OPUNM: return luai_numunm(L, v1); + case LUA_OPMOD: return luaV_modf(L, v1, v2); + default: lua_assert(0); return 0; + } +} + + +int luaO_rawarith (lua_State *L, int op, const TValue *p1, const TValue *p2, + TValue *res) { + switch (op) { + case LUA_OPBAND: case LUA_OPBOR: case LUA_OPBXOR: + case LUA_OPSHL: case LUA_OPSHR: + case LUA_OPBNOT: { /* operate only on integers */ + lua_Integer i1; lua_Integer i2; + if (tointegerns(p1, &i1) && tointegerns(p2, &i2)) { + setivalue(res, intarith(L, op, i1, i2)); + return 1; + } + else return 0; /* fail */ + } + case LUA_OPDIV: case LUA_OPPOW: { /* operate only on floats */ + lua_Number n1; lua_Number n2; + if (tonumberns(p1, n1) && tonumberns(p2, n2)) { + setfltvalue(res, numarith(L, op, n1, n2)); + return 1; + } + else return 0; /* fail */ + } + default: { /* other operations */ + lua_Number n1; lua_Number n2; + if (ttisinteger(p1) && ttisinteger(p2)) { + setivalue(res, intarith(L, op, ivalue(p1), ivalue(p2))); + return 1; + } + else if (tonumberns(p1, n1) && tonumberns(p2, n2)) { + setfltvalue(res, numarith(L, op, n1, n2)); + return 1; + } + else return 0; /* fail */ + } + } +} + + +void luaO_arith (lua_State *L, int op, const TValue *p1, const TValue *p2, + StkId res) { + if (!luaO_rawarith(L, op, p1, p2, s2v(res))) { + /* could not perform raw operation; try metamethod */ + luaT_trybinTM(L, p1, p2, res, cast(TMS, (op - LUA_OPADD) + TM_ADD)); + } +} + + +int luaO_hexavalue (int c) { + if (lisdigit(c)) return c - '0'; + else return (ltolower(c) - 'a') + 10; +} + + +static int isneg (const char **s) { + if (**s == '-') { (*s)++; return 1; } + else if (**s == '+') (*s)++; + return 0; +} + + + +/* +** {================================================================== +** Lua's implementation for 'lua_strx2number' +** =================================================================== +*/ + +#if !defined(lua_strx2number) + +/* maximum number of significant digits to read (to avoid overflows + even with single floats) */ +#define MAXSIGDIG 30 + +/* +** convert a hexadecimal numeric string to a number, following +** C99 specification for 'strtod' +*/ +static lua_Number lua_strx2number (const char *s, char **endptr) { + int dot = lua_getlocaledecpoint(); + lua_Number r = l_mathop(0.0); /* result (accumulator) */ + int sigdig = 0; /* number of significant digits */ + int nosigdig = 0; /* number of non-significant digits */ + int e = 0; /* exponent correction */ + int neg; /* 1 if number is negative */ + int hasdot = 0; /* true after seen a dot */ + *endptr = cast_charp(s); /* nothing is valid yet */ + while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */ + neg = isneg(&s); /* check sign */ + if (!(*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))) /* check '0x' */ + return l_mathop(0.0); /* invalid format (no '0x') */ + for (s += 2; ; s++) { /* skip '0x' and read numeral */ + if (*s == dot) { + if (hasdot) break; /* second dot? stop loop */ + else hasdot = 1; + } + else if (lisxdigit(cast_uchar(*s))) { + if (sigdig == 0 && *s == '0') /* non-significant digit (zero)? */ + nosigdig++; + else if (++sigdig <= MAXSIGDIG) /* can read it without overflow? */ + r = (r * l_mathop(16.0)) + luaO_hexavalue(*s); + else e++; /* too many digits; ignore, but still count for exponent */ + if (hasdot) e--; /* decimal digit? correct exponent */ + } + else break; /* neither a dot nor a digit */ + } + if (nosigdig + sigdig == 0) /* no digits? */ + return l_mathop(0.0); /* invalid format */ + *endptr = cast_charp(s); /* valid up to here */ + e *= 4; /* each digit multiplies/divides value by 2^4 */ + if (*s == 'p' || *s == 'P') { /* exponent part? */ + int exp1 = 0; /* exponent value */ + int neg1; /* exponent sign */ + s++; /* skip 'p' */ + neg1 = isneg(&s); /* sign */ + if (!lisdigit(cast_uchar(*s))) + return l_mathop(0.0); /* invalid; must have at least one digit */ + while (lisdigit(cast_uchar(*s))) /* read exponent */ + exp1 = exp1 * 10 + *(s++) - '0'; + if (neg1) exp1 = -exp1; + e += exp1; + *endptr = cast_charp(s); /* valid up to here */ + } + if (neg) r = -r; + return l_mathop(ldexp)(r, e); +} + +#endif +/* }====================================================== */ + + +/* maximum length of a numeral to be converted to a number */ +#if !defined (L_MAXLENNUM) +#define L_MAXLENNUM 200 +#endif + +/* +** Convert string 's' to a Lua number (put in 'result'). Return NULL on +** fail or the address of the ending '\0' on success. ('mode' == 'x') +** means a hexadecimal numeral. +*/ +static const char *l_str2dloc (const char *s, lua_Number *result, int mode) { + char *endptr; + *result = (mode == 'x') ? lua_strx2number(s, &endptr) /* try to convert */ + : lua_str2number(s, &endptr); + if (endptr == s) return NULL; /* nothing recognized? */ + while (lisspace(cast_uchar(*endptr))) endptr++; /* skip trailing spaces */ + return (*endptr == '\0') ? endptr : NULL; /* OK iff no trailing chars */ +} + + +/* +** Convert string 's' to a Lua number (put in 'result') handling the +** current locale. +** This function accepts both the current locale or a dot as the radix +** mark. If the conversion fails, it may mean number has a dot but +** locale accepts something else. In that case, the code copies 's' +** to a buffer (because 's' is read-only), changes the dot to the +** current locale radix mark, and tries to convert again. +** The variable 'mode' checks for special characters in the string: +** - 'n' means 'inf' or 'nan' (which should be rejected) +** - 'x' means a hexadecimal numeral +** - '.' just optimizes the search for the common case (no special chars) +*/ +static const char *l_str2d (const char *s, lua_Number *result) { + const char *endptr; + const char *pmode = strpbrk(s, ".xXnN"); /* look for special chars */ + int mode = pmode ? ltolower(cast_uchar(*pmode)) : 0; + if (mode == 'n') /* reject 'inf' and 'nan' */ + return NULL; + endptr = l_str2dloc(s, result, mode); /* try to convert */ + if (endptr == NULL) { /* failed? may be a different locale */ + char buff[L_MAXLENNUM + 1]; + const char *pdot = strchr(s, '.'); + if (pdot == NULL || strlen(s) > L_MAXLENNUM) + return NULL; /* string too long or no dot; fail */ + strcpy(buff, s); /* copy string to buffer */ + buff[pdot - s] = lua_getlocaledecpoint(); /* correct decimal point */ + endptr = l_str2dloc(buff, result, mode); /* try again */ + if (endptr != NULL) + endptr = s + (endptr - buff); /* make relative to 's' */ + } + return endptr; +} + + +#define MAXBY10 cast(lua_Unsigned, LUA_MAXINTEGER / 10) +#define MAXLASTD cast_int(LUA_MAXINTEGER % 10) + +static const char *l_str2int (const char *s, lua_Integer *result) { + lua_Unsigned a = 0; + int empty = 1; + int neg; + while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */ + neg = isneg(&s); + if (s[0] == '0' && + (s[1] == 'x' || s[1] == 'X')) { /* hex? */ + s += 2; /* skip '0x' */ + for (; lisxdigit(cast_uchar(*s)); s++) { + a = a * 16 + luaO_hexavalue(*s); + empty = 0; + } + } + else { /* decimal */ + for (; lisdigit(cast_uchar(*s)); s++) { + int d = *s - '0'; + if (a >= MAXBY10 && (a > MAXBY10 || d > MAXLASTD + neg)) /* overflow? */ + return NULL; /* do not accept it (as integer) */ + a = a * 10 + d; + empty = 0; + } + } + while (lisspace(cast_uchar(*s))) s++; /* skip trailing spaces */ + if (empty || *s != '\0') return NULL; /* something wrong in the numeral */ + else { + *result = l_castU2S((neg) ? 0u - a : a); + return s; + } +} + + +size_t luaO_str2num (const char *s, TValue *o) { + lua_Integer i; lua_Number n; + const char *e; + if ((e = l_str2int(s, &i)) != NULL) { /* try as an integer */ + setivalue(o, i); + } + else if ((e = l_str2d(s, &n)) != NULL) { /* else try as a float */ + setfltvalue(o, n); + } + else + return 0; /* conversion failed */ + return (e - s) + 1; /* success; return string size */ +} + + +int luaO_utf8esc (char *buff, unsigned long x) { + int n = 1; /* number of bytes put in buffer (backwards) */ + lua_assert(x <= 0x7FFFFFFFu); + if (x < 0x80) /* ascii? */ + buff[UTF8BUFFSZ - 1] = cast_char(x); + else { /* need continuation bytes */ + unsigned int mfb = 0x3f; /* maximum that fits in first byte */ + do { /* add continuation bytes */ + buff[UTF8BUFFSZ - (n++)] = cast_char(0x80 | (x & 0x3f)); + x >>= 6; /* remove added bits */ + mfb >>= 1; /* now there is one less bit available in first byte */ + } while (x > mfb); /* still needs continuation byte? */ + buff[UTF8BUFFSZ - n] = cast_char((~mfb << 1) | x); /* add first byte */ + } + return n; +} + + +/* +** Maximum length of the conversion of a number to a string. Must be +** enough to accommodate both LUA_INTEGER_FMT and LUA_NUMBER_FMT. +** (For a long long int, this is 19 digits plus a sign and a final '\0', +** adding to 21. For a long double, it can go to a sign, 33 digits, +** the dot, an exponent letter, an exponent sign, 5 exponent digits, +** and a final '\0', adding to 43.) +*/ +#define MAXNUMBER2STR 44 + + +/* +** Convert a number object to a string, adding it to a buffer +*/ +static int tostringbuff (TValue *obj, char *buff) { + int len; + lua_assert(ttisnumber(obj)); + if (ttisinteger(obj)) + len = lua_integer2str(buff, MAXNUMBER2STR, ivalue(obj)); + else { + len = lua_number2str(buff, MAXNUMBER2STR, fltvalue(obj)); + if (buff[strspn(buff, "-0123456789")] == '\0') { /* looks like an int? */ + buff[len++] = lua_getlocaledecpoint(); + buff[len++] = '0'; /* adds '.0' to result */ + } + } + return len; +} + + +/* +** Convert a number object to a Lua string, replacing the value at 'obj' +*/ +void luaO_tostring (lua_State *L, TValue *obj) { + char buff[MAXNUMBER2STR]; + int len = tostringbuff(obj, buff); + setsvalue(L, obj, luaS_newlstr(L, buff, len)); +} + + + + +/* +** {================================================================== +** 'luaO_pushvfstring' +** =================================================================== +*/ + +/* +** Size for buffer space used by 'luaO_pushvfstring'. It should be +** (LUA_IDSIZE + MAXNUMBER2STR) + a minimal space for basic messages, +** so that 'luaG_addinfo' can work directly on the buffer. +*/ +#define BUFVFS (LUA_IDSIZE + MAXNUMBER2STR + 95) + +/* buffer used by 'luaO_pushvfstring' */ +typedef struct BuffFS { + lua_State *L; + int pushed; /* true if there is a part of the result on the stack */ + int blen; /* length of partial string in 'space' */ + char space[BUFVFS]; /* holds last part of the result */ +} BuffFS; + + +/* +** Push given string to the stack, as part of the result, and +** join it to previous partial result if there is one. +** It may call 'luaV_concat' while using one slot from EXTRA_STACK. +** This call cannot invoke metamethods, as both operands must be +** strings. It can, however, raise an error if the result is too +** long. In that case, 'luaV_concat' frees the extra slot before +** raising the error. +*/ +static void pushstr (BuffFS *buff, const char *str, size_t lstr) { + lua_State *L = buff->L; + setsvalue2s(L, L->top.p, luaS_newlstr(L, str, lstr)); + L->top.p++; /* may use one slot from EXTRA_STACK */ + if (!buff->pushed) /* no previous string on the stack? */ + buff->pushed = 1; /* now there is one */ + else /* join previous string with new one */ + luaV_concat(L, 2); +} + + +/* +** empty the buffer space into the stack +*/ +static void clearbuff (BuffFS *buff) { + pushstr(buff, buff->space, buff->blen); /* push buffer contents */ + buff->blen = 0; /* space now is empty */ +} + + +/* +** Get a space of size 'sz' in the buffer. If buffer has not enough +** space, empty it. 'sz' must fit in an empty buffer. +*/ +static char *getbuff (BuffFS *buff, int sz) { + lua_assert(buff->blen <= BUFVFS); lua_assert(sz <= BUFVFS); + if (sz > BUFVFS - buff->blen) /* not enough space? */ + clearbuff(buff); + return buff->space + buff->blen; +} + + +#define addsize(b,sz) ((b)->blen += (sz)) + + +/* +** Add 'str' to the buffer. If string is larger than the buffer space, +** push the string directly to the stack. +*/ +static void addstr2buff (BuffFS *buff, const char *str, size_t slen) { + if (slen <= BUFVFS) { /* does string fit into buffer? */ + char *bf = getbuff(buff, cast_int(slen)); + memcpy(bf, str, slen); /* add string to buffer */ + addsize(buff, cast_int(slen)); + } + else { /* string larger than buffer */ + clearbuff(buff); /* string comes after buffer's content */ + pushstr(buff, str, slen); /* push string */ + } +} + + +/* +** Add a numeral to the buffer. +*/ +static void addnum2buff (BuffFS *buff, TValue *num) { + char *numbuff = getbuff(buff, MAXNUMBER2STR); + int len = tostringbuff(num, numbuff); /* format number into 'numbuff' */ + addsize(buff, len); +} + + +/* +** this function handles only '%d', '%c', '%f', '%p', '%s', and '%%' + conventional formats, plus Lua-specific '%I' and '%U' +*/ +const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { + BuffFS buff; /* holds last part of the result */ + const char *e; /* points to next '%' */ + buff.pushed = buff.blen = 0; + buff.L = L; + while ((e = strchr(fmt, '%')) != NULL) { + addstr2buff(&buff, fmt, e - fmt); /* add 'fmt' up to '%' */ + switch (*(e + 1)) { /* conversion specifier */ + case 's': { /* zero-terminated string */ + const char *s = va_arg(argp, char *); + if (s == NULL) s = "(null)"; + addstr2buff(&buff, s, strlen(s)); + break; + } + case 'c': { /* an 'int' as a character */ + char c = cast_uchar(va_arg(argp, int)); + addstr2buff(&buff, &c, sizeof(char)); + break; + } + case 'd': { /* an 'int' */ + TValue num; + setivalue(&num, va_arg(argp, int)); + addnum2buff(&buff, &num); + break; + } + case 'I': { /* a 'lua_Integer' */ + TValue num; + setivalue(&num, cast(lua_Integer, va_arg(argp, l_uacInt))); + addnum2buff(&buff, &num); + break; + } + case 'f': { /* a 'lua_Number' */ + TValue num; + setfltvalue(&num, cast_num(va_arg(argp, l_uacNumber))); + addnum2buff(&buff, &num); + break; + } + case 'p': { /* a pointer */ + const int sz = 3 * sizeof(void*) + 8; /* enough space for '%p' */ + char *bf = getbuff(&buff, sz); + void *p = va_arg(argp, void *); + int len = lua_pointer2str(bf, sz, p); + addsize(&buff, len); + break; + } + case 'U': { /* a 'long' as a UTF-8 sequence */ + char bf[UTF8BUFFSZ]; + int len = luaO_utf8esc(bf, va_arg(argp, long)); + addstr2buff(&buff, bf + UTF8BUFFSZ - len, len); + break; + } + case '%': { + addstr2buff(&buff, "%", 1); + break; + } + default: { + luaG_runerror(L, "invalid option '%%%c' to 'lua_pushfstring'", + *(e + 1)); + } + } + fmt = e + 2; /* skip '%' and the specifier */ + } + addstr2buff(&buff, fmt, strlen(fmt)); /* rest of 'fmt' */ + clearbuff(&buff); /* empty buffer into the stack */ + lua_assert(buff.pushed == 1); + return getstr(tsvalue(s2v(L->top.p - 1))); +} + + +const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) { + const char *msg; + va_list argp; + va_start(argp, fmt); + msg = luaO_pushvfstring(L, fmt, argp); + va_end(argp); + return msg; +} + +/* }================================================================== */ + + +#define RETS "..." +#define PRE "[string \"" +#define POS "\"]" + +#define addstr(a,b,l) ( memcpy(a,b,(l) * sizeof(char)), a += (l) ) + +void luaO_chunkid (char *out, const char *source, size_t srclen) { + size_t bufflen = LUA_IDSIZE; /* free space in buffer */ + if (*source == '=') { /* 'literal' source */ + if (srclen <= bufflen) /* small enough? */ + memcpy(out, source + 1, srclen * sizeof(char)); + else { /* truncate it */ + addstr(out, source + 1, bufflen - 1); + *out = '\0'; + } + } + else if (*source == '@') { /* file name */ + if (srclen <= bufflen) /* small enough? */ + memcpy(out, source + 1, srclen * sizeof(char)); + else { /* add '...' before rest of name */ + addstr(out, RETS, LL(RETS)); + bufflen -= LL(RETS); + memcpy(out, source + 1 + srclen - bufflen, bufflen * sizeof(char)); + } + } + else { /* string; format as [string "source"] */ + const char *nl = strchr(source, '\n'); /* find first new line (if any) */ + addstr(out, PRE, LL(PRE)); /* add prefix */ + bufflen -= LL(PRE RETS POS) + 1; /* save space for prefix+suffix+'\0' */ + if (srclen < bufflen && nl == NULL) { /* small one-line source? */ + addstr(out, source, srclen); /* keep it */ + } + else { + if (nl != NULL) srclen = nl - source; /* stop at first newline */ + if (srclen > bufflen) srclen = bufflen; + addstr(out, source, srclen); + addstr(out, RETS, LL(RETS)); + } + memcpy(out, POS, (LL(POS) + 1) * sizeof(char)); + } +} + diff --git a/LuaSkin/lua-5.4.7/src/lobject.h b/LuaSkin/lua-5.4.7/src/lobject.h new file mode 100644 index 000000000..980e42f8c --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lobject.h @@ -0,0 +1,813 @@ +/* +** $Id: lobject.h $ +** Type definitions for Lua objects +** See Copyright Notice in lua.h +*/ + + +#ifndef lobject_h +#define lobject_h + + +#include + + +#include "llimits.h" +#include "lua.h" + + +/* +** Extra types for collectable non-values +*/ +#define LUA_TUPVAL LUA_NUMTYPES /* upvalues */ +#define LUA_TPROTO (LUA_NUMTYPES+1) /* function prototypes */ +#define LUA_TDEADKEY (LUA_NUMTYPES+2) /* removed keys in tables */ + + + +/* +** number of all possible types (including LUA_TNONE but excluding DEADKEY) +*/ +#define LUA_TOTALTYPES (LUA_TPROTO + 2) + + +/* +** tags for Tagged Values have the following use of bits: +** bits 0-3: actual tag (a LUA_T* constant) +** bits 4-5: variant bits +** bit 6: whether value is collectable +*/ + +/* add variant bits to a type */ +#define makevariant(t,v) ((t) | ((v) << 4)) + + + +/* +** Union of all Lua values +*/ +typedef union Value { + struct GCObject *gc; /* collectable objects */ + void *p; /* light userdata */ + lua_CFunction f; /* light C functions */ + lua_Integer i; /* integer numbers */ + lua_Number n; /* float numbers */ + /* not used, but may avoid warnings for uninitialized value */ + lu_byte ub; +} Value; + + +/* +** Tagged Values. This is the basic representation of values in Lua: +** an actual value plus a tag with its type. +*/ + +#define TValuefields Value value_; lu_byte tt_ + +typedef struct TValue { + TValuefields; +} TValue; + + +#define val_(o) ((o)->value_) +#define valraw(o) (val_(o)) + + +/* raw type tag of a TValue */ +#define rawtt(o) ((o)->tt_) + +/* tag with no variants (bits 0-3) */ +#define novariant(t) ((t) & 0x0F) + +/* type tag of a TValue (bits 0-3 for tags + variant bits 4-5) */ +#define withvariant(t) ((t) & 0x3F) +#define ttypetag(o) withvariant(rawtt(o)) + +/* type of a TValue */ +#define ttype(o) (novariant(rawtt(o))) + + +/* Macros to test type */ +#define checktag(o,t) (rawtt(o) == (t)) +#define checktype(o,t) (ttype(o) == (t)) + + +/* Macros for internal tests */ + +/* collectable object has the same tag as the original value */ +#define righttt(obj) (ttypetag(obj) == gcvalue(obj)->tt) + +/* +** Any value being manipulated by the program either is non +** collectable, or the collectable object has the right tag +** and it is not dead. The option 'L == NULL' allows other +** macros using this one to be used where L is not available. +*/ +#define checkliveness(L,obj) \ + ((void)L, lua_longassert(!iscollectable(obj) || \ + (righttt(obj) && (L == NULL || !isdead(G(L),gcvalue(obj)))))) + + +/* Macros to set values */ + +/* set a value's tag */ +#define settt_(o,t) ((o)->tt_=(t)) + + +/* main macro to copy values (from 'obj2' to 'obj1') */ +#define setobj(L,obj1,obj2) \ + { TValue *io1=(obj1); const TValue *io2=(obj2); \ + io1->value_ = io2->value_; settt_(io1, io2->tt_); \ + checkliveness(L,io1); lua_assert(!isnonstrictnil(io1)); } + +/* +** Different types of assignments, according to source and destination. +** (They are mostly equal now, but may be different in the future.) +*/ + +/* from stack to stack */ +#define setobjs2s(L,o1,o2) setobj(L,s2v(o1),s2v(o2)) +/* to stack (not from same stack) */ +#define setobj2s(L,o1,o2) setobj(L,s2v(o1),o2) +/* from table to same table */ +#define setobjt2t setobj +/* to new object */ +#define setobj2n setobj +/* to table */ +#define setobj2t setobj + + +/* +** Entries in a Lua stack. Field 'tbclist' forms a list of all +** to-be-closed variables active in this stack. Dummy entries are +** used when the distance between two tbc variables does not fit +** in an unsigned short. They are represented by delta==0, and +** their real delta is always the maximum value that fits in +** that field. +*/ +typedef union StackValue { + TValue val; + struct { + TValuefields; + unsigned short delta; + } tbclist; +} StackValue; + + +/* index to stack elements */ +typedef StackValue *StkId; + + +/* +** When reallocating the stack, change all pointers to the stack into +** proper offsets. +*/ +typedef union { + StkId p; /* actual pointer */ + ptrdiff_t offset; /* used while the stack is being reallocated */ +} StkIdRel; + + +/* convert a 'StackValue' to a 'TValue' */ +#define s2v(o) (&(o)->val) + + + +/* +** {================================================================== +** Nil +** =================================================================== +*/ + +/* Standard nil */ +#define LUA_VNIL makevariant(LUA_TNIL, 0) + +/* Empty slot (which might be different from a slot containing nil) */ +#define LUA_VEMPTY makevariant(LUA_TNIL, 1) + +/* Value returned for a key not found in a table (absent key) */ +#define LUA_VABSTKEY makevariant(LUA_TNIL, 2) + + +/* macro to test for (any kind of) nil */ +#define ttisnil(v) checktype((v), LUA_TNIL) + + +/* macro to test for a standard nil */ +#define ttisstrictnil(o) checktag((o), LUA_VNIL) + + +#define setnilvalue(obj) settt_(obj, LUA_VNIL) + + +#define isabstkey(v) checktag((v), LUA_VABSTKEY) + + +/* +** macro to detect non-standard nils (used only in assertions) +*/ +#define isnonstrictnil(v) (ttisnil(v) && !ttisstrictnil(v)) + + +/* +** By default, entries with any kind of nil are considered empty. +** (In any definition, values associated with absent keys must also +** be accepted as empty.) +*/ +#define isempty(v) ttisnil(v) + + +/* macro defining a value corresponding to an absent key */ +#define ABSTKEYCONSTANT {NULL}, LUA_VABSTKEY + + +/* mark an entry as empty */ +#define setempty(v) settt_(v, LUA_VEMPTY) + + + +/* }================================================================== */ + + +/* +** {================================================================== +** Booleans +** =================================================================== +*/ + + +#define LUA_VFALSE makevariant(LUA_TBOOLEAN, 0) +#define LUA_VTRUE makevariant(LUA_TBOOLEAN, 1) + +#define ttisboolean(o) checktype((o), LUA_TBOOLEAN) +#define ttisfalse(o) checktag((o), LUA_VFALSE) +#define ttistrue(o) checktag((o), LUA_VTRUE) + + +#define l_isfalse(o) (ttisfalse(o) || ttisnil(o)) + + +#define setbfvalue(obj) settt_(obj, LUA_VFALSE) +#define setbtvalue(obj) settt_(obj, LUA_VTRUE) + +/* }================================================================== */ + + +/* +** {================================================================== +** Threads +** =================================================================== +*/ + +#define LUA_VTHREAD makevariant(LUA_TTHREAD, 0) + +#define ttisthread(o) checktag((o), ctb(LUA_VTHREAD)) + +#define thvalue(o) check_exp(ttisthread(o), gco2th(val_(o).gc)) + +#define setthvalue(L,obj,x) \ + { TValue *io = (obj); lua_State *x_ = (x); \ + val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_VTHREAD)); \ + checkliveness(L,io); } + +#define setthvalue2s(L,o,t) setthvalue(L,s2v(o),t) + +/* }================================================================== */ + + +/* +** {================================================================== +** Collectable Objects +** =================================================================== +*/ + +/* +** Common Header for all collectable objects (in macro form, to be +** included in other objects) +*/ +#define CommonHeader struct GCObject *next; lu_byte tt; lu_byte marked + + +/* Common type for all collectable objects */ +typedef struct GCObject { + CommonHeader; +} GCObject; + + +/* Bit mark for collectable types */ +#define BIT_ISCOLLECTABLE (1 << 6) + +#define iscollectable(o) (rawtt(o) & BIT_ISCOLLECTABLE) + +/* mark a tag as collectable */ +#define ctb(t) ((t) | BIT_ISCOLLECTABLE) + +#define gcvalue(o) check_exp(iscollectable(o), val_(o).gc) + +#define gcvalueraw(v) ((v).gc) + +#define setgcovalue(L,obj,x) \ + { TValue *io = (obj); GCObject *i_g=(x); \ + val_(io).gc = i_g; settt_(io, ctb(i_g->tt)); } + +/* }================================================================== */ + + +/* +** {================================================================== +** Numbers +** =================================================================== +*/ + +/* Variant tags for numbers */ +#define LUA_VNUMINT makevariant(LUA_TNUMBER, 0) /* integer numbers */ +#define LUA_VNUMFLT makevariant(LUA_TNUMBER, 1) /* float numbers */ + +#define ttisnumber(o) checktype((o), LUA_TNUMBER) +#define ttisfloat(o) checktag((o), LUA_VNUMFLT) +#define ttisinteger(o) checktag((o), LUA_VNUMINT) + +#define nvalue(o) check_exp(ttisnumber(o), \ + (ttisinteger(o) ? cast_num(ivalue(o)) : fltvalue(o))) +#define fltvalue(o) check_exp(ttisfloat(o), val_(o).n) +#define ivalue(o) check_exp(ttisinteger(o), val_(o).i) + +#define fltvalueraw(v) ((v).n) +#define ivalueraw(v) ((v).i) + +#define setfltvalue(obj,x) \ + { TValue *io=(obj); val_(io).n=(x); settt_(io, LUA_VNUMFLT); } + +#define chgfltvalue(obj,x) \ + { TValue *io=(obj); lua_assert(ttisfloat(io)); val_(io).n=(x); } + +#define setivalue(obj,x) \ + { TValue *io=(obj); val_(io).i=(x); settt_(io, LUA_VNUMINT); } + +#define chgivalue(obj,x) \ + { TValue *io=(obj); lua_assert(ttisinteger(io)); val_(io).i=(x); } + +/* }================================================================== */ + + +/* +** {================================================================== +** Strings +** =================================================================== +*/ + +/* Variant tags for strings */ +#define LUA_VSHRSTR makevariant(LUA_TSTRING, 0) /* short strings */ +#define LUA_VLNGSTR makevariant(LUA_TSTRING, 1) /* long strings */ + +#define ttisstring(o) checktype((o), LUA_TSTRING) +#define ttisshrstring(o) checktag((o), ctb(LUA_VSHRSTR)) +#define ttislngstring(o) checktag((o), ctb(LUA_VLNGSTR)) + +#define tsvalueraw(v) (gco2ts((v).gc)) + +#define tsvalue(o) check_exp(ttisstring(o), gco2ts(val_(o).gc)) + +#define setsvalue(L,obj,x) \ + { TValue *io = (obj); TString *x_ = (x); \ + val_(io).gc = obj2gco(x_); settt_(io, ctb(x_->tt)); \ + checkliveness(L,io); } + +/* set a string to the stack */ +#define setsvalue2s(L,o,s) setsvalue(L,s2v(o),s) + +/* set a string to a new object */ +#define setsvalue2n setsvalue + + +/* +** Header for a string value. +*/ +typedef struct TString { + CommonHeader; + lu_byte extra; /* reserved words for short strings; "has hash" for longs */ + lu_byte shrlen; /* length for short strings, 0xFF for long strings */ + unsigned int hash; + union { + size_t lnglen; /* length for long strings */ + struct TString *hnext; /* linked list for hash table */ + } u; + char contents[1]; +} TString; + + + +/* +** Get the actual string (array of bytes) from a 'TString'. (Generic +** version and specialized versions for long and short strings.) +*/ +#define getstr(ts) ((ts)->contents) +#define getlngstr(ts) check_exp((ts)->shrlen == 0xFF, (ts)->contents) +#define getshrstr(ts) check_exp((ts)->shrlen != 0xFF, (ts)->contents) + + +/* get string length from 'TString *s' */ +#define tsslen(s) \ + ((s)->shrlen != 0xFF ? (s)->shrlen : (s)->u.lnglen) + +/* }================================================================== */ + + +/* +** {================================================================== +** Userdata +** =================================================================== +*/ + + +/* +** Light userdata should be a variant of userdata, but for compatibility +** reasons they are also different types. +*/ +#define LUA_VLIGHTUSERDATA makevariant(LUA_TLIGHTUSERDATA, 0) + +#define LUA_VUSERDATA makevariant(LUA_TUSERDATA, 0) + +#define ttislightuserdata(o) checktag((o), LUA_VLIGHTUSERDATA) +#define ttisfulluserdata(o) checktag((o), ctb(LUA_VUSERDATA)) + +#define pvalue(o) check_exp(ttislightuserdata(o), val_(o).p) +#define uvalue(o) check_exp(ttisfulluserdata(o), gco2u(val_(o).gc)) + +#define pvalueraw(v) ((v).p) + +#define setpvalue(obj,x) \ + { TValue *io=(obj); val_(io).p=(x); settt_(io, LUA_VLIGHTUSERDATA); } + +#define setuvalue(L,obj,x) \ + { TValue *io = (obj); Udata *x_ = (x); \ + val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_VUSERDATA)); \ + checkliveness(L,io); } + + +/* Ensures that addresses after this type are always fully aligned. */ +typedef union UValue { + TValue uv; + LUAI_MAXALIGN; /* ensures maximum alignment for udata bytes */ +} UValue; + + +/* +** Header for userdata with user values; +** memory area follows the end of this structure. +*/ +typedef struct Udata { + CommonHeader; + unsigned short nuvalue; /* number of user values */ + size_t len; /* number of bytes */ + struct Table *metatable; + GCObject *gclist; + UValue uv[1]; /* user values */ +} Udata; + + +/* +** Header for userdata with no user values. These userdata do not need +** to be gray during GC, and therefore do not need a 'gclist' field. +** To simplify, the code always use 'Udata' for both kinds of userdata, +** making sure it never accesses 'gclist' on userdata with no user values. +** This structure here is used only to compute the correct size for +** this representation. (The 'bindata' field in its end ensures correct +** alignment for binary data following this header.) +*/ +typedef struct Udata0 { + CommonHeader; + unsigned short nuvalue; /* number of user values */ + size_t len; /* number of bytes */ + struct Table *metatable; + union {LUAI_MAXALIGN;} bindata; +} Udata0; + + +/* compute the offset of the memory area of a userdata */ +#define udatamemoffset(nuv) \ + ((nuv) == 0 ? offsetof(Udata0, bindata) \ + : offsetof(Udata, uv) + (sizeof(UValue) * (nuv))) + +/* get the address of the memory block inside 'Udata' */ +#define getudatamem(u) (cast_charp(u) + udatamemoffset((u)->nuvalue)) + +/* compute the size of a userdata */ +#define sizeudata(nuv,nb) (udatamemoffset(nuv) + (nb)) + +/* }================================================================== */ + + +/* +** {================================================================== +** Prototypes +** =================================================================== +*/ + +#define LUA_VPROTO makevariant(LUA_TPROTO, 0) + + +/* +** Description of an upvalue for function prototypes +*/ +typedef struct Upvaldesc { + TString *name; /* upvalue name (for debug information) */ + lu_byte instack; /* whether it is in stack (register) */ + lu_byte idx; /* index of upvalue (in stack or in outer function's list) */ + lu_byte kind; /* kind of corresponding variable */ +} Upvaldesc; + + +/* +** Description of a local variable for function prototypes +** (used for debug information) +*/ +typedef struct LocVar { + TString *varname; + int startpc; /* first point where variable is active */ + int endpc; /* first point where variable is dead */ +} LocVar; + + +/* +** Associates the absolute line source for a given instruction ('pc'). +** The array 'lineinfo' gives, for each instruction, the difference in +** lines from the previous instruction. When that difference does not +** fit into a byte, Lua saves the absolute line for that instruction. +** (Lua also saves the absolute line periodically, to speed up the +** computation of a line number: we can use binary search in the +** absolute-line array, but we must traverse the 'lineinfo' array +** linearly to compute a line.) +*/ +typedef struct AbsLineInfo { + int pc; + int line; +} AbsLineInfo; + +/* +** Function Prototypes +*/ +typedef struct Proto { + CommonHeader; + lu_byte numparams; /* number of fixed (named) parameters */ + lu_byte is_vararg; + lu_byte maxstacksize; /* number of registers needed by this function */ + int sizeupvalues; /* size of 'upvalues' */ + int sizek; /* size of 'k' */ + int sizecode; + int sizelineinfo; + int sizep; /* size of 'p' */ + int sizelocvars; + int sizeabslineinfo; /* size of 'abslineinfo' */ + int linedefined; /* debug information */ + int lastlinedefined; /* debug information */ + TValue *k; /* constants used by the function */ + Instruction *code; /* opcodes */ + struct Proto **p; /* functions defined inside the function */ + Upvaldesc *upvalues; /* upvalue information */ + ls_byte *lineinfo; /* information about source lines (debug information) */ + AbsLineInfo *abslineinfo; /* idem */ + LocVar *locvars; /* information about local variables (debug information) */ + TString *source; /* used for debug information */ + GCObject *gclist; +} Proto; + +/* }================================================================== */ + + +/* +** {================================================================== +** Functions +** =================================================================== +*/ + +#define LUA_VUPVAL makevariant(LUA_TUPVAL, 0) + + +/* Variant tags for functions */ +#define LUA_VLCL makevariant(LUA_TFUNCTION, 0) /* Lua closure */ +#define LUA_VLCF makevariant(LUA_TFUNCTION, 1) /* light C function */ +#define LUA_VCCL makevariant(LUA_TFUNCTION, 2) /* C closure */ + +#define ttisfunction(o) checktype(o, LUA_TFUNCTION) +#define ttisLclosure(o) checktag((o), ctb(LUA_VLCL)) +#define ttislcf(o) checktag((o), LUA_VLCF) +#define ttisCclosure(o) checktag((o), ctb(LUA_VCCL)) +#define ttisclosure(o) (ttisLclosure(o) || ttisCclosure(o)) + + +#define isLfunction(o) ttisLclosure(o) + +#define clvalue(o) check_exp(ttisclosure(o), gco2cl(val_(o).gc)) +#define clLvalue(o) check_exp(ttisLclosure(o), gco2lcl(val_(o).gc)) +#define fvalue(o) check_exp(ttislcf(o), val_(o).f) +#define clCvalue(o) check_exp(ttisCclosure(o), gco2ccl(val_(o).gc)) + +#define fvalueraw(v) ((v).f) + +#define setclLvalue(L,obj,x) \ + { TValue *io = (obj); LClosure *x_ = (x); \ + val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_VLCL)); \ + checkliveness(L,io); } + +#define setclLvalue2s(L,o,cl) setclLvalue(L,s2v(o),cl) + +#define setfvalue(obj,x) \ + { TValue *io=(obj); val_(io).f=(x); settt_(io, LUA_VLCF); } + +#define setclCvalue(L,obj,x) \ + { TValue *io = (obj); CClosure *x_ = (x); \ + val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_VCCL)); \ + checkliveness(L,io); } + + +/* +** Upvalues for Lua closures +*/ +typedef struct UpVal { + CommonHeader; + union { + TValue *p; /* points to stack or to its own value */ + ptrdiff_t offset; /* used while the stack is being reallocated */ + } v; + union { + struct { /* (when open) */ + struct UpVal *next; /* linked list */ + struct UpVal **previous; + } open; + TValue value; /* the value (when closed) */ + } u; +} UpVal; + + + +#define ClosureHeader \ + CommonHeader; lu_byte nupvalues; GCObject *gclist + +typedef struct CClosure { + ClosureHeader; + lua_CFunction f; + TValue upvalue[1]; /* list of upvalues */ +} CClosure; + + +typedef struct LClosure { + ClosureHeader; + struct Proto *p; + UpVal *upvals[1]; /* list of upvalues */ +} LClosure; + + +typedef union Closure { + CClosure c; + LClosure l; +} Closure; + + +#define getproto(o) (clLvalue(o)->p) + +/* }================================================================== */ + + +/* +** {================================================================== +** Tables +** =================================================================== +*/ + +#define LUA_VTABLE makevariant(LUA_TTABLE, 0) + +#define ttistable(o) checktag((o), ctb(LUA_VTABLE)) + +#define hvalue(o) check_exp(ttistable(o), gco2t(val_(o).gc)) + +#define sethvalue(L,obj,x) \ + { TValue *io = (obj); Table *x_ = (x); \ + val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_VTABLE)); \ + checkliveness(L,io); } + +#define sethvalue2s(L,o,h) sethvalue(L,s2v(o),h) + + +/* +** Nodes for Hash tables: A pack of two TValue's (key-value pairs) +** plus a 'next' field to link colliding entries. The distribution +** of the key's fields ('key_tt' and 'key_val') not forming a proper +** 'TValue' allows for a smaller size for 'Node' both in 4-byte +** and 8-byte alignments. +*/ +typedef union Node { + struct NodeKey { + TValuefields; /* fields for value */ + lu_byte key_tt; /* key type */ + int next; /* for chaining */ + Value key_val; /* key value */ + } u; + TValue i_val; /* direct access to node's value as a proper 'TValue' */ +} Node; + + +/* copy a value into a key */ +#define setnodekey(L,node,obj) \ + { Node *n_=(node); const TValue *io_=(obj); \ + n_->u.key_val = io_->value_; n_->u.key_tt = io_->tt_; \ + checkliveness(L,io_); } + + +/* copy a value from a key */ +#define getnodekey(L,obj,node) \ + { TValue *io_=(obj); const Node *n_=(node); \ + io_->value_ = n_->u.key_val; io_->tt_ = n_->u.key_tt; \ + checkliveness(L,io_); } + + +/* +** About 'alimit': if 'isrealasize(t)' is true, then 'alimit' is the +** real size of 'array'. Otherwise, the real size of 'array' is the +** smallest power of two not smaller than 'alimit' (or zero iff 'alimit' +** is zero); 'alimit' is then used as a hint for #t. +*/ + +#define BITRAS (1 << 7) +#define isrealasize(t) (!((t)->flags & BITRAS)) +#define setrealasize(t) ((t)->flags &= cast_byte(~BITRAS)) +#define setnorealasize(t) ((t)->flags |= BITRAS) + + +typedef struct Table { + CommonHeader; + lu_byte flags; /* 1<

    u.key_tt) +#define keyval(node) ((node)->u.key_val) + +#define keyisnil(node) (keytt(node) == LUA_TNIL) +#define keyisinteger(node) (keytt(node) == LUA_VNUMINT) +#define keyival(node) (keyval(node).i) +#define keyisshrstr(node) (keytt(node) == ctb(LUA_VSHRSTR)) +#define keystrval(node) (gco2ts(keyval(node).gc)) + +#define setnilkey(node) (keytt(node) = LUA_TNIL) + +#define keyiscollectable(n) (keytt(n) & BIT_ISCOLLECTABLE) + +#define gckey(n) (keyval(n).gc) +#define gckeyN(n) (keyiscollectable(n) ? gckey(n) : NULL) + + +/* +** Dead keys in tables have the tag DEADKEY but keep their original +** gcvalue. This distinguishes them from regular keys but allows them to +** be found when searched in a special way. ('next' needs that to find +** keys removed from a table during a traversal.) +*/ +#define setdeadkey(node) (keytt(node) = LUA_TDEADKEY) +#define keyisdead(node) (keytt(node) == LUA_TDEADKEY) + +/* }================================================================== */ + + + +/* +** 'module' operation for hashing (size is always a power of 2) +*/ +#define lmod(s,size) \ + (check_exp((size&(size-1))==0, (cast_int((s) & ((size)-1))))) + + +#define twoto(x) (1<<(x)) +#define sizenode(t) (twoto((t)->lsizenode)) + + +/* size of buffer for 'luaO_utf8esc' function */ +#define UTF8BUFFSZ 8 + +LUAI_FUNC int luaO_utf8esc (char *buff, unsigned long x); +LUAI_FUNC int luaO_ceillog2 (unsigned int x); +LUAI_FUNC int luaO_rawarith (lua_State *L, int op, const TValue *p1, + const TValue *p2, TValue *res); +LUAI_FUNC void luaO_arith (lua_State *L, int op, const TValue *p1, + const TValue *p2, StkId res); +LUAI_FUNC size_t luaO_str2num (const char *s, TValue *o); +LUAI_FUNC int luaO_hexavalue (int c); +LUAI_FUNC void luaO_tostring (lua_State *L, TValue *obj); +LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, + va_list argp); +LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...); +LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t srclen); + + +#endif + diff --git a/LuaSkin/LuaSkin/lobjectivec_exceptions.h b/LuaSkin/lua-5.4.7/src/lobjectivec_exceptions.h similarity index 93% rename from LuaSkin/LuaSkin/lobjectivec_exceptions.h rename to LuaSkin/lua-5.4.7/src/lobjectivec_exceptions.h index 70cc0dad1..b6633270f 100644 --- a/LuaSkin/LuaSkin/lobjectivec_exceptions.h +++ b/LuaSkin/lua-5.4.7/src/lobjectivec_exceptions.h @@ -14,7 +14,7 @@ struct lua_longjmp { volatile int status; /* error code */ }; -LUAI_FUNC void luai_objcthrow(struct lua_longjmp* errorJmp); +LUAI_FUNC void luai_objcthrow(struct lua_longjmp* errorJmp) __attribute__((noreturn)); /* Throw is moved into a real function instead of a macro because NSException is needed * which brings in #imports from Foundation which polutes the namespace diff --git a/LuaSkin/LuaSkin/lobjectivec_exceptions.m b/LuaSkin/lua-5.4.7/src/lobjectivec_exceptions.m similarity index 98% rename from LuaSkin/LuaSkin/lobjectivec_exceptions.m rename to LuaSkin/lua-5.4.7/src/lobjectivec_exceptions.m index 4480a8db4..2c1de7a53 100644 --- a/LuaSkin/LuaSkin/lobjectivec_exceptions.m +++ b/LuaSkin/lua-5.4.7/src/lobjectivec_exceptions.m @@ -125,7 +125,7 @@ void luai_objcttry(lua_State* L, struct lua_longjmp* c_lua_longjmp, Pfunc a_func c_lua_longjmp->status = LUA_ERR_EXCEPTION_OBJC; } } - @catch(id exception) + @catch(__unused id exception) { // Not sure what this object is. I don't know what methods it actually implements so I can't easily/safely extract any info. lua_pushliteral(L, "Unknown Objective-C exception"); @@ -172,7 +172,7 @@ void luai_objcttry(lua_State* L, struct lua_longjmp* c_lua_longjmp, Pfunc a_func } } -void luai_objcthrow(struct lua_longjmp* errorJmp) +void luai_objcthrow(__unused struct lua_longjmp* errorJmp) { // This must not be autoreleased because Lua doesn't have its own autorelease pool. (See Optimization Notes at the top). // To be nice to ARC, I moved to a static NSString away from a custom NSObject that I made sure never got autoreleased. diff --git a/LuaSkin/lua-5.4.7/src/lopcodes.c b/LuaSkin/lua-5.4.7/src/lopcodes.c new file mode 100644 index 000000000..c67aa227c --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lopcodes.c @@ -0,0 +1,104 @@ +/* +** $Id: lopcodes.c $ +** Opcodes for Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#define lopcodes_c +#define LUA_CORE + +#include "lprefix.h" + + +#include "lopcodes.h" + + +/* ORDER OP */ + +LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { +/* MM OT IT T A mode opcode */ + opmode(0, 0, 0, 0, 1, iABC) /* OP_MOVE */ + ,opmode(0, 0, 0, 0, 1, iAsBx) /* OP_LOADI */ + ,opmode(0, 0, 0, 0, 1, iAsBx) /* OP_LOADF */ + ,opmode(0, 0, 0, 0, 1, iABx) /* OP_LOADK */ + ,opmode(0, 0, 0, 0, 1, iABx) /* OP_LOADKX */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_LOADFALSE */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_LFALSESKIP */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_LOADTRUE */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_LOADNIL */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_GETUPVAL */ + ,opmode(0, 0, 0, 0, 0, iABC) /* OP_SETUPVAL */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_GETTABUP */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_GETTABLE */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_GETI */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_GETFIELD */ + ,opmode(0, 0, 0, 0, 0, iABC) /* OP_SETTABUP */ + ,opmode(0, 0, 0, 0, 0, iABC) /* OP_SETTABLE */ + ,opmode(0, 0, 0, 0, 0, iABC) /* OP_SETI */ + ,opmode(0, 0, 0, 0, 0, iABC) /* OP_SETFIELD */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_NEWTABLE */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_SELF */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_ADDI */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_ADDK */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_SUBK */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_MULK */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_MODK */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_POWK */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_DIVK */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_IDIVK */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_BANDK */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_BORK */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_BXORK */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_SHRI */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_SHLI */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_ADD */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_SUB */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_MUL */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_MOD */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_POW */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_DIV */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_IDIV */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_BAND */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_BOR */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_BXOR */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_SHL */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_SHR */ + ,opmode(1, 0, 0, 0, 0, iABC) /* OP_MMBIN */ + ,opmode(1, 0, 0, 0, 0, iABC) /* OP_MMBINI*/ + ,opmode(1, 0, 0, 0, 0, iABC) /* OP_MMBINK*/ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_UNM */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_BNOT */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_NOT */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_LEN */ + ,opmode(0, 0, 0, 0, 1, iABC) /* OP_CONCAT */ + ,opmode(0, 0, 0, 0, 0, iABC) /* OP_CLOSE */ + ,opmode(0, 0, 0, 0, 0, iABC) /* OP_TBC */ + ,opmode(0, 0, 0, 0, 0, isJ) /* OP_JMP */ + ,opmode(0, 0, 0, 1, 0, iABC) /* OP_EQ */ + ,opmode(0, 0, 0, 1, 0, iABC) /* OP_LT */ + ,opmode(0, 0, 0, 1, 0, iABC) /* OP_LE */ + ,opmode(0, 0, 0, 1, 0, iABC) /* OP_EQK */ + ,opmode(0, 0, 0, 1, 0, iABC) /* OP_EQI */ + ,opmode(0, 0, 0, 1, 0, iABC) /* OP_LTI */ + ,opmode(0, 0, 0, 1, 0, iABC) /* OP_LEI */ + ,opmode(0, 0, 0, 1, 0, iABC) /* OP_GTI */ + ,opmode(0, 0, 0, 1, 0, iABC) /* OP_GEI */ + ,opmode(0, 0, 0, 1, 0, iABC) /* OP_TEST */ + ,opmode(0, 0, 0, 1, 1, iABC) /* OP_TESTSET */ + ,opmode(0, 1, 1, 0, 1, iABC) /* OP_CALL */ + ,opmode(0, 1, 1, 0, 1, iABC) /* OP_TAILCALL */ + ,opmode(0, 0, 1, 0, 0, iABC) /* OP_RETURN */ + ,opmode(0, 0, 0, 0, 0, iABC) /* OP_RETURN0 */ + ,opmode(0, 0, 0, 0, 0, iABC) /* OP_RETURN1 */ + ,opmode(0, 0, 0, 0, 1, iABx) /* OP_FORLOOP */ + ,opmode(0, 0, 0, 0, 1, iABx) /* OP_FORPREP */ + ,opmode(0, 0, 0, 0, 0, iABx) /* OP_TFORPREP */ + ,opmode(0, 0, 0, 0, 0, iABC) /* OP_TFORCALL */ + ,opmode(0, 0, 0, 0, 1, iABx) /* OP_TFORLOOP */ + ,opmode(0, 0, 1, 0, 0, iABC) /* OP_SETLIST */ + ,opmode(0, 0, 0, 0, 1, iABx) /* OP_CLOSURE */ + ,opmode(0, 1, 0, 0, 1, iABC) /* OP_VARARG */ + ,opmode(0, 0, 1, 0, 1, iABC) /* OP_VARARGPREP */ + ,opmode(0, 0, 0, 0, 0, iAx) /* OP_EXTRAARG */ +}; + diff --git a/LuaSkin/lua-5.4.7/src/lopcodes.h b/LuaSkin/lua-5.4.7/src/lopcodes.h new file mode 100644 index 000000000..46911cac1 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lopcodes.h @@ -0,0 +1,405 @@ +/* +** $Id: lopcodes.h $ +** Opcodes for Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#ifndef lopcodes_h +#define lopcodes_h + +#include "llimits.h" + + +/*=========================================================================== + We assume that instructions are unsigned 32-bit integers. + All instructions have an opcode in the first 7 bits. + Instructions can have the following formats: + + 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 + 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 +iABC C(8) | B(8) |k| A(8) | Op(7) | +iABx Bx(17) | A(8) | Op(7) | +iAsBx sBx (signed)(17) | A(8) | Op(7) | +iAx Ax(25) | Op(7) | +isJ sJ (signed)(25) | Op(7) | + + A signed argument is represented in excess K: the represented value is + the written unsigned value minus K, where K is half the maximum for the + corresponding unsigned argument. +===========================================================================*/ + + +enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */ + + +/* +** size and position of opcode arguments. +*/ +#define SIZE_C 8 +#define SIZE_B 8 +#define SIZE_Bx (SIZE_C + SIZE_B + 1) +#define SIZE_A 8 +#define SIZE_Ax (SIZE_Bx + SIZE_A) +#define SIZE_sJ (SIZE_Bx + SIZE_A) + +#define SIZE_OP 7 + +#define POS_OP 0 + +#define POS_A (POS_OP + SIZE_OP) +#define POS_k (POS_A + SIZE_A) +#define POS_B (POS_k + 1) +#define POS_C (POS_B + SIZE_B) + +#define POS_Bx POS_k + +#define POS_Ax POS_A + +#define POS_sJ POS_A + + +/* +** limits for opcode arguments. +** we use (signed) 'int' to manipulate most arguments, +** so they must fit in ints. +*/ + +/* Check whether type 'int' has at least 'b' bits ('b' < 32) */ +#define L_INTHASBITS(b) ((UINT_MAX >> ((b) - 1)) >= 1) + + +#if L_INTHASBITS(SIZE_Bx) +#define MAXARG_Bx ((1<>1) /* 'sBx' is signed */ + + +#if L_INTHASBITS(SIZE_Ax) +#define MAXARG_Ax ((1<> 1) + + +#define MAXARG_A ((1<> 1) + +#define int2sC(i) ((i) + OFFSET_sC) +#define sC2int(i) ((i) - OFFSET_sC) + + +/* creates a mask with 'n' 1 bits at position 'p' */ +#define MASK1(n,p) ((~((~(Instruction)0)<<(n)))<<(p)) + +/* creates a mask with 'n' 0 bits at position 'p' */ +#define MASK0(n,p) (~MASK1(n,p)) + +/* +** the following macros help to manipulate instructions +*/ + +#define GET_OPCODE(i) (cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0))) +#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \ + ((cast(Instruction, o)<>(pos)) & MASK1(size,0))) +#define setarg(i,v,pos,size) ((i) = (((i)&MASK0(size,pos)) | \ + ((cast(Instruction, v)<> sC */ +OP_SHLI,/* A B sC R[A] := sC << R[B] */ + +OP_ADD,/* A B C R[A] := R[B] + R[C] */ +OP_SUB,/* A B C R[A] := R[B] - R[C] */ +OP_MUL,/* A B C R[A] := R[B] * R[C] */ +OP_MOD,/* A B C R[A] := R[B] % R[C] */ +OP_POW,/* A B C R[A] := R[B] ^ R[C] */ +OP_DIV,/* A B C R[A] := R[B] / R[C] */ +OP_IDIV,/* A B C R[A] := R[B] // R[C] */ + +OP_BAND,/* A B C R[A] := R[B] & R[C] */ +OP_BOR,/* A B C R[A] := R[B] | R[C] */ +OP_BXOR,/* A B C R[A] := R[B] ~ R[C] */ +OP_SHL,/* A B C R[A] := R[B] << R[C] */ +OP_SHR,/* A B C R[A] := R[B] >> R[C] */ + +OP_MMBIN,/* A B C call C metamethod over R[A] and R[B] (*) */ +OP_MMBINI,/* A sB C k call C metamethod over R[A] and sB */ +OP_MMBINK,/* A B C k call C metamethod over R[A] and K[B] */ + +OP_UNM,/* A B R[A] := -R[B] */ +OP_BNOT,/* A B R[A] := ~R[B] */ +OP_NOT,/* A B R[A] := not R[B] */ +OP_LEN,/* A B R[A] := #R[B] (length operator) */ + +OP_CONCAT,/* A B R[A] := R[A].. ... ..R[A + B - 1] */ + +OP_CLOSE,/* A close all upvalues >= R[A] */ +OP_TBC,/* A mark variable A "to be closed" */ +OP_JMP,/* sJ pc += sJ */ +OP_EQ,/* A B k if ((R[A] == R[B]) ~= k) then pc++ */ +OP_LT,/* A B k if ((R[A] < R[B]) ~= k) then pc++ */ +OP_LE,/* A B k if ((R[A] <= R[B]) ~= k) then pc++ */ + +OP_EQK,/* A B k if ((R[A] == K[B]) ~= k) then pc++ */ +OP_EQI,/* A sB k if ((R[A] == sB) ~= k) then pc++ */ +OP_LTI,/* A sB k if ((R[A] < sB) ~= k) then pc++ */ +OP_LEI,/* A sB k if ((R[A] <= sB) ~= k) then pc++ */ +OP_GTI,/* A sB k if ((R[A] > sB) ~= k) then pc++ */ +OP_GEI,/* A sB k if ((R[A] >= sB) ~= k) then pc++ */ + +OP_TEST,/* A k if (not R[A] == k) then pc++ */ +OP_TESTSET,/* A B k if (not R[B] == k) then pc++ else R[A] := R[B] (*) */ + +OP_CALL,/* A B C R[A], ... ,R[A+C-2] := R[A](R[A+1], ... ,R[A+B-1]) */ +OP_TAILCALL,/* A B C k return R[A](R[A+1], ... ,R[A+B-1]) */ + +OP_RETURN,/* A B C k return R[A], ... ,R[A+B-2] (see note) */ +OP_RETURN0,/* return */ +OP_RETURN1,/* A return R[A] */ + +OP_FORLOOP,/* A Bx update counters; if loop continues then pc-=Bx; */ +OP_FORPREP,/* A Bx ; + if not to run then pc+=Bx+1; */ + +OP_TFORPREP,/* A Bx create upvalue for R[A + 3]; pc+=Bx */ +OP_TFORCALL,/* A C R[A+4], ... ,R[A+3+C] := R[A](R[A+1], R[A+2]); */ +OP_TFORLOOP,/* A Bx if R[A+2] ~= nil then { R[A]=R[A+2]; pc -= Bx } */ + +OP_SETLIST,/* A B C k R[A][C+i] := R[A+i], 1 <= i <= B */ + +OP_CLOSURE,/* A Bx R[A] := closure(KPROTO[Bx]) */ + +OP_VARARG,/* A C R[A], R[A+1], ..., R[A+C-2] = vararg */ + +OP_VARARGPREP,/*A (adjust vararg parameters) */ + +OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */ +} OpCode; + + +#define NUM_OPCODES ((int)(OP_EXTRAARG) + 1) + + + +/*=========================================================================== + Notes: + + (*) Opcode OP_LFALSESKIP is used to convert a condition to a boolean + value, in a code equivalent to (not cond ? false : true). (It + produces false and skips the next instruction producing true.) + + (*) Opcodes OP_MMBIN and variants follow each arithmetic and + bitwise opcode. If the operation succeeds, it skips this next + opcode. Otherwise, this opcode calls the corresponding metamethod. + + (*) Opcode OP_TESTSET is used in short-circuit expressions that need + both to jump and to produce a value, such as (a = b or c). + + (*) In OP_CALL, if (B == 0) then B = top - A. If (C == 0), then + 'top' is set to last_result+1, so next open instruction (OP_CALL, + OP_RETURN*, OP_SETLIST) may use 'top'. + + (*) In OP_VARARG, if (C == 0) then use actual number of varargs and + set top (like in OP_CALL with C == 0). + + (*) In OP_RETURN, if (B == 0) then return up to 'top'. + + (*) In OP_LOADKX and OP_NEWTABLE, the next instruction is always + OP_EXTRAARG. + + (*) In OP_SETLIST, if (B == 0) then real B = 'top'; if k, then + real C = EXTRAARG _ C (the bits of EXTRAARG concatenated with the + bits of C). + + (*) In OP_NEWTABLE, B is log2 of the hash size (which is always a + power of 2) plus 1, or zero for size zero. If not k, the array size + is C. Otherwise, the array size is EXTRAARG _ C. + + (*) For comparisons, k specifies what condition the test should accept + (true or false). + + (*) In OP_MMBINI/OP_MMBINK, k means the arguments were flipped + (the constant is the first operand). + + (*) All 'skips' (pc++) assume that next instruction is a jump. + + (*) In instructions OP_RETURN/OP_TAILCALL, 'k' specifies that the + function builds upvalues, which may need to be closed. C > 0 means + the function is vararg, so that its 'func' must be corrected before + returning; in this case, (C - 1) is its number of fixed parameters. + + (*) In comparisons with an immediate operand, C signals whether the + original operand was a float. (It must be corrected in case of + metamethods.) + +===========================================================================*/ + + +/* +** masks for instruction properties. The format is: +** bits 0-2: op mode +** bit 3: instruction set register A +** bit 4: operator is a test (next instruction must be a jump) +** bit 5: instruction uses 'L->top' set by previous instruction (when B == 0) +** bit 6: instruction sets 'L->top' for next instruction (when C == 0) +** bit 7: instruction is an MM instruction (call a metamethod) +*/ + +LUAI_DDEC(const lu_byte luaP_opmodes[NUM_OPCODES];) + +#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 7)) +#define testAMode(m) (luaP_opmodes[m] & (1 << 3)) +#define testTMode(m) (luaP_opmodes[m] & (1 << 4)) +#define testITMode(m) (luaP_opmodes[m] & (1 << 5)) +#define testOTMode(m) (luaP_opmodes[m] & (1 << 6)) +#define testMMMode(m) (luaP_opmodes[m] & (1 << 7)) + +/* "out top" (set top for next instruction) */ +#define isOT(i) \ + ((testOTMode(GET_OPCODE(i)) && GETARG_C(i) == 0) || \ + GET_OPCODE(i) == OP_TAILCALL) + +/* "in top" (uses top from previous instruction) */ +#define isIT(i) (testITMode(GET_OPCODE(i)) && GETARG_B(i) == 0) + +#define opmode(mm,ot,it,t,a,m) \ + (((mm) << 7) | ((ot) << 6) | ((it) << 5) | ((t) << 4) | ((a) << 3) | (m)) + + +/* number of list items to accumulate before a SETLIST instruction */ +#define LFIELDS_PER_FLUSH 50 + +#endif diff --git a/LuaSkin/lua-5.4.7/src/lopnames.h b/LuaSkin/lua-5.4.7/src/lopnames.h new file mode 100644 index 000000000..965cec9bf --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lopnames.h @@ -0,0 +1,103 @@ +/* +** $Id: lopnames.h $ +** Opcode names +** See Copyright Notice in lua.h +*/ + +#if !defined(lopnames_h) +#define lopnames_h + +#include + + +/* ORDER OP */ + +static const char *const opnames[] = { + "MOVE", + "LOADI", + "LOADF", + "LOADK", + "LOADKX", + "LOADFALSE", + "LFALSESKIP", + "LOADTRUE", + "LOADNIL", + "GETUPVAL", + "SETUPVAL", + "GETTABUP", + "GETTABLE", + "GETI", + "GETFIELD", + "SETTABUP", + "SETTABLE", + "SETI", + "SETFIELD", + "NEWTABLE", + "SELF", + "ADDI", + "ADDK", + "SUBK", + "MULK", + "MODK", + "POWK", + "DIVK", + "IDIVK", + "BANDK", + "BORK", + "BXORK", + "SHRI", + "SHLI", + "ADD", + "SUB", + "MUL", + "MOD", + "POW", + "DIV", + "IDIV", + "BAND", + "BOR", + "BXOR", + "SHL", + "SHR", + "MMBIN", + "MMBINI", + "MMBINK", + "UNM", + "BNOT", + "NOT", + "LEN", + "CONCAT", + "CLOSE", + "TBC", + "JMP", + "EQ", + "LT", + "LE", + "EQK", + "EQI", + "LTI", + "LEI", + "GTI", + "GEI", + "TEST", + "TESTSET", + "CALL", + "TAILCALL", + "RETURN", + "RETURN0", + "RETURN1", + "FORLOOP", + "FORPREP", + "TFORPREP", + "TFORCALL", + "TFORLOOP", + "SETLIST", + "CLOSURE", + "VARARG", + "VARARGPREP", + "EXTRAARG", + NULL +}; + +#endif + diff --git a/LuaSkin/lua-5.3.4/src/loslib.c b/LuaSkin/lua-5.4.7/src/loslib.c similarity index 79% rename from LuaSkin/lua-5.3.4/src/loslib.c rename to LuaSkin/lua-5.4.7/src/loslib.c index 5a94eb906..ba80d72c4 100644 --- a/LuaSkin/lua-5.3.4/src/loslib.c +++ b/LuaSkin/lua-5.4.7/src/loslib.c @@ -1,5 +1,5 @@ /* -** $Id: loslib.c,v 1.65 2016/07/18 17:58:58 roberto Exp $ +** $Id: loslib.c $ ** Standard Operating System library ** See Copyright Notice in lua.h */ @@ -30,23 +30,14 @@ */ #if !defined(LUA_STRFTIMEOPTIONS) /* { */ -/* options for ANSI C 89 (only 1-char options) */ -#define L_STRFTIMEC89 "aAbBcdHIjmMpSUwWxXyYZ%" - -/* options for ISO C 99 and POSIX */ -#define L_STRFTIMEC99 "aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ%" \ - "||" "EcECExEXEyEY" "OdOeOHOIOmOMOSOuOUOVOwOWOy" /* two-char options */ - -/* options for Windows */ -#define L_STRFTIMEWIN "aAbBcdHIjmMpSUwWxXyYzZ%" \ - "||" "#c#x#d#H#I#j#m#M#S#U#w#W#y#Y" /* two-char options */ - #if defined(LUA_USE_WINDOWS) -#define LUA_STRFTIMEOPTIONS L_STRFTIMEWIN -#elif defined(LUA_USE_C89) -#define LUA_STRFTIMEOPTIONS L_STRFTIMEC89 +#define LUA_STRFTIMEOPTIONS "aAbBcdHIjmMpSUwWxXyYzZ%" \ + "||" "#c#x#d#H#I#j#m#M#S#U#w#W#y#Y" /* two-char options */ +#elif defined(LUA_USE_C89) /* ANSI C 89 (only 1-char options) */ +#define LUA_STRFTIMEOPTIONS "aAbBcdHIjmMpSUwWxXyYZ%" #else /* C99 specification */ -#define LUA_STRFTIMEOPTIONS L_STRFTIMEC99 +#define LUA_STRFTIMEOPTIONS "aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ%" \ + "||" "EcECExEXEyEY" "OdOeOHOIOmOMOSOuOUOVOwOWOy" /* two-char options */ #endif #endif /* } */ @@ -59,18 +50,20 @@ ** =================================================================== */ -#if !defined(l_time_t) /* { */ /* ** type to represent time_t in Lua */ +#if !defined(LUA_NUMTIME) /* { */ + #define l_timet lua_Integer #define l_pushtime(L,t) lua_pushinteger(L,(lua_Integer)(t)) +#define l_gettime(L,arg) luaL_checkinteger(L, arg) -static time_t l_checktime (lua_State *L, int arg) { - lua_Integer t = luaL_checkinteger(L, arg); - luaL_argcheck(L, (time_t)t == t, arg, "time out-of-bounds"); - return (time_t)t; -} +#else /* }{ */ + +#define l_timet lua_Number +#define l_pushtime(L,t) lua_pushnumber(L,(lua_Number)(t)) +#define l_gettime(L,arg) luaL_checknumber(L, arg) #endif /* } */ @@ -90,7 +83,7 @@ static time_t l_checktime (lua_State *L, int arg) { /* ISO C definitions */ #define l_gmtime(t,r) ((void)(r)->tm_sec, gmtime(t)) -#define l_localtime(t,r) ((void)(r)->tm_sec, localtime(t)) +#define l_localtime(t,r) ((void)(r)->tm_sec, localtime(t)) #endif /* } */ @@ -136,11 +129,21 @@ static time_t l_checktime (lua_State *L, int arg) { /* }================================================================== */ +#if !defined(l_system) +#if defined(LUA_USE_IOS) +/* Despite claiming to be ISO C, iOS does not implement 'system'. */ +#define l_system(cmd) ((cmd) == NULL ? 0 : -1) +#else +#define l_system(cmd) system(cmd) /* default definition */ +#endif +#endif static int os_execute (lua_State *L) { const char *cmd = luaL_optstring(L, 1, NULL); - int stat = system(cmd); + int stat; + errno = 0; + stat = l_system(cmd); if (cmd != NULL) return luaL_execresult(L, stat); else { @@ -152,6 +155,7 @@ static int os_execute (lua_State *L) { static int os_remove (lua_State *L) { const char *filename = luaL_checkstring(L, 1); + errno = 0; return luaL_fileresult(L, remove(filename) == 0, filename); } @@ -159,6 +163,7 @@ static int os_remove (lua_State *L) { static int os_rename (lua_State *L) { const char *fromname = luaL_checkstring(L, 1); const char *toname = luaL_checkstring(L, 2); + errno = 0; return luaL_fileresult(L, rename(fromname, toname) == 0, NULL); } @@ -167,7 +172,7 @@ static int os_tmpname (lua_State *L) { char buff[LUA_TMPNAMBUFSIZE]; int err; lua_tmpnam(buff, err); - if (err) + if (l_unlikely(err)) return luaL_error(L, "unable to generate a unique filename"); lua_pushstring(L, buff); return 1; @@ -194,11 +199,25 @@ static int os_clock (lua_State *L) { ** ======================================================= */ -static void setfield (lua_State *L, const char *key, int value) { - lua_pushinteger(L, value); +/* +** About the overflow check: an overflow cannot occur when time +** is represented by a lua_Integer, because either lua_Integer is +** large enough to represent all int fields or it is not large enough +** to represent a time that cause a field to overflow. However, if +** times are represented as doubles and lua_Integer is int, then the +** time 0x1.e1853b0d184f6p+55 would cause an overflow when adding 1900 +** to compute the year. +*/ +static void setfield (lua_State *L, const char *key, int value, int delta) { + #if (defined(LUA_NUMTIME) && LUA_MAXINTEGER <= INT_MAX) + if (l_unlikely(value > LUA_MAXINTEGER - delta)) + luaL_error(L, "field '%s' is out-of-bound", key); + #endif + lua_pushinteger(L, (lua_Integer)value + delta); lua_setfield(L, -2, key); } + static void setboolfield (lua_State *L, const char *key, int value) { if (value < 0) /* undefined? */ return; /* does not set field */ @@ -211,14 +230,14 @@ static void setboolfield (lua_State *L, const char *key, int value) { ** Set all fields from structure 'tm' in the table on top of the stack */ static void setallfields (lua_State *L, struct tm *stm) { - setfield(L, "sec", stm->tm_sec); - setfield(L, "min", stm->tm_min); - setfield(L, "hour", stm->tm_hour); - setfield(L, "day", stm->tm_mday); - setfield(L, "month", stm->tm_mon + 1); - setfield(L, "year", stm->tm_year + 1900); - setfield(L, "wday", stm->tm_wday + 1); - setfield(L, "yday", stm->tm_yday + 1); + setfield(L, "year", stm->tm_year, 1900); + setfield(L, "month", stm->tm_mon, 1); + setfield(L, "day", stm->tm_mday, 0); + setfield(L, "hour", stm->tm_hour, 0); + setfield(L, "min", stm->tm_min, 0); + setfield(L, "sec", stm->tm_sec, 0); + setfield(L, "yday", stm->tm_yday, 1); + setfield(L, "wday", stm->tm_wday, 1); setboolfield(L, "isdst", stm->tm_isdst); } @@ -231,24 +250,19 @@ static int getboolfield (lua_State *L, const char *key) { } -/* maximum value for date fields (to avoid arithmetic overflows with 'int') */ -#if !defined(L_MAXDATEFIELD) -#define L_MAXDATEFIELD (INT_MAX / 2) -#endif - static int getfield (lua_State *L, const char *key, int d, int delta) { int isnum; int t = lua_getfield(L, -1, key); /* get field and its type */ lua_Integer res = lua_tointegerx(L, -1, &isnum); if (!isnum) { /* field is not an integer? */ - if (t != LUA_TNIL) /* some other value? */ + if (l_unlikely(t != LUA_TNIL)) /* some other value? */ return luaL_error(L, "field '%s' is not an integer", key); - else if (d < 0) /* absent field; no default? */ + else if (l_unlikely(d < 0)) /* absent field; no default? */ return luaL_error(L, "field '%s' missing in date table", key); res = d; } else { - if (!(-L_MAXDATEFIELD <= res && res <= L_MAXDATEFIELD)) + if (!(res >= 0 ? res - delta <= INT_MAX : INT_MIN + delta <= res)) return luaL_error(L, "field '%s' is out-of-bound", key); res -= delta; } @@ -276,6 +290,13 @@ static const char *checkoption (lua_State *L, const char *conv, } +static time_t l_checktime (lua_State *L, int arg) { + l_timet t = l_gettime(L, arg); + luaL_argcheck(L, (time_t)t == t, arg, "time out-of-bounds"); + return (time_t)t; +} + + /* maximum size for an individual 'strftime' item */ #define SIZETIMEFMT 250 @@ -293,7 +314,8 @@ static int os_date (lua_State *L) { else stm = l_localtime(&t, &tmr); if (stm == NULL) /* invalid date? */ - luaL_error(L, "time result cannot be represented in this installation"); + return luaL_error(L, + "date result cannot be represented in this installation"); if (strcmp(s, "*t") == 0) { lua_createtable(L, 0, 9); /* 9 = number of fields */ setallfields(L, stm); @@ -329,18 +351,19 @@ static int os_time (lua_State *L) { struct tm ts; luaL_checktype(L, 1, LUA_TTABLE); lua_settop(L, 1); /* make sure table is at the top */ - ts.tm_sec = getfield(L, "sec", 0, 0); - ts.tm_min = getfield(L, "min", 0, 0); - ts.tm_hour = getfield(L, "hour", 12, 0); - ts.tm_mday = getfield(L, "day", -1, 0); - ts.tm_mon = getfield(L, "month", -1, 1); ts.tm_year = getfield(L, "year", -1, 1900); + ts.tm_mon = getfield(L, "month", -1, 1); + ts.tm_mday = getfield(L, "day", -1, 0); + ts.tm_hour = getfield(L, "hour", 12, 0); + ts.tm_min = getfield(L, "min", 0, 0); + ts.tm_sec = getfield(L, "sec", 0, 0); ts.tm_isdst = getboolfield(L, "isdst"); t = mktime(&ts); setallfields(L, &ts); /* update fields with normalized values */ } if (t != (time_t)(l_timet)t || t == (time_t)(-1)) - luaL_error(L, "time result cannot be represented in this installation"); + return luaL_error(L, + "time result cannot be represented in this installation"); l_pushtime(L, t); return 1; } diff --git a/LuaSkin/lua-5.4.7/src/lparser.c b/LuaSkin/lua-5.4.7/src/lparser.c new file mode 100644 index 000000000..2b888c7cf --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lparser.c @@ -0,0 +1,1967 @@ +/* +** $Id: lparser.c $ +** Lua Parser +** See Copyright Notice in lua.h +*/ + +#define lparser_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include + +#include "lua.h" + +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "llex.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" + + + +/* maximum number of local variables per function (must be smaller + than 250, due to the bytecode format) */ +#define MAXVARS 200 + + +#define hasmultret(k) ((k) == VCALL || (k) == VVARARG) + + +/* because all strings are unified by the scanner, the parser + can use pointer equality for string equality */ +#define eqstr(a,b) ((a) == (b)) + + +/* +** nodes for block list (list of active blocks) +*/ +typedef struct BlockCnt { + struct BlockCnt *previous; /* chain */ + int firstlabel; /* index of first label in this block */ + int firstgoto; /* index of first pending goto in this block */ + lu_byte nactvar; /* # active locals outside the block */ + lu_byte upval; /* true if some variable in the block is an upvalue */ + lu_byte isloop; /* true if 'block' is a loop */ + lu_byte insidetbc; /* true if inside the scope of a to-be-closed var. */ +} BlockCnt; + + + +/* +** prototypes for recursive non-terminal functions +*/ +static void statement (LexState *ls); +static void expr (LexState *ls, expdesc *v); + + +static l_noret error_expected (LexState *ls, int token) { + luaX_syntaxerror(ls, + luaO_pushfstring(ls->L, "%s expected", luaX_token2str(ls, token))); +} + + +static l_noret errorlimit (FuncState *fs, int limit, const char *what) { + lua_State *L = fs->ls->L; + const char *msg; + int line = fs->f->linedefined; + const char *where = (line == 0) + ? "main function" + : luaO_pushfstring(L, "function at line %d", line); + msg = luaO_pushfstring(L, "too many %s (limit is %d) in %s", + what, limit, where); + luaX_syntaxerror(fs->ls, msg); +} + + +static void checklimit (FuncState *fs, int v, int l, const char *what) { + if (v > l) errorlimit(fs, l, what); +} + + +/* +** Test whether next token is 'c'; if so, skip it. +*/ +static int testnext (LexState *ls, int c) { + if (ls->t.token == c) { + luaX_next(ls); + return 1; + } + else return 0; +} + + +/* +** Check that next token is 'c'. +*/ +static void check (LexState *ls, int c) { + if (ls->t.token != c) + error_expected(ls, c); +} + + +/* +** Check that next token is 'c' and skip it. +*/ +static void checknext (LexState *ls, int c) { + check(ls, c); + luaX_next(ls); +} + + +#define check_condition(ls,c,msg) { if (!(c)) luaX_syntaxerror(ls, msg); } + + +/* +** Check that next token is 'what' and skip it. In case of error, +** raise an error that the expected 'what' should match a 'who' +** in line 'where' (if that is not the current line). +*/ +static void check_match (LexState *ls, int what, int who, int where) { + if (l_unlikely(!testnext(ls, what))) { + if (where == ls->linenumber) /* all in the same line? */ + error_expected(ls, what); /* do not need a complex message */ + else { + luaX_syntaxerror(ls, luaO_pushfstring(ls->L, + "%s expected (to close %s at line %d)", + luaX_token2str(ls, what), luaX_token2str(ls, who), where)); + } + } +} + + +static TString *str_checkname (LexState *ls) { + TString *ts; + check(ls, TK_NAME); + ts = ls->t.seminfo.ts; + luaX_next(ls); + return ts; +} + + +static void init_exp (expdesc *e, expkind k, int i) { + e->f = e->t = NO_JUMP; + e->k = k; + e->u.info = i; +} + + +static void codestring (expdesc *e, TString *s) { + e->f = e->t = NO_JUMP; + e->k = VKSTR; + e->u.strval = s; +} + + +static void codename (LexState *ls, expdesc *e) { + codestring(e, str_checkname(ls)); +} + + +/* +** Register a new local variable in the active 'Proto' (for debug +** information). +*/ +static int registerlocalvar (LexState *ls, FuncState *fs, TString *varname) { + Proto *f = fs->f; + int oldsize = f->sizelocvars; + luaM_growvector(ls->L, f->locvars, fs->ndebugvars, f->sizelocvars, + LocVar, SHRT_MAX, "local variables"); + while (oldsize < f->sizelocvars) + f->locvars[oldsize++].varname = NULL; + f->locvars[fs->ndebugvars].varname = varname; + f->locvars[fs->ndebugvars].startpc = fs->pc; + luaC_objbarrier(ls->L, f, varname); + return fs->ndebugvars++; +} + + +/* +** Create a new local variable with the given 'name'. Return its index +** in the function. +*/ +static int new_localvar (LexState *ls, TString *name) { + lua_State *L = ls->L; + FuncState *fs = ls->fs; + Dyndata *dyd = ls->dyd; + Vardesc *var; + checklimit(fs, dyd->actvar.n + 1 - fs->firstlocal, + MAXVARS, "local variables"); + luaM_growvector(L, dyd->actvar.arr, dyd->actvar.n + 1, + dyd->actvar.size, Vardesc, USHRT_MAX, "local variables"); + var = &dyd->actvar.arr[dyd->actvar.n++]; + var->vd.kind = VDKREG; /* default */ + var->vd.name = name; + return dyd->actvar.n - 1 - fs->firstlocal; +} + +#define new_localvarliteral(ls,v) \ + new_localvar(ls, \ + luaX_newstring(ls, "" v, (sizeof(v)/sizeof(char)) - 1)); + + + +/* +** Return the "variable description" (Vardesc) of a given variable. +** (Unless noted otherwise, all variables are referred to by their +** compiler indices.) +*/ +static Vardesc *getlocalvardesc (FuncState *fs, int vidx) { + return &fs->ls->dyd->actvar.arr[fs->firstlocal + vidx]; +} + + +/* +** Convert 'nvar', a compiler index level, to its corresponding +** register. For that, search for the highest variable below that level +** that is in a register and uses its register index ('ridx') plus one. +*/ +static int reglevel (FuncState *fs, int nvar) { + while (nvar-- > 0) { + Vardesc *vd = getlocalvardesc(fs, nvar); /* get previous variable */ + if (vd->vd.kind != RDKCTC) /* is in a register? */ + return vd->vd.ridx + 1; + } + return 0; /* no variables in registers */ +} + + +/* +** Return the number of variables in the register stack for the given +** function. +*/ +int luaY_nvarstack (FuncState *fs) { + return reglevel(fs, fs->nactvar); +} + + +/* +** Get the debug-information entry for current variable 'vidx'. +*/ +static LocVar *localdebuginfo (FuncState *fs, int vidx) { + Vardesc *vd = getlocalvardesc(fs, vidx); + if (vd->vd.kind == RDKCTC) + return NULL; /* no debug info. for constants */ + else { + int idx = vd->vd.pidx; + lua_assert(idx < fs->ndebugvars); + return &fs->f->locvars[idx]; + } +} + + +/* +** Create an expression representing variable 'vidx' +*/ +static void init_var (FuncState *fs, expdesc *e, int vidx) { + e->f = e->t = NO_JUMP; + e->k = VLOCAL; + e->u.var.vidx = vidx; + e->u.var.ridx = getlocalvardesc(fs, vidx)->vd.ridx; +} + + +/* +** Raises an error if variable described by 'e' is read only +*/ +static void check_readonly (LexState *ls, expdesc *e) { + FuncState *fs = ls->fs; + TString *varname = NULL; /* to be set if variable is const */ + switch (e->k) { + case VCONST: { + varname = ls->dyd->actvar.arr[e->u.info].vd.name; + break; + } + case VLOCAL: { + Vardesc *vardesc = getlocalvardesc(fs, e->u.var.vidx); + if (vardesc->vd.kind != VDKREG) /* not a regular variable? */ + varname = vardesc->vd.name; + break; + } + case VUPVAL: { + Upvaldesc *up = &fs->f->upvalues[e->u.info]; + if (up->kind != VDKREG) + varname = up->name; + break; + } + default: + return; /* other cases cannot be read-only */ + } + if (varname) { + const char *msg = luaO_pushfstring(ls->L, + "attempt to assign to const variable '%s'", getstr(varname)); + luaK_semerror(ls, msg); /* error */ + } +} + + +/* +** Start the scope for the last 'nvars' created variables. +*/ +static void adjustlocalvars (LexState *ls, int nvars) { + FuncState *fs = ls->fs; + int reglevel = luaY_nvarstack(fs); + int i; + for (i = 0; i < nvars; i++) { + int vidx = fs->nactvar++; + Vardesc *var = getlocalvardesc(fs, vidx); + var->vd.ridx = reglevel++; + var->vd.pidx = registerlocalvar(ls, fs, var->vd.name); + } +} + + +/* +** Close the scope for all variables up to level 'tolevel'. +** (debug info.) +*/ +static void removevars (FuncState *fs, int tolevel) { + fs->ls->dyd->actvar.n -= (fs->nactvar - tolevel); + while (fs->nactvar > tolevel) { + LocVar *var = localdebuginfo(fs, --fs->nactvar); + if (var) /* does it have debug information? */ + var->endpc = fs->pc; + } +} + + +/* +** Search the upvalues of the function 'fs' for one +** with the given 'name'. +*/ +static int searchupvalue (FuncState *fs, TString *name) { + int i; + Upvaldesc *up = fs->f->upvalues; + for (i = 0; i < fs->nups; i++) { + if (eqstr(up[i].name, name)) return i; + } + return -1; /* not found */ +} + + +static Upvaldesc *allocupvalue (FuncState *fs) { + Proto *f = fs->f; + int oldsize = f->sizeupvalues; + checklimit(fs, fs->nups + 1, MAXUPVAL, "upvalues"); + luaM_growvector(fs->ls->L, f->upvalues, fs->nups, f->sizeupvalues, + Upvaldesc, MAXUPVAL, "upvalues"); + while (oldsize < f->sizeupvalues) + f->upvalues[oldsize++].name = NULL; + return &f->upvalues[fs->nups++]; +} + + +static int newupvalue (FuncState *fs, TString *name, expdesc *v) { + Upvaldesc *up = allocupvalue(fs); + FuncState *prev = fs->prev; + if (v->k == VLOCAL) { + up->instack = 1; + up->idx = v->u.var.ridx; + up->kind = getlocalvardesc(prev, v->u.var.vidx)->vd.kind; + lua_assert(eqstr(name, getlocalvardesc(prev, v->u.var.vidx)->vd.name)); + } + else { + up->instack = 0; + up->idx = cast_byte(v->u.info); + up->kind = prev->f->upvalues[v->u.info].kind; + lua_assert(eqstr(name, prev->f->upvalues[v->u.info].name)); + } + up->name = name; + luaC_objbarrier(fs->ls->L, fs->f, name); + return fs->nups - 1; +} + + +/* +** Look for an active local variable with the name 'n' in the +** function 'fs'. If found, initialize 'var' with it and return +** its expression kind; otherwise return -1. +*/ +static int searchvar (FuncState *fs, TString *n, expdesc *var) { + int i; + for (i = cast_int(fs->nactvar) - 1; i >= 0; i--) { + Vardesc *vd = getlocalvardesc(fs, i); + if (eqstr(n, vd->vd.name)) { /* found? */ + if (vd->vd.kind == RDKCTC) /* compile-time constant? */ + init_exp(var, VCONST, fs->firstlocal + i); + else /* real variable */ + init_var(fs, var, i); + return var->k; + } + } + return -1; /* not found */ +} + + +/* +** Mark block where variable at given level was defined +** (to emit close instructions later). +*/ +static void markupval (FuncState *fs, int level) { + BlockCnt *bl = fs->bl; + while (bl->nactvar > level) + bl = bl->previous; + bl->upval = 1; + fs->needclose = 1; +} + + +/* +** Mark that current block has a to-be-closed variable. +*/ +static void marktobeclosed (FuncState *fs) { + BlockCnt *bl = fs->bl; + bl->upval = 1; + bl->insidetbc = 1; + fs->needclose = 1; +} + + +/* +** Find a variable with the given name 'n'. If it is an upvalue, add +** this upvalue into all intermediate functions. If it is a global, set +** 'var' as 'void' as a flag. +*/ +static void singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) { + if (fs == NULL) /* no more levels? */ + init_exp(var, VVOID, 0); /* default is global */ + else { + int v = searchvar(fs, n, var); /* look up locals at current level */ + if (v >= 0) { /* found? */ + if (v == VLOCAL && !base) + markupval(fs, var->u.var.vidx); /* local will be used as an upval */ + } + else { /* not found as local at current level; try upvalues */ + int idx = searchupvalue(fs, n); /* try existing upvalues */ + if (idx < 0) { /* not found? */ + singlevaraux(fs->prev, n, var, 0); /* try upper levels */ + if (var->k == VLOCAL || var->k == VUPVAL) /* local or upvalue? */ + idx = newupvalue(fs, n, var); /* will be a new upvalue */ + else /* it is a global or a constant */ + return; /* don't need to do anything at this level */ + } + init_exp(var, VUPVAL, idx); /* new or old upvalue */ + } + } +} + + +/* +** Find a variable with the given name 'n', handling global variables +** too. +*/ +static void singlevar (LexState *ls, expdesc *var) { + TString *varname = str_checkname(ls); + FuncState *fs = ls->fs; + singlevaraux(fs, varname, var, 1); + if (var->k == VVOID) { /* global name? */ + expdesc key; + singlevaraux(fs, ls->envn, var, 1); /* get environment variable */ + lua_assert(var->k != VVOID); /* this one must exist */ + luaK_exp2anyregup(fs, var); /* but could be a constant */ + codestring(&key, varname); /* key is variable name */ + luaK_indexed(fs, var, &key); /* env[varname] */ + } +} + + +/* +** Adjust the number of results from an expression list 'e' with 'nexps' +** expressions to 'nvars' values. +*/ +static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) { + FuncState *fs = ls->fs; + int needed = nvars - nexps; /* extra values needed */ + if (hasmultret(e->k)) { /* last expression has multiple returns? */ + int extra = needed + 1; /* discount last expression itself */ + if (extra < 0) + extra = 0; + luaK_setreturns(fs, e, extra); /* last exp. provides the difference */ + } + else { + if (e->k != VVOID) /* at least one expression? */ + luaK_exp2nextreg(fs, e); /* close last expression */ + if (needed > 0) /* missing values? */ + luaK_nil(fs, fs->freereg, needed); /* complete with nils */ + } + if (needed > 0) + luaK_reserveregs(fs, needed); /* registers for extra values */ + else /* adding 'needed' is actually a subtraction */ + fs->freereg += needed; /* remove extra values */ +} + + +#define enterlevel(ls) luaE_incCstack(ls->L) + + +#define leavelevel(ls) ((ls)->L->nCcalls--) + + +/* +** Generates an error that a goto jumps into the scope of some +** local variable. +*/ +static l_noret jumpscopeerror (LexState *ls, Labeldesc *gt) { + const char *varname = getstr(getlocalvardesc(ls->fs, gt->nactvar)->vd.name); + const char *msg = " at line %d jumps into the scope of local '%s'"; + msg = luaO_pushfstring(ls->L, msg, getstr(gt->name), gt->line, varname); + luaK_semerror(ls, msg); /* raise the error */ +} + + +/* +** Solves the goto at index 'g' to given 'label' and removes it +** from the list of pending gotos. +** If it jumps into the scope of some variable, raises an error. +*/ +static void solvegoto (LexState *ls, int g, Labeldesc *label) { + int i; + Labellist *gl = &ls->dyd->gt; /* list of gotos */ + Labeldesc *gt = &gl->arr[g]; /* goto to be resolved */ + lua_assert(eqstr(gt->name, label->name)); + if (l_unlikely(gt->nactvar < label->nactvar)) /* enter some scope? */ + jumpscopeerror(ls, gt); + luaK_patchlist(ls->fs, gt->pc, label->pc); + for (i = g; i < gl->n - 1; i++) /* remove goto from pending list */ + gl->arr[i] = gl->arr[i + 1]; + gl->n--; +} + + +/* +** Search for an active label with the given name. +*/ +static Labeldesc *findlabel (LexState *ls, TString *name) { + int i; + Dyndata *dyd = ls->dyd; + /* check labels in current function for a match */ + for (i = ls->fs->firstlabel; i < dyd->label.n; i++) { + Labeldesc *lb = &dyd->label.arr[i]; + if (eqstr(lb->name, name)) /* correct label? */ + return lb; + } + return NULL; /* label not found */ +} + + +/* +** Adds a new label/goto in the corresponding list. +*/ +static int newlabelentry (LexState *ls, Labellist *l, TString *name, + int line, int pc) { + int n = l->n; + luaM_growvector(ls->L, l->arr, n, l->size, + Labeldesc, SHRT_MAX, "labels/gotos"); + l->arr[n].name = name; + l->arr[n].line = line; + l->arr[n].nactvar = ls->fs->nactvar; + l->arr[n].close = 0; + l->arr[n].pc = pc; + l->n = n + 1; + return n; +} + + +static int newgotoentry (LexState *ls, TString *name, int line, int pc) { + return newlabelentry(ls, &ls->dyd->gt, name, line, pc); +} + + +/* +** Solves forward jumps. Check whether new label 'lb' matches any +** pending gotos in current block and solves them. Return true +** if any of the gotos need to close upvalues. +*/ +static int solvegotos (LexState *ls, Labeldesc *lb) { + Labellist *gl = &ls->dyd->gt; + int i = ls->fs->bl->firstgoto; + int needsclose = 0; + while (i < gl->n) { + if (eqstr(gl->arr[i].name, lb->name)) { + needsclose |= gl->arr[i].close; + solvegoto(ls, i, lb); /* will remove 'i' from the list */ + } + else + i++; + } + return needsclose; +} + + +/* +** Create a new label with the given 'name' at the given 'line'. +** 'last' tells whether label is the last non-op statement in its +** block. Solves all pending gotos to this new label and adds +** a close instruction if necessary. +** Returns true iff it added a close instruction. +*/ +static int createlabel (LexState *ls, TString *name, int line, + int last) { + FuncState *fs = ls->fs; + Labellist *ll = &ls->dyd->label; + int l = newlabelentry(ls, ll, name, line, luaK_getlabel(fs)); + if (last) { /* label is last no-op statement in the block? */ + /* assume that locals are already out of scope */ + ll->arr[l].nactvar = fs->bl->nactvar; + } + if (solvegotos(ls, &ll->arr[l])) { /* need close? */ + luaK_codeABC(fs, OP_CLOSE, luaY_nvarstack(fs), 0, 0); + return 1; + } + return 0; +} + + +/* +** Adjust pending gotos to outer level of a block. +*/ +static void movegotosout (FuncState *fs, BlockCnt *bl) { + int i; + Labellist *gl = &fs->ls->dyd->gt; + /* correct pending gotos to current block */ + for (i = bl->firstgoto; i < gl->n; i++) { /* for each pending goto */ + Labeldesc *gt = &gl->arr[i]; + /* leaving a variable scope? */ + if (reglevel(fs, gt->nactvar) > reglevel(fs, bl->nactvar)) + gt->close |= bl->upval; /* jump may need a close */ + gt->nactvar = bl->nactvar; /* update goto level */ + } +} + + +static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isloop) { + bl->isloop = isloop; + bl->nactvar = fs->nactvar; + bl->firstlabel = fs->ls->dyd->label.n; + bl->firstgoto = fs->ls->dyd->gt.n; + bl->upval = 0; + bl->insidetbc = (fs->bl != NULL && fs->bl->insidetbc); + bl->previous = fs->bl; + fs->bl = bl; + lua_assert(fs->freereg == luaY_nvarstack(fs)); +} + + +/* +** generates an error for an undefined 'goto'. +*/ +static l_noret undefgoto (LexState *ls, Labeldesc *gt) { + const char *msg; + if (eqstr(gt->name, luaS_newliteral(ls->L, "break"))) { + msg = "break outside loop at line %d"; + msg = luaO_pushfstring(ls->L, msg, gt->line); + } + else { + msg = "no visible label '%s' for at line %d"; + msg = luaO_pushfstring(ls->L, msg, getstr(gt->name), gt->line); + } + luaK_semerror(ls, msg); +} + + +static void leaveblock (FuncState *fs) { + BlockCnt *bl = fs->bl; + LexState *ls = fs->ls; + int hasclose = 0; + int stklevel = reglevel(fs, bl->nactvar); /* level outside the block */ + removevars(fs, bl->nactvar); /* remove block locals */ + lua_assert(bl->nactvar == fs->nactvar); /* back to level on entry */ + if (bl->isloop) /* has to fix pending breaks? */ + hasclose = createlabel(ls, luaS_newliteral(ls->L, "break"), 0, 0); + if (!hasclose && bl->previous && bl->upval) /* still need a 'close'? */ + luaK_codeABC(fs, OP_CLOSE, stklevel, 0, 0); + fs->freereg = stklevel; /* free registers */ + ls->dyd->label.n = bl->firstlabel; /* remove local labels */ + fs->bl = bl->previous; /* current block now is previous one */ + if (bl->previous) /* was it a nested block? */ + movegotosout(fs, bl); /* update pending gotos to enclosing block */ + else { + if (bl->firstgoto < ls->dyd->gt.n) /* still pending gotos? */ + undefgoto(ls, &ls->dyd->gt.arr[bl->firstgoto]); /* error */ + } +} + + +/* +** adds a new prototype into list of prototypes +*/ +static Proto *addprototype (LexState *ls) { + Proto *clp; + lua_State *L = ls->L; + FuncState *fs = ls->fs; + Proto *f = fs->f; /* prototype of current function */ + if (fs->np >= f->sizep) { + int oldsize = f->sizep; + luaM_growvector(L, f->p, fs->np, f->sizep, Proto *, MAXARG_Bx, "functions"); + while (oldsize < f->sizep) + f->p[oldsize++] = NULL; + } + f->p[fs->np++] = clp = luaF_newproto(L); + luaC_objbarrier(L, f, clp); + return clp; +} + + +/* +** codes instruction to create new closure in parent function. +** The OP_CLOSURE instruction uses the last available register, +** so that, if it invokes the GC, the GC knows which registers +** are in use at that time. + +*/ +static void codeclosure (LexState *ls, expdesc *v) { + FuncState *fs = ls->fs->prev; + init_exp(v, VRELOC, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np - 1)); + luaK_exp2nextreg(fs, v); /* fix it at the last register */ +} + + +static void open_func (LexState *ls, FuncState *fs, BlockCnt *bl) { + Proto *f = fs->f; + fs->prev = ls->fs; /* linked list of funcstates */ + fs->ls = ls; + ls->fs = fs; + fs->pc = 0; + fs->previousline = f->linedefined; + fs->iwthabs = 0; + fs->lasttarget = 0; + fs->freereg = 0; + fs->nk = 0; + fs->nabslineinfo = 0; + fs->np = 0; + fs->nups = 0; + fs->ndebugvars = 0; + fs->nactvar = 0; + fs->needclose = 0; + fs->firstlocal = ls->dyd->actvar.n; + fs->firstlabel = ls->dyd->label.n; + fs->bl = NULL; + f->source = ls->source; + luaC_objbarrier(ls->L, f, f->source); + f->maxstacksize = 2; /* registers 0/1 are always valid */ + enterblock(fs, bl, 0); +} + + +static void close_func (LexState *ls) { + lua_State *L = ls->L; + FuncState *fs = ls->fs; + Proto *f = fs->f; + luaK_ret(fs, luaY_nvarstack(fs), 0); /* final return */ + leaveblock(fs); + lua_assert(fs->bl == NULL); + luaK_finish(fs); + luaM_shrinkvector(L, f->code, f->sizecode, fs->pc, Instruction); + luaM_shrinkvector(L, f->lineinfo, f->sizelineinfo, fs->pc, ls_byte); + luaM_shrinkvector(L, f->abslineinfo, f->sizeabslineinfo, + fs->nabslineinfo, AbsLineInfo); + luaM_shrinkvector(L, f->k, f->sizek, fs->nk, TValue); + luaM_shrinkvector(L, f->p, f->sizep, fs->np, Proto *); + luaM_shrinkvector(L, f->locvars, f->sizelocvars, fs->ndebugvars, LocVar); + luaM_shrinkvector(L, f->upvalues, f->sizeupvalues, fs->nups, Upvaldesc); + ls->fs = fs->prev; + luaC_checkGC(L); +} + + + +/*============================================================*/ +/* GRAMMAR RULES */ +/*============================================================*/ + + +/* +** check whether current token is in the follow set of a block. +** 'until' closes syntactical blocks, but do not close scope, +** so it is handled in separate. +*/ +static int block_follow (LexState *ls, int withuntil) { + switch (ls->t.token) { + case TK_ELSE: case TK_ELSEIF: + case TK_END: case TK_EOS: + return 1; + case TK_UNTIL: return withuntil; + default: return 0; + } +} + + +static void statlist (LexState *ls) { + /* statlist -> { stat [';'] } */ + while (!block_follow(ls, 1)) { + if (ls->t.token == TK_RETURN) { + statement(ls); + return; /* 'return' must be last statement */ + } + statement(ls); + } +} + + +static void fieldsel (LexState *ls, expdesc *v) { + /* fieldsel -> ['.' | ':'] NAME */ + FuncState *fs = ls->fs; + expdesc key; + luaK_exp2anyregup(fs, v); + luaX_next(ls); /* skip the dot or colon */ + codename(ls, &key); + luaK_indexed(fs, v, &key); +} + + +static void yindex (LexState *ls, expdesc *v) { + /* index -> '[' expr ']' */ + luaX_next(ls); /* skip the '[' */ + expr(ls, v); + luaK_exp2val(ls->fs, v); + checknext(ls, ']'); +} + + +/* +** {====================================================================== +** Rules for Constructors +** ======================================================================= +*/ + + +typedef struct ConsControl { + expdesc v; /* last list item read */ + expdesc *t; /* table descriptor */ + int nh; /* total number of 'record' elements */ + int na; /* number of array elements already stored */ + int tostore; /* number of array elements pending to be stored */ +} ConsControl; + + +static void recfield (LexState *ls, ConsControl *cc) { + /* recfield -> (NAME | '['exp']') = exp */ + FuncState *fs = ls->fs; + int reg = ls->fs->freereg; + expdesc tab, key, val; + if (ls->t.token == TK_NAME) { + checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); + codename(ls, &key); + } + else /* ls->t.token == '[' */ + yindex(ls, &key); + cc->nh++; + checknext(ls, '='); + tab = *cc->t; + luaK_indexed(fs, &tab, &key); + expr(ls, &val); + luaK_storevar(fs, &tab, &val); + fs->freereg = reg; /* free registers */ +} + + +static void closelistfield (FuncState *fs, ConsControl *cc) { + if (cc->v.k == VVOID) return; /* there is no list item */ + luaK_exp2nextreg(fs, &cc->v); + cc->v.k = VVOID; + if (cc->tostore == LFIELDS_PER_FLUSH) { + luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore); /* flush */ + cc->na += cc->tostore; + cc->tostore = 0; /* no more items pending */ + } +} + + +static void lastlistfield (FuncState *fs, ConsControl *cc) { + if (cc->tostore == 0) return; + if (hasmultret(cc->v.k)) { + luaK_setmultret(fs, &cc->v); + luaK_setlist(fs, cc->t->u.info, cc->na, LUA_MULTRET); + cc->na--; /* do not count last expression (unknown number of elements) */ + } + else { + if (cc->v.k != VVOID) + luaK_exp2nextreg(fs, &cc->v); + luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore); + } + cc->na += cc->tostore; +} + + +static void listfield (LexState *ls, ConsControl *cc) { + /* listfield -> exp */ + expr(ls, &cc->v); + cc->tostore++; +} + + +static void field (LexState *ls, ConsControl *cc) { + /* field -> listfield | recfield */ + switch(ls->t.token) { + case TK_NAME: { /* may be 'listfield' or 'recfield' */ + if (luaX_lookahead(ls) != '=') /* expression? */ + listfield(ls, cc); + else + recfield(ls, cc); + break; + } + case '[': { + recfield(ls, cc); + break; + } + default: { + listfield(ls, cc); + break; + } + } +} + + +static void constructor (LexState *ls, expdesc *t) { + /* constructor -> '{' [ field { sep field } [sep] ] '}' + sep -> ',' | ';' */ + FuncState *fs = ls->fs; + int line = ls->linenumber; + int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0); + ConsControl cc; + luaK_code(fs, 0); /* space for extra arg. */ + cc.na = cc.nh = cc.tostore = 0; + cc.t = t; + init_exp(t, VNONRELOC, fs->freereg); /* table will be at stack top */ + luaK_reserveregs(fs, 1); + init_exp(&cc.v, VVOID, 0); /* no value (yet) */ + checknext(ls, '{'); + do { + lua_assert(cc.v.k == VVOID || cc.tostore > 0); + if (ls->t.token == '}') break; + closelistfield(fs, &cc); + field(ls, &cc); + } while (testnext(ls, ',') || testnext(ls, ';')); + check_match(ls, '}', '{', line); + lastlistfield(fs, &cc); + luaK_settablesize(fs, pc, t->u.info, cc.na, cc.nh); +} + +/* }====================================================================== */ + + +static void setvararg (FuncState *fs, int nparams) { + fs->f->is_vararg = 1; + luaK_codeABC(fs, OP_VARARGPREP, nparams, 0, 0); +} + + +static void parlist (LexState *ls) { + /* parlist -> [ {NAME ','} (NAME | '...') ] */ + FuncState *fs = ls->fs; + Proto *f = fs->f; + int nparams = 0; + int isvararg = 0; + if (ls->t.token != ')') { /* is 'parlist' not empty? */ + do { + switch (ls->t.token) { + case TK_NAME: { + new_localvar(ls, str_checkname(ls)); + nparams++; + break; + } + case TK_DOTS: { + luaX_next(ls); + isvararg = 1; + break; + } + default: luaX_syntaxerror(ls, " or '...' expected"); + } + } while (!isvararg && testnext(ls, ',')); + } + adjustlocalvars(ls, nparams); + f->numparams = cast_byte(fs->nactvar); + if (isvararg) + setvararg(fs, f->numparams); /* declared vararg */ + luaK_reserveregs(fs, fs->nactvar); /* reserve registers for parameters */ +} + + +static void body (LexState *ls, expdesc *e, int ismethod, int line) { + /* body -> '(' parlist ')' block END */ + FuncState new_fs; + BlockCnt bl; + new_fs.f = addprototype(ls); + new_fs.f->linedefined = line; + open_func(ls, &new_fs, &bl); + checknext(ls, '('); + if (ismethod) { + new_localvarliteral(ls, "self"); /* create 'self' parameter */ + adjustlocalvars(ls, 1); + } + parlist(ls); + checknext(ls, ')'); + statlist(ls); + new_fs.f->lastlinedefined = ls->linenumber; + check_match(ls, TK_END, TK_FUNCTION, line); + codeclosure(ls, e); + close_func(ls); +} + + +static int explist (LexState *ls, expdesc *v) { + /* explist -> expr { ',' expr } */ + int n = 1; /* at least one expression */ + expr(ls, v); + while (testnext(ls, ',')) { + luaK_exp2nextreg(ls->fs, v); + expr(ls, v); + n++; + } + return n; +} + + +static void funcargs (LexState *ls, expdesc *f) { + FuncState *fs = ls->fs; + expdesc args; + int base, nparams; + int line = ls->linenumber; + switch (ls->t.token) { + case '(': { /* funcargs -> '(' [ explist ] ')' */ + luaX_next(ls); + if (ls->t.token == ')') /* arg list is empty? */ + args.k = VVOID; + else { + explist(ls, &args); + if (hasmultret(args.k)) + luaK_setmultret(fs, &args); + } + check_match(ls, ')', '(', line); + break; + } + case '{': { /* funcargs -> constructor */ + constructor(ls, &args); + break; + } + case TK_STRING: { /* funcargs -> STRING */ + codestring(&args, ls->t.seminfo.ts); + luaX_next(ls); /* must use 'seminfo' before 'next' */ + break; + } + default: { + luaX_syntaxerror(ls, "function arguments expected"); + } + } + lua_assert(f->k == VNONRELOC); + base = f->u.info; /* base register for call */ + if (hasmultret(args.k)) + nparams = LUA_MULTRET; /* open call */ + else { + if (args.k != VVOID) + luaK_exp2nextreg(fs, &args); /* close last argument */ + nparams = fs->freereg - (base+1); + } + init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2)); + luaK_fixline(fs, line); + fs->freereg = base+1; /* call removes function and arguments and leaves + one result (unless changed later) */ +} + + + + +/* +** {====================================================================== +** Expression parsing +** ======================================================================= +*/ + + +static void primaryexp (LexState *ls, expdesc *v) { + /* primaryexp -> NAME | '(' expr ')' */ + switch (ls->t.token) { + case '(': { + int line = ls->linenumber; + luaX_next(ls); + expr(ls, v); + check_match(ls, ')', '(', line); + luaK_dischargevars(ls->fs, v); + return; + } + case TK_NAME: { + singlevar(ls, v); + return; + } + default: { + luaX_syntaxerror(ls, "unexpected symbol"); + } + } +} + + +static void suffixedexp (LexState *ls, expdesc *v) { + /* suffixedexp -> + primaryexp { '.' NAME | '[' exp ']' | ':' NAME funcargs | funcargs } */ + FuncState *fs = ls->fs; + primaryexp(ls, v); + for (;;) { + switch (ls->t.token) { + case '.': { /* fieldsel */ + fieldsel(ls, v); + break; + } + case '[': { /* '[' exp ']' */ + expdesc key; + luaK_exp2anyregup(fs, v); + yindex(ls, &key); + luaK_indexed(fs, v, &key); + break; + } + case ':': { /* ':' NAME funcargs */ + expdesc key; + luaX_next(ls); + codename(ls, &key); + luaK_self(fs, v, &key); + funcargs(ls, v); + break; + } + case '(': case TK_STRING: case '{': { /* funcargs */ + luaK_exp2nextreg(fs, v); + funcargs(ls, v); + break; + } + default: return; + } + } +} + + +static void simpleexp (LexState *ls, expdesc *v) { + /* simpleexp -> FLT | INT | STRING | NIL | TRUE | FALSE | ... | + constructor | FUNCTION body | suffixedexp */ + switch (ls->t.token) { + case TK_FLT: { + init_exp(v, VKFLT, 0); + v->u.nval = ls->t.seminfo.r; + break; + } + case TK_INT: { + init_exp(v, VKINT, 0); + v->u.ival = ls->t.seminfo.i; + break; + } + case TK_STRING: { + codestring(v, ls->t.seminfo.ts); + break; + } + case TK_NIL: { + init_exp(v, VNIL, 0); + break; + } + case TK_TRUE: { + init_exp(v, VTRUE, 0); + break; + } + case TK_FALSE: { + init_exp(v, VFALSE, 0); + break; + } + case TK_DOTS: { /* vararg */ + FuncState *fs = ls->fs; + check_condition(ls, fs->f->is_vararg, + "cannot use '...' outside a vararg function"); + init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 0, 1)); + break; + } + case '{': { /* constructor */ + constructor(ls, v); + return; + } + case TK_FUNCTION: { + luaX_next(ls); + body(ls, v, 0, ls->linenumber); + return; + } + default: { + suffixedexp(ls, v); + return; + } + } + luaX_next(ls); +} + + +static UnOpr getunopr (int op) { + switch (op) { + case TK_NOT: return OPR_NOT; + case '-': return OPR_MINUS; + case '~': return OPR_BNOT; + case '#': return OPR_LEN; + default: return OPR_NOUNOPR; + } +} + + +static BinOpr getbinopr (int op) { + switch (op) { + case '+': return OPR_ADD; + case '-': return OPR_SUB; + case '*': return OPR_MUL; + case '%': return OPR_MOD; + case '^': return OPR_POW; + case '/': return OPR_DIV; + case TK_IDIV: return OPR_IDIV; + case '&': return OPR_BAND; + case '|': return OPR_BOR; + case '~': return OPR_BXOR; + case TK_SHL: return OPR_SHL; + case TK_SHR: return OPR_SHR; + case TK_CONCAT: return OPR_CONCAT; + case TK_NE: return OPR_NE; + case TK_EQ: return OPR_EQ; + case '<': return OPR_LT; + case TK_LE: return OPR_LE; + case '>': return OPR_GT; + case TK_GE: return OPR_GE; + case TK_AND: return OPR_AND; + case TK_OR: return OPR_OR; + default: return OPR_NOBINOPR; + } +} + + +/* +** Priority table for binary operators. +*/ +static const struct { + lu_byte left; /* left priority for each binary operator */ + lu_byte right; /* right priority */ +} priority[] = { /* ORDER OPR */ + {10, 10}, {10, 10}, /* '+' '-' */ + {11, 11}, {11, 11}, /* '*' '%' */ + {14, 13}, /* '^' (right associative) */ + {11, 11}, {11, 11}, /* '/' '//' */ + {6, 6}, {4, 4}, {5, 5}, /* '&' '|' '~' */ + {7, 7}, {7, 7}, /* '<<' '>>' */ + {9, 8}, /* '..' (right associative) */ + {3, 3}, {3, 3}, {3, 3}, /* ==, <, <= */ + {3, 3}, {3, 3}, {3, 3}, /* ~=, >, >= */ + {2, 2}, {1, 1} /* and, or */ +}; + +#define UNARY_PRIORITY 12 /* priority for unary operators */ + + +/* +** subexpr -> (simpleexp | unop subexpr) { binop subexpr } +** where 'binop' is any binary operator with a priority higher than 'limit' +*/ +static BinOpr subexpr (LexState *ls, expdesc *v, int limit) { + BinOpr op; + UnOpr uop; + enterlevel(ls); + uop = getunopr(ls->t.token); + if (uop != OPR_NOUNOPR) { /* prefix (unary) operator? */ + int line = ls->linenumber; + luaX_next(ls); /* skip operator */ + subexpr(ls, v, UNARY_PRIORITY); + luaK_prefix(ls->fs, uop, v, line); + } + else simpleexp(ls, v); + /* expand while operators have priorities higher than 'limit' */ + op = getbinopr(ls->t.token); + while (op != OPR_NOBINOPR && priority[op].left > limit) { + expdesc v2; + BinOpr nextop; + int line = ls->linenumber; + luaX_next(ls); /* skip operator */ + luaK_infix(ls->fs, op, v); + /* read sub-expression with higher priority */ + nextop = subexpr(ls, &v2, priority[op].right); + luaK_posfix(ls->fs, op, v, &v2, line); + op = nextop; + } + leavelevel(ls); + return op; /* return first untreated operator */ +} + + +static void expr (LexState *ls, expdesc *v) { + subexpr(ls, v, 0); +} + +/* }==================================================================== */ + + + +/* +** {====================================================================== +** Rules for Statements +** ======================================================================= +*/ + + +static void block (LexState *ls) { + /* block -> statlist */ + FuncState *fs = ls->fs; + BlockCnt bl; + enterblock(fs, &bl, 0); + statlist(ls); + leaveblock(fs); +} + + +/* +** structure to chain all variables in the left-hand side of an +** assignment +*/ +struct LHS_assign { + struct LHS_assign *prev; + expdesc v; /* variable (global, local, upvalue, or indexed) */ +}; + + +/* +** check whether, in an assignment to an upvalue/local variable, the +** upvalue/local variable is begin used in a previous assignment to a +** table. If so, save original upvalue/local value in a safe place and +** use this safe copy in the previous assignment. +*/ +static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) { + FuncState *fs = ls->fs; + int extra = fs->freereg; /* eventual position to save local variable */ + int conflict = 0; + for (; lh; lh = lh->prev) { /* check all previous assignments */ + if (vkisindexed(lh->v.k)) { /* assignment to table field? */ + if (lh->v.k == VINDEXUP) { /* is table an upvalue? */ + if (v->k == VUPVAL && lh->v.u.ind.t == v->u.info) { + conflict = 1; /* table is the upvalue being assigned now */ + lh->v.k = VINDEXSTR; + lh->v.u.ind.t = extra; /* assignment will use safe copy */ + } + } + else { /* table is a register */ + if (v->k == VLOCAL && lh->v.u.ind.t == v->u.var.ridx) { + conflict = 1; /* table is the local being assigned now */ + lh->v.u.ind.t = extra; /* assignment will use safe copy */ + } + /* is index the local being assigned? */ + if (lh->v.k == VINDEXED && v->k == VLOCAL && + lh->v.u.ind.idx == v->u.var.ridx) { + conflict = 1; + lh->v.u.ind.idx = extra; /* previous assignment will use safe copy */ + } + } + } + } + if (conflict) { + /* copy upvalue/local value to a temporary (in position 'extra') */ + if (v->k == VLOCAL) + luaK_codeABC(fs, OP_MOVE, extra, v->u.var.ridx, 0); + else + luaK_codeABC(fs, OP_GETUPVAL, extra, v->u.info, 0); + luaK_reserveregs(fs, 1); + } +} + +/* +** Parse and compile a multiple assignment. The first "variable" +** (a 'suffixedexp') was already read by the caller. +** +** assignment -> suffixedexp restassign +** restassign -> ',' suffixedexp restassign | '=' explist +*/ +static void restassign (LexState *ls, struct LHS_assign *lh, int nvars) { + expdesc e; + check_condition(ls, vkisvar(lh->v.k), "syntax error"); + check_readonly(ls, &lh->v); + if (testnext(ls, ',')) { /* restassign -> ',' suffixedexp restassign */ + struct LHS_assign nv; + nv.prev = lh; + suffixedexp(ls, &nv.v); + if (!vkisindexed(nv.v.k)) + check_conflict(ls, lh, &nv.v); + enterlevel(ls); /* control recursion depth */ + restassign(ls, &nv, nvars+1); + leavelevel(ls); + } + else { /* restassign -> '=' explist */ + int nexps; + checknext(ls, '='); + nexps = explist(ls, &e); + if (nexps != nvars) + adjust_assign(ls, nvars, nexps, &e); + else { + luaK_setoneret(ls->fs, &e); /* close last expression */ + luaK_storevar(ls->fs, &lh->v, &e); + return; /* avoid default */ + } + } + init_exp(&e, VNONRELOC, ls->fs->freereg-1); /* default assignment */ + luaK_storevar(ls->fs, &lh->v, &e); +} + + +static int cond (LexState *ls) { + /* cond -> exp */ + expdesc v; + expr(ls, &v); /* read condition */ + if (v.k == VNIL) v.k = VFALSE; /* 'falses' are all equal here */ + luaK_goiftrue(ls->fs, &v); + return v.f; +} + + +static void gotostat (LexState *ls) { + FuncState *fs = ls->fs; + int line = ls->linenumber; + TString *name = str_checkname(ls); /* label's name */ + Labeldesc *lb = findlabel(ls, name); + if (lb == NULL) /* no label? */ + /* forward jump; will be resolved when the label is declared */ + newgotoentry(ls, name, line, luaK_jump(fs)); + else { /* found a label */ + /* backward jump; will be resolved here */ + int lblevel = reglevel(fs, lb->nactvar); /* label level */ + if (luaY_nvarstack(fs) > lblevel) /* leaving the scope of a variable? */ + luaK_codeABC(fs, OP_CLOSE, lblevel, 0, 0); + /* create jump and link it to the label */ + luaK_patchlist(fs, luaK_jump(fs), lb->pc); + } +} + + +/* +** Break statement. Semantically equivalent to "goto break". +*/ +static void breakstat (LexState *ls) { + int line = ls->linenumber; + luaX_next(ls); /* skip break */ + newgotoentry(ls, luaS_newliteral(ls->L, "break"), line, luaK_jump(ls->fs)); +} + + +/* +** Check whether there is already a label with the given 'name'. +*/ +static void checkrepeated (LexState *ls, TString *name) { + Labeldesc *lb = findlabel(ls, name); + if (l_unlikely(lb != NULL)) { /* already defined? */ + const char *msg = "label '%s' already defined on line %d"; + msg = luaO_pushfstring(ls->L, msg, getstr(name), lb->line); + luaK_semerror(ls, msg); /* error */ + } +} + + +static void labelstat (LexState *ls, TString *name, int line) { + /* label -> '::' NAME '::' */ + checknext(ls, TK_DBCOLON); /* skip double colon */ + while (ls->t.token == ';' || ls->t.token == TK_DBCOLON) + statement(ls); /* skip other no-op statements */ + checkrepeated(ls, name); /* check for repeated labels */ + createlabel(ls, name, line, block_follow(ls, 0)); +} + + +static void whilestat (LexState *ls, int line) { + /* whilestat -> WHILE cond DO block END */ + FuncState *fs = ls->fs; + int whileinit; + int condexit; + BlockCnt bl; + luaX_next(ls); /* skip WHILE */ + whileinit = luaK_getlabel(fs); + condexit = cond(ls); + enterblock(fs, &bl, 1); + checknext(ls, TK_DO); + block(ls); + luaK_jumpto(fs, whileinit); + check_match(ls, TK_END, TK_WHILE, line); + leaveblock(fs); + luaK_patchtohere(fs, condexit); /* false conditions finish the loop */ +} + + +static void repeatstat (LexState *ls, int line) { + /* repeatstat -> REPEAT block UNTIL cond */ + int condexit; + FuncState *fs = ls->fs; + int repeat_init = luaK_getlabel(fs); + BlockCnt bl1, bl2; + enterblock(fs, &bl1, 1); /* loop block */ + enterblock(fs, &bl2, 0); /* scope block */ + luaX_next(ls); /* skip REPEAT */ + statlist(ls); + check_match(ls, TK_UNTIL, TK_REPEAT, line); + condexit = cond(ls); /* read condition (inside scope block) */ + leaveblock(fs); /* finish scope */ + if (bl2.upval) { /* upvalues? */ + int exit = luaK_jump(fs); /* normal exit must jump over fix */ + luaK_patchtohere(fs, condexit); /* repetition must close upvalues */ + luaK_codeABC(fs, OP_CLOSE, reglevel(fs, bl2.nactvar), 0, 0); + condexit = luaK_jump(fs); /* repeat after closing upvalues */ + luaK_patchtohere(fs, exit); /* normal exit comes to here */ + } + luaK_patchlist(fs, condexit, repeat_init); /* close the loop */ + leaveblock(fs); /* finish loop */ +} + + +/* +** Read an expression and generate code to put its results in next +** stack slot. +** +*/ +static void exp1 (LexState *ls) { + expdesc e; + expr(ls, &e); + luaK_exp2nextreg(ls->fs, &e); + lua_assert(e.k == VNONRELOC); +} + + +/* +** Fix for instruction at position 'pc' to jump to 'dest'. +** (Jump addresses are relative in Lua). 'back' true means +** a back jump. +*/ +static void fixforjump (FuncState *fs, int pc, int dest, int back) { + Instruction *jmp = &fs->f->code[pc]; + int offset = dest - (pc + 1); + if (back) + offset = -offset; + if (l_unlikely(offset > MAXARG_Bx)) + luaX_syntaxerror(fs->ls, "control structure too long"); + SETARG_Bx(*jmp, offset); +} + + +/* +** Generate code for a 'for' loop. +*/ +static void forbody (LexState *ls, int base, int line, int nvars, int isgen) { + /* forbody -> DO block */ + static const OpCode forprep[2] = {OP_FORPREP, OP_TFORPREP}; + static const OpCode forloop[2] = {OP_FORLOOP, OP_TFORLOOP}; + BlockCnt bl; + FuncState *fs = ls->fs; + int prep, endfor; + checknext(ls, TK_DO); + prep = luaK_codeABx(fs, forprep[isgen], base, 0); + enterblock(fs, &bl, 0); /* scope for declared variables */ + adjustlocalvars(ls, nvars); + luaK_reserveregs(fs, nvars); + block(ls); + leaveblock(fs); /* end of scope for declared variables */ + fixforjump(fs, prep, luaK_getlabel(fs), 0); + if (isgen) { /* generic for? */ + luaK_codeABC(fs, OP_TFORCALL, base, 0, nvars); + luaK_fixline(fs, line); + } + endfor = luaK_codeABx(fs, forloop[isgen], base, 0); + fixforjump(fs, endfor, prep + 1, 1); + luaK_fixline(fs, line); +} + + +static void fornum (LexState *ls, TString *varname, int line) { + /* fornum -> NAME = exp,exp[,exp] forbody */ + FuncState *fs = ls->fs; + int base = fs->freereg; + new_localvarliteral(ls, "(for state)"); + new_localvarliteral(ls, "(for state)"); + new_localvarliteral(ls, "(for state)"); + new_localvar(ls, varname); + checknext(ls, '='); + exp1(ls); /* initial value */ + checknext(ls, ','); + exp1(ls); /* limit */ + if (testnext(ls, ',')) + exp1(ls); /* optional step */ + else { /* default step = 1 */ + luaK_int(fs, fs->freereg, 1); + luaK_reserveregs(fs, 1); + } + adjustlocalvars(ls, 3); /* control variables */ + forbody(ls, base, line, 1, 0); +} + + +static void forlist (LexState *ls, TString *indexname) { + /* forlist -> NAME {,NAME} IN explist forbody */ + FuncState *fs = ls->fs; + expdesc e; + int nvars = 5; /* gen, state, control, toclose, 'indexname' */ + int line; + int base = fs->freereg; + /* create control variables */ + new_localvarliteral(ls, "(for state)"); + new_localvarliteral(ls, "(for state)"); + new_localvarliteral(ls, "(for state)"); + new_localvarliteral(ls, "(for state)"); + /* create declared variables */ + new_localvar(ls, indexname); + while (testnext(ls, ',')) { + new_localvar(ls, str_checkname(ls)); + nvars++; + } + checknext(ls, TK_IN); + line = ls->linenumber; + adjust_assign(ls, 4, explist(ls, &e), &e); + adjustlocalvars(ls, 4); /* control variables */ + marktobeclosed(fs); /* last control var. must be closed */ + luaK_checkstack(fs, 3); /* extra space to call generator */ + forbody(ls, base, line, nvars - 4, 1); +} + + +static void forstat (LexState *ls, int line) { + /* forstat -> FOR (fornum | forlist) END */ + FuncState *fs = ls->fs; + TString *varname; + BlockCnt bl; + enterblock(fs, &bl, 1); /* scope for loop and control variables */ + luaX_next(ls); /* skip 'for' */ + varname = str_checkname(ls); /* first variable name */ + switch (ls->t.token) { + case '=': fornum(ls, varname, line); break; + case ',': case TK_IN: forlist(ls, varname); break; + default: luaX_syntaxerror(ls, "'=' or 'in' expected"); + } + check_match(ls, TK_END, TK_FOR, line); + leaveblock(fs); /* loop scope ('break' jumps to this point) */ +} + + +static void test_then_block (LexState *ls, int *escapelist) { + /* test_then_block -> [IF | ELSEIF] cond THEN block */ + BlockCnt bl; + FuncState *fs = ls->fs; + expdesc v; + int jf; /* instruction to skip 'then' code (if condition is false) */ + luaX_next(ls); /* skip IF or ELSEIF */ + expr(ls, &v); /* read condition */ + checknext(ls, TK_THEN); + if (ls->t.token == TK_BREAK) { /* 'if x then break' ? */ + int line = ls->linenumber; + luaK_goiffalse(ls->fs, &v); /* will jump if condition is true */ + luaX_next(ls); /* skip 'break' */ + enterblock(fs, &bl, 0); /* must enter block before 'goto' */ + newgotoentry(ls, luaS_newliteral(ls->L, "break"), line, v.t); + while (testnext(ls, ';')) {} /* skip semicolons */ + if (block_follow(ls, 0)) { /* jump is the entire block? */ + leaveblock(fs); + return; /* and that is it */ + } + else /* must skip over 'then' part if condition is false */ + jf = luaK_jump(fs); + } + else { /* regular case (not a break) */ + luaK_goiftrue(ls->fs, &v); /* skip over block if condition is false */ + enterblock(fs, &bl, 0); + jf = v.f; + } + statlist(ls); /* 'then' part */ + leaveblock(fs); + if (ls->t.token == TK_ELSE || + ls->t.token == TK_ELSEIF) /* followed by 'else'/'elseif'? */ + luaK_concat(fs, escapelist, luaK_jump(fs)); /* must jump over it */ + luaK_patchtohere(fs, jf); +} + + +static void ifstat (LexState *ls, int line) { + /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */ + FuncState *fs = ls->fs; + int escapelist = NO_JUMP; /* exit list for finished parts */ + test_then_block(ls, &escapelist); /* IF cond THEN block */ + while (ls->t.token == TK_ELSEIF) + test_then_block(ls, &escapelist); /* ELSEIF cond THEN block */ + if (testnext(ls, TK_ELSE)) + block(ls); /* 'else' part */ + check_match(ls, TK_END, TK_IF, line); + luaK_patchtohere(fs, escapelist); /* patch escape list to 'if' end */ +} + + +static void localfunc (LexState *ls) { + expdesc b; + FuncState *fs = ls->fs; + int fvar = fs->nactvar; /* function's variable index */ + new_localvar(ls, str_checkname(ls)); /* new local variable */ + adjustlocalvars(ls, 1); /* enter its scope */ + body(ls, &b, 0, ls->linenumber); /* function created in next register */ + /* debug information will only see the variable after this point! */ + localdebuginfo(fs, fvar)->startpc = fs->pc; +} + + +static int getlocalattribute (LexState *ls) { + /* ATTRIB -> ['<' Name '>'] */ + if (testnext(ls, '<')) { + const char *attr = getstr(str_checkname(ls)); + checknext(ls, '>'); + if (strcmp(attr, "const") == 0) + return RDKCONST; /* read-only variable */ + else if (strcmp(attr, "close") == 0) + return RDKTOCLOSE; /* to-be-closed variable */ + else + luaK_semerror(ls, + luaO_pushfstring(ls->L, "unknown attribute '%s'", attr)); + } + return VDKREG; /* regular variable */ +} + + +static void checktoclose (FuncState *fs, int level) { + if (level != -1) { /* is there a to-be-closed variable? */ + marktobeclosed(fs); + luaK_codeABC(fs, OP_TBC, reglevel(fs, level), 0, 0); + } +} + + +static void localstat (LexState *ls) { + /* stat -> LOCAL NAME ATTRIB { ',' NAME ATTRIB } ['=' explist] */ + FuncState *fs = ls->fs; + int toclose = -1; /* index of to-be-closed variable (if any) */ + Vardesc *var; /* last variable */ + int vidx, kind; /* index and kind of last variable */ + int nvars = 0; + int nexps; + expdesc e; + do { + vidx = new_localvar(ls, str_checkname(ls)); + kind = getlocalattribute(ls); + getlocalvardesc(fs, vidx)->vd.kind = kind; + if (kind == RDKTOCLOSE) { /* to-be-closed? */ + if (toclose != -1) /* one already present? */ + luaK_semerror(ls, "multiple to-be-closed variables in local list"); + toclose = fs->nactvar + nvars; + } + nvars++; + } while (testnext(ls, ',')); + if (testnext(ls, '=')) + nexps = explist(ls, &e); + else { + e.k = VVOID; + nexps = 0; + } + var = getlocalvardesc(fs, vidx); /* get last variable */ + if (nvars == nexps && /* no adjustments? */ + var->vd.kind == RDKCONST && /* last variable is const? */ + luaK_exp2const(fs, &e, &var->k)) { /* compile-time constant? */ + var->vd.kind = RDKCTC; /* variable is a compile-time constant */ + adjustlocalvars(ls, nvars - 1); /* exclude last variable */ + fs->nactvar++; /* but count it */ + } + else { + adjust_assign(ls, nvars, nexps, &e); + adjustlocalvars(ls, nvars); + } + checktoclose(fs, toclose); +} + + +static int funcname (LexState *ls, expdesc *v) { + /* funcname -> NAME {fieldsel} [':' NAME] */ + int ismethod = 0; + singlevar(ls, v); + while (ls->t.token == '.') + fieldsel(ls, v); + if (ls->t.token == ':') { + ismethod = 1; + fieldsel(ls, v); + } + return ismethod; +} + + +static void funcstat (LexState *ls, int line) { + /* funcstat -> FUNCTION funcname body */ + int ismethod; + expdesc v, b; + luaX_next(ls); /* skip FUNCTION */ + ismethod = funcname(ls, &v); + body(ls, &b, ismethod, line); + check_readonly(ls, &v); + luaK_storevar(ls->fs, &v, &b); + luaK_fixline(ls->fs, line); /* definition "happens" in the first line */ +} + + +static void exprstat (LexState *ls) { + /* stat -> func | assignment */ + FuncState *fs = ls->fs; + struct LHS_assign v; + suffixedexp(ls, &v.v); + if (ls->t.token == '=' || ls->t.token == ',') { /* stat -> assignment ? */ + v.prev = NULL; + restassign(ls, &v, 1); + } + else { /* stat -> func */ + Instruction *inst; + check_condition(ls, v.v.k == VCALL, "syntax error"); + inst = &getinstruction(fs, &v.v); + SETARG_C(*inst, 1); /* call statement uses no results */ + } +} + + +static void retstat (LexState *ls) { + /* stat -> RETURN [explist] [';'] */ + FuncState *fs = ls->fs; + expdesc e; + int nret; /* number of values being returned */ + int first = luaY_nvarstack(fs); /* first slot to be returned */ + if (block_follow(ls, 1) || ls->t.token == ';') + nret = 0; /* return no values */ + else { + nret = explist(ls, &e); /* optional return values */ + if (hasmultret(e.k)) { + luaK_setmultret(fs, &e); + if (e.k == VCALL && nret == 1 && !fs->bl->insidetbc) { /* tail call? */ + SET_OPCODE(getinstruction(fs,&e), OP_TAILCALL); + lua_assert(GETARG_A(getinstruction(fs,&e)) == luaY_nvarstack(fs)); + } + nret = LUA_MULTRET; /* return all values */ + } + else { + if (nret == 1) /* only one single value? */ + first = luaK_exp2anyreg(fs, &e); /* can use original slot */ + else { /* values must go to the top of the stack */ + luaK_exp2nextreg(fs, &e); + lua_assert(nret == fs->freereg - first); + } + } + } + luaK_ret(fs, first, nret); + testnext(ls, ';'); /* skip optional semicolon */ +} + + +static void statement (LexState *ls) { + int line = ls->linenumber; /* may be needed for error messages */ + enterlevel(ls); + switch (ls->t.token) { + case ';': { /* stat -> ';' (empty statement) */ + luaX_next(ls); /* skip ';' */ + break; + } + case TK_IF: { /* stat -> ifstat */ + ifstat(ls, line); + break; + } + case TK_WHILE: { /* stat -> whilestat */ + whilestat(ls, line); + break; + } + case TK_DO: { /* stat -> DO block END */ + luaX_next(ls); /* skip DO */ + block(ls); + check_match(ls, TK_END, TK_DO, line); + break; + } + case TK_FOR: { /* stat -> forstat */ + forstat(ls, line); + break; + } + case TK_REPEAT: { /* stat -> repeatstat */ + repeatstat(ls, line); + break; + } + case TK_FUNCTION: { /* stat -> funcstat */ + funcstat(ls, line); + break; + } + case TK_LOCAL: { /* stat -> localstat */ + luaX_next(ls); /* skip LOCAL */ + if (testnext(ls, TK_FUNCTION)) /* local function? */ + localfunc(ls); + else + localstat(ls); + break; + } + case TK_DBCOLON: { /* stat -> label */ + luaX_next(ls); /* skip double colon */ + labelstat(ls, str_checkname(ls), line); + break; + } + case TK_RETURN: { /* stat -> retstat */ + luaX_next(ls); /* skip RETURN */ + retstat(ls); + break; + } + case TK_BREAK: { /* stat -> breakstat */ + breakstat(ls); + break; + } + case TK_GOTO: { /* stat -> 'goto' NAME */ + luaX_next(ls); /* skip 'goto' */ + gotostat(ls); + break; + } + default: { /* stat -> func | assignment */ + exprstat(ls); + break; + } + } + lua_assert(ls->fs->f->maxstacksize >= ls->fs->freereg && + ls->fs->freereg >= luaY_nvarstack(ls->fs)); + ls->fs->freereg = luaY_nvarstack(ls->fs); /* free registers */ + leavelevel(ls); +} + +/* }====================================================================== */ + + +/* +** compiles the main function, which is a regular vararg function with an +** upvalue named LUA_ENV +*/ +static void mainfunc (LexState *ls, FuncState *fs) { + BlockCnt bl; + Upvaldesc *env; + open_func(ls, fs, &bl); + setvararg(fs, 0); /* main function is always declared vararg */ + env = allocupvalue(fs); /* ...set environment upvalue */ + env->instack = 1; + env->idx = 0; + env->kind = VDKREG; + env->name = ls->envn; + luaC_objbarrier(ls->L, fs->f, env->name); + luaX_next(ls); /* read first token */ + statlist(ls); /* parse main body */ + check(ls, TK_EOS); + close_func(ls); +} + + +LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, + Dyndata *dyd, const char *name, int firstchar) { + LexState lexstate; + FuncState funcstate; + LClosure *cl = luaF_newLclosure(L, 1); /* create main closure */ + setclLvalue2s(L, L->top.p, cl); /* anchor it (to avoid being collected) */ + luaD_inctop(L); + lexstate.h = luaH_new(L); /* create table for scanner */ + sethvalue2s(L, L->top.p, lexstate.h); /* anchor it */ + luaD_inctop(L); + funcstate.f = cl->p = luaF_newproto(L); + luaC_objbarrier(L, cl, cl->p); + funcstate.f->source = luaS_new(L, name); /* create and anchor TString */ + luaC_objbarrier(L, funcstate.f, funcstate.f->source); + lexstate.buff = buff; + lexstate.dyd = dyd; + dyd->actvar.n = dyd->gt.n = dyd->label.n = 0; + luaX_setinput(L, &lexstate, z, funcstate.f->source, firstchar); + mainfunc(&lexstate, &funcstate); + lua_assert(!funcstate.prev && funcstate.nups == 1 && !lexstate.fs); + /* all scopes should be correctly finished */ + lua_assert(dyd->actvar.n == 0 && dyd->gt.n == 0 && dyd->label.n == 0); + L->top.p--; /* remove scanner's table */ + return cl; /* closure is on the stack, too */ +} + diff --git a/LuaSkin/lua-5.4.7/src/lparser.h b/LuaSkin/lua-5.4.7/src/lparser.h new file mode 100644 index 000000000..5e4500f18 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lparser.h @@ -0,0 +1,171 @@ +/* +** $Id: lparser.h $ +** Lua Parser +** See Copyright Notice in lua.h +*/ + +#ifndef lparser_h +#define lparser_h + +#include "llimits.h" +#include "lobject.h" +#include "lzio.h" + + +/* +** Expression and variable descriptor. +** Code generation for variables and expressions can be delayed to allow +** optimizations; An 'expdesc' structure describes a potentially-delayed +** variable/expression. It has a description of its "main" value plus a +** list of conditional jumps that can also produce its value (generated +** by short-circuit operators 'and'/'or'). +*/ + +/* kinds of variables/expressions */ +typedef enum { + VVOID, /* when 'expdesc' describes the last expression of a list, + this kind means an empty list (so, no expression) */ + VNIL, /* constant nil */ + VTRUE, /* constant true */ + VFALSE, /* constant false */ + VK, /* constant in 'k'; info = index of constant in 'k' */ + VKFLT, /* floating constant; nval = numerical float value */ + VKINT, /* integer constant; ival = numerical integer value */ + VKSTR, /* string constant; strval = TString address; + (string is fixed by the lexer) */ + VNONRELOC, /* expression has its value in a fixed register; + info = result register */ + VLOCAL, /* local variable; var.ridx = register index; + var.vidx = relative index in 'actvar.arr' */ + VUPVAL, /* upvalue variable; info = index of upvalue in 'upvalues' */ + VCONST, /* compile-time variable; + info = absolute index in 'actvar.arr' */ + VINDEXED, /* indexed variable; + ind.t = table register; + ind.idx = key's R index */ + VINDEXUP, /* indexed upvalue; + ind.t = table upvalue; + ind.idx = key's K index */ + VINDEXI, /* indexed variable with constant integer; + ind.t = table register; + ind.idx = key's value */ + VINDEXSTR, /* indexed variable with literal string; + ind.t = table register; + ind.idx = key's K index */ + VJMP, /* expression is a test/comparison; + info = pc of corresponding jump instruction */ + VRELOC, /* expression can put result in any register; + info = instruction pc */ + VCALL, /* expression is a function call; info = instruction pc */ + VVARARG /* vararg expression; info = instruction pc */ +} expkind; + + +#define vkisvar(k) (VLOCAL <= (k) && (k) <= VINDEXSTR) +#define vkisindexed(k) (VINDEXED <= (k) && (k) <= VINDEXSTR) + + +typedef struct expdesc { + expkind k; + union { + lua_Integer ival; /* for VKINT */ + lua_Number nval; /* for VKFLT */ + TString *strval; /* for VKSTR */ + int info; /* for generic use */ + struct { /* for indexed variables */ + short idx; /* index (R or "long" K) */ + lu_byte t; /* table (register or upvalue) */ + } ind; + struct { /* for local variables */ + lu_byte ridx; /* register holding the variable */ + unsigned short vidx; /* compiler index (in 'actvar.arr') */ + } var; + } u; + int t; /* patch list of 'exit when true' */ + int f; /* patch list of 'exit when false' */ +} expdesc; + + +/* kinds of variables */ +#define VDKREG 0 /* regular */ +#define RDKCONST 1 /* constant */ +#define RDKTOCLOSE 2 /* to-be-closed */ +#define RDKCTC 3 /* compile-time constant */ + +/* description of an active local variable */ +typedef union Vardesc { + struct { + TValuefields; /* constant value (if it is a compile-time constant) */ + lu_byte kind; + lu_byte ridx; /* register holding the variable */ + short pidx; /* index of the variable in the Proto's 'locvars' array */ + TString *name; /* variable name */ + } vd; + TValue k; /* constant value (if any) */ +} Vardesc; + + + +/* description of pending goto statements and label statements */ +typedef struct Labeldesc { + TString *name; /* label identifier */ + int pc; /* position in code */ + int line; /* line where it appeared */ + lu_byte nactvar; /* number of active variables in that position */ + lu_byte close; /* goto that escapes upvalues */ +} Labeldesc; + + +/* list of labels or gotos */ +typedef struct Labellist { + Labeldesc *arr; /* array */ + int n; /* number of entries in use */ + int size; /* array size */ +} Labellist; + + +/* dynamic structures used by the parser */ +typedef struct Dyndata { + struct { /* list of all active local variables */ + Vardesc *arr; + int n; + int size; + } actvar; + Labellist gt; /* list of pending gotos */ + Labellist label; /* list of active labels */ +} Dyndata; + + +/* control of blocks */ +struct BlockCnt; /* defined in lparser.c */ + + +/* state needed to generate code for a given function */ +typedef struct FuncState { + Proto *f; /* current function header */ + struct FuncState *prev; /* enclosing function */ + struct LexState *ls; /* lexical state */ + struct BlockCnt *bl; /* chain of current blocks */ + int pc; /* next position to code (equivalent to 'ncode') */ + int lasttarget; /* 'label' of last 'jump label' */ + int previousline; /* last line that was saved in 'lineinfo' */ + int nk; /* number of elements in 'k' */ + int np; /* number of elements in 'p' */ + int nabslineinfo; /* number of elements in 'abslineinfo' */ + int firstlocal; /* index of first local var (in Dyndata array) */ + int firstlabel; /* index of first label (in 'dyd->label->arr') */ + short ndebugvars; /* number of elements in 'f->locvars' */ + lu_byte nactvar; /* number of active local variables */ + lu_byte nups; /* number of upvalues */ + lu_byte freereg; /* first free register */ + lu_byte iwthabs; /* instructions issued since last absolute line info */ + lu_byte needclose; /* function needs to close upvalues when returning */ +} FuncState; + + +LUAI_FUNC int luaY_nvarstack (FuncState *fs); +LUAI_FUNC LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, + Dyndata *dyd, const char *name, int firstchar); + + +#endif diff --git a/LuaSkin/lua-5.3.4/src/lprefix.h b/LuaSkin/lua-5.4.7/src/lprefix.h similarity index 89% rename from LuaSkin/lua-5.3.4/src/lprefix.h rename to LuaSkin/lua-5.4.7/src/lprefix.h index 02daa837f..484f2ad6f 100644 --- a/LuaSkin/lua-5.3.4/src/lprefix.h +++ b/LuaSkin/lua-5.4.7/src/lprefix.h @@ -1,5 +1,5 @@ /* -** $Id: lprefix.h,v 1.2 2014/12/29 16:54:13 roberto Exp $ +** $Id: lprefix.h $ ** Definitions for Lua code that must come before any other header file ** See Copyright Notice in lua.h */ @@ -33,7 +33,7 @@ /* ** Windows stuff */ -#if defined(_WIN32) /* { */ +#if defined(_WIN32) /* { */ #if !defined(_CRT_SECURE_NO_WARNINGS) #define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ISO C functions */ diff --git a/LuaSkin/lua-5.4.7/src/lstate.c b/LuaSkin/lua-5.4.7/src/lstate.c new file mode 100644 index 000000000..7fefacba2 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lstate.c @@ -0,0 +1,445 @@ +/* +** $Id: lstate.c $ +** Global State +** See Copyright Notice in lua.h +*/ + +#define lstate_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include + +#include "lua.h" + +#include "lapi.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "llex.h" +#include "lmem.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + + +/* +** thread state + extra space +*/ +typedef struct LX { + lu_byte extra_[LUA_EXTRASPACE]; + lua_State l; +} LX; + + +/* +** Main thread combines a thread state and the global state +*/ +typedef struct LG { + LX l; + global_State g; +} LG; + + + +#define fromstate(L) (cast(LX *, cast(lu_byte *, (L)) - offsetof(LX, l))) + + +/* +** A macro to create a "random" seed when a state is created; +** the seed is used to randomize string hashes. +*/ +#if !defined(luai_makeseed) + +#include + +/* +** Compute an initial seed with some level of randomness. +** Rely on Address Space Layout Randomization (if present) and +** current time. +*/ +#define addbuff(b,p,e) \ + { size_t t = cast_sizet(e); \ + memcpy(b + p, &t, sizeof(t)); p += sizeof(t); } + +static unsigned int luai_makeseed (lua_State *L) { + char buff[3 * sizeof(size_t)]; + unsigned int h = cast_uint(time(NULL)); + int p = 0; + addbuff(buff, p, L); /* heap variable */ + addbuff(buff, p, &h); /* local variable */ + addbuff(buff, p, &lua_newstate); /* public function */ + lua_assert(p == sizeof(buff)); + return luaS_hash(buff, p, h); +} + +#endif + + +/* +** set GCdebt to a new value keeping the value (totalbytes + GCdebt) +** invariant (and avoiding underflows in 'totalbytes') +*/ +void luaE_setdebt (global_State *g, l_mem debt) { + l_mem tb = gettotalbytes(g); + lua_assert(tb > 0); + if (debt < tb - MAX_LMEM) + debt = tb - MAX_LMEM; /* will make 'totalbytes == MAX_LMEM' */ + g->totalbytes = tb - debt; + g->GCdebt = debt; +} + + +LUA_API int lua_setcstacklimit (lua_State *L, unsigned int limit) { + UNUSED(L); UNUSED(limit); + return LUAI_MAXCCALLS; /* warning?? */ +} + + +CallInfo *luaE_extendCI (lua_State *L) { + CallInfo *ci; + lua_assert(L->ci->next == NULL); + ci = luaM_new(L, CallInfo); + lua_assert(L->ci->next == NULL); + L->ci->next = ci; + ci->previous = L->ci; + ci->next = NULL; + ci->u.l.trap = 0; + L->nci++; + return ci; +} + + +/* +** free all CallInfo structures not in use by a thread +*/ +static void freeCI (lua_State *L) { + CallInfo *ci = L->ci; + CallInfo *next = ci->next; + ci->next = NULL; + while ((ci = next) != NULL) { + next = ci->next; + luaM_free(L, ci); + L->nci--; + } +} + + +/* +** free half of the CallInfo structures not in use by a thread, +** keeping the first one. +*/ +void luaE_shrinkCI (lua_State *L) { + CallInfo *ci = L->ci->next; /* first free CallInfo */ + CallInfo *next; + if (ci == NULL) + return; /* no extra elements */ + while ((next = ci->next) != NULL) { /* two extra elements? */ + CallInfo *next2 = next->next; /* next's next */ + ci->next = next2; /* remove next from the list */ + L->nci--; + luaM_free(L, next); /* free next */ + if (next2 == NULL) + break; /* no more elements */ + else { + next2->previous = ci; + ci = next2; /* continue */ + } + } +} + + +/* +** Called when 'getCcalls(L)' larger or equal to LUAI_MAXCCALLS. +** If equal, raises an overflow error. If value is larger than +** LUAI_MAXCCALLS (which means it is handling an overflow) but +** not much larger, does not report an error (to allow overflow +** handling to work). +*/ +void luaE_checkcstack (lua_State *L) { + if (getCcalls(L) == LUAI_MAXCCALLS) + luaG_runerror(L, "C stack overflow"); + else if (getCcalls(L) >= (LUAI_MAXCCALLS / 10 * 11)) + luaD_throw(L, LUA_ERRERR); /* error while handling stack error */ +} + + +LUAI_FUNC void luaE_incCstack (lua_State *L) { + L->nCcalls++; + if (l_unlikely(getCcalls(L) >= LUAI_MAXCCALLS)) + luaE_checkcstack(L); +} + + +static void stack_init (lua_State *L1, lua_State *L) { + int i; CallInfo *ci; + /* initialize stack array */ + L1->stack.p = luaM_newvector(L, BASIC_STACK_SIZE + EXTRA_STACK, StackValue); + L1->tbclist.p = L1->stack.p; + for (i = 0; i < BASIC_STACK_SIZE + EXTRA_STACK; i++) + setnilvalue(s2v(L1->stack.p + i)); /* erase new stack */ + L1->top.p = L1->stack.p; + L1->stack_last.p = L1->stack.p + BASIC_STACK_SIZE; + /* initialize first ci */ + ci = &L1->base_ci; + ci->next = ci->previous = NULL; + ci->callstatus = CIST_C; + ci->func.p = L1->top.p; + ci->u.c.k = NULL; + ci->nresults = 0; + setnilvalue(s2v(L1->top.p)); /* 'function' entry for this 'ci' */ + L1->top.p++; + ci->top.p = L1->top.p + LUA_MINSTACK; + L1->ci = ci; +} + + +static void freestack (lua_State *L) { + if (L->stack.p == NULL) + return; /* stack not completely built yet */ + L->ci = &L->base_ci; /* free the entire 'ci' list */ + freeCI(L); + lua_assert(L->nci == 0); + luaM_freearray(L, L->stack.p, stacksize(L) + EXTRA_STACK); /* free stack */ +} + + +/* +** Create registry table and its predefined values +*/ +static void init_registry (lua_State *L, global_State *g) { + /* create registry */ + Table *registry = luaH_new(L); + sethvalue(L, &g->l_registry, registry); + luaH_resize(L, registry, LUA_RIDX_LAST, 0); + /* registry[LUA_RIDX_MAINTHREAD] = L */ + setthvalue(L, ®istry->array[LUA_RIDX_MAINTHREAD - 1], L); + /* registry[LUA_RIDX_GLOBALS] = new table (table of globals) */ + sethvalue(L, ®istry->array[LUA_RIDX_GLOBALS - 1], luaH_new(L)); +} + + +/* +** open parts of the state that may cause memory-allocation errors. +*/ +static void f_luaopen (lua_State *L, void *ud) { + global_State *g = G(L); + UNUSED(ud); + stack_init(L, L); /* init stack */ + init_registry(L, g); + luaS_init(L); + luaT_init(L); + luaX_init(L); + g->gcstp = 0; /* allow gc */ + setnilvalue(&g->nilvalue); /* now state is complete */ + luai_userstateopen(L); +} + + +/* +** preinitialize a thread with consistent values without allocating +** any memory (to avoid errors) +*/ +static void preinit_thread (lua_State *L, global_State *g) { + G(L) = g; + L->stack.p = NULL; + L->ci = NULL; + L->nci = 0; + L->twups = L; /* thread has no upvalues */ + L->nCcalls = 0; + L->errorJmp = NULL; + L->hook = NULL; + L->hookmask = 0; + L->basehookcount = 0; + L->allowhook = 1; + resethookcount(L); + L->openupval = NULL; + L->status = LUA_OK; + L->errfunc = 0; + L->oldpc = 0; +} + + +static void close_state (lua_State *L) { + global_State *g = G(L); + if (!completestate(g)) /* closing a partially built state? */ + luaC_freeallobjects(L); /* just collect its objects */ + else { /* closing a fully built state */ + L->ci = &L->base_ci; /* unwind CallInfo list */ + luaD_closeprotected(L, 1, LUA_OK); /* close all upvalues */ + luaC_freeallobjects(L); /* collect all objects */ + luai_userstateclose(L); + } + luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size); + freestack(L); + lua_assert(gettotalbytes(g) == sizeof(LG)); + (*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0); /* free main block */ +} + + +LUA_API lua_State *lua_newthread (lua_State *L) { + global_State *g = G(L); + GCObject *o; + lua_State *L1; + lua_lock(L); + luaC_checkGC(L); + /* create new thread */ + o = luaC_newobjdt(L, LUA_TTHREAD, sizeof(LX), offsetof(LX, l)); + L1 = gco2th(o); + /* anchor it on L stack */ + setthvalue2s(L, L->top.p, L1); + api_incr_top(L); + preinit_thread(L1, g); + L1->hookmask = L->hookmask; + L1->basehookcount = L->basehookcount; + L1->hook = L->hook; + resethookcount(L1); + /* initialize L1 extra space */ + memcpy(lua_getextraspace(L1), lua_getextraspace(g->mainthread), + LUA_EXTRASPACE); + luai_userstatethread(L, L1); + stack_init(L1, L); /* init stack */ + lua_unlock(L); + return L1; +} + + +void luaE_freethread (lua_State *L, lua_State *L1) { + LX *l = fromstate(L1); + luaF_closeupval(L1, L1->stack.p); /* close all upvalues */ + lua_assert(L1->openupval == NULL); + luai_userstatefree(L, L1); + freestack(L1); + luaM_free(L, l); +} + + +int luaE_resetthread (lua_State *L, int status) { + CallInfo *ci = L->ci = &L->base_ci; /* unwind CallInfo list */ + setnilvalue(s2v(L->stack.p)); /* 'function' entry for basic 'ci' */ + ci->func.p = L->stack.p; + ci->callstatus = CIST_C; + if (status == LUA_YIELD) + status = LUA_OK; + L->status = LUA_OK; /* so it can run __close metamethods */ + status = luaD_closeprotected(L, 1, status); + if (status != LUA_OK) /* errors? */ + luaD_seterrorobj(L, status, L->stack.p + 1); + else + L->top.p = L->stack.p + 1; + ci->top.p = L->top.p + LUA_MINSTACK; + luaD_reallocstack(L, cast_int(ci->top.p - L->stack.p), 0); + return status; +} + + +LUA_API int lua_closethread (lua_State *L, lua_State *from) { + int status; + lua_lock(L); + L->nCcalls = (from) ? getCcalls(from) : 0; + status = luaE_resetthread(L, L->status); + lua_unlock(L); + return status; +} + + +/* +** Deprecated! Use 'lua_closethread' instead. +*/ +LUA_API int lua_resetthread (lua_State *L) { + return lua_closethread(L, NULL); +} + + +LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { + int i; + lua_State *L; + global_State *g; + LG *l = cast(LG *, (*f)(ud, NULL, LUA_TTHREAD, sizeof(LG))); + if (l == NULL) return NULL; + L = &l->l.l; + g = &l->g; + L->tt = LUA_VTHREAD; + g->currentwhite = bitmask(WHITE0BIT); + L->marked = luaC_white(g); + preinit_thread(L, g); + g->allgc = obj2gco(L); /* by now, only object is the main thread */ + L->next = NULL; + incnny(L); /* main thread is always non yieldable */ + g->frealloc = f; + g->ud = ud; + g->warnf = NULL; + g->ud_warn = NULL; + g->mainthread = L; + g->seed = luai_makeseed(L); + g->gcstp = GCSTPGC; /* no GC while building state */ + g->strt.size = g->strt.nuse = 0; + g->strt.hash = NULL; + setnilvalue(&g->l_registry); + g->panic = NULL; + g->gcstate = GCSpause; + g->gckind = KGC_INC; + g->gcstopem = 0; + g->gcemergency = 0; + g->finobj = g->tobefnz = g->fixedgc = NULL; + g->firstold1 = g->survival = g->old1 = g->reallyold = NULL; + g->finobjsur = g->finobjold1 = g->finobjrold = NULL; + g->sweepgc = NULL; + g->gray = g->grayagain = NULL; + g->weak = g->ephemeron = g->allweak = NULL; + g->twups = NULL; + g->totalbytes = sizeof(LG); + g->GCdebt = 0; + g->lastatomic = 0; + setivalue(&g->nilvalue, 0); /* to signal that state is not yet built */ + setgcparam(g->gcpause, LUAI_GCPAUSE); + setgcparam(g->gcstepmul, LUAI_GCMUL); + g->gcstepsize = LUAI_GCSTEPSIZE; + setgcparam(g->genmajormul, LUAI_GENMAJORMUL); + g->genminormul = LUAI_GENMINORMUL; + for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL; + if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) { + /* memory allocation error: free partial state */ + close_state(L); + L = NULL; + } + return L; +} + + +LUA_API void lua_close (lua_State *L) { + lua_lock(L); + L = G(L)->mainthread; /* only the main thread can be closed */ + close_state(L); +} + + +void luaE_warning (lua_State *L, const char *msg, int tocont) { + lua_WarnFunction wf = G(L)->warnf; + if (wf != NULL) + wf(G(L)->ud_warn, msg, tocont); +} + + +/* +** Generate a warning from an error message +*/ +void luaE_warnerror (lua_State *L, const char *where) { + TValue *errobj = s2v(L->top.p - 1); /* error object */ + const char *msg = (ttisstring(errobj)) + ? getstr(tsvalue(errobj)) + : "error object is not a string"; + /* produce warning "error in %s (%s)" (where, msg) */ + luaE_warning(L, "error in ", 1); + luaE_warning(L, where, 1); + luaE_warning(L, " (", 1); + luaE_warning(L, msg, 1); + luaE_warning(L, ")", 0); +} + diff --git a/LuaSkin/lua-5.4.7/src/lstate.h b/LuaSkin/lua-5.4.7/src/lstate.h new file mode 100644 index 000000000..007704c82 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lstate.h @@ -0,0 +1,408 @@ +/* +** $Id: lstate.h $ +** Global State +** See Copyright Notice in lua.h +*/ + +#ifndef lstate_h +#define lstate_h + +#include "lua.h" + + +/* Some header files included here need this definition */ +typedef struct CallInfo CallInfo; + + +#include "lobject.h" +#include "ltm.h" +#include "lzio.h" + + +/* +** Some notes about garbage-collected objects: All objects in Lua must +** be kept somehow accessible until being freed, so all objects always +** belong to one (and only one) of these lists, using field 'next' of +** the 'CommonHeader' for the link: +** +** 'allgc': all objects not marked for finalization; +** 'finobj': all objects marked for finalization; +** 'tobefnz': all objects ready to be finalized; +** 'fixedgc': all objects that are not to be collected (currently +** only small strings, such as reserved words). +** +** For the generational collector, some of these lists have marks for +** generations. Each mark points to the first element in the list for +** that particular generation; that generation goes until the next mark. +** +** 'allgc' -> 'survival': new objects; +** 'survival' -> 'old': objects that survived one collection; +** 'old1' -> 'reallyold': objects that became old in last collection; +** 'reallyold' -> NULL: objects old for more than one cycle. +** +** 'finobj' -> 'finobjsur': new objects marked for finalization; +** 'finobjsur' -> 'finobjold1': survived """"; +** 'finobjold1' -> 'finobjrold': just old """"; +** 'finobjrold' -> NULL: really old """". +** +** All lists can contain elements older than their main ages, due +** to 'luaC_checkfinalizer' and 'udata2finalize', which move +** objects between the normal lists and the "marked for finalization" +** lists. Moreover, barriers can age young objects in young lists as +** OLD0, which then become OLD1. However, a list never contains +** elements younger than their main ages. +** +** The generational collector also uses a pointer 'firstold1', which +** points to the first OLD1 object in the list. It is used to optimize +** 'markold'. (Potentially OLD1 objects can be anywhere between 'allgc' +** and 'reallyold', but often the list has no OLD1 objects or they are +** after 'old1'.) Note the difference between it and 'old1': +** 'firstold1': no OLD1 objects before this point; there can be all +** ages after it. +** 'old1': no objects younger than OLD1 after this point. +*/ + +/* +** Moreover, there is another set of lists that control gray objects. +** These lists are linked by fields 'gclist'. (All objects that +** can become gray have such a field. The field is not the same +** in all objects, but it always has this name.) Any gray object +** must belong to one of these lists, and all objects in these lists +** must be gray (with two exceptions explained below): +** +** 'gray': regular gray objects, still waiting to be visited. +** 'grayagain': objects that must be revisited at the atomic phase. +** That includes +** - black objects got in a write barrier; +** - all kinds of weak tables during propagation phase; +** - all threads. +** 'weak': tables with weak values to be cleared; +** 'ephemeron': ephemeron tables with white->white entries; +** 'allweak': tables with weak keys and/or weak values to be cleared. +** +** The exceptions to that "gray rule" are: +** - TOUCHED2 objects in generational mode stay in a gray list (because +** they must be visited again at the end of the cycle), but they are +** marked black because assignments to them must activate barriers (to +** move them back to TOUCHED1). +** - Open upvales are kept gray to avoid barriers, but they stay out +** of gray lists. (They don't even have a 'gclist' field.) +*/ + + + +/* +** About 'nCcalls': This count has two parts: the lower 16 bits counts +** the number of recursive invocations in the C stack; the higher +** 16 bits counts the number of non-yieldable calls in the stack. +** (They are together so that we can change and save both with one +** instruction.) +*/ + + +/* true if this thread does not have non-yieldable calls in the stack */ +#define yieldable(L) (((L)->nCcalls & 0xffff0000) == 0) + +/* real number of C calls */ +#define getCcalls(L) ((L)->nCcalls & 0xffff) + + +/* Increment the number of non-yieldable calls */ +#define incnny(L) ((L)->nCcalls += 0x10000) + +/* Decrement the number of non-yieldable calls */ +#define decnny(L) ((L)->nCcalls -= 0x10000) + +/* Non-yieldable call increment */ +#define nyci (0x10000 | 1) + + + + +struct lua_longjmp; /* defined in ldo.c */ + + +/* +** Atomic type (relative to signals) to better ensure that 'lua_sethook' +** is thread safe +*/ +#if !defined(l_signalT) +#include +#define l_signalT sig_atomic_t +#endif + + +/* +** Extra stack space to handle TM calls and some other extras. This +** space is not included in 'stack_last'. It is used only to avoid stack +** checks, either because the element will be promptly popped or because +** there will be a stack check soon after the push. Function frames +** never use this extra space, so it does not need to be kept clean. +*/ +#define EXTRA_STACK 5 + + +#define BASIC_STACK_SIZE (2*LUA_MINSTACK) + +#define stacksize(th) cast_int((th)->stack_last.p - (th)->stack.p) + + +/* kinds of Garbage Collection */ +#define KGC_INC 0 /* incremental gc */ +#define KGC_GEN 1 /* generational gc */ + + +typedef struct stringtable { + TString **hash; + int nuse; /* number of elements */ + int size; +} stringtable; + + +/* +** Information about a call. +** About union 'u': +** - field 'l' is used only for Lua functions; +** - field 'c' is used only for C functions. +** About union 'u2': +** - field 'funcidx' is used only by C functions while doing a +** protected call; +** - field 'nyield' is used only while a function is "doing" an +** yield (from the yield until the next resume); +** - field 'nres' is used only while closing tbc variables when +** returning from a function; +** - field 'transferinfo' is used only during call/returnhooks, +** before the function starts or after it ends. +*/ +struct CallInfo { + StkIdRel func; /* function index in the stack */ + StkIdRel top; /* top for this function */ + struct CallInfo *previous, *next; /* dynamic call link */ + union { + struct { /* only for Lua functions */ + const Instruction *savedpc; + volatile l_signalT trap; /* function is tracing lines/counts */ + int nextraargs; /* # of extra arguments in vararg functions */ + } l; + struct { /* only for C functions */ + lua_KFunction k; /* continuation in case of yields */ + ptrdiff_t old_errfunc; + lua_KContext ctx; /* context info. in case of yields */ + } c; + } u; + union { + int funcidx; /* called-function index */ + int nyield; /* number of values yielded */ + int nres; /* number of values returned */ + struct { /* info about transferred values (for call/return hooks) */ + unsigned short ftransfer; /* offset of first value transferred */ + unsigned short ntransfer; /* number of values transferred */ + } transferinfo; + } u2; + short nresults; /* expected number of results from this function */ + unsigned short callstatus; +}; + + +/* +** Bits in CallInfo status +*/ +#define CIST_OAH (1<<0) /* original value of 'allowhook' */ +#define CIST_C (1<<1) /* call is running a C function */ +#define CIST_FRESH (1<<2) /* call is on a fresh "luaV_execute" frame */ +#define CIST_HOOKED (1<<3) /* call is running a debug hook */ +#define CIST_YPCALL (1<<4) /* doing a yieldable protected call */ +#define CIST_TAIL (1<<5) /* call was tail called */ +#define CIST_HOOKYIELD (1<<6) /* last hook called yielded */ +#define CIST_FIN (1<<7) /* function "called" a finalizer */ +#define CIST_TRAN (1<<8) /* 'ci' has transfer information */ +#define CIST_CLSRET (1<<9) /* function is closing tbc variables */ +/* Bits 10-12 are used for CIST_RECST (see below) */ +#define CIST_RECST 10 +#if defined(LUA_COMPAT_LT_LE) +#define CIST_LEQ (1<<13) /* using __lt for __le */ +#endif + + +/* +** Field CIST_RECST stores the "recover status", used to keep the error +** status while closing to-be-closed variables in coroutines, so that +** Lua can correctly resume after an yield from a __close method called +** because of an error. (Three bits are enough for error status.) +*/ +#define getcistrecst(ci) (((ci)->callstatus >> CIST_RECST) & 7) +#define setcistrecst(ci,st) \ + check_exp(((st) & 7) == (st), /* status must fit in three bits */ \ + ((ci)->callstatus = ((ci)->callstatus & ~(7 << CIST_RECST)) \ + | ((st) << CIST_RECST))) + + +/* active function is a Lua function */ +#define isLua(ci) (!((ci)->callstatus & CIST_C)) + +/* call is running Lua code (not a hook) */ +#define isLuacode(ci) (!((ci)->callstatus & (CIST_C | CIST_HOOKED))) + +/* assume that CIST_OAH has offset 0 and that 'v' is strictly 0/1 */ +#define setoah(st,v) ((st) = ((st) & ~CIST_OAH) | (v)) +#define getoah(st) ((st) & CIST_OAH) + + +/* +** 'global state', shared by all threads of this state +*/ +typedef struct global_State { + lua_Alloc frealloc; /* function to reallocate memory */ + void *ud; /* auxiliary data to 'frealloc' */ + l_mem totalbytes; /* number of bytes currently allocated - GCdebt */ + l_mem GCdebt; /* bytes allocated not yet compensated by the collector */ + lu_mem GCestimate; /* an estimate of the non-garbage memory in use */ + lu_mem lastatomic; /* see function 'genstep' in file 'lgc.c' */ + stringtable strt; /* hash table for strings */ + TValue l_registry; + TValue nilvalue; /* a nil value */ + unsigned int seed; /* randomized seed for hashes */ + lu_byte currentwhite; + lu_byte gcstate; /* state of garbage collector */ + lu_byte gckind; /* kind of GC running */ + lu_byte gcstopem; /* stops emergency collections */ + lu_byte genminormul; /* control for minor generational collections */ + lu_byte genmajormul; /* control for major generational collections */ + lu_byte gcstp; /* control whether GC is running */ + lu_byte gcemergency; /* true if this is an emergency collection */ + lu_byte gcpause; /* size of pause between successive GCs */ + lu_byte gcstepmul; /* GC "speed" */ + lu_byte gcstepsize; /* (log2 of) GC granularity */ + GCObject *allgc; /* list of all collectable objects */ + GCObject **sweepgc; /* current position of sweep in list */ + GCObject *finobj; /* list of collectable objects with finalizers */ + GCObject *gray; /* list of gray objects */ + GCObject *grayagain; /* list of objects to be traversed atomically */ + GCObject *weak; /* list of tables with weak values */ + GCObject *ephemeron; /* list of ephemeron tables (weak keys) */ + GCObject *allweak; /* list of all-weak tables */ + GCObject *tobefnz; /* list of userdata to be GC */ + GCObject *fixedgc; /* list of objects not to be collected */ + /* fields for generational collector */ + GCObject *survival; /* start of objects that survived one GC cycle */ + GCObject *old1; /* start of old1 objects */ + GCObject *reallyold; /* objects more than one cycle old ("really old") */ + GCObject *firstold1; /* first OLD1 object in the list (if any) */ + GCObject *finobjsur; /* list of survival objects with finalizers */ + GCObject *finobjold1; /* list of old1 objects with finalizers */ + GCObject *finobjrold; /* list of really old objects with finalizers */ + struct lua_State *twups; /* list of threads with open upvalues */ + lua_CFunction panic; /* to be called in unprotected errors */ + struct lua_State *mainthread; + TString *memerrmsg; /* message for memory-allocation errors */ + TString *tmname[TM_N]; /* array with tag-method names */ + struct Table *mt[LUA_NUMTYPES]; /* metatables for basic types */ + TString *strcache[STRCACHE_N][STRCACHE_M]; /* cache for strings in API */ + lua_WarnFunction warnf; /* warning function */ + void *ud_warn; /* auxiliary data to 'warnf' */ +} global_State; + + +/* +** 'per thread' state +*/ +struct lua_State { + CommonHeader; + lu_byte status; + lu_byte allowhook; + unsigned short nci; /* number of items in 'ci' list */ + StkIdRel top; /* first free slot in the stack */ + global_State *l_G; + CallInfo *ci; /* call info for current function */ + StkIdRel stack_last; /* end of stack (last element + 1) */ + StkIdRel stack; /* stack base */ + UpVal *openupval; /* list of open upvalues in this stack */ + StkIdRel tbclist; /* list of to-be-closed variables */ + GCObject *gclist; + struct lua_State *twups; /* list of threads with open upvalues */ + struct lua_longjmp *errorJmp; /* current error recover point */ + CallInfo base_ci; /* CallInfo for first level (C calling Lua) */ + volatile lua_Hook hook; + ptrdiff_t errfunc; /* current error handling function (stack index) */ + l_uint32 nCcalls; /* number of nested (non-yieldable | C) calls */ + int oldpc; /* last pc traced */ + int basehookcount; + int hookcount; + volatile l_signalT hookmask; +}; + + +#define G(L) (L->l_G) + +/* +** 'g->nilvalue' being a nil value flags that the state was completely +** build. +*/ +#define completestate(g) ttisnil(&g->nilvalue) + + +/* +** Union of all collectable objects (only for conversions) +** ISO C99, 6.5.2.3 p.5: +** "if a union contains several structures that share a common initial +** sequence [...], and if the union object currently contains one +** of these structures, it is permitted to inspect the common initial +** part of any of them anywhere that a declaration of the complete type +** of the union is visible." +*/ +union GCUnion { + GCObject gc; /* common header */ + struct TString ts; + struct Udata u; + union Closure cl; + struct Table h; + struct Proto p; + struct lua_State th; /* thread */ + struct UpVal upv; +}; + + +/* +** ISO C99, 6.7.2.1 p.14: +** "A pointer to a union object, suitably converted, points to each of +** its members [...], and vice versa." +*/ +#define cast_u(o) cast(union GCUnion *, (o)) + +/* macros to convert a GCObject into a specific value */ +#define gco2ts(o) \ + check_exp(novariant((o)->tt) == LUA_TSTRING, &((cast_u(o))->ts)) +#define gco2u(o) check_exp((o)->tt == LUA_VUSERDATA, &((cast_u(o))->u)) +#define gco2lcl(o) check_exp((o)->tt == LUA_VLCL, &((cast_u(o))->cl.l)) +#define gco2ccl(o) check_exp((o)->tt == LUA_VCCL, &((cast_u(o))->cl.c)) +#define gco2cl(o) \ + check_exp(novariant((o)->tt) == LUA_TFUNCTION, &((cast_u(o))->cl)) +#define gco2t(o) check_exp((o)->tt == LUA_VTABLE, &((cast_u(o))->h)) +#define gco2p(o) check_exp((o)->tt == LUA_VPROTO, &((cast_u(o))->p)) +#define gco2th(o) check_exp((o)->tt == LUA_VTHREAD, &((cast_u(o))->th)) +#define gco2upv(o) check_exp((o)->tt == LUA_VUPVAL, &((cast_u(o))->upv)) + + +/* +** macro to convert a Lua object into a GCObject +** (The access to 'tt' tries to ensure that 'v' is actually a Lua object.) +*/ +#define obj2gco(v) check_exp((v)->tt >= LUA_TSTRING, &(cast_u(v)->gc)) + + +/* actual number of total bytes allocated */ +#define gettotalbytes(g) cast(lu_mem, (g)->totalbytes + (g)->GCdebt) + +LUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt); +LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); +LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L); +LUAI_FUNC void luaE_shrinkCI (lua_State *L); +LUAI_FUNC void luaE_checkcstack (lua_State *L); +LUAI_FUNC void luaE_incCstack (lua_State *L); +LUAI_FUNC void luaE_warning (lua_State *L, const char *msg, int tocont); +LUAI_FUNC void luaE_warnerror (lua_State *L, const char *where); +LUAI_FUNC int luaE_resetthread (lua_State *L, int status); + + +#endif + diff --git a/LuaSkin/lua-5.4.7/src/lstring.c b/LuaSkin/lua-5.4.7/src/lstring.c new file mode 100644 index 000000000..97757355c --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lstring.c @@ -0,0 +1,274 @@ +/* +** $Id: lstring.c $ +** String table (keeps all strings handled by Lua) +** See Copyright Notice in lua.h +*/ + +#define lstring_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" + + +/* +** Maximum size for string table. +*/ +#define MAXSTRTB cast_int(luaM_limitN(MAX_INT, TString*)) + + +/* +** equality for long strings +*/ +int luaS_eqlngstr (TString *a, TString *b) { + size_t len = a->u.lnglen; + lua_assert(a->tt == LUA_VLNGSTR && b->tt == LUA_VLNGSTR); + return (a == b) || /* same instance or... */ + ((len == b->u.lnglen) && /* equal length and ... */ + (memcmp(getlngstr(a), getlngstr(b), len) == 0)); /* equal contents */ +} + + +unsigned int luaS_hash (const char *str, size_t l, unsigned int seed) { + unsigned int h = seed ^ cast_uint(l); + for (; l > 0; l--) + h ^= ((h<<5) + (h>>2) + cast_byte(str[l - 1])); + return h; +} + + +unsigned int luaS_hashlongstr (TString *ts) { + lua_assert(ts->tt == LUA_VLNGSTR); + if (ts->extra == 0) { /* no hash? */ + size_t len = ts->u.lnglen; + ts->hash = luaS_hash(getlngstr(ts), len, ts->hash); + ts->extra = 1; /* now it has its hash */ + } + return ts->hash; +} + + +static void tablerehash (TString **vect, int osize, int nsize) { + int i; + for (i = osize; i < nsize; i++) /* clear new elements */ + vect[i] = NULL; + for (i = 0; i < osize; i++) { /* rehash old part of the array */ + TString *p = vect[i]; + vect[i] = NULL; + while (p) { /* for each string in the list */ + TString *hnext = p->u.hnext; /* save next */ + unsigned int h = lmod(p->hash, nsize); /* new position */ + p->u.hnext = vect[h]; /* chain it into array */ + vect[h] = p; + p = hnext; + } + } +} + + +/* +** Resize the string table. If allocation fails, keep the current size. +** (This can degrade performance, but any non-zero size should work +** correctly.) +*/ +void luaS_resize (lua_State *L, int nsize) { + stringtable *tb = &G(L)->strt; + int osize = tb->size; + TString **newvect; + if (nsize < osize) /* shrinking table? */ + tablerehash(tb->hash, osize, nsize); /* depopulate shrinking part */ + newvect = luaM_reallocvector(L, tb->hash, osize, nsize, TString*); + if (l_unlikely(newvect == NULL)) { /* reallocation failed? */ + if (nsize < osize) /* was it shrinking table? */ + tablerehash(tb->hash, nsize, osize); /* restore to original size */ + /* leave table as it was */ + } + else { /* allocation succeeded */ + tb->hash = newvect; + tb->size = nsize; + if (nsize > osize) + tablerehash(newvect, osize, nsize); /* rehash for new size */ + } +} + + +/* +** Clear API string cache. (Entries cannot be empty, so fill them with +** a non-collectable string.) +*/ +void luaS_clearcache (global_State *g) { + int i, j; + for (i = 0; i < STRCACHE_N; i++) + for (j = 0; j < STRCACHE_M; j++) { + if (iswhite(g->strcache[i][j])) /* will entry be collected? */ + g->strcache[i][j] = g->memerrmsg; /* replace it with something fixed */ + } +} + + +/* +** Initialize the string table and the string cache +*/ +void luaS_init (lua_State *L) { + global_State *g = G(L); + int i, j; + stringtable *tb = &G(L)->strt; + tb->hash = luaM_newvector(L, MINSTRTABSIZE, TString*); + tablerehash(tb->hash, 0, MINSTRTABSIZE); /* clear array */ + tb->size = MINSTRTABSIZE; + /* pre-create memory-error message */ + g->memerrmsg = luaS_newliteral(L, MEMERRMSG); + luaC_fix(L, obj2gco(g->memerrmsg)); /* it should never be collected */ + for (i = 0; i < STRCACHE_N; i++) /* fill cache with valid strings */ + for (j = 0; j < STRCACHE_M; j++) + g->strcache[i][j] = g->memerrmsg; +} + + + +/* +** creates a new string object +*/ +static TString *createstrobj (lua_State *L, size_t l, int tag, unsigned int h) { + TString *ts; + GCObject *o; + size_t totalsize; /* total size of TString object */ + totalsize = sizelstring(l); + o = luaC_newobj(L, tag, totalsize); + ts = gco2ts(o); + ts->hash = h; + ts->extra = 0; + getstr(ts)[l] = '\0'; /* ending 0 */ + return ts; +} + + +TString *luaS_createlngstrobj (lua_State *L, size_t l) { + TString *ts = createstrobj(L, l, LUA_VLNGSTR, G(L)->seed); + ts->u.lnglen = l; + ts->shrlen = 0xFF; /* signals that it is a long string */ + return ts; +} + + +void luaS_remove (lua_State *L, TString *ts) { + stringtable *tb = &G(L)->strt; + TString **p = &tb->hash[lmod(ts->hash, tb->size)]; + while (*p != ts) /* find previous element */ + p = &(*p)->u.hnext; + *p = (*p)->u.hnext; /* remove element from its list */ + tb->nuse--; +} + + +static void growstrtab (lua_State *L, stringtable *tb) { + if (l_unlikely(tb->nuse == MAX_INT)) { /* too many strings? */ + luaC_fullgc(L, 1); /* try to free some... */ + if (tb->nuse == MAX_INT) /* still too many? */ + luaM_error(L); /* cannot even create a message... */ + } + if (tb->size <= MAXSTRTB / 2) /* can grow string table? */ + luaS_resize(L, tb->size * 2); +} + + +/* +** Checks whether short string exists and reuses it or creates a new one. +*/ +static TString *internshrstr (lua_State *L, const char *str, size_t l) { + TString *ts; + global_State *g = G(L); + stringtable *tb = &g->strt; + unsigned int h = luaS_hash(str, l, g->seed); + TString **list = &tb->hash[lmod(h, tb->size)]; + lua_assert(str != NULL); /* otherwise 'memcmp'/'memcpy' are undefined */ + for (ts = *list; ts != NULL; ts = ts->u.hnext) { + if (l == ts->shrlen && (memcmp(str, getshrstr(ts), l * sizeof(char)) == 0)) { + /* found! */ + if (isdead(g, ts)) /* dead (but not collected yet)? */ + changewhite(ts); /* resurrect it */ + return ts; + } + } + /* else must create a new string */ + if (tb->nuse >= tb->size) { /* need to grow string table? */ + growstrtab(L, tb); + list = &tb->hash[lmod(h, tb->size)]; /* rehash with new size */ + } + ts = createstrobj(L, l, LUA_VSHRSTR, h); + ts->shrlen = cast_byte(l); + memcpy(getshrstr(ts), str, l * sizeof(char)); + ts->u.hnext = *list; + *list = ts; + tb->nuse++; + return ts; +} + + +/* +** new string (with explicit length) +*/ +TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { + if (l <= LUAI_MAXSHORTLEN) /* short string? */ + return internshrstr(L, str, l); + else { + TString *ts; + if (l_unlikely(l * sizeof(char) >= (MAX_SIZE - sizeof(TString)))) + luaM_toobig(L); + ts = luaS_createlngstrobj(L, l); + memcpy(getlngstr(ts), str, l * sizeof(char)); + return ts; + } +} + + +/* +** Create or reuse a zero-terminated string, first checking in the +** cache (using the string address as a key). The cache can contain +** only zero-terminated strings, so it is safe to use 'strcmp' to +** check hits. +*/ +TString *luaS_new (lua_State *L, const char *str) { + unsigned int i = point2uint(str) % STRCACHE_N; /* hash */ + int j; + TString **p = G(L)->strcache[i]; + for (j = 0; j < STRCACHE_M; j++) { + if (strcmp(str, getstr(p[j])) == 0) /* hit? */ + return p[j]; /* that is it */ + } + /* normal route */ + for (j = STRCACHE_M - 1; j > 0; j--) + p[j] = p[j - 1]; /* move out last element */ + /* new element is first in the list */ + p[0] = luaS_newlstr(L, str, strlen(str)); + return p[0]; +} + + +Udata *luaS_newudata (lua_State *L, size_t s, int nuvalue) { + Udata *u; + int i; + GCObject *o; + if (l_unlikely(s > MAX_SIZE - udatamemoffset(nuvalue))) + luaM_toobig(L); + o = luaC_newobj(L, LUA_VUSERDATA, sizeudata(nuvalue, s)); + u = gco2u(o); + u->len = s; + u->nuvalue = nuvalue; + u->metatable = NULL; + for (i = 0; i < nuvalue; i++) + setnilvalue(&u->uv[i].uv); + return u; +} + diff --git a/LuaSkin/lua-5.4.7/src/lstring.h b/LuaSkin/lua-5.4.7/src/lstring.h new file mode 100644 index 000000000..450c2390d --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lstring.h @@ -0,0 +1,57 @@ +/* +** $Id: lstring.h $ +** String table (keep all strings handled by Lua) +** See Copyright Notice in lua.h +*/ + +#ifndef lstring_h +#define lstring_h + +#include "lgc.h" +#include "lobject.h" +#include "lstate.h" + + +/* +** Memory-allocation error message must be preallocated (it cannot +** be created after memory is exhausted) +*/ +#define MEMERRMSG "not enough memory" + + +/* +** Size of a TString: Size of the header plus space for the string +** itself (including final '\0'). +*/ +#define sizelstring(l) (offsetof(TString, contents) + ((l) + 1) * sizeof(char)) + +#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ + (sizeof(s)/sizeof(char))-1)) + + +/* +** test whether a string is a reserved word +*/ +#define isreserved(s) ((s)->tt == LUA_VSHRSTR && (s)->extra > 0) + + +/* +** equality for short strings, which are always internalized +*/ +#define eqshrstr(a,b) check_exp((a)->tt == LUA_VSHRSTR, (a) == (b)) + + +LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed); +LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts); +LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b); +LUAI_FUNC void luaS_resize (lua_State *L, int newsize); +LUAI_FUNC void luaS_clearcache (global_State *g); +LUAI_FUNC void luaS_init (lua_State *L); +LUAI_FUNC void luaS_remove (lua_State *L, TString *ts); +LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, int nuvalue); +LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); +LUAI_FUNC TString *luaS_new (lua_State *L, const char *str); +LUAI_FUNC TString *luaS_createlngstrobj (lua_State *L, size_t l); + + +#endif diff --git a/LuaSkin/lua-5.4.7/src/lstrlib.c b/LuaSkin/lua-5.4.7/src/lstrlib.c new file mode 100644 index 000000000..03167161d --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lstrlib.c @@ -0,0 +1,1874 @@ +/* +** $Id: lstrlib.c $ +** Standard library for string operations and pattern-matching +** See Copyright Notice in lua.h +*/ + +#define lstrlib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* +** maximum number of captures that a pattern can do during +** pattern-matching. This limit is arbitrary, but must fit in +** an unsigned char. +*/ +#if !defined(LUA_MAXCAPTURES) +#define LUA_MAXCAPTURES 32 +#endif + + +/* macro to 'unsign' a character */ +#define uchar(c) ((unsigned char)(c)) + + +/* +** Some sizes are better limited to fit in 'int', but must also fit in +** 'size_t'. (We assume that 'lua_Integer' cannot be smaller than 'int'.) +*/ +#define MAX_SIZET ((size_t)(~(size_t)0)) + +#define MAXSIZE \ + (sizeof(size_t) < sizeof(int) ? MAX_SIZET : (size_t)(INT_MAX)) + + + + +static int str_len (lua_State *L) { + size_t l; + luaL_checklstring(L, 1, &l); + lua_pushinteger(L, (lua_Integer)l); + return 1; +} + + +/* +** translate a relative initial string position +** (negative means back from end): clip result to [1, inf). +** The length of any string in Lua must fit in a lua_Integer, +** so there are no overflows in the casts. +** The inverted comparison avoids a possible overflow +** computing '-pos'. +*/ +static size_t posrelatI (lua_Integer pos, size_t len) { + if (pos > 0) + return (size_t)pos; + else if (pos == 0) + return 1; + else if (pos < -(lua_Integer)len) /* inverted comparison */ + return 1; /* clip to 1 */ + else return len + (size_t)pos + 1; +} + + +/* +** Gets an optional ending string position from argument 'arg', +** with default value 'def'. +** Negative means back from end: clip result to [0, len] +*/ +static size_t getendpos (lua_State *L, int arg, lua_Integer def, + size_t len) { + lua_Integer pos = luaL_optinteger(L, arg, def); + if (pos > (lua_Integer)len) + return len; + else if (pos >= 0) + return (size_t)pos; + else if (pos < -(lua_Integer)len) + return 0; + else return len + (size_t)pos + 1; +} + + +static int str_sub (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + size_t start = posrelatI(luaL_checkinteger(L, 2), l); + size_t end = getendpos(L, 3, -1, l); + if (start <= end) + lua_pushlstring(L, s + start - 1, (end - start) + 1); + else lua_pushliteral(L, ""); + return 1; +} + + +static int str_reverse (lua_State *L) { + size_t l, i; + luaL_Buffer b; + const char *s = luaL_checklstring(L, 1, &l); + char *p = luaL_buffinitsize(L, &b, l); + for (i = 0; i < l; i++) + p[i] = s[l - i - 1]; + luaL_pushresultsize(&b, l); + return 1; +} + + +static int str_lower (lua_State *L) { + size_t l; + size_t i; + luaL_Buffer b; + const char *s = luaL_checklstring(L, 1, &l); + char *p = luaL_buffinitsize(L, &b, l); + for (i=0; i MAXSIZE / n)) + return luaL_error(L, "resulting string too large"); + else { + size_t totallen = (size_t)n * l + (size_t)(n - 1) * lsep; + luaL_Buffer b; + char *p = luaL_buffinitsize(L, &b, totallen); + while (n-- > 1) { /* first n-1 copies (followed by separator) */ + memcpy(p, s, l * sizeof(char)); p += l; + if (lsep > 0) { /* empty 'memcpy' is not that cheap */ + memcpy(p, sep, lsep * sizeof(char)); + p += lsep; + } + } + memcpy(p, s, l * sizeof(char)); /* last copy (not followed by separator) */ + luaL_pushresultsize(&b, totallen); + } + return 1; +} + + +static int str_byte (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + lua_Integer pi = luaL_optinteger(L, 2, 1); + size_t posi = posrelatI(pi, l); + size_t pose = getendpos(L, 3, pi, l); + int n, i; + if (posi > pose) return 0; /* empty interval; return no values */ + if (l_unlikely(pose - posi >= (size_t)INT_MAX)) /* arithmetic overflow? */ + return luaL_error(L, "string slice too long"); + n = (int)(pose - posi) + 1; + luaL_checkstack(L, n, "string slice too long"); + for (i=0; iinit) { + state->init = 1; + luaL_buffinit(L, &state->B); + } + luaL_addlstring(&state->B, (const char *)b, size); + return 0; +} + + +static int str_dump (lua_State *L) { + struct str_Writer state; + int strip = lua_toboolean(L, 2); + luaL_checktype(L, 1, LUA_TFUNCTION); + lua_settop(L, 1); /* ensure function is on the top of the stack */ + state.init = 0; + if (l_unlikely(lua_dump(L, writer, &state, strip) != 0)) + return luaL_error(L, "unable to dump given function"); + luaL_pushresult(&state.B); + return 1; +} + + + +/* +** {====================================================== +** METAMETHODS +** ======================================================= +*/ + +#if defined(LUA_NOCVTS2N) /* { */ + +/* no coercion from strings to numbers */ + +static const luaL_Reg stringmetamethods[] = { + {"__index", NULL}, /* placeholder */ + {NULL, NULL} +}; + +#else /* }{ */ + +static int tonum (lua_State *L, int arg) { + if (lua_type(L, arg) == LUA_TNUMBER) { /* already a number? */ + lua_pushvalue(L, arg); + return 1; + } + else { /* check whether it is a numerical string */ + size_t len; + const char *s = lua_tolstring(L, arg, &len); + return (s != NULL && lua_stringtonumber(L, s) == len + 1); + } +} + + +static void trymt (lua_State *L, const char *mtname) { + lua_settop(L, 2); /* back to the original arguments */ + if (l_unlikely(lua_type(L, 2) == LUA_TSTRING || + !luaL_getmetafield(L, 2, mtname))) + luaL_error(L, "attempt to %s a '%s' with a '%s'", mtname + 2, + luaL_typename(L, -2), luaL_typename(L, -1)); + lua_insert(L, -3); /* put metamethod before arguments */ + lua_call(L, 2, 1); /* call metamethod */ +} + + +static int arith (lua_State *L, int op, const char *mtname) { + if (tonum(L, 1) && tonum(L, 2)) + lua_arith(L, op); /* result will be on the top */ + else + trymt(L, mtname); + return 1; +} + + +static int arith_add (lua_State *L) { + return arith(L, LUA_OPADD, "__add"); +} + +static int arith_sub (lua_State *L) { + return arith(L, LUA_OPSUB, "__sub"); +} + +static int arith_mul (lua_State *L) { + return arith(L, LUA_OPMUL, "__mul"); +} + +static int arith_mod (lua_State *L) { + return arith(L, LUA_OPMOD, "__mod"); +} + +static int arith_pow (lua_State *L) { + return arith(L, LUA_OPPOW, "__pow"); +} + +static int arith_div (lua_State *L) { + return arith(L, LUA_OPDIV, "__div"); +} + +static int arith_idiv (lua_State *L) { + return arith(L, LUA_OPIDIV, "__idiv"); +} + +static int arith_unm (lua_State *L) { + return arith(L, LUA_OPUNM, "__unm"); +} + + +static const luaL_Reg stringmetamethods[] = { + {"__add", arith_add}, + {"__sub", arith_sub}, + {"__mul", arith_mul}, + {"__mod", arith_mod}, + {"__pow", arith_pow}, + {"__div", arith_div}, + {"__idiv", arith_idiv}, + {"__unm", arith_unm}, + {"__index", NULL}, /* placeholder */ + {NULL, NULL} +}; + +#endif /* } */ + +/* }====================================================== */ + +/* +** {====================================================== +** PATTERN MATCHING +** ======================================================= +*/ + + +#define CAP_UNFINISHED (-1) +#define CAP_POSITION (-2) + + +typedef struct MatchState { + const char *src_init; /* init of source string */ + const char *src_end; /* end ('\0') of source string */ + const char *p_end; /* end ('\0') of pattern */ + lua_State *L; + int matchdepth; /* control for recursive depth (to avoid C stack overflow) */ + unsigned char level; /* total number of captures (finished or unfinished) */ + struct { + const char *init; + ptrdiff_t len; + } capture[LUA_MAXCAPTURES]; +} MatchState; + + +/* recursive function */ +static const char *match (MatchState *ms, const char *s, const char *p); + + +/* maximum recursion depth for 'match' */ +#if !defined(MAXCCALLS) +#define MAXCCALLS 200 +#endif + + +#define L_ESC '%' +#define SPECIALS "^$*+?.([%-" + + +static int check_capture (MatchState *ms, int l) { + l -= '1'; + if (l_unlikely(l < 0 || l >= ms->level || + ms->capture[l].len == CAP_UNFINISHED)) + return luaL_error(ms->L, "invalid capture index %%%d", l + 1); + return l; +} + + +static int capture_to_close (MatchState *ms) { + int level = ms->level; + for (level--; level>=0; level--) + if (ms->capture[level].len == CAP_UNFINISHED) return level; + return luaL_error(ms->L, "invalid pattern capture"); +} + + +static const char *classend (MatchState *ms, const char *p) { + switch (*p++) { + case L_ESC: { + if (l_unlikely(p == ms->p_end)) + luaL_error(ms->L, "malformed pattern (ends with '%%')"); + return p+1; + } + case '[': { + if (*p == '^') p++; + do { /* look for a ']' */ + if (l_unlikely(p == ms->p_end)) + luaL_error(ms->L, "malformed pattern (missing ']')"); + if (*(p++) == L_ESC && p < ms->p_end) + p++; /* skip escapes (e.g. '%]') */ + } while (*p != ']'); + return p+1; + } + default: { + return p; + } + } +} + + +static int match_class (int c, int cl) { + int res; + switch (tolower(cl)) { + case 'a' : res = isalpha(c); break; + case 'c' : res = iscntrl(c); break; + case 'd' : res = isdigit(c); break; + case 'g' : res = isgraph(c); break; + case 'l' : res = islower(c); break; + case 'p' : res = ispunct(c); break; + case 's' : res = isspace(c); break; + case 'u' : res = isupper(c); break; + case 'w' : res = isalnum(c); break; + case 'x' : res = isxdigit(c); break; + case 'z' : res = (c == 0); break; /* deprecated option */ + default: return (cl == c); + } + return (islower(cl) ? res : !res); +} + + +static int matchbracketclass (int c, const char *p, const char *ec) { + int sig = 1; + if (*(p+1) == '^') { + sig = 0; + p++; /* skip the '^' */ + } + while (++p < ec) { + if (*p == L_ESC) { + p++; + if (match_class(c, uchar(*p))) + return sig; + } + else if ((*(p+1) == '-') && (p+2 < ec)) { + p+=2; + if (uchar(*(p-2)) <= c && c <= uchar(*p)) + return sig; + } + else if (uchar(*p) == c) return sig; + } + return !sig; +} + + +static int singlematch (MatchState *ms, const char *s, const char *p, + const char *ep) { + if (s >= ms->src_end) + return 0; + else { + int c = uchar(*s); + switch (*p) { + case '.': return 1; /* matches any char */ + case L_ESC: return match_class(c, uchar(*(p+1))); + case '[': return matchbracketclass(c, p, ep-1); + default: return (uchar(*p) == c); + } + } +} + + +static const char *matchbalance (MatchState *ms, const char *s, + const char *p) { + if (l_unlikely(p >= ms->p_end - 1)) + luaL_error(ms->L, "malformed pattern (missing arguments to '%%b')"); + if (*s != *p) return NULL; + else { + int b = *p; + int e = *(p+1); + int cont = 1; + while (++s < ms->src_end) { + if (*s == e) { + if (--cont == 0) return s+1; + } + else if (*s == b) cont++; + } + } + return NULL; /* string ends out of balance */ +} + + +static const char *max_expand (MatchState *ms, const char *s, + const char *p, const char *ep) { + ptrdiff_t i = 0; /* counts maximum expand for item */ + while (singlematch(ms, s + i, p, ep)) + i++; + /* keeps trying to match with the maximum repetitions */ + while (i>=0) { + const char *res = match(ms, (s+i), ep+1); + if (res) return res; + i--; /* else didn't match; reduce 1 repetition to try again */ + } + return NULL; +} + + +static const char *min_expand (MatchState *ms, const char *s, + const char *p, const char *ep) { + for (;;) { + const char *res = match(ms, s, ep+1); + if (res != NULL) + return res; + else if (singlematch(ms, s, p, ep)) + s++; /* try with one more repetition */ + else return NULL; + } +} + + +static const char *start_capture (MatchState *ms, const char *s, + const char *p, int what) { + const char *res; + int level = ms->level; + if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures"); + ms->capture[level].init = s; + ms->capture[level].len = what; + ms->level = level+1; + if ((res=match(ms, s, p)) == NULL) /* match failed? */ + ms->level--; /* undo capture */ + return res; +} + + +static const char *end_capture (MatchState *ms, const char *s, + const char *p) { + int l = capture_to_close(ms); + const char *res; + ms->capture[l].len = s - ms->capture[l].init; /* close capture */ + if ((res = match(ms, s, p)) == NULL) /* match failed? */ + ms->capture[l].len = CAP_UNFINISHED; /* undo capture */ + return res; +} + + +static const char *match_capture (MatchState *ms, const char *s, int l) { + size_t len; + l = check_capture(ms, l); + len = ms->capture[l].len; + if ((size_t)(ms->src_end-s) >= len && + memcmp(ms->capture[l].init, s, len) == 0) + return s+len; + else return NULL; +} + + +static const char *match (MatchState *ms, const char *s, const char *p) { + if (l_unlikely(ms->matchdepth-- == 0)) + luaL_error(ms->L, "pattern too complex"); + init: /* using goto to optimize tail recursion */ + if (p != ms->p_end) { /* end of pattern? */ + switch (*p) { + case '(': { /* start capture */ + if (*(p + 1) == ')') /* position capture? */ + s = start_capture(ms, s, p + 2, CAP_POSITION); + else + s = start_capture(ms, s, p + 1, CAP_UNFINISHED); + break; + } + case ')': { /* end capture */ + s = end_capture(ms, s, p + 1); + break; + } + case '$': { + if ((p + 1) != ms->p_end) /* is the '$' the last char in pattern? */ + goto dflt; /* no; go to default */ + s = (s == ms->src_end) ? s : NULL; /* check end of string */ + break; + } + case L_ESC: { /* escaped sequences not in the format class[*+?-]? */ + switch (*(p + 1)) { + case 'b': { /* balanced string? */ + s = matchbalance(ms, s, p + 2); + if (s != NULL) { + p += 4; goto init; /* return match(ms, s, p + 4); */ + } /* else fail (s == NULL) */ + break; + } + case 'f': { /* frontier? */ + const char *ep; char previous; + p += 2; + if (l_unlikely(*p != '[')) + luaL_error(ms->L, "missing '[' after '%%f' in pattern"); + ep = classend(ms, p); /* points to what is next */ + previous = (s == ms->src_init) ? '\0' : *(s - 1); + if (!matchbracketclass(uchar(previous), p, ep - 1) && + matchbracketclass(uchar(*s), p, ep - 1)) { + p = ep; goto init; /* return match(ms, s, ep); */ + } + s = NULL; /* match failed */ + break; + } + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + case '8': case '9': { /* capture results (%0-%9)? */ + s = match_capture(ms, s, uchar(*(p + 1))); + if (s != NULL) { + p += 2; goto init; /* return match(ms, s, p + 2) */ + } + break; + } + default: goto dflt; + } + break; + } + default: dflt: { /* pattern class plus optional suffix */ + const char *ep = classend(ms, p); /* points to optional suffix */ + /* does not match at least once? */ + if (!singlematch(ms, s, p, ep)) { + if (*ep == '*' || *ep == '?' || *ep == '-') { /* accept empty? */ + p = ep + 1; goto init; /* return match(ms, s, ep + 1); */ + } + else /* '+' or no suffix */ + s = NULL; /* fail */ + } + else { /* matched once */ + switch (*ep) { /* handle optional suffix */ + case '?': { /* optional */ + const char *res; + if ((res = match(ms, s + 1, ep + 1)) != NULL) + s = res; + else { + p = ep + 1; goto init; /* else return match(ms, s, ep + 1); */ + } + break; + } + case '+': /* 1 or more repetitions */ + s++; /* 1 match already done */ + /* FALLTHROUGH */ + case '*': /* 0 or more repetitions */ + s = max_expand(ms, s, p, ep); + break; + case '-': /* 0 or more repetitions (minimum) */ + s = min_expand(ms, s, p, ep); + break; + default: /* no suffix */ + s++; p = ep; goto init; /* return match(ms, s + 1, ep); */ + } + } + break; + } + } + } + ms->matchdepth++; + return s; +} + + + +static const char *lmemfind (const char *s1, size_t l1, + const char *s2, size_t l2) { + if (l2 == 0) return s1; /* empty strings are everywhere */ + else if (l2 > l1) return NULL; /* avoids a negative 'l1' */ + else { + const char *init; /* to search for a '*s2' inside 's1' */ + l2--; /* 1st char will be checked by 'memchr' */ + l1 = l1-l2; /* 's2' cannot be found after that */ + while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) { + init++; /* 1st char is already checked */ + if (memcmp(init, s2+1, l2) == 0) + return init-1; + else { /* correct 'l1' and 's1' to try again */ + l1 -= init-s1; + s1 = init; + } + } + return NULL; /* not found */ + } +} + + +/* +** get information about the i-th capture. If there are no captures +** and 'i==0', return information about the whole match, which +** is the range 's'..'e'. If the capture is a string, return +** its length and put its address in '*cap'. If it is an integer +** (a position), push it on the stack and return CAP_POSITION. +*/ +static size_t get_onecapture (MatchState *ms, int i, const char *s, + const char *e, const char **cap) { + if (i >= ms->level) { + if (l_unlikely(i != 0)) + luaL_error(ms->L, "invalid capture index %%%d", i + 1); + *cap = s; + return e - s; + } + else { + ptrdiff_t capl = ms->capture[i].len; + *cap = ms->capture[i].init; + if (l_unlikely(capl == CAP_UNFINISHED)) + luaL_error(ms->L, "unfinished capture"); + else if (capl == CAP_POSITION) + lua_pushinteger(ms->L, (ms->capture[i].init - ms->src_init) + 1); + return capl; + } +} + + +/* +** Push the i-th capture on the stack. +*/ +static void push_onecapture (MatchState *ms, int i, const char *s, + const char *e) { + const char *cap; + ptrdiff_t l = get_onecapture(ms, i, s, e, &cap); + if (l != CAP_POSITION) + lua_pushlstring(ms->L, cap, l); + /* else position was already pushed */ +} + + +static int push_captures (MatchState *ms, const char *s, const char *e) { + int i; + int nlevels = (ms->level == 0 && s) ? 1 : ms->level; + luaL_checkstack(ms->L, nlevels, "too many captures"); + for (i = 0; i < nlevels; i++) + push_onecapture(ms, i, s, e); + return nlevels; /* number of strings pushed */ +} + + +/* check whether pattern has no special characters */ +static int nospecials (const char *p, size_t l) { + size_t upto = 0; + do { + if (strpbrk(p + upto, SPECIALS)) + return 0; /* pattern has a special character */ + upto += strlen(p + upto) + 1; /* may have more after \0 */ + } while (upto <= l); + return 1; /* no special chars found */ +} + + +static void prepstate (MatchState *ms, lua_State *L, + const char *s, size_t ls, const char *p, size_t lp) { + ms->L = L; + ms->matchdepth = MAXCCALLS; + ms->src_init = s; + ms->src_end = s + ls; + ms->p_end = p + lp; +} + + +static void reprepstate (MatchState *ms) { + ms->level = 0; + lua_assert(ms->matchdepth == MAXCCALLS); +} + + +static int str_find_aux (lua_State *L, int find) { + size_t ls, lp; + const char *s = luaL_checklstring(L, 1, &ls); + const char *p = luaL_checklstring(L, 2, &lp); + size_t init = posrelatI(luaL_optinteger(L, 3, 1), ls) - 1; + if (init > ls) { /* start after string's end? */ + luaL_pushfail(L); /* cannot find anything */ + return 1; + } + /* explicit request or no special characters? */ + if (find && (lua_toboolean(L, 4) || nospecials(p, lp))) { + /* do a plain search */ + const char *s2 = lmemfind(s + init, ls - init, p, lp); + if (s2) { + lua_pushinteger(L, (s2 - s) + 1); + lua_pushinteger(L, (s2 - s) + lp); + return 2; + } + } + else { + MatchState ms; + const char *s1 = s + init; + int anchor = (*p == '^'); + if (anchor) { + p++; lp--; /* skip anchor character */ + } + prepstate(&ms, L, s, ls, p, lp); + do { + const char *res; + reprepstate(&ms); + if ((res=match(&ms, s1, p)) != NULL) { + if (find) { + lua_pushinteger(L, (s1 - s) + 1); /* start */ + lua_pushinteger(L, res - s); /* end */ + return push_captures(&ms, NULL, 0) + 2; + } + else + return push_captures(&ms, s1, res); + } + } while (s1++ < ms.src_end && !anchor); + } + luaL_pushfail(L); /* not found */ + return 1; +} + + +static int str_find (lua_State *L) { + return str_find_aux(L, 1); +} + + +static int str_match (lua_State *L) { + return str_find_aux(L, 0); +} + + +/* state for 'gmatch' */ +typedef struct GMatchState { + const char *src; /* current position */ + const char *p; /* pattern */ + const char *lastmatch; /* end of last match */ + MatchState ms; /* match state */ +} GMatchState; + + +static int gmatch_aux (lua_State *L) { + GMatchState *gm = (GMatchState *)lua_touserdata(L, lua_upvalueindex(3)); + const char *src; + gm->ms.L = L; + for (src = gm->src; src <= gm->ms.src_end; src++) { + const char *e; + reprepstate(&gm->ms); + if ((e = match(&gm->ms, src, gm->p)) != NULL && e != gm->lastmatch) { + gm->src = gm->lastmatch = e; + return push_captures(&gm->ms, src, e); + } + } + return 0; /* not found */ +} + + +static int gmatch (lua_State *L) { + size_t ls, lp; + const char *s = luaL_checklstring(L, 1, &ls); + const char *p = luaL_checklstring(L, 2, &lp); + size_t init = posrelatI(luaL_optinteger(L, 3, 1), ls) - 1; + GMatchState *gm; + lua_settop(L, 2); /* keep strings on closure to avoid being collected */ + gm = (GMatchState *)lua_newuserdatauv(L, sizeof(GMatchState), 0); + if (init > ls) /* start after string's end? */ + init = ls + 1; /* avoid overflows in 's + init' */ + prepstate(&gm->ms, L, s, ls, p, lp); + gm->src = s + init; gm->p = p; gm->lastmatch = NULL; + lua_pushcclosure(L, gmatch_aux, 3); + return 1; +} + + +static void add_s (MatchState *ms, luaL_Buffer *b, const char *s, + const char *e) { + size_t l; + lua_State *L = ms->L; + const char *news = lua_tolstring(L, 3, &l); + const char *p; + while ((p = (char *)memchr(news, L_ESC, l)) != NULL) { + luaL_addlstring(b, news, p - news); + p++; /* skip ESC */ + if (*p == L_ESC) /* '%%' */ + luaL_addchar(b, *p); + else if (*p == '0') /* '%0' */ + luaL_addlstring(b, s, e - s); + else if (isdigit(uchar(*p))) { /* '%n' */ + const char *cap; + ptrdiff_t resl = get_onecapture(ms, *p - '1', s, e, &cap); + if (resl == CAP_POSITION) + luaL_addvalue(b); /* add position to accumulated result */ + else + luaL_addlstring(b, cap, resl); + } + else + luaL_error(L, "invalid use of '%c' in replacement string", L_ESC); + l -= p + 1 - news; + news = p + 1; + } + luaL_addlstring(b, news, l); +} + + +/* +** Add the replacement value to the string buffer 'b'. +** Return true if the original string was changed. (Function calls and +** table indexing resulting in nil or false do not change the subject.) +*/ +static int add_value (MatchState *ms, luaL_Buffer *b, const char *s, + const char *e, int tr) { + lua_State *L = ms->L; + switch (tr) { + case LUA_TFUNCTION: { /* call the function */ + int n; + lua_pushvalue(L, 3); /* push the function */ + n = push_captures(ms, s, e); /* all captures as arguments */ + lua_call(L, n, 1); /* call it */ + break; + } + case LUA_TTABLE: { /* index the table */ + push_onecapture(ms, 0, s, e); /* first capture is the index */ + lua_gettable(L, 3); + break; + } + default: { /* LUA_TNUMBER or LUA_TSTRING */ + add_s(ms, b, s, e); /* add value to the buffer */ + return 1; /* something changed */ + } + } + if (!lua_toboolean(L, -1)) { /* nil or false? */ + lua_pop(L, 1); /* remove value */ + luaL_addlstring(b, s, e - s); /* keep original text */ + return 0; /* no changes */ + } + else if (l_unlikely(!lua_isstring(L, -1))) + return luaL_error(L, "invalid replacement value (a %s)", + luaL_typename(L, -1)); + else { + luaL_addvalue(b); /* add result to accumulator */ + return 1; /* something changed */ + } +} + + +static int str_gsub (lua_State *L) { + size_t srcl, lp; + const char *src = luaL_checklstring(L, 1, &srcl); /* subject */ + const char *p = luaL_checklstring(L, 2, &lp); /* pattern */ + const char *lastmatch = NULL; /* end of last match */ + int tr = lua_type(L, 3); /* replacement type */ + lua_Integer max_s = luaL_optinteger(L, 4, srcl + 1); /* max replacements */ + int anchor = (*p == '^'); + lua_Integer n = 0; /* replacement count */ + int changed = 0; /* change flag */ + MatchState ms; + luaL_Buffer b; + luaL_argexpected(L, tr == LUA_TNUMBER || tr == LUA_TSTRING || + tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3, + "string/function/table"); + luaL_buffinit(L, &b); + if (anchor) { + p++; lp--; /* skip anchor character */ + } + prepstate(&ms, L, src, srcl, p, lp); + while (n < max_s) { + const char *e; + reprepstate(&ms); /* (re)prepare state for new match */ + if ((e = match(&ms, src, p)) != NULL && e != lastmatch) { /* match? */ + n++; + changed = add_value(&ms, &b, src, e, tr) | changed; + src = lastmatch = e; + } + else if (src < ms.src_end) /* otherwise, skip one character */ + luaL_addchar(&b, *src++); + else break; /* end of subject */ + if (anchor) break; + } + if (!changed) /* no changes? */ + lua_pushvalue(L, 1); /* return original string */ + else { /* something changed */ + luaL_addlstring(&b, src, ms.src_end-src); + luaL_pushresult(&b); /* create and return new string */ + } + lua_pushinteger(L, n); /* number of substitutions */ + return 2; +} + +/* }====================================================== */ + + + +/* +** {====================================================== +** STRING FORMAT +** ======================================================= +*/ + +#if !defined(lua_number2strx) /* { */ + +/* +** Hexadecimal floating-point formatter +*/ + +#define SIZELENMOD (sizeof(LUA_NUMBER_FRMLEN)/sizeof(char)) + + +/* +** Number of bits that goes into the first digit. It can be any value +** between 1 and 4; the following definition tries to align the number +** to nibble boundaries by making what is left after that first digit a +** multiple of 4. +*/ +#define L_NBFD ((l_floatatt(MANT_DIG) - 1)%4 + 1) + + +/* +** Add integer part of 'x' to buffer and return new 'x' +*/ +static lua_Number adddigit (char *buff, int n, lua_Number x) { + lua_Number dd = l_mathop(floor)(x); /* get integer part from 'x' */ + int d = (int)dd; + buff[n] = (d < 10 ? d + '0' : d - 10 + 'a'); /* add to buffer */ + return x - dd; /* return what is left */ +} + + +static int num2straux (char *buff, int sz, lua_Number x) { + /* if 'inf' or 'NaN', format it like '%g' */ + if (x != x || x == (lua_Number)HUGE_VAL || x == -(lua_Number)HUGE_VAL) + return l_sprintf(buff, sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)x); + else if (x == 0) { /* can be -0... */ + /* create "0" or "-0" followed by exponent */ + return l_sprintf(buff, sz, LUA_NUMBER_FMT "x0p+0", (LUAI_UACNUMBER)x); + } + else { + int e; + lua_Number m = l_mathop(frexp)(x, &e); /* 'x' fraction and exponent */ + int n = 0; /* character count */ + if (m < 0) { /* is number negative? */ + buff[n++] = '-'; /* add sign */ + m = -m; /* make it positive */ + } + buff[n++] = '0'; buff[n++] = 'x'; /* add "0x" */ + m = adddigit(buff, n++, m * (1 << L_NBFD)); /* add first digit */ + e -= L_NBFD; /* this digit goes before the radix point */ + if (m > 0) { /* more digits? */ + buff[n++] = lua_getlocaledecpoint(); /* add radix point */ + do { /* add as many digits as needed */ + m = adddigit(buff, n++, m * 16); + } while (m > 0); + } + n += l_sprintf(buff + n, sz - n, "p%+d", e); /* add exponent */ + lua_assert(n < sz); + return n; + } +} + + +static int lua_number2strx (lua_State *L, char *buff, int sz, + const char *fmt, lua_Number x) { + int n = num2straux(buff, sz, x); + if (fmt[SIZELENMOD] == 'A') { + int i; + for (i = 0; i < n; i++) + buff[i] = toupper(uchar(buff[i])); + } + else if (l_unlikely(fmt[SIZELENMOD] != 'a')) + return luaL_error(L, "modifiers for format '%%a'/'%%A' not implemented"); + return n; +} + +#endif /* } */ + + +/* +** Maximum size for items formatted with '%f'. This size is produced +** by format('%.99f', -maxfloat), and is equal to 99 + 3 ('-', '.', +** and '\0') + number of decimal digits to represent maxfloat (which +** is maximum exponent + 1). (99+3+1, adding some extra, 110) +*/ +#define MAX_ITEMF (110 + l_floatatt(MAX_10_EXP)) + + +/* +** All formats except '%f' do not need that large limit. The other +** float formats use exponents, so that they fit in the 99 limit for +** significant digits; 's' for large strings and 'q' add items directly +** to the buffer; all integer formats also fit in the 99 limit. The +** worst case are floats: they may need 99 significant digits, plus +** '0x', '-', '.', 'e+XXXX', and '\0'. Adding some extra, 120. +*/ +#define MAX_ITEM 120 + + +/* valid flags in a format specification */ +#if !defined(L_FMTFLAGSF) + +/* valid flags for a, A, e, E, f, F, g, and G conversions */ +#define L_FMTFLAGSF "-+#0 " + +/* valid flags for o, x, and X conversions */ +#define L_FMTFLAGSX "-#0" + +/* valid flags for d and i conversions */ +#define L_FMTFLAGSI "-+0 " + +/* valid flags for u conversions */ +#define L_FMTFLAGSU "-0" + +/* valid flags for c, p, and s conversions */ +#define L_FMTFLAGSC "-" + +#endif + + +/* +** Maximum size of each format specification (such as "%-099.99d"): +** Initial '%', flags (up to 5), width (2), period, precision (2), +** length modifier (8), conversion specifier, and final '\0', plus some +** extra. +*/ +#define MAX_FORMAT 32 + + +static void addquoted (luaL_Buffer *b, const char *s, size_t len) { + luaL_addchar(b, '"'); + while (len--) { + if (*s == '"' || *s == '\\' || *s == '\n') { + luaL_addchar(b, '\\'); + luaL_addchar(b, *s); + } + else if (iscntrl(uchar(*s))) { + char buff[10]; + if (!isdigit(uchar(*(s+1)))) + l_sprintf(buff, sizeof(buff), "\\%d", (int)uchar(*s)); + else + l_sprintf(buff, sizeof(buff), "\\%03d", (int)uchar(*s)); + luaL_addstring(b, buff); + } + else + luaL_addchar(b, *s); + s++; + } + luaL_addchar(b, '"'); +} + + +/* +** Serialize a floating-point number in such a way that it can be +** scanned back by Lua. Use hexadecimal format for "common" numbers +** (to preserve precision); inf, -inf, and NaN are handled separately. +** (NaN cannot be expressed as a numeral, so we write '(0/0)' for it.) +*/ +static int quotefloat (lua_State *L, char *buff, lua_Number n) { + const char *s; /* for the fixed representations */ + if (n == (lua_Number)HUGE_VAL) /* inf? */ + s = "1e9999"; + else if (n == -(lua_Number)HUGE_VAL) /* -inf? */ + s = "-1e9999"; + else if (n != n) /* NaN? */ + s = "(0/0)"; + else { /* format number as hexadecimal */ + int nb = lua_number2strx(L, buff, MAX_ITEM, + "%" LUA_NUMBER_FRMLEN "a", n); + /* ensures that 'buff' string uses a dot as the radix character */ + if (memchr(buff, '.', nb) == NULL) { /* no dot? */ + char point = lua_getlocaledecpoint(); /* try locale point */ + char *ppoint = (char *)memchr(buff, point, nb); + if (ppoint) *ppoint = '.'; /* change it to a dot */ + } + return nb; + } + /* for the fixed representations */ + return l_sprintf(buff, MAX_ITEM, "%s", s); +} + + +static void addliteral (lua_State *L, luaL_Buffer *b, int arg) { + switch (lua_type(L, arg)) { + case LUA_TSTRING: { + size_t len; + const char *s = lua_tolstring(L, arg, &len); + addquoted(b, s, len); + break; + } + case LUA_TNUMBER: { + char *buff = luaL_prepbuffsize(b, MAX_ITEM); + int nb; + if (!lua_isinteger(L, arg)) /* float? */ + nb = quotefloat(L, buff, lua_tonumber(L, arg)); + else { /* integers */ + lua_Integer n = lua_tointeger(L, arg); + const char *format = (n == LUA_MININTEGER) /* corner case? */ + ? "0x%" LUA_INTEGER_FRMLEN "x" /* use hex */ + : LUA_INTEGER_FMT; /* else use default format */ + nb = l_sprintf(buff, MAX_ITEM, format, (LUAI_UACINT)n); + } + luaL_addsize(b, nb); + break; + } + case LUA_TNIL: case LUA_TBOOLEAN: { + luaL_tolstring(L, arg, NULL); + luaL_addvalue(b); + break; + } + default: { + luaL_argerror(L, arg, "value has no literal form"); + } + } +} + + +static const char *get2digits (const char *s) { + if (isdigit(uchar(*s))) { + s++; + if (isdigit(uchar(*s))) s++; /* (2 digits at most) */ + } + return s; +} + + +/* +** Check whether a conversion specification is valid. When called, +** first character in 'form' must be '%' and last character must +** be a valid conversion specifier. 'flags' are the accepted flags; +** 'precision' signals whether to accept a precision. +*/ +static void checkformat (lua_State *L, const char *form, const char *flags, + int precision) { + const char *spec = form + 1; /* skip '%' */ + spec += strspn(spec, flags); /* skip flags */ + if (*spec != '0') { /* a width cannot start with '0' */ + spec = get2digits(spec); /* skip width */ + if (*spec == '.' && precision) { + spec++; + spec = get2digits(spec); /* skip precision */ + } + } + if (!isalpha(uchar(*spec))) /* did not go to the end? */ + luaL_error(L, "invalid conversion specification: '%s'", form); +} + + +/* +** Get a conversion specification and copy it to 'form'. +** Return the address of its last character. +*/ +static const char *getformat (lua_State *L, const char *strfrmt, + char *form) { + /* spans flags, width, and precision ('0' is included as a flag) */ + size_t len = strspn(strfrmt, L_FMTFLAGSF "123456789."); + len++; /* adds following character (should be the specifier) */ + /* still needs space for '%', '\0', plus a length modifier */ + if (len >= MAX_FORMAT - 10) + luaL_error(L, "invalid format (too long)"); + *(form++) = '%'; + memcpy(form, strfrmt, len * sizeof(char)); + *(form + len) = '\0'; + return strfrmt + len - 1; +} + + +/* +** add length modifier into formats +*/ +static void addlenmod (char *form, const char *lenmod) { + size_t l = strlen(form); + size_t lm = strlen(lenmod); + char spec = form[l - 1]; + strcpy(form + l - 1, lenmod); + form[l + lm - 1] = spec; + form[l + lm] = '\0'; +} + + +static int str_format (lua_State *L) { + int top = lua_gettop(L); + int arg = 1; + size_t sfl; + const char *strfrmt = luaL_checklstring(L, arg, &sfl); + const char *strfrmt_end = strfrmt+sfl; + const char *flags; + luaL_Buffer b; + luaL_buffinit(L, &b); + while (strfrmt < strfrmt_end) { + if (*strfrmt != L_ESC) + luaL_addchar(&b, *strfrmt++); + else if (*++strfrmt == L_ESC) + luaL_addchar(&b, *strfrmt++); /* %% */ + else { /* format item */ + char form[MAX_FORMAT]; /* to store the format ('%...') */ + int maxitem = MAX_ITEM; /* maximum length for the result */ + char *buff = luaL_prepbuffsize(&b, maxitem); /* to put result */ + int nb = 0; /* number of bytes in result */ + if (++arg > top) + return luaL_argerror(L, arg, "no value"); + strfrmt = getformat(L, strfrmt, form); + switch (*strfrmt++) { + case 'c': { + checkformat(L, form, L_FMTFLAGSC, 0); + nb = l_sprintf(buff, maxitem, form, (int)luaL_checkinteger(L, arg)); + break; + } + case 'd': case 'i': + flags = L_FMTFLAGSI; + goto intcase; + case 'u': + flags = L_FMTFLAGSU; + goto intcase; + case 'o': case 'x': case 'X': + flags = L_FMTFLAGSX; + intcase: { + lua_Integer n = luaL_checkinteger(L, arg); + checkformat(L, form, flags, 1); + addlenmod(form, LUA_INTEGER_FRMLEN); + nb = l_sprintf(buff, maxitem, form, (LUAI_UACINT)n); + break; + } + case 'a': case 'A': + checkformat(L, form, L_FMTFLAGSF, 1); + addlenmod(form, LUA_NUMBER_FRMLEN); + nb = lua_number2strx(L, buff, maxitem, form, + luaL_checknumber(L, arg)); + break; + case 'f': + maxitem = MAX_ITEMF; /* extra space for '%f' */ + buff = luaL_prepbuffsize(&b, maxitem); + /* FALLTHROUGH */ + case 'e': case 'E': case 'g': case 'G': { + lua_Number n = luaL_checknumber(L, arg); + checkformat(L, form, L_FMTFLAGSF, 1); + addlenmod(form, LUA_NUMBER_FRMLEN); + nb = l_sprintf(buff, maxitem, form, (LUAI_UACNUMBER)n); + break; + } + case 'p': { + const void *p = lua_topointer(L, arg); + checkformat(L, form, L_FMTFLAGSC, 0); + if (p == NULL) { /* avoid calling 'printf' with argument NULL */ + p = "(null)"; /* result */ + form[strlen(form) - 1] = 's'; /* format it as a string */ + } + nb = l_sprintf(buff, maxitem, form, p); + break; + } + case 'q': { + if (form[2] != '\0') /* modifiers? */ + return luaL_error(L, "specifier '%%q' cannot have modifiers"); + addliteral(L, &b, arg); + break; + } + case 's': { + size_t l; + const char *s = luaL_tolstring(L, arg, &l); + if (form[2] == '\0') /* no modifiers? */ + luaL_addvalue(&b); /* keep entire string */ + else { + luaL_argcheck(L, l == strlen(s), arg, "string contains zeros"); + checkformat(L, form, L_FMTFLAGSC, 1); + if (strchr(form, '.') == NULL && l >= 100) { + /* no precision and string is too long to be formatted */ + luaL_addvalue(&b); /* keep entire string */ + } + else { /* format the string into 'buff' */ + nb = l_sprintf(buff, maxitem, form, s); + lua_pop(L, 1); /* remove result from 'luaL_tolstring' */ + } + } + break; + } + default: { /* also treat cases 'pnLlh' */ + return luaL_error(L, "invalid conversion '%s' to 'format'", form); + } + } + lua_assert(nb < maxitem); + luaL_addsize(&b, nb); + } + } + luaL_pushresult(&b); + return 1; +} + +/* }====================================================== */ + + +/* +** {====================================================== +** PACK/UNPACK +** ======================================================= +*/ + + +/* value used for padding */ +#if !defined(LUAL_PACKPADBYTE) +#define LUAL_PACKPADBYTE 0x00 +#endif + +/* maximum size for the binary representation of an integer */ +#define MAXINTSIZE 16 + +/* number of bits in a character */ +#define NB CHAR_BIT + +/* mask for one character (NB 1's) */ +#define MC ((1 << NB) - 1) + +/* size of a lua_Integer */ +#define SZINT ((int)sizeof(lua_Integer)) + + +/* dummy union to get native endianness */ +static const union { + int dummy; + char little; /* true iff machine is little endian */ +} nativeendian = {1}; + + +/* +** information to pack/unpack stuff +*/ +typedef struct Header { + lua_State *L; + int islittle; + int maxalign; +} Header; + + +/* +** options for pack/unpack +*/ +typedef enum KOption { + Kint, /* signed integers */ + Kuint, /* unsigned integers */ + Kfloat, /* single-precision floating-point numbers */ + Knumber, /* Lua "native" floating-point numbers */ + Kdouble, /* double-precision floating-point numbers */ + Kchar, /* fixed-length strings */ + Kstring, /* strings with prefixed length */ + Kzstr, /* zero-terminated strings */ + Kpadding, /* padding */ + Kpaddalign, /* padding for alignment */ + Knop /* no-op (configuration or spaces) */ +} KOption; + + +/* +** Read an integer numeral from string 'fmt' or return 'df' if +** there is no numeral +*/ +static int digit (int c) { return '0' <= c && c <= '9'; } + +static int getnum (const char **fmt, int df) { + if (!digit(**fmt)) /* no number? */ + return df; /* return default value */ + else { + int a = 0; + do { + a = a*10 + (*((*fmt)++) - '0'); + } while (digit(**fmt) && a <= ((int)MAXSIZE - 9)/10); + return a; + } +} + + +/* +** Read an integer numeral and raises an error if it is larger +** than the maximum size for integers. +*/ +static int getnumlimit (Header *h, const char **fmt, int df) { + int sz = getnum(fmt, df); + if (l_unlikely(sz > MAXINTSIZE || sz <= 0)) + return luaL_error(h->L, "integral size (%d) out of limits [1,%d]", + sz, MAXINTSIZE); + return sz; +} + + +/* +** Initialize Header +*/ +static void initheader (lua_State *L, Header *h) { + h->L = L; + h->islittle = nativeendian.little; + h->maxalign = 1; +} + + +/* +** Read and classify next option. 'size' is filled with option's size. +*/ +static KOption getoption (Header *h, const char **fmt, int *size) { + /* dummy structure to get native alignment requirements */ + struct cD { char c; union { LUAI_MAXALIGN; } u; }; + int opt = *((*fmt)++); + *size = 0; /* default */ + switch (opt) { + case 'b': *size = sizeof(char); return Kint; + case 'B': *size = sizeof(char); return Kuint; + case 'h': *size = sizeof(short); return Kint; + case 'H': *size = sizeof(short); return Kuint; + case 'l': *size = sizeof(long); return Kint; + case 'L': *size = sizeof(long); return Kuint; + case 'j': *size = sizeof(lua_Integer); return Kint; + case 'J': *size = sizeof(lua_Integer); return Kuint; + case 'T': *size = sizeof(size_t); return Kuint; + case 'f': *size = sizeof(float); return Kfloat; + case 'n': *size = sizeof(lua_Number); return Knumber; + case 'd': *size = sizeof(double); return Kdouble; + case 'i': *size = getnumlimit(h, fmt, sizeof(int)); return Kint; + case 'I': *size = getnumlimit(h, fmt, sizeof(int)); return Kuint; + case 's': *size = getnumlimit(h, fmt, sizeof(size_t)); return Kstring; + case 'c': + *size = getnum(fmt, -1); + if (l_unlikely(*size == -1)) + luaL_error(h->L, "missing size for format option 'c'"); + return Kchar; + case 'z': return Kzstr; + case 'x': *size = 1; return Kpadding; + case 'X': return Kpaddalign; + case ' ': break; + case '<': h->islittle = 1; break; + case '>': h->islittle = 0; break; + case '=': h->islittle = nativeendian.little; break; + case '!': { + const int maxalign = offsetof(struct cD, u); + h->maxalign = getnumlimit(h, fmt, maxalign); + break; + } + default: luaL_error(h->L, "invalid format option '%c'", opt); + } + return Knop; +} + + +/* +** Read, classify, and fill other details about the next option. +** 'psize' is filled with option's size, 'notoalign' with its +** alignment requirements. +** Local variable 'size' gets the size to be aligned. (Kpadal option +** always gets its full alignment, other options are limited by +** the maximum alignment ('maxalign'). Kchar option needs no alignment +** despite its size. +*/ +static KOption getdetails (Header *h, size_t totalsize, + const char **fmt, int *psize, int *ntoalign) { + KOption opt = getoption(h, fmt, psize); + int align = *psize; /* usually, alignment follows size */ + if (opt == Kpaddalign) { /* 'X' gets alignment from following option */ + if (**fmt == '\0' || getoption(h, fmt, &align) == Kchar || align == 0) + luaL_argerror(h->L, 1, "invalid next option for option 'X'"); + } + if (align <= 1 || opt == Kchar) /* need no alignment? */ + *ntoalign = 0; + else { + if (align > h->maxalign) /* enforce maximum alignment */ + align = h->maxalign; + if (l_unlikely((align & (align - 1)) != 0)) /* not a power of 2? */ + luaL_argerror(h->L, 1, "format asks for alignment not power of 2"); + *ntoalign = (align - (int)(totalsize & (align - 1))) & (align - 1); + } + return opt; +} + + +/* +** Pack integer 'n' with 'size' bytes and 'islittle' endianness. +** The final 'if' handles the case when 'size' is larger than +** the size of a Lua integer, correcting the extra sign-extension +** bytes if necessary (by default they would be zeros). +*/ +static void packint (luaL_Buffer *b, lua_Unsigned n, + int islittle, int size, int neg) { + char *buff = luaL_prepbuffsize(b, size); + int i; + buff[islittle ? 0 : size - 1] = (char)(n & MC); /* first byte */ + for (i = 1; i < size; i++) { + n >>= NB; + buff[islittle ? i : size - 1 - i] = (char)(n & MC); + } + if (neg && size > SZINT) { /* negative number need sign extension? */ + for (i = SZINT; i < size; i++) /* correct extra bytes */ + buff[islittle ? i : size - 1 - i] = (char)MC; + } + luaL_addsize(b, size); /* add result to buffer */ +} + + +/* +** Copy 'size' bytes from 'src' to 'dest', correcting endianness if +** given 'islittle' is different from native endianness. +*/ +static void copywithendian (char *dest, const char *src, + int size, int islittle) { + if (islittle == nativeendian.little) + memcpy(dest, src, size); + else { + dest += size - 1; + while (size-- != 0) + *(dest--) = *(src++); + } +} + + +static int str_pack (lua_State *L) { + luaL_Buffer b; + Header h; + const char *fmt = luaL_checkstring(L, 1); /* format string */ + int arg = 1; /* current argument to pack */ + size_t totalsize = 0; /* accumulate total size of result */ + initheader(L, &h); + lua_pushnil(L); /* mark to separate arguments from string buffer */ + luaL_buffinit(L, &b); + while (*fmt != '\0') { + int size, ntoalign; + KOption opt = getdetails(&h, totalsize, &fmt, &size, &ntoalign); + totalsize += ntoalign + size; + while (ntoalign-- > 0) + luaL_addchar(&b, LUAL_PACKPADBYTE); /* fill alignment */ + arg++; + switch (opt) { + case Kint: { /* signed integers */ + lua_Integer n = luaL_checkinteger(L, arg); + if (size < SZINT) { /* need overflow check? */ + lua_Integer lim = (lua_Integer)1 << ((size * NB) - 1); + luaL_argcheck(L, -lim <= n && n < lim, arg, "integer overflow"); + } + packint(&b, (lua_Unsigned)n, h.islittle, size, (n < 0)); + break; + } + case Kuint: { /* unsigned integers */ + lua_Integer n = luaL_checkinteger(L, arg); + if (size < SZINT) /* need overflow check? */ + luaL_argcheck(L, (lua_Unsigned)n < ((lua_Unsigned)1 << (size * NB)), + arg, "unsigned overflow"); + packint(&b, (lua_Unsigned)n, h.islittle, size, 0); + break; + } + case Kfloat: { /* C float */ + float f = (float)luaL_checknumber(L, arg); /* get argument */ + char *buff = luaL_prepbuffsize(&b, sizeof(f)); + /* move 'f' to final result, correcting endianness if needed */ + copywithendian(buff, (char *)&f, sizeof(f), h.islittle); + luaL_addsize(&b, size); + break; + } + case Knumber: { /* Lua float */ + lua_Number f = luaL_checknumber(L, arg); /* get argument */ + char *buff = luaL_prepbuffsize(&b, sizeof(f)); + /* move 'f' to final result, correcting endianness if needed */ + copywithendian(buff, (char *)&f, sizeof(f), h.islittle); + luaL_addsize(&b, size); + break; + } + case Kdouble: { /* C double */ + double f = (double)luaL_checknumber(L, arg); /* get argument */ + char *buff = luaL_prepbuffsize(&b, sizeof(f)); + /* move 'f' to final result, correcting endianness if needed */ + copywithendian(buff, (char *)&f, sizeof(f), h.islittle); + luaL_addsize(&b, size); + break; + } + case Kchar: { /* fixed-size string */ + size_t len; + const char *s = luaL_checklstring(L, arg, &len); + luaL_argcheck(L, len <= (size_t)size, arg, + "string longer than given size"); + luaL_addlstring(&b, s, len); /* add string */ + while (len++ < (size_t)size) /* pad extra space */ + luaL_addchar(&b, LUAL_PACKPADBYTE); + break; + } + case Kstring: { /* strings with length count */ + size_t len; + const char *s = luaL_checklstring(L, arg, &len); + luaL_argcheck(L, size >= (int)sizeof(size_t) || + len < ((size_t)1 << (size * NB)), + arg, "string length does not fit in given size"); + packint(&b, (lua_Unsigned)len, h.islittle, size, 0); /* pack length */ + luaL_addlstring(&b, s, len); + totalsize += len; + break; + } + case Kzstr: { /* zero-terminated string */ + size_t len; + const char *s = luaL_checklstring(L, arg, &len); + luaL_argcheck(L, strlen(s) == len, arg, "string contains zeros"); + luaL_addlstring(&b, s, len); + luaL_addchar(&b, '\0'); /* add zero at the end */ + totalsize += len + 1; + break; + } + case Kpadding: luaL_addchar(&b, LUAL_PACKPADBYTE); /* FALLTHROUGH */ + case Kpaddalign: case Knop: + arg--; /* undo increment */ + break; + } + } + luaL_pushresult(&b); + return 1; +} + + +static int str_packsize (lua_State *L) { + Header h; + const char *fmt = luaL_checkstring(L, 1); /* format string */ + size_t totalsize = 0; /* accumulate total size of result */ + initheader(L, &h); + while (*fmt != '\0') { + int size, ntoalign; + KOption opt = getdetails(&h, totalsize, &fmt, &size, &ntoalign); + luaL_argcheck(L, opt != Kstring && opt != Kzstr, 1, + "variable-length format"); + size += ntoalign; /* total space used by option */ + luaL_argcheck(L, totalsize <= MAXSIZE - size, 1, + "format result too large"); + totalsize += size; + } + lua_pushinteger(L, (lua_Integer)totalsize); + return 1; +} + + +/* +** Unpack an integer with 'size' bytes and 'islittle' endianness. +** If size is smaller than the size of a Lua integer and integer +** is signed, must do sign extension (propagating the sign to the +** higher bits); if size is larger than the size of a Lua integer, +** it must check the unread bytes to see whether they do not cause an +** overflow. +*/ +static lua_Integer unpackint (lua_State *L, const char *str, + int islittle, int size, int issigned) { + lua_Unsigned res = 0; + int i; + int limit = (size <= SZINT) ? size : SZINT; + for (i = limit - 1; i >= 0; i--) { + res <<= NB; + res |= (lua_Unsigned)(unsigned char)str[islittle ? i : size - 1 - i]; + } + if (size < SZINT) { /* real size smaller than lua_Integer? */ + if (issigned) { /* needs sign extension? */ + lua_Unsigned mask = (lua_Unsigned)1 << (size*NB - 1); + res = ((res ^ mask) - mask); /* do sign extension */ + } + } + else if (size > SZINT) { /* must check unread bytes */ + int mask = (!issigned || (lua_Integer)res >= 0) ? 0 : MC; + for (i = limit; i < size; i++) { + if (l_unlikely((unsigned char)str[islittle ? i : size - 1 - i] != mask)) + luaL_error(L, "%d-byte integer does not fit into Lua Integer", size); + } + } + return (lua_Integer)res; +} + + +static int str_unpack (lua_State *L) { + Header h; + const char *fmt = luaL_checkstring(L, 1); + size_t ld; + const char *data = luaL_checklstring(L, 2, &ld); + size_t pos = posrelatI(luaL_optinteger(L, 3, 1), ld) - 1; + int n = 0; /* number of results */ + luaL_argcheck(L, pos <= ld, 3, "initial position out of string"); + initheader(L, &h); + while (*fmt != '\0') { + int size, ntoalign; + KOption opt = getdetails(&h, pos, &fmt, &size, &ntoalign); + luaL_argcheck(L, (size_t)ntoalign + size <= ld - pos, 2, + "data string too short"); + pos += ntoalign; /* skip alignment */ + /* stack space for item + next position */ + luaL_checkstack(L, 2, "too many results"); + n++; + switch (opt) { + case Kint: + case Kuint: { + lua_Integer res = unpackint(L, data + pos, h.islittle, size, + (opt == Kint)); + lua_pushinteger(L, res); + break; + } + case Kfloat: { + float f; + copywithendian((char *)&f, data + pos, sizeof(f), h.islittle); + lua_pushnumber(L, (lua_Number)f); + break; + } + case Knumber: { + lua_Number f; + copywithendian((char *)&f, data + pos, sizeof(f), h.islittle); + lua_pushnumber(L, f); + break; + } + case Kdouble: { + double f; + copywithendian((char *)&f, data + pos, sizeof(f), h.islittle); + lua_pushnumber(L, (lua_Number)f); + break; + } + case Kchar: { + lua_pushlstring(L, data + pos, size); + break; + } + case Kstring: { + size_t len = (size_t)unpackint(L, data + pos, h.islittle, size, 0); + luaL_argcheck(L, len <= ld - pos - size, 2, "data string too short"); + lua_pushlstring(L, data + pos + size, len); + pos += len; /* skip string */ + break; + } + case Kzstr: { + size_t len = strlen(data + pos); + luaL_argcheck(L, pos + len < ld, 2, + "unfinished string for format 'z'"); + lua_pushlstring(L, data + pos, len); + pos += len + 1; /* skip string plus final '\0' */ + break; + } + case Kpaddalign: case Kpadding: case Knop: + n--; /* undo increment */ + break; + } + pos += size; + } + lua_pushinteger(L, pos + 1); /* next position */ + return n + 1; +} + +/* }====================================================== */ + + +static const luaL_Reg strlib[] = { + {"byte", str_byte}, + {"char", str_char}, + {"dump", str_dump}, + {"find", str_find}, + {"format", str_format}, + {"gmatch", gmatch}, + {"gsub", str_gsub}, + {"len", str_len}, + {"lower", str_lower}, + {"match", str_match}, + {"rep", str_rep}, + {"reverse", str_reverse}, + {"sub", str_sub}, + {"upper", str_upper}, + {"pack", str_pack}, + {"packsize", str_packsize}, + {"unpack", str_unpack}, + {NULL, NULL} +}; + + +static void createmetatable (lua_State *L) { + /* table to be metatable for strings */ + luaL_newlibtable(L, stringmetamethods); + luaL_setfuncs(L, stringmetamethods, 0); + lua_pushliteral(L, ""); /* dummy string */ + lua_pushvalue(L, -2); /* copy table */ + lua_setmetatable(L, -2); /* set table as metatable for strings */ + lua_pop(L, 1); /* pop dummy string */ + lua_pushvalue(L, -2); /* get string library */ + lua_setfield(L, -2, "__index"); /* metatable.__index = string */ + lua_pop(L, 1); /* pop metatable */ +} + + +/* +** Open string library +*/ +LUAMOD_API int luaopen_string (lua_State *L) { + luaL_newlib(L, strlib); + createmetatable(L); + return 1; +} + diff --git a/LuaSkin/lua-5.4.7/src/ltable.c b/LuaSkin/lua-5.4.7/src/ltable.c new file mode 100644 index 000000000..3353c0479 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/ltable.c @@ -0,0 +1,995 @@ +/* +** $Id: ltable.c $ +** Lua tables (hash) +** See Copyright Notice in lua.h +*/ + +#define ltable_c +#define LUA_CORE + +#include "lprefix.h" + + +/* +** Implementation of tables (aka arrays, objects, or hash tables). +** Tables keep its elements in two parts: an array part and a hash part. +** Non-negative integer keys are all candidates to be kept in the array +** part. The actual size of the array is the largest 'n' such that +** more than half the slots between 1 and n are in use. +** Hash uses a mix of chained scatter table with Brent's variation. +** A main invariant of these tables is that, if an element is not +** in its main position (i.e. the 'original' position that its hash gives +** to it), then the colliding element is in its own main position. +** Hence even when the load factor reaches 100%, performance remains good. +*/ + +#include +#include + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "lvm.h" + + +/* +** MAXABITS is the largest integer such that MAXASIZE fits in an +** unsigned int. +*/ +#define MAXABITS cast_int(sizeof(int) * CHAR_BIT - 1) + + +/* +** MAXASIZE is the maximum size of the array part. It is the minimum +** between 2^MAXABITS and the maximum size that, measured in bytes, +** fits in a 'size_t'. +*/ +#define MAXASIZE luaM_limitN(1u << MAXABITS, TValue) + +/* +** MAXHBITS is the largest integer such that 2^MAXHBITS fits in a +** signed int. +*/ +#define MAXHBITS (MAXABITS - 1) + + +/* +** MAXHSIZE is the maximum size of the hash part. It is the minimum +** between 2^MAXHBITS and the maximum size such that, measured in bytes, +** it fits in a 'size_t'. +*/ +#define MAXHSIZE luaM_limitN(1u << MAXHBITS, Node) + + +/* +** When the original hash value is good, hashing by a power of 2 +** avoids the cost of '%'. +*/ +#define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t)))) + +/* +** for other types, it is better to avoid modulo by power of 2, as +** they can have many 2 factors. +*/ +#define hashmod(t,n) (gnode(t, ((n) % ((sizenode(t)-1)|1)))) + + +#define hashstr(t,str) hashpow2(t, (str)->hash) +#define hashboolean(t,p) hashpow2(t, p) + + +#define hashpointer(t,p) hashmod(t, point2uint(p)) + + +#define dummynode (&dummynode_) + +static const Node dummynode_ = { + {{NULL}, LUA_VEMPTY, /* value's value and type */ + LUA_VNIL, 0, {NULL}} /* key type, next, and key value */ +}; + + +static const TValue absentkey = {ABSTKEYCONSTANT}; + + +/* +** Hash for integers. To allow a good hash, use the remainder operator +** ('%'). If integer fits as a non-negative int, compute an int +** remainder, which is faster. Otherwise, use an unsigned-integer +** remainder, which uses all bits and ensures a non-negative result. +*/ +static Node *hashint (const Table *t, lua_Integer i) { + lua_Unsigned ui = l_castS2U(i); + if (ui <= cast_uint(INT_MAX)) + return hashmod(t, cast_int(ui)); + else + return hashmod(t, ui); +} + + +/* +** Hash for floating-point numbers. +** The main computation should be just +** n = frexp(n, &i); return (n * INT_MAX) + i +** but there are some numerical subtleties. +** In a two-complement representation, INT_MAX does not has an exact +** representation as a float, but INT_MIN does; because the absolute +** value of 'frexp' is smaller than 1 (unless 'n' is inf/NaN), the +** absolute value of the product 'frexp * -INT_MIN' is smaller or equal +** to INT_MAX. Next, the use of 'unsigned int' avoids overflows when +** adding 'i'; the use of '~u' (instead of '-u') avoids problems with +** INT_MIN. +*/ +#if !defined(l_hashfloat) +static int l_hashfloat (lua_Number n) { + int i; + lua_Integer ni; + n = l_mathop(frexp)(n, &i) * -cast_num(INT_MIN); + if (!lua_numbertointeger(n, &ni)) { /* is 'n' inf/-inf/NaN? */ + lua_assert(luai_numisnan(n) || l_mathop(fabs)(n) == cast_num(HUGE_VAL)); + return 0; + } + else { /* normal case */ + unsigned int u = cast_uint(i) + cast_uint(ni); + return cast_int(u <= cast_uint(INT_MAX) ? u : ~u); + } +} +#endif + + +/* +** returns the 'main' position of an element in a table (that is, +** the index of its hash value). +*/ +static Node *mainpositionTV (const Table *t, const TValue *key) { + switch (ttypetag(key)) { + case LUA_VNUMINT: { + lua_Integer i = ivalue(key); + return hashint(t, i); + } + case LUA_VNUMFLT: { + lua_Number n = fltvalue(key); + return hashmod(t, l_hashfloat(n)); + } + case LUA_VSHRSTR: { + TString *ts = tsvalue(key); + return hashstr(t, ts); + } + case LUA_VLNGSTR: { + TString *ts = tsvalue(key); + return hashpow2(t, luaS_hashlongstr(ts)); + } + case LUA_VFALSE: + return hashboolean(t, 0); + case LUA_VTRUE: + return hashboolean(t, 1); + case LUA_VLIGHTUSERDATA: { + void *p = pvalue(key); + return hashpointer(t, p); + } + case LUA_VLCF: { + lua_CFunction f = fvalue(key); + return hashpointer(t, f); + } + default: { + GCObject *o = gcvalue(key); + return hashpointer(t, o); + } + } +} + + +l_sinline Node *mainpositionfromnode (const Table *t, Node *nd) { + TValue key; + getnodekey(cast(lua_State *, NULL), &key, nd); + return mainpositionTV(t, &key); +} + + +/* +** Check whether key 'k1' is equal to the key in node 'n2'. This +** equality is raw, so there are no metamethods. Floats with integer +** values have been normalized, so integers cannot be equal to +** floats. It is assumed that 'eqshrstr' is simply pointer equality, so +** that short strings are handled in the default case. +** A true 'deadok' means to accept dead keys as equal to their original +** values. All dead keys are compared in the default case, by pointer +** identity. (Only collectable objects can produce dead keys.) Note that +** dead long strings are also compared by identity. +** Once a key is dead, its corresponding value may be collected, and +** then another value can be created with the same address. If this +** other value is given to 'next', 'equalkey' will signal a false +** positive. In a regular traversal, this situation should never happen, +** as all keys given to 'next' came from the table itself, and therefore +** could not have been collected. Outside a regular traversal, we +** have garbage in, garbage out. What is relevant is that this false +** positive does not break anything. (In particular, 'next' will return +** some other valid item on the table or nil.) +*/ +static int equalkey (const TValue *k1, const Node *n2, int deadok) { + if ((rawtt(k1) != keytt(n2)) && /* not the same variants? */ + !(deadok && keyisdead(n2) && iscollectable(k1))) + return 0; /* cannot be same key */ + switch (keytt(n2)) { + case LUA_VNIL: case LUA_VFALSE: case LUA_VTRUE: + return 1; + case LUA_VNUMINT: + return (ivalue(k1) == keyival(n2)); + case LUA_VNUMFLT: + return luai_numeq(fltvalue(k1), fltvalueraw(keyval(n2))); + case LUA_VLIGHTUSERDATA: + return pvalue(k1) == pvalueraw(keyval(n2)); + case LUA_VLCF: + return fvalue(k1) == fvalueraw(keyval(n2)); + case ctb(LUA_VLNGSTR): + return luaS_eqlngstr(tsvalue(k1), keystrval(n2)); + default: + return gcvalue(k1) == gcvalueraw(keyval(n2)); + } +} + + +/* +** True if value of 'alimit' is equal to the real size of the array +** part of table 't'. (Otherwise, the array part must be larger than +** 'alimit'.) +*/ +#define limitequalsasize(t) (isrealasize(t) || ispow2((t)->alimit)) + + +/* +** Returns the real size of the 'array' array +*/ +LUAI_FUNC unsigned int luaH_realasize (const Table *t) { + if (limitequalsasize(t)) + return t->alimit; /* this is the size */ + else { + unsigned int size = t->alimit; + /* compute the smallest power of 2 not smaller than 'size' */ + size |= (size >> 1); + size |= (size >> 2); + size |= (size >> 4); + size |= (size >> 8); +#if (UINT_MAX >> 14) > 3 /* unsigned int has more than 16 bits */ + size |= (size >> 16); +#if (UINT_MAX >> 30) > 3 + size |= (size >> 32); /* unsigned int has more than 32 bits */ +#endif +#endif + size++; + lua_assert(ispow2(size) && size/2 < t->alimit && t->alimit < size); + return size; + } +} + + +/* +** Check whether real size of the array is a power of 2. +** (If it is not, 'alimit' cannot be changed to any other value +** without changing the real size.) +*/ +static int ispow2realasize (const Table *t) { + return (!isrealasize(t) || ispow2(t->alimit)); +} + + +static unsigned int setlimittosize (Table *t) { + t->alimit = luaH_realasize(t); + setrealasize(t); + return t->alimit; +} + + +#define limitasasize(t) check_exp(isrealasize(t), t->alimit) + + + +/* +** "Generic" get version. (Not that generic: not valid for integers, +** which may be in array part, nor for floats with integral values.) +** See explanation about 'deadok' in function 'equalkey'. +*/ +static const TValue *getgeneric (Table *t, const TValue *key, int deadok) { + Node *n = mainpositionTV(t, key); + for (;;) { /* check whether 'key' is somewhere in the chain */ + if (equalkey(key, n, deadok)) + return gval(n); /* that's it */ + else { + int nx = gnext(n); + if (nx == 0) + return &absentkey; /* not found */ + n += nx; + } + } +} + + +/* +** returns the index for 'k' if 'k' is an appropriate key to live in +** the array part of a table, 0 otherwise. +*/ +static unsigned int arrayindex (lua_Integer k) { + if (l_castS2U(k) - 1u < MAXASIZE) /* 'k' in [1, MAXASIZE]? */ + return cast_uint(k); /* 'key' is an appropriate array index */ + else + return 0; +} + + +/* +** returns the index of a 'key' for table traversals. First goes all +** elements in the array part, then elements in the hash part. The +** beginning of a traversal is signaled by 0. +*/ +static unsigned int findindex (lua_State *L, Table *t, TValue *key, + unsigned int asize) { + unsigned int i; + if (ttisnil(key)) return 0; /* first iteration */ + i = ttisinteger(key) ? arrayindex(ivalue(key)) : 0; + if (i - 1u < asize) /* is 'key' inside array part? */ + return i; /* yes; that's the index */ + else { + const TValue *n = getgeneric(t, key, 1); + if (l_unlikely(isabstkey(n))) + luaG_runerror(L, "invalid key to 'next'"); /* key not found */ + i = cast_int(nodefromval(n) - gnode(t, 0)); /* key index in hash table */ + /* hash elements are numbered after array ones */ + return (i + 1) + asize; + } +} + + +int luaH_next (lua_State *L, Table *t, StkId key) { + unsigned int asize = luaH_realasize(t); + unsigned int i = findindex(L, t, s2v(key), asize); /* find original key */ + for (; i < asize; i++) { /* try first array part */ + if (!isempty(&t->array[i])) { /* a non-empty entry? */ + setivalue(s2v(key), i + 1); + setobj2s(L, key + 1, &t->array[i]); + return 1; + } + } + for (i -= asize; cast_int(i) < sizenode(t); i++) { /* hash part */ + if (!isempty(gval(gnode(t, i)))) { /* a non-empty entry? */ + Node *n = gnode(t, i); + getnodekey(L, s2v(key), n); + setobj2s(L, key + 1, gval(n)); + return 1; + } + } + return 0; /* no more elements */ +} + + +static void freehash (lua_State *L, Table *t) { + if (!isdummy(t)) + luaM_freearray(L, t->node, cast_sizet(sizenode(t))); +} + + +/* +** {============================================================= +** Rehash +** ============================================================== +*/ + +/* +** Compute the optimal size for the array part of table 't'. 'nums' is a +** "count array" where 'nums[i]' is the number of integers in the table +** between 2^(i - 1) + 1 and 2^i. 'pna' enters with the total number of +** integer keys in the table and leaves with the number of keys that +** will go to the array part; return the optimal size. (The condition +** 'twotoi > 0' in the for loop stops the loop if 'twotoi' overflows.) +*/ +static unsigned int computesizes (unsigned int nums[], unsigned int *pna) { + int i; + unsigned int twotoi; /* 2^i (candidate for optimal size) */ + unsigned int a = 0; /* number of elements smaller than 2^i */ + unsigned int na = 0; /* number of elements to go to array part */ + unsigned int optimal = 0; /* optimal size for array part */ + /* loop while keys can fill more than half of total size */ + for (i = 0, twotoi = 1; + twotoi > 0 && *pna > twotoi / 2; + i++, twotoi *= 2) { + a += nums[i]; + if (a > twotoi/2) { /* more than half elements present? */ + optimal = twotoi; /* optimal size (till now) */ + na = a; /* all elements up to 'optimal' will go to array part */ + } + } + lua_assert((optimal == 0 || optimal / 2 < na) && na <= optimal); + *pna = na; + return optimal; +} + + +static int countint (lua_Integer key, unsigned int *nums) { + unsigned int k = arrayindex(key); + if (k != 0) { /* is 'key' an appropriate array index? */ + nums[luaO_ceillog2(k)]++; /* count as such */ + return 1; + } + else + return 0; +} + + +/* +** Count keys in array part of table 't': Fill 'nums[i]' with +** number of keys that will go into corresponding slice and return +** total number of non-nil keys. +*/ +static unsigned int numusearray (const Table *t, unsigned int *nums) { + int lg; + unsigned int ttlg; /* 2^lg */ + unsigned int ause = 0; /* summation of 'nums' */ + unsigned int i = 1; /* count to traverse all array keys */ + unsigned int asize = limitasasize(t); /* real array size */ + /* traverse each slice */ + for (lg = 0, ttlg = 1; lg <= MAXABITS; lg++, ttlg *= 2) { + unsigned int lc = 0; /* counter */ + unsigned int lim = ttlg; + if (lim > asize) { + lim = asize; /* adjust upper limit */ + if (i > lim) + break; /* no more elements to count */ + } + /* count elements in range (2^(lg - 1), 2^lg] */ + for (; i <= lim; i++) { + if (!isempty(&t->array[i-1])) + lc++; + } + nums[lg] += lc; + ause += lc; + } + return ause; +} + + +static int numusehash (const Table *t, unsigned int *nums, unsigned int *pna) { + int totaluse = 0; /* total number of elements */ + int ause = 0; /* elements added to 'nums' (can go to array part) */ + int i = sizenode(t); + while (i--) { + Node *n = &t->node[i]; + if (!isempty(gval(n))) { + if (keyisinteger(n)) + ause += countint(keyival(n), nums); + totaluse++; + } + } + *pna += ause; + return totaluse; +} + + +/* +** Creates an array for the hash part of a table with the given +** size, or reuses the dummy node if size is zero. +** The computation for size overflow is in two steps: the first +** comparison ensures that the shift in the second one does not +** overflow. +*/ +static void setnodevector (lua_State *L, Table *t, unsigned int size) { + if (size == 0) { /* no elements to hash part? */ + t->node = cast(Node *, dummynode); /* use common 'dummynode' */ + t->lsizenode = 0; + t->lastfree = NULL; /* signal that it is using dummy node */ + } + else { + int i; + int lsize = luaO_ceillog2(size); + if (lsize > MAXHBITS || (1u << lsize) > MAXHSIZE) + luaG_runerror(L, "table overflow"); + size = twoto(lsize); + t->node = luaM_newvector(L, size, Node); + for (i = 0; i < cast_int(size); i++) { + Node *n = gnode(t, i); + gnext(n) = 0; + setnilkey(n); + setempty(gval(n)); + } + t->lsizenode = cast_byte(lsize); + t->lastfree = gnode(t, size); /* all positions are free */ + } +} + + +/* +** (Re)insert all elements from the hash part of 'ot' into table 't'. +*/ +static void reinsert (lua_State *L, Table *ot, Table *t) { + int j; + int size = sizenode(ot); + for (j = 0; j < size; j++) { + Node *old = gnode(ot, j); + if (!isempty(gval(old))) { + /* doesn't need barrier/invalidate cache, as entry was + already present in the table */ + TValue k; + getnodekey(L, &k, old); + luaH_set(L, t, &k, gval(old)); + } + } +} + + +/* +** Exchange the hash part of 't1' and 't2'. +*/ +static void exchangehashpart (Table *t1, Table *t2) { + lu_byte lsizenode = t1->lsizenode; + Node *node = t1->node; + Node *lastfree = t1->lastfree; + t1->lsizenode = t2->lsizenode; + t1->node = t2->node; + t1->lastfree = t2->lastfree; + t2->lsizenode = lsizenode; + t2->node = node; + t2->lastfree = lastfree; +} + + +/* +** Resize table 't' for the new given sizes. Both allocations (for +** the hash part and for the array part) can fail, which creates some +** subtleties. If the first allocation, for the hash part, fails, an +** error is raised and that is it. Otherwise, it copies the elements from +** the shrinking part of the array (if it is shrinking) into the new +** hash. Then it reallocates the array part. If that fails, the table +** is in its original state; the function frees the new hash part and then +** raises the allocation error. Otherwise, it sets the new hash part +** into the table, initializes the new part of the array (if any) with +** nils and reinserts the elements of the old hash back into the new +** parts of the table. +*/ +void luaH_resize (lua_State *L, Table *t, unsigned int newasize, + unsigned int nhsize) { + unsigned int i; + Table newt; /* to keep the new hash part */ + unsigned int oldasize = setlimittosize(t); + TValue *newarray; + /* create new hash part with appropriate size into 'newt' */ + setnodevector(L, &newt, nhsize); + if (newasize < oldasize) { /* will array shrink? */ + t->alimit = newasize; /* pretend array has new size... */ + exchangehashpart(t, &newt); /* and new hash */ + /* re-insert into the new hash the elements from vanishing slice */ + for (i = newasize; i < oldasize; i++) { + if (!isempty(&t->array[i])) + luaH_setint(L, t, i + 1, &t->array[i]); + } + t->alimit = oldasize; /* restore current size... */ + exchangehashpart(t, &newt); /* and hash (in case of errors) */ + } + /* allocate new array */ + newarray = luaM_reallocvector(L, t->array, oldasize, newasize, TValue); + if (l_unlikely(newarray == NULL && newasize > 0)) { /* allocation failed? */ + freehash(L, &newt); /* release new hash part */ + luaM_error(L); /* raise error (with array unchanged) */ + } + /* allocation ok; initialize new part of the array */ + exchangehashpart(t, &newt); /* 't' has the new hash ('newt' has the old) */ + t->array = newarray; /* set new array part */ + t->alimit = newasize; + for (i = oldasize; i < newasize; i++) /* clear new slice of the array */ + setempty(&t->array[i]); + /* re-insert elements from old hash part into new parts */ + reinsert(L, &newt, t); /* 'newt' now has the old hash */ + freehash(L, &newt); /* free old hash part */ +} + + +void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize) { + int nsize = allocsizenode(t); + luaH_resize(L, t, nasize, nsize); +} + +/* +** nums[i] = number of keys 'k' where 2^(i - 1) < k <= 2^i +*/ +static void rehash (lua_State *L, Table *t, const TValue *ek) { + unsigned int asize; /* optimal size for array part */ + unsigned int na; /* number of keys in the array part */ + unsigned int nums[MAXABITS + 1]; + int i; + int totaluse; + for (i = 0; i <= MAXABITS; i++) nums[i] = 0; /* reset counts */ + setlimittosize(t); + na = numusearray(t, nums); /* count keys in array part */ + totaluse = na; /* all those keys are integer keys */ + totaluse += numusehash(t, nums, &na); /* count keys in hash part */ + /* count extra key */ + if (ttisinteger(ek)) + na += countint(ivalue(ek), nums); + totaluse++; + /* compute new size for array part */ + asize = computesizes(nums, &na); + /* resize the table to new computed sizes */ + luaH_resize(L, t, asize, totaluse - na); +} + + + +/* +** }============================================================= +*/ + + +Table *luaH_new (lua_State *L) { + GCObject *o = luaC_newobj(L, LUA_VTABLE, sizeof(Table)); + Table *t = gco2t(o); + t->metatable = NULL; + t->flags = cast_byte(maskflags); /* table has no metamethod fields */ + t->array = NULL; + t->alimit = 0; + setnodevector(L, t, 0); + return t; +} + + +void luaH_free (lua_State *L, Table *t) { + freehash(L, t); + luaM_freearray(L, t->array, luaH_realasize(t)); + luaM_free(L, t); +} + + +static Node *getfreepos (Table *t) { + if (!isdummy(t)) { + while (t->lastfree > t->node) { + t->lastfree--; + if (keyisnil(t->lastfree)) + return t->lastfree; + } + } + return NULL; /* could not find a free place */ +} + + + +/* +** inserts a new key into a hash table; first, check whether key's main +** position is free. If not, check whether colliding node is in its main +** position or not: if it is not, move colliding node to an empty place and +** put new key in its main position; otherwise (colliding node is in its main +** position), new key goes to an empty position. +*/ +static void luaH_newkey (lua_State *L, Table *t, const TValue *key, + TValue *value) { + Node *mp; + TValue aux; + if (l_unlikely(ttisnil(key))) + luaG_runerror(L, "table index is nil"); + else if (ttisfloat(key)) { + lua_Number f = fltvalue(key); + lua_Integer k; + if (luaV_flttointeger(f, &k, F2Ieq)) { /* does key fit in an integer? */ + setivalue(&aux, k); + key = &aux; /* insert it as an integer */ + } + else if (l_unlikely(luai_numisnan(f))) + luaG_runerror(L, "table index is NaN"); + } + if (ttisnil(value)) + return; /* do not insert nil values */ + mp = mainpositionTV(t, key); + if (!isempty(gval(mp)) || isdummy(t)) { /* main position is taken? */ + Node *othern; + Node *f = getfreepos(t); /* get a free place */ + if (f == NULL) { /* cannot find a free place? */ + rehash(L, t, key); /* grow table */ + /* whatever called 'newkey' takes care of TM cache */ + luaH_set(L, t, key, value); /* insert key into grown table */ + return; + } + lua_assert(!isdummy(t)); + othern = mainpositionfromnode(t, mp); + if (othern != mp) { /* is colliding node out of its main position? */ + /* yes; move colliding node into free position */ + while (othern + gnext(othern) != mp) /* find previous */ + othern += gnext(othern); + gnext(othern) = cast_int(f - othern); /* rechain to point to 'f' */ + *f = *mp; /* copy colliding node into free pos. (mp->next also goes) */ + if (gnext(mp) != 0) { + gnext(f) += cast_int(mp - f); /* correct 'next' */ + gnext(mp) = 0; /* now 'mp' is free */ + } + setempty(gval(mp)); + } + else { /* colliding node is in its own main position */ + /* new node will go into free position */ + if (gnext(mp) != 0) + gnext(f) = cast_int((mp + gnext(mp)) - f); /* chain new position */ + else lua_assert(gnext(f) == 0); + gnext(mp) = cast_int(f - mp); + mp = f; + } + } + setnodekey(L, mp, key); + luaC_barrierback(L, obj2gco(t), key); + lua_assert(isempty(gval(mp))); + setobj2t(L, gval(mp), value); +} + + +/* +** Search function for integers. If integer is inside 'alimit', get it +** directly from the array part. Otherwise, if 'alimit' is not +** the real size of the array, the key still can be in the array part. +** In this case, do the "Xmilia trick" to check whether 'key-1' is +** smaller than the real size. +** The trick works as follow: let 'p' be an integer such that +** '2^(p+1) >= alimit > 2^p', or '2^(p+1) > alimit-1 >= 2^p'. +** That is, 2^(p+1) is the real size of the array, and 'p' is the highest +** bit on in 'alimit-1'. What we have to check becomes 'key-1 < 2^(p+1)'. +** We compute '(key-1) & ~(alimit-1)', which we call 'res'; it will +** have the 'p' bit cleared. If the key is outside the array, that is, +** 'key-1 >= 2^(p+1)', then 'res' will have some bit on higher than 'p', +** therefore it will be larger or equal to 'alimit', and the check +** will fail. If 'key-1 < 2^(p+1)', then 'res' has no bit on higher than +** 'p', and as the bit 'p' itself was cleared, 'res' will be smaller +** than 2^p, therefore smaller than 'alimit', and the check succeeds. +** As special cases, when 'alimit' is 0 the condition is trivially false, +** and when 'alimit' is 1 the condition simplifies to 'key-1 < alimit'. +** If key is 0 or negative, 'res' will have its higher bit on, so that +** if cannot be smaller than alimit. +*/ +const TValue *luaH_getint (Table *t, lua_Integer key) { + lua_Unsigned alimit = t->alimit; + if (l_castS2U(key) - 1u < alimit) /* 'key' in [1, t->alimit]? */ + return &t->array[key - 1]; + else if (!isrealasize(t) && /* key still may be in the array part? */ + (((l_castS2U(key) - 1u) & ~(alimit - 1u)) < alimit)) { + t->alimit = cast_uint(key); /* probably '#t' is here now */ + return &t->array[key - 1]; + } + else { /* key is not in the array part; check the hash */ + Node *n = hashint(t, key); + for (;;) { /* check whether 'key' is somewhere in the chain */ + if (keyisinteger(n) && keyival(n) == key) + return gval(n); /* that's it */ + else { + int nx = gnext(n); + if (nx == 0) break; + n += nx; + } + } + return &absentkey; + } +} + + +/* +** search function for short strings +*/ +const TValue *luaH_getshortstr (Table *t, TString *key) { + Node *n = hashstr(t, key); + lua_assert(key->tt == LUA_VSHRSTR); + for (;;) { /* check whether 'key' is somewhere in the chain */ + if (keyisshrstr(n) && eqshrstr(keystrval(n), key)) + return gval(n); /* that's it */ + else { + int nx = gnext(n); + if (nx == 0) + return &absentkey; /* not found */ + n += nx; + } + } +} + + +const TValue *luaH_getstr (Table *t, TString *key) { + if (key->tt == LUA_VSHRSTR) + return luaH_getshortstr(t, key); + else { /* for long strings, use generic case */ + TValue ko; + setsvalue(cast(lua_State *, NULL), &ko, key); + return getgeneric(t, &ko, 0); + } +} + + +/* +** main search function +*/ +const TValue *luaH_get (Table *t, const TValue *key) { + switch (ttypetag(key)) { + case LUA_VSHRSTR: return luaH_getshortstr(t, tsvalue(key)); + case LUA_VNUMINT: return luaH_getint(t, ivalue(key)); + case LUA_VNIL: return &absentkey; + case LUA_VNUMFLT: { + lua_Integer k; + if (luaV_flttointeger(fltvalue(key), &k, F2Ieq)) /* integral index? */ + return luaH_getint(t, k); /* use specialized version */ + /* else... */ + } /* FALLTHROUGH */ + default: + return getgeneric(t, key, 0); + } +} + + +/* +** Finish a raw "set table" operation, where 'slot' is where the value +** should have been (the result of a previous "get table"). +** Beware: when using this function you probably need to check a GC +** barrier and invalidate the TM cache. +*/ +void luaH_finishset (lua_State *L, Table *t, const TValue *key, + const TValue *slot, TValue *value) { + if (isabstkey(slot)) + luaH_newkey(L, t, key, value); + else + setobj2t(L, cast(TValue *, slot), value); +} + + +/* +** beware: when using this function you probably need to check a GC +** barrier and invalidate the TM cache. +*/ +void luaH_set (lua_State *L, Table *t, const TValue *key, TValue *value) { + const TValue *slot = luaH_get(t, key); + luaH_finishset(L, t, key, slot, value); +} + + +void luaH_setint (lua_State *L, Table *t, lua_Integer key, TValue *value) { + const TValue *p = luaH_getint(t, key); + if (isabstkey(p)) { + TValue k; + setivalue(&k, key); + luaH_newkey(L, t, &k, value); + } + else + setobj2t(L, cast(TValue *, p), value); +} + + +/* +** Try to find a boundary in the hash part of table 't'. From the +** caller, we know that 'j' is zero or present and that 'j + 1' is +** present. We want to find a larger key that is absent from the +** table, so that we can do a binary search between the two keys to +** find a boundary. We keep doubling 'j' until we get an absent index. +** If the doubling would overflow, we try LUA_MAXINTEGER. If it is +** absent, we are ready for the binary search. ('j', being max integer, +** is larger or equal to 'i', but it cannot be equal because it is +** absent while 'i' is present; so 'j > i'.) Otherwise, 'j' is a +** boundary. ('j + 1' cannot be a present integer key because it is +** not a valid integer in Lua.) +*/ +static lua_Unsigned hash_search (Table *t, lua_Unsigned j) { + lua_Unsigned i; + if (j == 0) j++; /* the caller ensures 'j + 1' is present */ + do { + i = j; /* 'i' is a present index */ + if (j <= l_castS2U(LUA_MAXINTEGER) / 2) + j *= 2; + else { + j = LUA_MAXINTEGER; + if (isempty(luaH_getint(t, j))) /* t[j] not present? */ + break; /* 'j' now is an absent index */ + else /* weird case */ + return j; /* well, max integer is a boundary... */ + } + } while (!isempty(luaH_getint(t, j))); /* repeat until an absent t[j] */ + /* i < j && t[i] present && t[j] absent */ + while (j - i > 1u) { /* do a binary search between them */ + lua_Unsigned m = (i + j) / 2; + if (isempty(luaH_getint(t, m))) j = m; + else i = m; + } + return i; +} + + +static unsigned int binsearch (const TValue *array, unsigned int i, + unsigned int j) { + while (j - i > 1u) { /* binary search */ + unsigned int m = (i + j) / 2; + if (isempty(&array[m - 1])) j = m; + else i = m; + } + return i; +} + + +/* +** Try to find a boundary in table 't'. (A 'boundary' is an integer index +** such that t[i] is present and t[i+1] is absent, or 0 if t[1] is absent +** and 'maxinteger' if t[maxinteger] is present.) +** (In the next explanation, we use Lua indices, that is, with base 1. +** The code itself uses base 0 when indexing the array part of the table.) +** The code starts with 'limit = t->alimit', a position in the array +** part that may be a boundary. +** +** (1) If 't[limit]' is empty, there must be a boundary before it. +** As a common case (e.g., after 't[#t]=nil'), check whether 'limit-1' +** is present. If so, it is a boundary. Otherwise, do a binary search +** between 0 and limit to find a boundary. In both cases, try to +** use this boundary as the new 'alimit', as a hint for the next call. +** +** (2) If 't[limit]' is not empty and the array has more elements +** after 'limit', try to find a boundary there. Again, try first +** the special case (which should be quite frequent) where 'limit+1' +** is empty, so that 'limit' is a boundary. Otherwise, check the +** last element of the array part. If it is empty, there must be a +** boundary between the old limit (present) and the last element +** (absent), which is found with a binary search. (This boundary always +** can be a new limit.) +** +** (3) The last case is when there are no elements in the array part +** (limit == 0) or its last element (the new limit) is present. +** In this case, must check the hash part. If there is no hash part +** or 'limit+1' is absent, 'limit' is a boundary. Otherwise, call +** 'hash_search' to find a boundary in the hash part of the table. +** (In those cases, the boundary is not inside the array part, and +** therefore cannot be used as a new limit.) +*/ +lua_Unsigned luaH_getn (Table *t) { + unsigned int limit = t->alimit; + if (limit > 0 && isempty(&t->array[limit - 1])) { /* (1)? */ + /* there must be a boundary before 'limit' */ + if (limit >= 2 && !isempty(&t->array[limit - 2])) { + /* 'limit - 1' is a boundary; can it be a new limit? */ + if (ispow2realasize(t) && !ispow2(limit - 1)) { + t->alimit = limit - 1; + setnorealasize(t); /* now 'alimit' is not the real size */ + } + return limit - 1; + } + else { /* must search for a boundary in [0, limit] */ + unsigned int boundary = binsearch(t->array, 0, limit); + /* can this boundary represent the real size of the array? */ + if (ispow2realasize(t) && boundary > luaH_realasize(t) / 2) { + t->alimit = boundary; /* use it as the new limit */ + setnorealasize(t); + } + return boundary; + } + } + /* 'limit' is zero or present in table */ + if (!limitequalsasize(t)) { /* (2)? */ + /* 'limit' > 0 and array has more elements after 'limit' */ + if (isempty(&t->array[limit])) /* 'limit + 1' is empty? */ + return limit; /* this is the boundary */ + /* else, try last element in the array */ + limit = luaH_realasize(t); + if (isempty(&t->array[limit - 1])) { /* empty? */ + /* there must be a boundary in the array after old limit, + and it must be a valid new limit */ + unsigned int boundary = binsearch(t->array, t->alimit, limit); + t->alimit = boundary; + return boundary; + } + /* else, new limit is present in the table; check the hash part */ + } + /* (3) 'limit' is the last element and either is zero or present in table */ + lua_assert(limit == luaH_realasize(t) && + (limit == 0 || !isempty(&t->array[limit - 1]))); + if (isdummy(t) || isempty(luaH_getint(t, cast(lua_Integer, limit + 1)))) + return limit; /* 'limit + 1' is absent */ + else /* 'limit + 1' is also present */ + return hash_search(t, limit); +} + + + +#if defined(LUA_DEBUG) + +/* export these functions for the test library */ + +Node *luaH_mainposition (const Table *t, const TValue *key) { + return mainpositionTV(t, key); +} + +#endif diff --git a/LuaSkin/lua-5.4.7/src/ltable.h b/LuaSkin/lua-5.4.7/src/ltable.h new file mode 100644 index 000000000..8e6890342 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/ltable.h @@ -0,0 +1,63 @@ +/* +** $Id: ltable.h $ +** Lua tables (hash) +** See Copyright Notice in lua.h +*/ + +#ifndef ltable_h +#define ltable_h + +#include "lobject.h" + + +#define gnode(t,i) (&(t)->node[i]) +#define gval(n) (&(n)->i_val) +#define gnext(n) ((n)->u.next) + + +/* +** Clear all bits of fast-access metamethods, which means that the table +** may have any of these metamethods. (First access that fails after the +** clearing will set the bit again.) +*/ +#define invalidateTMcache(t) ((t)->flags &= ~maskflags) + + +/* true when 't' is using 'dummynode' as its hash part */ +#define isdummy(t) ((t)->lastfree == NULL) + + +/* allocated size for hash nodes */ +#define allocsizenode(t) (isdummy(t) ? 0 : sizenode(t)) + + +/* returns the Node, given the value of a table entry */ +#define nodefromval(v) cast(Node *, (v)) + + +LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key); +LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key, + TValue *value); +LUAI_FUNC const TValue *luaH_getshortstr (Table *t, TString *key); +LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); +LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); +LUAI_FUNC void luaH_set (lua_State *L, Table *t, const TValue *key, + TValue *value); +LUAI_FUNC void luaH_finishset (lua_State *L, Table *t, const TValue *key, + const TValue *slot, TValue *value); +LUAI_FUNC Table *luaH_new (lua_State *L); +LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize, + unsigned int nhsize); +LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize); +LUAI_FUNC void luaH_free (lua_State *L, Table *t); +LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); +LUAI_FUNC lua_Unsigned luaH_getn (Table *t); +LUAI_FUNC unsigned int luaH_realasize (const Table *t); + + +#if defined(LUA_DEBUG) +LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); +#endif + + +#endif diff --git a/LuaSkin/lua-5.3.4/src/ltablib.c b/LuaSkin/lua-5.4.7/src/ltablib.c similarity index 89% rename from LuaSkin/lua-5.3.4/src/ltablib.c rename to LuaSkin/lua-5.4.7/src/ltablib.c index 98b2f8713..e6bc4d04a 100644 --- a/LuaSkin/lua-5.3.4/src/ltablib.c +++ b/LuaSkin/lua-5.4.7/src/ltablib.c @@ -1,5 +1,5 @@ /* -** $Id: ltablib.c,v 1.93 2016/02/25 19:41:54 roberto Exp $ +** $Id: ltablib.c $ ** Library for Table Manipulation ** See Copyright Notice in lua.h */ @@ -58,27 +58,10 @@ static void checktab (lua_State *L, int arg, int what) { } -#if defined(LUA_COMPAT_MAXN) -static int maxn (lua_State *L) { - lua_Number max = 0; - luaL_checktype(L, 1, LUA_TTABLE); - lua_pushnil(L); /* first key */ - while (lua_next(L, 1)) { - lua_pop(L, 1); /* remove value */ - if (lua_type(L, -1) == LUA_TNUMBER) { - lua_Number v = lua_tonumber(L, -1); - if (v > max) max = v; - } - } - lua_pushnumber(L, max); - return 1; -} -#endif - - static int tinsert (lua_State *L) { - lua_Integer e = aux_getn(L, 1, TAB_RW) + 1; /* first empty element */ lua_Integer pos; /* where to insert new element */ + lua_Integer e = aux_getn(L, 1, TAB_RW); + e = luaL_intop(+, e, 1); /* first empty element */ switch (lua_gettop(L)) { case 2: { /* called with only 2 arguments */ pos = e; /* insert new element at the end */ @@ -87,7 +70,9 @@ static int tinsert (lua_State *L) { case 3: { lua_Integer i; pos = luaL_checkinteger(L, 2); /* 2nd argument is the position */ - luaL_argcheck(L, 1 <= pos && pos <= e, 2, "position out of bounds"); + /* check whether 'pos' is in [1, e] */ + luaL_argcheck(L, (lua_Unsigned)pos - 1u < (lua_Unsigned)e, 2, + "position out of bounds"); for (i = e; i > pos; i--) { /* move up elements */ lua_geti(L, 1, i - 1); lua_seti(L, 1, i); /* t[i] = t[i - 1] */ @@ -107,14 +92,16 @@ static int tremove (lua_State *L) { lua_Integer size = aux_getn(L, 1, TAB_RW); lua_Integer pos = luaL_optinteger(L, 2, size); if (pos != size) /* validate 'pos' if given */ - luaL_argcheck(L, 1 <= pos && pos <= size + 1, 1, "position out of bounds"); + /* check whether 'pos' is in [1, size + 1] */ + luaL_argcheck(L, (lua_Unsigned)pos - 1u <= (lua_Unsigned)size, 2, + "position out of bounds"); lua_geti(L, 1, pos); /* result = t[pos] */ for ( ; pos < size; pos++) { lua_geti(L, 1, pos + 1); lua_seti(L, 1, pos); /* t[pos] = t[pos + 1] */ } lua_pushnil(L); - lua_seti(L, 1, pos); /* t[pos] = nil */ + lua_seti(L, 1, pos); /* remove entry t[pos] */ return 1; } @@ -159,9 +146,9 @@ static int tmove (lua_State *L) { static void addfield (lua_State *L, luaL_Buffer *b, lua_Integer i) { lua_geti(L, 1, i); - if (!lua_isstring(L, -1)) - luaL_error(L, "invalid value (%s) at index %d in table for 'concat'", - luaL_typename(L, -1), i); + if (l_unlikely(!lua_isstring(L, -1))) + luaL_error(L, "invalid value (%s) at index %I in table for 'concat'", + luaL_typename(L, -1), (LUAI_UACINT)i); luaL_addvalue(b); } @@ -191,7 +178,7 @@ static int tconcat (lua_State *L) { ** ======================================================= */ -static int pack (lua_State *L) { +static int tpack (lua_State *L) { int i; int n = lua_gettop(L); /* number of elements to pack */ lua_createtable(L, n, 1); /* create result table */ @@ -204,13 +191,14 @@ static int pack (lua_State *L) { } -static int unpack (lua_State *L) { +static int tunpack (lua_State *L) { lua_Unsigned n; lua_Integer i = luaL_optinteger(L, 2, 1); lua_Integer e = luaL_opt(L, luaL_checkinteger, 3, luaL_len(L, 1)); if (i > e) return 0; /* empty range */ n = (lua_Unsigned)e - i; /* number of elements minus 1 (avoid overflows) */ - if (n >= (unsigned int)INT_MAX || !lua_checkstack(L, (int)(++n))) + if (l_unlikely(n >= (unsigned int)INT_MAX || + !lua_checkstack(L, (int)(++n)))) return luaL_error(L, "too many results to unpack"); for (; i < e; i++) { /* push arg[i..e - 1] (to avoid overflows) */ lua_geti(L, 1, i); @@ -313,15 +301,15 @@ static IdxT partition (lua_State *L, IdxT lo, IdxT up) { /* loop invariant: a[lo .. i] <= P <= a[j .. up] */ for (;;) { /* next loop: repeat ++i while a[i] < P */ - while (lua_geti(L, 1, ++i), sort_comp(L, -1, -2)) { - if (i == up - 1) /* a[i] < P but a[up - 1] == P ?? */ + while ((void)lua_geti(L, 1, ++i), sort_comp(L, -1, -2)) { + if (l_unlikely(i == up - 1)) /* a[i] < P but a[up - 1] == P ?? */ luaL_error(L, "invalid order function for sorting"); lua_pop(L, 1); /* remove a[i] */ } /* after the loop, a[i] >= P and a[lo .. i - 1] < P */ /* next loop: repeat --j while P < a[j] */ - while (lua_geti(L, 1, --j), sort_comp(L, -3, -1)) { - if (j < i) /* j < i but a[j] > P ?? */ + while ((void)lua_geti(L, 1, --j), sort_comp(L, -3, -1)) { + if (l_unlikely(j < i)) /* j < i but a[j] > P ?? */ luaL_error(L, "invalid order function for sorting"); lua_pop(L, 1); /* remove a[j] */ } @@ -352,7 +340,7 @@ static IdxT choosePivot (IdxT lo, IdxT up, unsigned int rnd) { /* -** QuickSort algorithm (recursive function) +** Quicksort algorithm (recursive function) */ static void auxsort (lua_State *L, IdxT lo, IdxT up, unsigned int rnd) { @@ -425,12 +413,9 @@ static int sort (lua_State *L) { static const luaL_Reg tab_funcs[] = { {"concat", tconcat}, -#if defined(LUA_COMPAT_MAXN) - {"maxn", maxn}, -#endif {"insert", tinsert}, - {"pack", pack}, - {"unpack", unpack}, + {"pack", tpack}, + {"unpack", tunpack}, {"remove", tremove}, {"move", tmove}, {"sort", sort}, @@ -440,11 +425,6 @@ static const luaL_Reg tab_funcs[] = { LUAMOD_API int luaopen_table (lua_State *L) { luaL_newlib(L, tab_funcs); -#if defined(LUA_COMPAT_UNPACK) - /* _G.unpack = table.unpack */ - lua_getfield(L, -1, "unpack"); - lua_setglobal(L, "unpack"); -#endif return 1; } diff --git a/LuaSkin/lua-5.4.7/src/ltm.c b/LuaSkin/lua-5.4.7/src/ltm.c new file mode 100644 index 000000000..07a060811 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/ltm.c @@ -0,0 +1,271 @@ +/* +** $Id: ltm.c $ +** Tag methods +** See Copyright Notice in lua.h +*/ + +#define ltm_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lvm.h" + + +static const char udatatypename[] = "userdata"; + +LUAI_DDEF const char *const luaT_typenames_[LUA_TOTALTYPES] = { + "no value", + "nil", "boolean", udatatypename, "number", + "string", "table", "function", udatatypename, "thread", + "upvalue", "proto" /* these last cases are used for tests only */ +}; + + +void luaT_init (lua_State *L) { + static const char *const luaT_eventname[] = { /* ORDER TM */ + "__index", "__newindex", + "__gc", "__mode", "__len", "__eq", + "__add", "__sub", "__mul", "__mod", "__pow", + "__div", "__idiv", + "__band", "__bor", "__bxor", "__shl", "__shr", + "__unm", "__bnot", "__lt", "__le", + "__concat", "__call", "__close" + }; + int i; + for (i=0; itmname[i] = luaS_new(L, luaT_eventname[i]); + luaC_fix(L, obj2gco(G(L)->tmname[i])); /* never collect these names */ + } +} + + +/* +** function to be used with macro "fasttm": optimized for absence of +** tag methods +*/ +const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { + const TValue *tm = luaH_getshortstr(events, ename); + lua_assert(event <= TM_EQ); + if (notm(tm)) { /* no tag method? */ + events->flags |= cast_byte(1u<metatable; + break; + case LUA_TUSERDATA: + mt = uvalue(o)->metatable; + break; + default: + mt = G(L)->mt[ttype(o)]; + } + return (mt ? luaH_getshortstr(mt, G(L)->tmname[event]) : &G(L)->nilvalue); +} + + +/* +** Return the name of the type of an object. For tables and userdata +** with metatable, use their '__name' metafield, if present. +*/ +const char *luaT_objtypename (lua_State *L, const TValue *o) { + Table *mt; + if ((ttistable(o) && (mt = hvalue(o)->metatable) != NULL) || + (ttisfulluserdata(o) && (mt = uvalue(o)->metatable) != NULL)) { + const TValue *name = luaH_getshortstr(mt, luaS_new(L, "__name")); + if (ttisstring(name)) /* is '__name' a string? */ + return getstr(tsvalue(name)); /* use it as type name */ + } + return ttypename(ttype(o)); /* else use standard type name */ +} + + +void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1, + const TValue *p2, const TValue *p3) { + StkId func = L->top.p; + setobj2s(L, func, f); /* push function (assume EXTRA_STACK) */ + setobj2s(L, func + 1, p1); /* 1st argument */ + setobj2s(L, func + 2, p2); /* 2nd argument */ + setobj2s(L, func + 3, p3); /* 3rd argument */ + L->top.p = func + 4; + /* metamethod may yield only when called from Lua code */ + if (isLuacode(L->ci)) + luaD_call(L, func, 0); + else + luaD_callnoyield(L, func, 0); +} + + +void luaT_callTMres (lua_State *L, const TValue *f, const TValue *p1, + const TValue *p2, StkId res) { + ptrdiff_t result = savestack(L, res); + StkId func = L->top.p; + setobj2s(L, func, f); /* push function (assume EXTRA_STACK) */ + setobj2s(L, func + 1, p1); /* 1st argument */ + setobj2s(L, func + 2, p2); /* 2nd argument */ + L->top.p += 3; + /* metamethod may yield only when called from Lua code */ + if (isLuacode(L->ci)) + luaD_call(L, func, 1); + else + luaD_callnoyield(L, func, 1); + res = restorestack(L, result); + setobjs2s(L, res, --L->top.p); /* move result to its place */ +} + + +static int callbinTM (lua_State *L, const TValue *p1, const TValue *p2, + StkId res, TMS event) { + const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */ + if (notm(tm)) + tm = luaT_gettmbyobj(L, p2, event); /* try second operand */ + if (notm(tm)) return 0; + luaT_callTMres(L, tm, p1, p2, res); + return 1; +} + + +void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, + StkId res, TMS event) { + if (l_unlikely(!callbinTM(L, p1, p2, res, event))) { + switch (event) { + case TM_BAND: case TM_BOR: case TM_BXOR: + case TM_SHL: case TM_SHR: case TM_BNOT: { + if (ttisnumber(p1) && ttisnumber(p2)) + luaG_tointerror(L, p1, p2); + else + luaG_opinterror(L, p1, p2, "perform bitwise operation on"); + } + /* calls never return, but to avoid warnings: *//* FALLTHROUGH */ + default: + luaG_opinterror(L, p1, p2, "perform arithmetic on"); + } + } +} + + +void luaT_tryconcatTM (lua_State *L) { + StkId top = L->top.p; + if (l_unlikely(!callbinTM(L, s2v(top - 2), s2v(top - 1), top - 2, + TM_CONCAT))) + luaG_concaterror(L, s2v(top - 2), s2v(top - 1)); +} + + +void luaT_trybinassocTM (lua_State *L, const TValue *p1, const TValue *p2, + int flip, StkId res, TMS event) { + if (flip) + luaT_trybinTM(L, p2, p1, res, event); + else + luaT_trybinTM(L, p1, p2, res, event); +} + + +void luaT_trybiniTM (lua_State *L, const TValue *p1, lua_Integer i2, + int flip, StkId res, TMS event) { + TValue aux; + setivalue(&aux, i2); + luaT_trybinassocTM(L, p1, &aux, flip, res, event); +} + + +/* +** Calls an order tag method. +** For lessequal, LUA_COMPAT_LT_LE keeps compatibility with old +** behavior: if there is no '__le', try '__lt', based on l <= r iff +** !(r < l) (assuming a total order). If the metamethod yields during +** this substitution, the continuation has to know about it (to negate +** the result of rtop.p, event)) /* try original event */ + return !l_isfalse(s2v(L->top.p)); +#if defined(LUA_COMPAT_LT_LE) + else if (event == TM_LE) { + /* try '!(p2 < p1)' for '(p1 <= p2)' */ + L->ci->callstatus |= CIST_LEQ; /* mark it is doing 'lt' for 'le' */ + if (callbinTM(L, p2, p1, L->top.p, TM_LT)) { + L->ci->callstatus ^= CIST_LEQ; /* clear mark */ + return l_isfalse(s2v(L->top.p)); + } + /* else error will remove this 'ci'; no need to clear mark */ + } +#endif + luaG_ordererror(L, p1, p2); /* no metamethod found */ + return 0; /* to avoid warnings */ +} + + +int luaT_callorderiTM (lua_State *L, const TValue *p1, int v2, + int flip, int isfloat, TMS event) { + TValue aux; const TValue *p2; + if (isfloat) { + setfltvalue(&aux, cast_num(v2)); + } + else + setivalue(&aux, v2); + if (flip) { /* arguments were exchanged? */ + p2 = p1; p1 = &aux; /* correct them */ + } + else + p2 = &aux; + return luaT_callorderTM(L, p1, p2, event); +} + + +void luaT_adjustvarargs (lua_State *L, int nfixparams, CallInfo *ci, + const Proto *p) { + int i; + int actual = cast_int(L->top.p - ci->func.p) - 1; /* number of arguments */ + int nextra = actual - nfixparams; /* number of extra arguments */ + ci->u.l.nextraargs = nextra; + luaD_checkstack(L, p->maxstacksize + 1); + /* copy function to the top of the stack */ + setobjs2s(L, L->top.p++, ci->func.p); + /* move fixed parameters to the top of the stack */ + for (i = 1; i <= nfixparams; i++) { + setobjs2s(L, L->top.p++, ci->func.p + i); + setnilvalue(s2v(ci->func.p + i)); /* erase original parameter (for GC) */ + } + ci->func.p += actual + 1; + ci->top.p += actual + 1; + lua_assert(L->top.p <= ci->top.p && ci->top.p <= L->stack_last.p); +} + + +void luaT_getvarargs (lua_State *L, CallInfo *ci, StkId where, int wanted) { + int i; + int nextra = ci->u.l.nextraargs; + if (wanted < 0) { + wanted = nextra; /* get all extra arguments available */ + checkstackGCp(L, nextra, where); /* ensure stack space */ + L->top.p = where + nextra; /* next instruction will need top */ + } + for (i = 0; i < wanted && i < nextra; i++) + setobjs2s(L, where + i, ci->func.p - nextra + i); + for (; i < wanted; i++) /* complete required results with nil */ + setnilvalue(s2v(where + i)); +} + diff --git a/LuaSkin/lua-5.4.7/src/ltm.h b/LuaSkin/lua-5.4.7/src/ltm.h new file mode 100644 index 000000000..73b833c60 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/ltm.h @@ -0,0 +1,103 @@ +/* +** $Id: ltm.h $ +** Tag methods +** See Copyright Notice in lua.h +*/ + +#ifndef ltm_h +#define ltm_h + + +#include "lobject.h" + + +/* +* WARNING: if you change the order of this enumeration, +* grep "ORDER TM" and "ORDER OP" +*/ +typedef enum { + TM_INDEX, + TM_NEWINDEX, + TM_GC, + TM_MODE, + TM_LEN, + TM_EQ, /* last tag method with fast access */ + TM_ADD, + TM_SUB, + TM_MUL, + TM_MOD, + TM_POW, + TM_DIV, + TM_IDIV, + TM_BAND, + TM_BOR, + TM_BXOR, + TM_SHL, + TM_SHR, + TM_UNM, + TM_BNOT, + TM_LT, + TM_LE, + TM_CONCAT, + TM_CALL, + TM_CLOSE, + TM_N /* number of elements in the enum */ +} TMS; + + +/* +** Mask with 1 in all fast-access methods. A 1 in any of these bits +** in the flag of a (meta)table means the metatable does not have the +** corresponding metamethod field. (Bit 7 of the flag is used for +** 'isrealasize'.) +*/ +#define maskflags (~(~0u << (TM_EQ + 1))) + + +/* +** Test whether there is no tagmethod. +** (Because tagmethods use raw accesses, the result may be an "empty" nil.) +*/ +#define notm(tm) ttisnil(tm) + + +#define gfasttm(g,et,e) ((et) == NULL ? NULL : \ + ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) + +#define fasttm(l,et,e) gfasttm(G(l), et, e) + +#define ttypename(x) luaT_typenames_[(x) + 1] + +LUAI_DDEC(const char *const luaT_typenames_[LUA_TOTALTYPES];) + + +LUAI_FUNC const char *luaT_objtypename (lua_State *L, const TValue *o); + +LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); +LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, + TMS event); +LUAI_FUNC void luaT_init (lua_State *L); + +LUAI_FUNC void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1, + const TValue *p2, const TValue *p3); +LUAI_FUNC void luaT_callTMres (lua_State *L, const TValue *f, + const TValue *p1, const TValue *p2, StkId p3); +LUAI_FUNC void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, + StkId res, TMS event); +LUAI_FUNC void luaT_tryconcatTM (lua_State *L); +LUAI_FUNC void luaT_trybinassocTM (lua_State *L, const TValue *p1, + const TValue *p2, int inv, StkId res, TMS event); +LUAI_FUNC void luaT_trybiniTM (lua_State *L, const TValue *p1, lua_Integer i2, + int inv, StkId res, TMS event); +LUAI_FUNC int luaT_callorderTM (lua_State *L, const TValue *p1, + const TValue *p2, TMS event); +LUAI_FUNC int luaT_callorderiTM (lua_State *L, const TValue *p1, int v2, + int inv, int isfloat, TMS event); + +LUAI_FUNC void luaT_adjustvarargs (lua_State *L, int nfixparams, + struct CallInfo *ci, const Proto *p); +LUAI_FUNC void luaT_getvarargs (lua_State *L, struct CallInfo *ci, + StkId where, int wanted); + + +#endif diff --git a/LuaSkin/lua-5.3.4/src/lua.c b/LuaSkin/lua-5.4.7/src/lua.c similarity index 75% rename from LuaSkin/lua-5.3.4/src/lua.c rename to LuaSkin/lua-5.4.7/src/lua.c index 3f082da6b..6da331f11 100644 --- a/LuaSkin/lua-5.3.4/src/lua.c +++ b/LuaSkin/lua-5.4.7/src/lua.c @@ -1,5 +1,5 @@ /* -** $Id: lua.c,v 1.230 2017/01/12 17:14:26 roberto Exp $ +** $Id: lua.c $ ** Lua stand-alone interpreter ** See Copyright Notice in lua.h */ @@ -9,31 +9,22 @@ #include "lprefix.h" -#include #include #include #include +#include + #include "lua.h" #include "lauxlib.h" #include "lualib.h" - -#if !defined(LUA_PROMPT) -#define LUA_PROMPT "> " -#define LUA_PROMPT2 ">> " -#endif - #if !defined(LUA_PROGNAME) #define LUA_PROGNAME "lua" #endif -#if !defined(LUA_MAXINPUT) -#define LUA_MAXINPUT 512 -#endif - #if !defined(LUA_INIT_VAR) #define LUA_INIT_VAR "LUA_INIT" #endif @@ -41,68 +32,29 @@ #define LUA_INITVARVERSION LUA_INIT_VAR LUA_VERSUFFIX -/* -** lua_stdin_is_tty detects whether the standard input is a 'tty' (that -** is, whether we're running lua interactively). -*/ -#if !defined(lua_stdin_is_tty) /* { */ - -#if defined(LUA_USE_POSIX) /* { */ - -#include -#define lua_stdin_is_tty() isatty(0) - -#elif defined(LUA_USE_WINDOWS) /* }{ */ - -#include -#include - -#define lua_stdin_is_tty() _isatty(_fileno(stdin)) - -#else /* }{ */ - -/* ISO C definition */ -#define lua_stdin_is_tty() 1 /* assume stdin is a tty */ +static lua_State *globalL = NULL; -#endif /* } */ +static const char *progname = LUA_PROGNAME; -#endif /* } */ +#if defined(LUA_USE_POSIX) /* { */ /* -** lua_readline defines how to show a prompt and then read a line from -** the standard input. -** lua_saveline defines how to "save" a read line in a "history". -** lua_freeline defines how to free a line read by lua_readline. +** Use 'sigaction' when available. */ -#if !defined(lua_readline) /* { */ - -#if defined(LUA_USE_READLINE) /* { */ - -#include -#include -#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) -#define lua_saveline(L,line) ((void)L, add_history(line)) -#define lua_freeline(L,b) ((void)L, free(b)) - -#else /* }{ */ - -#define lua_readline(L,b,p) \ - ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ - fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ -#define lua_saveline(L,line) { (void)L; (void)line; } -#define lua_freeline(L,b) { (void)L; (void)b; } - -#endif /* } */ - -#endif /* } */ - - +static void setsignal (int sig, void (*handler)(int)) { + struct sigaction sa; + sa.sa_handler = handler; + sa.sa_flags = 0; + sigemptyset(&sa.sa_mask); /* do not mask any signal */ + sigaction(sig, &sa, NULL); +} +#else /* }{ */ -static lua_State *globalL = NULL; +#define setsignal signal -static const char *progname = LUA_PROGNAME; +#endif /* } */ /* @@ -122,8 +74,9 @@ static void lstop (lua_State *L, lua_Debug *ar) { ** interpreter. */ static void laction (int i) { - signal(i, SIG_DFL); /* if another SIGINT happens, terminate process */ - lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); + int flag = LUA_MASKCALL | LUA_MASKRET | LUA_MASKLINE | LUA_MASKCOUNT; + setsignal(i, SIG_DFL); /* if another SIGINT happens, terminate process */ + lua_sethook(globalL, lstop, flag, 1); } @@ -136,13 +89,15 @@ static void print_usage (const char *badoption) { lua_writestringerror( "usage: %s [options] [script [args]]\n" "Available options are:\n" - " -e stat execute string 'stat'\n" - " -i enter interactive mode after executing 'script'\n" - " -l name require library 'name'\n" - " -v show version information\n" - " -E ignore environment variables\n" - " -- stop handling options\n" - " - stop handling options and execute stdin\n" + " -e stat execute string 'stat'\n" + " -i enter interactive mode after executing 'script'\n" + " -l mod require library 'mod' into global 'mod'\n" + " -l g=mod require library 'mod' into global 'g'\n" + " -v show version information\n" + " -E ignore environment variables\n" + " -W turn warnings on\n" + " -- stop handling options\n" + " - stop handling options and execute stdin\n" , progname); } @@ -160,12 +115,13 @@ static void l_message (const char *pname, const char *msg) { /* ** Check whether 'status' is not OK and, if so, prints the error -** message on the top of the stack. It assumes that the error object -** is a string, as it was either generated by Lua or by 'msghandler'. +** message on the top of the stack. */ static int report (lua_State *L, int status) { if (status != LUA_OK) { const char *msg = lua_tostring(L, -1); + if (msg == NULL) + msg = "(error message not a string)"; l_message(progname, msg); lua_pop(L, 1); /* remove message */ } @@ -201,9 +157,9 @@ static int docall (lua_State *L, int narg, int nres) { lua_pushcfunction(L, msghandler); /* push message handler */ lua_insert(L, base); /* put it under function and args */ globalL = L; /* to be available to 'laction' */ - signal(SIGINT, laction); /* set C-signal handler */ + setsignal(SIGINT, laction); /* set C-signal handler */ status = lua_pcall(L, narg, nres, base); - signal(SIGINT, SIG_DFL); /* reset C-signal handler */ + setsignal(SIGINT, SIG_DFL); /* reset C-signal handler */ lua_remove(L, base); /* remove message handler from the stack */ return status; } @@ -222,10 +178,11 @@ static void print_version (void) { ** to the script (everything after 'script') go to positive indices; ** other arguments (before the script name) go to negative indices. ** If there is no script name, assume interpreter's name as base. +** (If there is no interpreter's name either, 'script' is -1, so +** table sizes are zero.) */ static void createargtable (lua_State *L, char **argv, int argc, int script) { int i, narg; - if (script == argc) script = 0; /* no script name? */ narg = argc - (script + 1); /* number of positive indices */ lua_createtable(L, narg, script + 1); for (i = 0; i < argc; i++) { @@ -253,29 +210,270 @@ static int dostring (lua_State *L, const char *s, const char *name) { /* -** Calls 'require(name)' and stores the result in a global variable -** with the given name. +** Receives 'globname[=modname]' and runs 'globname = require(modname)'. +** If there is no explicit modname and globname contains a '-', cut +** the suffix after '-' (the "version") to make the global name. */ -static int dolibrary (lua_State *L, const char *name) { +static int dolibrary (lua_State *L, char *globname) { int status; + char *suffix = NULL; + char *modname = strchr(globname, '='); + if (modname == NULL) { /* no explicit name? */ + modname = globname; /* module name is equal to global name */ + suffix = strchr(modname, *LUA_IGMARK); /* look for a suffix mark */ + } + else { + *modname = '\0'; /* global name ends here */ + modname++; /* module name starts after the '=' */ + } lua_getglobal(L, "require"); - lua_pushstring(L, name); - status = docall(L, 1, 1); /* call 'require(name)' */ - if (status == LUA_OK) - lua_setglobal(L, name); /* global[name] = require return */ + lua_pushstring(L, modname); + status = docall(L, 1, 1); /* call 'require(modname)' */ + if (status == LUA_OK) { + if (suffix != NULL) /* is there a suffix mark? */ + *suffix = '\0'; /* remove suffix from global name */ + lua_setglobal(L, globname); /* globname = require(modname) */ + } + return report(L, status); +} + + +/* +** Push on the stack the contents of table 'arg' from 1 to #arg +*/ +static int pushargs (lua_State *L) { + int i, n; + if (lua_getglobal(L, "arg") != LUA_TTABLE) + luaL_error(L, "'arg' is not a table"); + n = (int)luaL_len(L, -1); + luaL_checkstack(L, n + 3, "too many arguments to script"); + for (i = 1; i <= n; i++) + lua_rawgeti(L, -i, i); + lua_remove(L, -i); /* remove table from the stack */ + return n; +} + + +static int handle_script (lua_State *L, char **argv) { + int status; + const char *fname = argv[0]; + if (strcmp(fname, "-") == 0 && strcmp(argv[-1], "--") != 0) + fname = NULL; /* stdin */ + status = luaL_loadfile(L, fname); + if (status == LUA_OK) { + int n = pushargs(L); /* push arguments to script */ + status = docall(L, n, LUA_MULTRET); + } return report(L, status); } +/* bits of various argument indicators in 'args' */ +#define has_error 1 /* bad option */ +#define has_i 2 /* -i */ +#define has_v 4 /* -v */ +#define has_e 8 /* -e */ +#define has_E 16 /* -E */ + + +/* +** Traverses all arguments from 'argv', returning a mask with those +** needed before running any Lua code or an error code if it finds any +** invalid argument. In case of error, 'first' is the index of the bad +** argument. Otherwise, 'first' is -1 if there is no program name, +** 0 if there is no script name, or the index of the script name. +*/ +static int collectargs (char **argv, int *first) { + int args = 0; + int i; + if (argv[0] != NULL) { /* is there a program name? */ + if (argv[0][0]) /* not empty? */ + progname = argv[0]; /* save it */ + } + else { /* no program name */ + *first = -1; + return 0; + } + for (i = 1; argv[i] != NULL; i++) { /* handle arguments */ + *first = i; + if (argv[i][0] != '-') /* not an option? */ + return args; /* stop handling options */ + switch (argv[i][1]) { /* else check option */ + case '-': /* '--' */ + if (argv[i][2] != '\0') /* extra characters after '--'? */ + return has_error; /* invalid option */ + *first = i + 1; + return args; + case '\0': /* '-' */ + return args; /* script "name" is '-' */ + case 'E': + if (argv[i][2] != '\0') /* extra characters? */ + return has_error; /* invalid option */ + args |= has_E; + break; + case 'W': + if (argv[i][2] != '\0') /* extra characters? */ + return has_error; /* invalid option */ + break; + case 'i': + args |= has_i; /* (-i implies -v) *//* FALLTHROUGH */ + case 'v': + if (argv[i][2] != '\0') /* extra characters? */ + return has_error; /* invalid option */ + args |= has_v; + break; + case 'e': + args |= has_e; /* FALLTHROUGH */ + case 'l': /* both options need an argument */ + if (argv[i][2] == '\0') { /* no concatenated argument? */ + i++; /* try next 'argv' */ + if (argv[i] == NULL || argv[i][0] == '-') + return has_error; /* no next argument or it is another option */ + } + break; + default: /* invalid option */ + return has_error; + } + } + *first = 0; /* no script name */ + return args; +} + + /* -** Returns the string to be used as a prompt by the interpreter. +** Processes options 'e' and 'l', which involve running Lua code, and +** 'W', which also affects the state. +** Returns 0 if some code raises an error. +*/ +static int runargs (lua_State *L, char **argv, int n) { + int i; + for (i = 1; i < n; i++) { + int option = argv[i][1]; + lua_assert(argv[i][0] == '-'); /* already checked */ + switch (option) { + case 'e': case 'l': { + int status; + char *extra = argv[i] + 2; /* both options need an argument */ + if (*extra == '\0') extra = argv[++i]; + lua_assert(extra != NULL); + status = (option == 'e') + ? dostring(L, extra, "=(command line)") + : dolibrary(L, extra); + if (status != LUA_OK) return 0; + break; + } + case 'W': + lua_warning(L, "@on", 0); /* warnings on */ + break; + } + } + return 1; +} + + +static int handle_luainit (lua_State *L) { + const char *name = "=" LUA_INITVARVERSION; + const char *init = getenv(name + 1); + if (init == NULL) { + name = "=" LUA_INIT_VAR; + init = getenv(name + 1); /* try alternative name */ + } + if (init == NULL) return LUA_OK; + else if (init[0] == '@') + return dofile(L, init+1); + else + return dostring(L, init, name); +} + + +/* +** {================================================================== +** Read-Eval-Print Loop (REPL) +** =================================================================== +*/ + +#if !defined(LUA_PROMPT) +#define LUA_PROMPT "> " +#define LUA_PROMPT2 ">> " +#endif + +#if !defined(LUA_MAXINPUT) +#define LUA_MAXINPUT 512 +#endif + + +/* +** lua_stdin_is_tty detects whether the standard input is a 'tty' (that +** is, whether we're running lua interactively). +*/ +#if !defined(lua_stdin_is_tty) /* { */ + +#if defined(LUA_USE_POSIX) /* { */ + +#include +#define lua_stdin_is_tty() isatty(0) + +#elif defined(LUA_USE_WINDOWS) /* }{ */ + +#include +#include + +#define lua_stdin_is_tty() _isatty(_fileno(stdin)) + +#else /* }{ */ + +/* ISO C definition */ +#define lua_stdin_is_tty() 1 /* assume stdin is a tty */ + +#endif /* } */ + +#endif /* } */ + + +/* +** lua_readline defines how to show a prompt and then read a line from +** the standard input. +** lua_saveline defines how to "save" a read line in a "history". +** lua_freeline defines how to free a line read by lua_readline. +*/ +#if !defined(lua_readline) /* { */ + +#if defined(LUA_USE_READLINE) /* { */ + +#include +#include +#define lua_initreadline(L) ((void)L, rl_readline_name="lua") +#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) +#define lua_saveline(L,line) ((void)L, add_history(line)) +#define lua_freeline(L,b) ((void)L, free(b)) + +#else /* }{ */ + +#define lua_initreadline(L) ((void)L) +#define lua_readline(L,b,p) \ + ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ + fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ +#define lua_saveline(L,line) { (void)L; (void)line; } +#define lua_freeline(L,b) { (void)L; (void)b; } + +#endif /* } */ + +#endif /* } */ + + +/* +** Return the string to be used as a prompt by the interpreter. Leave +** the string (or nil, if using the default value) on the stack, to keep +** it anchored. */ static const char *get_prompt (lua_State *L, int firstline) { - const char *p; - lua_getglobal(L, firstline ? "_PROMPT" : "_PROMPT2"); - p = lua_tostring(L, -1); - if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2); - return p; + if (lua_getglobal(L, firstline ? "_PROMPT" : "_PROMPT2") == LUA_TNIL) + return (firstline ? LUA_PROMPT : LUA_PROMPT2); /* use the default */ + else { /* apply 'tostring' over the value */ + const char *p = luaL_tolstring(L, -1, NULL); + lua_remove(L, -2); /* remove original value */ + return p; + } } /* mark in error messages for incomplete statements */ @@ -406,6 +604,7 @@ static void doREPL (lua_State *L) { int status; const char *oldprogname = progname; progname = NULL; /* no 'progname' on errors in interactive mode */ + lua_initreadline(L); while ((status = loadline(L)) != -1) { if (status == LUA_OK) status = docall(L, 0, LUA_MULTRET); @@ -417,134 +616,7 @@ static void doREPL (lua_State *L) { progname = oldprogname; } - -/* -** Push on the stack the contents of table 'arg' from 1 to #arg -*/ -static int pushargs (lua_State *L) { - int i, n; - if (lua_getglobal(L, "arg") != LUA_TTABLE) - luaL_error(L, "'arg' is not a table"); - n = (int)luaL_len(L, -1); - luaL_checkstack(L, n + 3, "too many arguments to script"); - for (i = 1; i <= n; i++) - lua_rawgeti(L, -i, i); - lua_remove(L, -i); /* remove table from the stack */ - return n; -} - - -static int handle_script (lua_State *L, char **argv) { - int status; - const char *fname = argv[0]; - if (strcmp(fname, "-") == 0 && strcmp(argv[-1], "--") != 0) - fname = NULL; /* stdin */ - status = luaL_loadfile(L, fname); - if (status == LUA_OK) { - int n = pushargs(L); /* push arguments to script */ - status = docall(L, n, LUA_MULTRET); - } - return report(L, status); -} - - - -/* bits of various argument indicators in 'args' */ -#define has_error 1 /* bad option */ -#define has_i 2 /* -i */ -#define has_v 4 /* -v */ -#define has_e 8 /* -e */ -#define has_E 16 /* -E */ - -/* -** Traverses all arguments from 'argv', returning a mask with those -** needed before running any Lua code (or an error code if it finds -** any invalid argument). 'first' returns the first not-handled argument -** (either the script name or a bad argument in case of error). -*/ -static int collectargs (char **argv, int *first) { - int args = 0; - int i; - for (i = 1; argv[i] != NULL; i++) { - *first = i; - if (argv[i][0] != '-') /* not an option? */ - return args; /* stop handling options */ - switch (argv[i][1]) { /* else check option */ - case '-': /* '--' */ - if (argv[i][2] != '\0') /* extra characters after '--'? */ - return has_error; /* invalid option */ - *first = i + 1; - return args; - case '\0': /* '-' */ - return args; /* script "name" is '-' */ - case 'E': - if (argv[i][2] != '\0') /* extra characters after 1st? */ - return has_error; /* invalid option */ - args |= has_E; - break; - case 'i': - args |= has_i; /* (-i implies -v) *//* FALLTHROUGH */ - case 'v': - if (argv[i][2] != '\0') /* extra characters after 1st? */ - return has_error; /* invalid option */ - args |= has_v; - break; - case 'e': - args |= has_e; /* FALLTHROUGH */ - case 'l': /* both options need an argument */ - if (argv[i][2] == '\0') { /* no concatenated argument? */ - i++; /* try next 'argv' */ - if (argv[i] == NULL || argv[i][0] == '-') - return has_error; /* no next argument or it is another option */ - } - break; - default: /* invalid option */ - return has_error; - } - } - *first = i; /* no script name */ - return args; -} - - -/* -** Processes options 'e' and 'l', which involve running Lua code. -** Returns 0 if some code raises an error. -*/ -static int runargs (lua_State *L, char **argv, int n) { - int i; - for (i = 1; i < n; i++) { - int option = argv[i][1]; - lua_assert(argv[i][0] == '-'); /* already checked */ - if (option == 'e' || option == 'l') { - int status; - const char *extra = argv[i] + 2; /* both options need an argument */ - if (*extra == '\0') extra = argv[++i]; - lua_assert(extra != NULL); - status = (option == 'e') - ? dostring(L, extra, "=(command line)") - : dolibrary(L, extra); - if (status != LUA_OK) return 0; - } - } - return 1; -} - - - -static int handle_luainit (lua_State *L) { - const char *name = "=" LUA_INITVARVERSION; - const char *init = getenv(name + 1); - if (init == NULL) { - name = "=" LUA_INIT_VAR; - init = getenv(name + 1); /* try alternative name */ - } - if (init == NULL) return LUA_OK; - else if (init[0] == '@') - return dofile(L, init+1); - else - return dostring(L, init, name); -} +/* }================================================================== */ /* @@ -556,8 +628,8 @@ static int pmain (lua_State *L) { char **argv = (char **)lua_touserdata(L, 2); int script; int args = collectargs(argv, &script); + int optlim = (script > 0) ? script : argc; /* first argv not an option */ luaL_checkversion(L); /* check that interpreter has correct version */ - if (argv[0] && argv[0][0]) progname = argv[0]; if (args == has_error) { /* bad arg? */ print_usage(argv[script]); /* 'script' has index of bad arg. */ return 0; @@ -570,18 +642,21 @@ static int pmain (lua_State *L) { } luaL_openlibs(L); /* open standard libraries */ createargtable(L, argv, argc, script); /* create table 'arg' */ + lua_gc(L, LUA_GCRESTART); /* start GC... */ + lua_gc(L, LUA_GCGEN, 0, 0); /* ...in generational mode */ if (!(args & has_E)) { /* no option '-E'? */ if (handle_luainit(L) != LUA_OK) /* run LUA_INIT */ return 0; /* error running LUA_INIT */ } - if (!runargs(L, argv, script)) /* execute arguments -e and -l */ + if (!runargs(L, argv, optlim)) /* execute arguments -e and -l */ return 0; /* something failed */ - if (script < argc && /* execute main script (if there is one) */ - handle_script(L, argv + script) != LUA_OK) - return 0; + if (script > 0) { /* execute main script (if there is one) */ + if (handle_script(L, argv + script) != LUA_OK) + return 0; /* interrupt in case of error */ + } if (args & has_i) /* -i option? */ doREPL(L); /* do read-eval-print loop */ - else if (script == argc && !(args & (has_e | has_v))) { /* no arguments? */ + else if (script < 1 && !(args & (has_e | has_v))) { /* no active option? */ if (lua_stdin_is_tty()) { /* running in interactive mode? */ print_version(); doREPL(L); /* do read-eval-print loop */ @@ -600,6 +675,7 @@ int main (int argc, char **argv) { l_message(argv[0], "cannot create state: not enough memory"); return EXIT_FAILURE; } + lua_gc(L, LUA_GCSTOP); /* stop GC while building state */ lua_pushcfunction(L, &pmain); /* to call 'pmain' in protected mode */ lua_pushinteger(L, argc); /* 1st argument */ lua_pushlightuserdata(L, argv); /* 2nd argument */ diff --git a/LuaSkin/lua-5.3.4/src/lua.h b/LuaSkin/lua-5.4.7/src/lua.h similarity index 87% rename from LuaSkin/lua-5.3.4/src/lua.h rename to LuaSkin/lua-5.4.7/src/lua.h index 26c0e2d69..f050dac09 100644 --- a/LuaSkin/lua-5.3.4/src/lua.h +++ b/LuaSkin/lua-5.4.7/src/lua.h @@ -1,5 +1,5 @@ /* -** $Id: lua.h,v 1.332 2016/12/22 15:51:20 roberto Exp $ +** $Id: lua.h $ ** Lua - A Scripting Language ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) ** See Copyright Notice at the end of this file @@ -17,13 +17,15 @@ #define LUA_VERSION_MAJOR "5" -#define LUA_VERSION_MINOR "3" -#define LUA_VERSION_NUM 503 -#define LUA_VERSION_RELEASE "4" +#define LUA_VERSION_MINOR "4" +#define LUA_VERSION_RELEASE "7" + +#define LUA_VERSION_NUM 504 +#define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 7) #define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR #define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE -#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2017 Lua.org, PUC-Rio" +#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2024 Lua.org, PUC-Rio" #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes" @@ -49,8 +51,7 @@ #define LUA_ERRRUN 2 #define LUA_ERRSYNTAX 3 #define LUA_ERRMEM 4 -#define LUA_ERRGCMM 5 -#define LUA_ERRERR 6 +#define LUA_ERRERR 5 typedef struct lua_State lua_State; @@ -71,7 +72,7 @@ typedef struct lua_State lua_State; #define LUA_TUSERDATA 7 #define LUA_TTHREAD 8 -#define LUA_NUMTAGS 9 +#define LUA_NUMTYPES 9 @@ -124,6 +125,23 @@ typedef int (*lua_Writer) (lua_State *L, const void *p, size_t sz, void *ud); typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); +/* +** Type for warning functions +*/ +typedef void (*lua_WarnFunction) (void *ud, const char *msg, int tocont); + + +/* +** Type used by the debug API to collect debug information +*/ +typedef struct lua_Debug lua_Debug; + + +/* +** Functions to be called by the debugger in specific events +*/ +typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); + /* ** generic extra include file @@ -145,11 +163,13 @@ extern const char lua_ident[]; LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); LUA_API void (lua_close) (lua_State *L); LUA_API lua_State *(lua_newthread) (lua_State *L); +LUA_API int (lua_closethread) (lua_State *L, lua_State *from); +LUA_API int (lua_resetthread) (lua_State *L); /* Deprecated! */ LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); -LUA_API const lua_Number *(lua_version) (lua_State *L); +LUA_API lua_Number (lua_version) (lua_State *L); /* @@ -182,7 +202,7 @@ LUA_API lua_Number (lua_tonumberx) (lua_State *L, int idx, int *isnum); LUA_API lua_Integer (lua_tointegerx) (lua_State *L, int idx, int *isnum); LUA_API int (lua_toboolean) (lua_State *L, int idx); LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); -LUA_API size_t (lua_rawlen) (lua_State *L, int idx); +LUA_API lua_Unsigned (lua_rawlen) (lua_State *L, int idx); LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); LUA_API void *(lua_touserdata) (lua_State *L, int idx); LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); @@ -247,9 +267,9 @@ LUA_API int (lua_rawgeti) (lua_State *L, int idx, lua_Integer n); LUA_API int (lua_rawgetp) (lua_State *L, int idx, const void *p); LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); -LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); +LUA_API void *(lua_newuserdatauv) (lua_State *L, size_t sz, int nuvalue); LUA_API int (lua_getmetatable) (lua_State *L, int objindex); -LUA_API int (lua_getuservalue) (lua_State *L, int idx); +LUA_API int (lua_getiuservalue) (lua_State *L, int idx, int n); /* @@ -263,7 +283,7 @@ LUA_API void (lua_rawset) (lua_State *L, int idx); LUA_API void (lua_rawseti) (lua_State *L, int idx, lua_Integer n); LUA_API void (lua_rawsetp) (lua_State *L, int idx, const void *p); LUA_API int (lua_setmetatable) (lua_State *L, int objindex); -LUA_API void (lua_setuservalue) (lua_State *L, int idx); +LUA_API int (lua_setiuservalue) (lua_State *L, int idx, int n); /* @@ -288,13 +308,21 @@ LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data, int strip); */ LUA_API int (lua_yieldk) (lua_State *L, int nresults, lua_KContext ctx, lua_KFunction k); -LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg); +LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg, + int *nres); LUA_API int (lua_status) (lua_State *L); LUA_API int (lua_isyieldable) (lua_State *L); #define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL) +/* +** Warning-related functions +*/ +LUA_API void (lua_setwarnf) (lua_State *L, lua_WarnFunction f, void *ud); +LUA_API void (lua_warning) (lua_State *L, const char *msg, int tocont); + + /* ** garbage-collection function and options */ @@ -308,8 +336,10 @@ LUA_API int (lua_isyieldable) (lua_State *L); #define LUA_GCSETPAUSE 6 #define LUA_GCSETSTEPMUL 7 #define LUA_GCISRUNNING 9 +#define LUA_GCGEN 10 +#define LUA_GCINC 11 -LUA_API int (lua_gc) (lua_State *L, int what, int data); +LUA_API int (lua_gc) (lua_State *L, int what, ...); /* @@ -328,6 +358,8 @@ LUA_API size_t (lua_stringtonumber) (lua_State *L, const char *s); LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); +LUA_API void (lua_toclose) (lua_State *L, int idx); +LUA_API void (lua_closeslot) (lua_State *L, int idx); /* @@ -377,7 +409,7 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); /* ** {============================================================== -** compatibility macros for unsigned conversions +** compatibility macros ** =============================================================== */ #if defined(LUA_COMPAT_APIINTCASTS) @@ -387,6 +419,13 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); #define lua_tounsigned(L,i) lua_tounsignedx(L,(i),NULL) #endif + +#define lua_newuserdata(L,s) lua_newuserdatauv(L,s,1) +#define lua_getuservalue(L,idx) lua_getiuservalue(L,idx,1) +#define lua_setuservalue(L,idx) lua_setiuservalue(L,idx,1) + +#define LUA_NUMTAGS LUA_NUMTYPES + /* }============================================================== */ /* @@ -414,12 +453,6 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); #define LUA_MASKLINE (1 << LUA_HOOKLINE) #define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) -typedef struct lua_Debug lua_Debug; /* activation record */ - - -/* Functions to be called by the debugger in specific events */ -typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); - LUA_API int (lua_getstack) (lua_State *L, int level, lua_Debug *ar); LUA_API int (lua_getinfo) (lua_State *L, const char *what, lua_Debug *ar); @@ -437,6 +470,7 @@ LUA_API lua_Hook (lua_gethook) (lua_State *L); LUA_API int (lua_gethookmask) (lua_State *L); LUA_API int (lua_gethookcount) (lua_State *L); +LUA_API int (lua_setcstacklimit) (lua_State *L, unsigned int limit); struct lua_Debug { int event; @@ -444,6 +478,7 @@ struct lua_Debug { const char *namewhat; /* (n) 'global', 'local', 'field', 'method' */ const char *what; /* (S) 'Lua', 'C', 'main', 'tail' */ const char *source; /* (S) */ + size_t srclen; /* (S) */ int currentline; /* (l) */ int linedefined; /* (S) */ int lastlinedefined; /* (S) */ @@ -451,6 +486,8 @@ struct lua_Debug { unsigned char nparams;/* (u) number of parameters */ char isvararg; /* (u) */ char istailcall; /* (t) */ + unsigned short ftransfer; /* (r) index of first value transferred */ + unsigned short ntransfer; /* (r) number of transferred values */ char short_src[LUA_IDSIZE]; /* (S) */ /* private part */ struct CallInfo *i_ci; /* active function */ @@ -460,7 +497,7 @@ struct lua_Debug { /****************************************************************************** -* Copyright (C) 1994-2017 Lua.org, PUC-Rio. +* Copyright (C) 1994-2024 Lua.org, PUC-Rio. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the diff --git a/LuaSkin/lua-5.3.4/src/lua.hpp b/LuaSkin/lua-5.4.7/src/lua.hpp similarity index 100% rename from LuaSkin/lua-5.3.4/src/lua.hpp rename to LuaSkin/lua-5.4.7/src/lua.hpp diff --git a/LuaSkin/lua-5.4.7/src/luac.c b/LuaSkin/lua-5.4.7/src/luac.c new file mode 100644 index 000000000..5f4a141bd --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/luac.c @@ -0,0 +1,723 @@ +/* +** $Id: luac.c $ +** Lua compiler (saves bytecodes to files; also lists bytecodes) +** See Copyright Notice in lua.h +*/ + +#define luac_c +#define LUA_CORE + +#include "lprefix.h" + +#include +#include +#include +#include +#include + +#include "lua.h" +#include "lauxlib.h" + +#include "ldebug.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lopnames.h" +#include "lstate.h" +#include "lundump.h" + +static void PrintFunction(const Proto* f, int full); +#define luaU_print PrintFunction + +#define PROGNAME "luac" /* default program name */ +#define OUTPUT PROGNAME ".out" /* default output file */ + +static int listing=0; /* list bytecodes? */ +static int dumping=1; /* dump bytecodes? */ +static int stripping=0; /* strip debug information? */ +static char Output[]={ OUTPUT }; /* default output file name */ +static const char* output=Output; /* actual output file name */ +static const char* progname=PROGNAME; /* actual program name */ +static TString **tmname; + +static void fatal(const char* message) +{ + fprintf(stderr,"%s: %s\n",progname,message); + exit(EXIT_FAILURE); +} + +static void cannot(const char* what) +{ + fprintf(stderr,"%s: cannot %s %s: %s\n",progname,what,output,strerror(errno)); + exit(EXIT_FAILURE); +} + +static void usage(const char* message) +{ + if (*message=='-') + fprintf(stderr,"%s: unrecognized option '%s'\n",progname,message); + else + fprintf(stderr,"%s: %s\n",progname,message); + fprintf(stderr, + "usage: %s [options] [filenames]\n" + "Available options are:\n" + " -l list (use -l -l for full listing)\n" + " -o name output to file 'name' (default is \"%s\")\n" + " -p parse only\n" + " -s strip debug information\n" + " -v show version information\n" + " -- stop handling options\n" + " - stop handling options and process stdin\n" + ,progname,Output); + exit(EXIT_FAILURE); +} + +#define IS(s) (strcmp(argv[i],s)==0) + +static int doargs(int argc, char* argv[]) +{ + int i; + int version=0; + if (argv[0]!=NULL && *argv[0]!=0) progname=argv[0]; + for (i=1; itop.p+(i))) + +static const Proto* combine(lua_State* L, int n) +{ + if (n==1) + return toproto(L,-1); + else + { + Proto* f; + int i=n; + if (lua_load(L,reader,&i,"=(" PROGNAME ")",NULL)!=LUA_OK) fatal(lua_tostring(L,-1)); + f=toproto(L,-1); + for (i=0; ip[i]=toproto(L,i-n-1); + if (f->p[i]->sizeupvalues>0) f->p[i]->upvalues[0].instack=0; + } + return f; + } +} + +static int writer(lua_State* L, const void* p, size_t size, void* u) +{ + UNUSED(L); + return (fwrite(p,size,1,(FILE*)u)!=1) && (size!=0); +} + +static int pmain(lua_State* L) +{ + int argc=(int)lua_tointeger(L,1); + char** argv=(char**)lua_touserdata(L,2); + const Proto* f; + int i; + tmname=G(L)->tmname; + if (!lua_checkstack(L,argc)) fatal("too many input files"); + for (i=0; i1); + if (dumping) + { + FILE* D= (output==NULL) ? stdout : fopen(output,"wb"); + if (D==NULL) cannot("open"); + lua_lock(L); + luaU_dump(L,f,writer,D,stripping); + lua_unlock(L); + if (ferror(D)) cannot("write"); + if (fclose(D)) cannot("close"); + } + return 0; +} + +int main(int argc, char* argv[]) +{ + lua_State* L; + int i=doargs(argc,argv); + argc-=i; argv+=i; + if (argc<=0) usage("no input files given"); + L=luaL_newstate(); + if (L==NULL) fatal("cannot create state: not enough memory"); + lua_pushcfunction(L,&pmain); + lua_pushinteger(L,argc); + lua_pushlightuserdata(L,argv); + if (lua_pcall(L,2,0,0)!=LUA_OK) fatal(lua_tostring(L,-1)); + lua_close(L); + return EXIT_SUCCESS; +} + +/* +** print bytecodes +*/ + +#define UPVALNAME(x) ((f->upvalues[x].name) ? getstr(f->upvalues[x].name) : "-") +#define VOID(p) ((const void*)(p)) +#define eventname(i) (getstr(tmname[i])) + +static void PrintString(const TString* ts) +{ + const char* s=getstr(ts); + size_t i,n=tsslen(ts); + printf("\""); + for (i=0; ik[i]; + switch (ttypetag(o)) + { + case LUA_VNIL: + printf("N"); + break; + case LUA_VFALSE: + case LUA_VTRUE: + printf("B"); + break; + case LUA_VNUMFLT: + printf("F"); + break; + case LUA_VNUMINT: + printf("I"); + break; + case LUA_VSHRSTR: + case LUA_VLNGSTR: + printf("S"); + break; + default: /* cannot happen */ + printf("?%d",ttypetag(o)); + break; + } + printf("\t"); +} + +static void PrintConstant(const Proto* f, int i) +{ + const TValue* o=&f->k[i]; + switch (ttypetag(o)) + { + case LUA_VNIL: + printf("nil"); + break; + case LUA_VFALSE: + printf("false"); + break; + case LUA_VTRUE: + printf("true"); + break; + case LUA_VNUMFLT: + { + char buff[100]; + sprintf(buff,LUA_NUMBER_FMT,fltvalue(o)); + printf("%s",buff); + if (buff[strspn(buff,"-0123456789")]=='\0') printf(".0"); + break; + } + case LUA_VNUMINT: + printf(LUA_INTEGER_FMT,ivalue(o)); + break; + case LUA_VSHRSTR: + case LUA_VLNGSTR: + PrintString(tsvalue(o)); + break; + default: /* cannot happen */ + printf("?%d",ttypetag(o)); + break; + } +} + +#define COMMENT "\t; " +#define EXTRAARG GETARG_Ax(code[pc+1]) +#define EXTRAARGC (EXTRAARG*(MAXARG_C+1)) +#define ISK (isk ? "k" : "") + +static void PrintCode(const Proto* f) +{ + const Instruction* code=f->code; + int pc,n=f->sizecode; + for (pc=0; pc0) printf("[%d]\t",line); else printf("[-]\t"); + printf("%-9s\t",opnames[o]); + switch (o) + { + case OP_MOVE: + printf("%d %d",a,b); + break; + case OP_LOADI: + printf("%d %d",a,sbx); + break; + case OP_LOADF: + printf("%d %d",a,sbx); + break; + case OP_LOADK: + printf("%d %d",a,bx); + printf(COMMENT); PrintConstant(f,bx); + break; + case OP_LOADKX: + printf("%d",a); + printf(COMMENT); PrintConstant(f,EXTRAARG); + break; + case OP_LOADFALSE: + printf("%d",a); + break; + case OP_LFALSESKIP: + printf("%d",a); + break; + case OP_LOADTRUE: + printf("%d",a); + break; + case OP_LOADNIL: + printf("%d %d",a,b); + printf(COMMENT "%d out",b+1); + break; + case OP_GETUPVAL: + printf("%d %d",a,b); + printf(COMMENT "%s",UPVALNAME(b)); + break; + case OP_SETUPVAL: + printf("%d %d",a,b); + printf(COMMENT "%s",UPVALNAME(b)); + break; + case OP_GETTABUP: + printf("%d %d %d",a,b,c); + printf(COMMENT "%s",UPVALNAME(b)); + printf(" "); PrintConstant(f,c); + break; + case OP_GETTABLE: + printf("%d %d %d",a,b,c); + break; + case OP_GETI: + printf("%d %d %d",a,b,c); + break; + case OP_GETFIELD: + printf("%d %d %d",a,b,c); + printf(COMMENT); PrintConstant(f,c); + break; + case OP_SETTABUP: + printf("%d %d %d%s",a,b,c,ISK); + printf(COMMENT "%s",UPVALNAME(a)); + printf(" "); PrintConstant(f,b); + if (isk) { printf(" "); PrintConstant(f,c); } + break; + case OP_SETTABLE: + printf("%d %d %d%s",a,b,c,ISK); + if (isk) { printf(COMMENT); PrintConstant(f,c); } + break; + case OP_SETI: + printf("%d %d %d%s",a,b,c,ISK); + if (isk) { printf(COMMENT); PrintConstant(f,c); } + break; + case OP_SETFIELD: + printf("%d %d %d%s",a,b,c,ISK); + printf(COMMENT); PrintConstant(f,b); + if (isk) { printf(" "); PrintConstant(f,c); } + break; + case OP_NEWTABLE: + printf("%d %d %d",a,b,c); + printf(COMMENT "%d",c+EXTRAARGC); + break; + case OP_SELF: + printf("%d %d %d%s",a,b,c,ISK); + if (isk) { printf(COMMENT); PrintConstant(f,c); } + break; + case OP_ADDI: + printf("%d %d %d",a,b,sc); + break; + case OP_ADDK: + printf("%d %d %d",a,b,c); + printf(COMMENT); PrintConstant(f,c); + break; + case OP_SUBK: + printf("%d %d %d",a,b,c); + printf(COMMENT); PrintConstant(f,c); + break; + case OP_MULK: + printf("%d %d %d",a,b,c); + printf(COMMENT); PrintConstant(f,c); + break; + case OP_MODK: + printf("%d %d %d",a,b,c); + printf(COMMENT); PrintConstant(f,c); + break; + case OP_POWK: + printf("%d %d %d",a,b,c); + printf(COMMENT); PrintConstant(f,c); + break; + case OP_DIVK: + printf("%d %d %d",a,b,c); + printf(COMMENT); PrintConstant(f,c); + break; + case OP_IDIVK: + printf("%d %d %d",a,b,c); + printf(COMMENT); PrintConstant(f,c); + break; + case OP_BANDK: + printf("%d %d %d",a,b,c); + printf(COMMENT); PrintConstant(f,c); + break; + case OP_BORK: + printf("%d %d %d",a,b,c); + printf(COMMENT); PrintConstant(f,c); + break; + case OP_BXORK: + printf("%d %d %d",a,b,c); + printf(COMMENT); PrintConstant(f,c); + break; + case OP_SHRI: + printf("%d %d %d",a,b,sc); + break; + case OP_SHLI: + printf("%d %d %d",a,b,sc); + break; + case OP_ADD: + printf("%d %d %d",a,b,c); + break; + case OP_SUB: + printf("%d %d %d",a,b,c); + break; + case OP_MUL: + printf("%d %d %d",a,b,c); + break; + case OP_MOD: + printf("%d %d %d",a,b,c); + break; + case OP_POW: + printf("%d %d %d",a,b,c); + break; + case OP_DIV: + printf("%d %d %d",a,b,c); + break; + case OP_IDIV: + printf("%d %d %d",a,b,c); + break; + case OP_BAND: + printf("%d %d %d",a,b,c); + break; + case OP_BOR: + printf("%d %d %d",a,b,c); + break; + case OP_BXOR: + printf("%d %d %d",a,b,c); + break; + case OP_SHL: + printf("%d %d %d",a,b,c); + break; + case OP_SHR: + printf("%d %d %d",a,b,c); + break; + case OP_MMBIN: + printf("%d %d %d",a,b,c); + printf(COMMENT "%s",eventname(c)); + break; + case OP_MMBINI: + printf("%d %d %d %d",a,sb,c,isk); + printf(COMMENT "%s",eventname(c)); + if (isk) printf(" flip"); + break; + case OP_MMBINK: + printf("%d %d %d %d",a,b,c,isk); + printf(COMMENT "%s ",eventname(c)); PrintConstant(f,b); + if (isk) printf(" flip"); + break; + case OP_UNM: + printf("%d %d",a,b); + break; + case OP_BNOT: + printf("%d %d",a,b); + break; + case OP_NOT: + printf("%d %d",a,b); + break; + case OP_LEN: + printf("%d %d",a,b); + break; + case OP_CONCAT: + printf("%d %d",a,b); + break; + case OP_CLOSE: + printf("%d",a); + break; + case OP_TBC: + printf("%d",a); + break; + case OP_JMP: + printf("%d",GETARG_sJ(i)); + printf(COMMENT "to %d",GETARG_sJ(i)+pc+2); + break; + case OP_EQ: + printf("%d %d %d",a,b,isk); + break; + case OP_LT: + printf("%d %d %d",a,b,isk); + break; + case OP_LE: + printf("%d %d %d",a,b,isk); + break; + case OP_EQK: + printf("%d %d %d",a,b,isk); + printf(COMMENT); PrintConstant(f,b); + break; + case OP_EQI: + printf("%d %d %d",a,sb,isk); + break; + case OP_LTI: + printf("%d %d %d",a,sb,isk); + break; + case OP_LEI: + printf("%d %d %d",a,sb,isk); + break; + case OP_GTI: + printf("%d %d %d",a,sb,isk); + break; + case OP_GEI: + printf("%d %d %d",a,sb,isk); + break; + case OP_TEST: + printf("%d %d",a,isk); + break; + case OP_TESTSET: + printf("%d %d %d",a,b,isk); + break; + case OP_CALL: + printf("%d %d %d",a,b,c); + printf(COMMENT); + if (b==0) printf("all in "); else printf("%d in ",b-1); + if (c==0) printf("all out"); else printf("%d out",c-1); + break; + case OP_TAILCALL: + printf("%d %d %d%s",a,b,c,ISK); + printf(COMMENT "%d in",b-1); + break; + case OP_RETURN: + printf("%d %d %d%s",a,b,c,ISK); + printf(COMMENT); + if (b==0) printf("all out"); else printf("%d out",b-1); + break; + case OP_RETURN0: + break; + case OP_RETURN1: + printf("%d",a); + break; + case OP_FORLOOP: + printf("%d %d",a,bx); + printf(COMMENT "to %d",pc-bx+2); + break; + case OP_FORPREP: + printf("%d %d",a,bx); + printf(COMMENT "exit to %d",pc+bx+3); + break; + case OP_TFORPREP: + printf("%d %d",a,bx); + printf(COMMENT "to %d",pc+bx+2); + break; + case OP_TFORCALL: + printf("%d %d",a,c); + break; + case OP_TFORLOOP: + printf("%d %d",a,bx); + printf(COMMENT "to %d",pc-bx+2); + break; + case OP_SETLIST: + printf("%d %d %d",a,b,c); + if (isk) printf(COMMENT "%d",c+EXTRAARGC); + break; + case OP_CLOSURE: + printf("%d %d",a,bx); + printf(COMMENT "%p",VOID(f->p[bx])); + break; + case OP_VARARG: + printf("%d %d",a,c); + printf(COMMENT); + if (c==0) printf("all out"); else printf("%d out",c-1); + break; + case OP_VARARGPREP: + printf("%d",a); + break; + case OP_EXTRAARG: + printf("%d",ax); + break; +#if 0 + default: + printf("%d %d %d",a,b,c); + printf(COMMENT "not handled"); + break; +#endif + } + printf("\n"); + } +} + + +#define SS(x) ((x==1)?"":"s") +#define S(x) (int)(x),SS(x) + +static void PrintHeader(const Proto* f) +{ + const char* s=f->source ? getstr(f->source) : "=?"; + if (*s=='@' || *s=='=') + s++; + else if (*s==LUA_SIGNATURE[0]) + s="(bstring)"; + else + s="(string)"; + printf("\n%s <%s:%d,%d> (%d instruction%s at %p)\n", + (f->linedefined==0)?"main":"function",s, + f->linedefined,f->lastlinedefined, + S(f->sizecode),VOID(f)); + printf("%d%s param%s, %d slot%s, %d upvalue%s, ", + (int)(f->numparams),f->is_vararg?"+":"",SS(f->numparams), + S(f->maxstacksize),S(f->sizeupvalues)); + printf("%d local%s, %d constant%s, %d function%s\n", + S(f->sizelocvars),S(f->sizek),S(f->sizep)); +} + +static void PrintDebug(const Proto* f) +{ + int i,n; + n=f->sizek; + printf("constants (%d) for %p:\n",n,VOID(f)); + for (i=0; isizelocvars; + printf("locals (%d) for %p:\n",n,VOID(f)); + for (i=0; ilocvars[i].varname),f->locvars[i].startpc+1,f->locvars[i].endpc+1); + } + n=f->sizeupvalues; + printf("upvalues (%d) for %p:\n",n,VOID(f)); + for (i=0; iupvalues[i].instack,f->upvalues[i].idx); + } +} + +static void PrintFunction(const Proto* f, int full) +{ + int i,n=f->sizep; + PrintHeader(f); + PrintCode(f); + if (full) PrintDebug(f); + for (i=0; ip[i],full); +} diff --git a/LuaSkin/lua-5.4.7/src/luaconf.h b/LuaSkin/lua-5.4.7/src/luaconf.h new file mode 100644 index 000000000..f6301f4e2 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/luaconf.h @@ -0,0 +1,840 @@ +/* +** $Id: luaconf.h $ +** Configuration file for Lua +** See Copyright Notice in lua.h +*/ + + +#ifndef luaconf_h +#define luaconf_h + +#include +#include + + +/* +** =================================================================== +** General Configuration File for Lua +** +** Some definitions here can be changed externally, through the compiler +** (e.g., with '-D' options): They are commented out or protected +** by '#if !defined' guards. However, several other definitions +** should be changed directly here, either because they affect the +** Lua ABI (by making the changes here, you ensure that all software +** connected to Lua, such as C libraries, will be compiled with the same +** configuration); or because they are seldom changed. +** +** Search for "@@" to find all configurable definitions. +** =================================================================== +*/ + + +/* +** {==================================================================== +** System Configuration: macros to adapt (if needed) Lua to some +** particular platform, for instance restricting it to C89. +** ===================================================================== +*/ + +/* +@@ LUA_USE_C89 controls the use of non-ISO-C89 features. +** Define it if you want Lua to avoid the use of a few C99 features +** or Windows-specific features on Windows. +*/ +/* #define LUA_USE_C89 */ + + +/* +** By default, Lua on Windows use (some) specific Windows features +*/ +#if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE) +#define LUA_USE_WINDOWS /* enable goodies for regular Windows */ +#endif + + +#if defined(LUA_USE_WINDOWS) +#define LUA_DL_DLL /* enable support for DLL */ +#define LUA_USE_C89 /* broadly, Windows is C89 */ +#endif + + +#if defined(LUA_USE_LINUX) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ +#endif + + +#if defined(LUA_USE_MACOSX) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN /* MacOS does not need -ldl */ +#define LUA_USE_OBJC_EXCEPTIONS +#endif + + +#if defined(LUA_USE_IOS) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN +#endif + + +/* +@@ LUAI_IS32INT is true iff 'int' has (at least) 32 bits. +*/ +#define LUAI_IS32INT ((UINT_MAX >> 30) >= 3) + +/* }================================================================== */ + + + +/* +** {================================================================== +** Configuration for Number types. These options should not be +** set externally, because any other code connected to Lua must +** use the same configuration. +** =================================================================== +*/ + +/* +@@ LUA_INT_TYPE defines the type for Lua integers. +@@ LUA_FLOAT_TYPE defines the type for Lua floats. +** Lua should work fine with any mix of these options supported +** by your C compiler. The usual configurations are 64-bit integers +** and 'double' (the default), 32-bit integers and 'float' (for +** restricted platforms), and 'long'/'double' (for C compilers not +** compliant with C99, which may not have support for 'long long'). +*/ + +/* predefined options for LUA_INT_TYPE */ +#define LUA_INT_INT 1 +#define LUA_INT_LONG 2 +#define LUA_INT_LONGLONG 3 + +/* predefined options for LUA_FLOAT_TYPE */ +#define LUA_FLOAT_FLOAT 1 +#define LUA_FLOAT_DOUBLE 2 +#define LUA_FLOAT_LONGDOUBLE 3 + + +/* Default configuration ('long long' and 'double', for 64-bit Lua) */ +#define LUA_INT_DEFAULT LUA_INT_LONGLONG +#define LUA_FLOAT_DEFAULT LUA_FLOAT_DOUBLE + + +/* +@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. +*/ +#define LUA_32BITS 0 + + +/* +@@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for +** C89 ('long' and 'double'); Windows always has '__int64', so it does +** not need to use this case. +*/ +#if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) +#define LUA_C89_NUMBERS 1 +#else +#define LUA_C89_NUMBERS 0 +#endif + + +#if LUA_32BITS /* { */ +/* +** 32-bit integers and 'float' +*/ +#if LUAI_IS32INT /* use 'int' if big enough */ +#define LUA_INT_TYPE LUA_INT_INT +#else /* otherwise use 'long' */ +#define LUA_INT_TYPE LUA_INT_LONG +#endif +#define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT + +#elif LUA_C89_NUMBERS /* }{ */ +/* +** largest types available for C89 ('long' and 'double') +*/ +#define LUA_INT_TYPE LUA_INT_LONG +#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE + +#else /* }{ */ +/* use defaults */ + +#define LUA_INT_TYPE LUA_INT_DEFAULT +#define LUA_FLOAT_TYPE LUA_FLOAT_DEFAULT + +#endif /* } */ + + +/* }================================================================== */ + + + +/* +** {================================================================== +** Configuration for Paths. +** =================================================================== +*/ + +/* +** LUA_PATH_SEP is the character that separates templates in a path. +** LUA_PATH_MARK is the string that marks the substitution points in a +** template. +** LUA_EXEC_DIR in a Windows path is replaced by the executable's +** directory. +*/ +#define LUA_PATH_SEP ";" +#define LUA_PATH_MARK "?" +#define LUA_EXEC_DIR "!" + + +/* +@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for +** Lua libraries. +@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for +** C libraries. +** CHANGE them if your machine has a non-conventional directory +** hierarchy or if you want to install your libraries in +** non-conventional directories. +*/ + +#define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR +#if defined(_WIN32) /* { */ +/* +** In Windows, any exclamation mark ('!') in the path is replaced by the +** path of the directory of the executable file of the current process. +*/ +#define LUA_LDIR "!\\lua\\" +#define LUA_CDIR "!\\" +#define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\" + +#if !defined(LUA_PATH_DEFAULT) +#define LUA_PATH_DEFAULT \ + LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \ + LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \ + ".\\?.lua;" ".\\?\\init.lua" +#endif + +#if !defined(LUA_CPATH_DEFAULT) +#define LUA_CPATH_DEFAULT \ + LUA_CDIR"?.dll;" \ + LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \ + LUA_CDIR"loadall.dll;" ".\\?.dll" +#endif + +#else /* }{ */ + +//#define LUA_ROOT "/usr/local/" +//#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" +//#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" + +#define LUA_INTEL_ROOT "/usr/local/" +#define LUA_INTEL_LDIR LUA_INTEL_ROOT "share/lua/" LUA_VDIR "/" +#define LUA_INTEL_CDIR LUA_INTEL_ROOT "lib/lua/" LUA_VDIR "/" + +#define LUA_ARM_ROOT "/opt/homebrew/" +#define LUA_ARM_LDIR LUA_ARM_ROOT "share/lua/" LUA_VDIR "/" +#define LUA_ARM_CDIR LUA_ARM_ROOT "lib/lua/" LUA_VDIR "/" + + +#if !defined(LUA_PATH_DEFAULT) +#define LUA_INTEL_PATH_DEFAULT \ + LUA_INTEL_LDIR"?.lua;" LUA_INTEL_LDIR"?/init.lua;" \ + LUA_INTEL_CDIR"?.lua;" LUA_INTEL_CDIR"?/init.lua" +#define LUA_ARM_PATH_DEFAULT \ + LUA_ARM_LDIR"?.lua;" LUA_ARM_LDIR"?/init.lua;" \ + LUA_ARM_CDIR"?.lua;" LUA_ARM_CDIR"?/init.lua" +#define LUA_PATH_DEFAULT_TAIL "./?.lua;" "./?/init.lua" + +#if defined(__aarch64__) + // On Apple Silicon we want to prioritise /opt/homebrew over /usr/local because it's more likely the + // user has things there, and also it avoids an error where they have migrated x86 homebrew from an + // older Mac, but we still want to include the /usr/local paths because they are still legitimate + // install locations on Apple Silicon. + #define LUA_PATH_DEFAULT LUA_ARM_PATH_DEFAULT ";" LUA_INTEL_PATH_DEFAULT ";" LUA_PATH_DEFAULT_TAIL +#else + #define LUA_PATH_DEFAULT LUA_INTEL_PATH_DEFAULT ";" LUA_PATH_DEFAULT_TAIL +#endif + +#endif + +#if !defined(LUA_CPATH_DEFAULT) +#define LUA_INTEL_CPATH_DEFAULT \ + LUA_INTEL_CDIR"?.so;" LUA_INTEL_CDIR"loadall.so" +#define LUA_ARM_CPATH_DEFAULT \ + LUA_ARM_CDIR"?.so;" LUA_ARM_CDIR"loadall.so" +#define LUA_CPATH_DEFAULT_TAIL "./?.so" + +#if defined(__aarch64__) + // On Apple Silicon we want to prioritise /opt/homebrew over /usr/local because it's more likely the + // user has things there, and also it avoids an error where they have migrated x86 homebrew from an + // older Mac, but we still want to include the /usr/local paths because they are still legitimate + // install locations on Apple Silicon. + #define LUA_CPATH_DEFAULT LUA_ARM_CPATH_DEFAULT ";" LUA_INTEL_CPATH_DEFAULT ";" LUA_CPATH_DEFAULT_TAIL +#else + #define LUA_CPATH_DEFAULT LUA_INTEL_CPATH_DEFAULT ";" LUA_CPATH_DEFAULT_TAIL +#endif + +#endif + +#endif /* } */ + + +/* +@@ LUA_DIRSEP is the directory separator (for submodules). +** CHANGE it if your machine does not use "/" as the directory separator +** and is not Windows. (On Windows Lua automatically uses "\".) +*/ +#if !defined(LUA_DIRSEP) + +#if defined(_WIN32) +#define LUA_DIRSEP "\\" +#else +#define LUA_DIRSEP "/" +#endif + +#endif + + +/* +** LUA_IGMARK is a mark to ignore all after it when building the +** module name (e.g., used to build the luaopen_ function name). +** Typically, the suffix after the mark is the module version, +** as in "mod-v1.2.so". +*/ +#define LUA_IGMARK "-" + +/* }================================================================== */ + + +/* +** {================================================================== +** Marks for exported symbols in the C code +** =================================================================== +*/ + +/* +@@ LUA_API is a mark for all core API functions. +@@ LUALIB_API is a mark for all auxiliary library functions. +@@ LUAMOD_API is a mark for all standard library opening functions. +** CHANGE them if you need to define those functions in some special way. +** For instance, if you want to create one Windows DLL with the core and +** the libraries, you may want to use the following definition (define +** LUA_BUILD_AS_DLL to get it). +*/ +#if defined(LUA_BUILD_AS_DLL) /* { */ + +#if defined(LUA_CORE) || defined(LUA_LIB) /* { */ +#define LUA_API __declspec(dllexport) +#else /* }{ */ +#define LUA_API __declspec(dllimport) +#endif /* } */ + +#else /* }{ */ + +#define LUA_API extern + +#endif /* } */ + + +/* +** More often than not the libs go together with the core. +*/ +#define LUALIB_API LUA_API +#define LUAMOD_API LUA_API + + +/* +@@ LUAI_FUNC is a mark for all extern functions that are not to be +** exported to outside modules. +@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables, +** none of which to be exported to outside modules (LUAI_DDEF for +** definitions and LUAI_DDEC for declarations). +** CHANGE them if you need to mark them in some special way. Elf/gcc +** (versions 3.2 and later) mark them as "hidden" to optimize access +** when Lua is compiled as a shared library. Not all elf targets support +** this attribute. Unfortunately, gcc does not offer a way to check +** whether the target offers that support, and those without support +** give a warning about it. To avoid these warnings, change to the +** default definition. +*/ +#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ + defined(__ELF__) /* { */ +#define LUAI_FUNC __attribute__((visibility("internal"))) extern +#else /* }{ */ +#define LUAI_FUNC extern +#endif /* } */ + +#define LUAI_DDEC(dec) LUAI_FUNC dec +#define LUAI_DDEF /* empty */ + +/* }================================================================== */ + + +/* +** {================================================================== +** Compatibility with previous versions +** =================================================================== +*/ + +/* +@@ LUA_COMPAT_5_3 controls other macros for compatibility with Lua 5.3. +** You can define it to get all options, or change specific options +** to fit your specific needs. +*/ +#if defined(LUA_COMPAT_5_3) /* { */ + +/* +@@ LUA_COMPAT_MATHLIB controls the presence of several deprecated +** functions in the mathematical library. +** (These functions were already officially removed in 5.3; +** nevertheless they are still available here.) +*/ +#define LUA_COMPAT_MATHLIB + +/* +@@ LUA_COMPAT_APIINTCASTS controls the presence of macros for +** manipulating other integer types (lua_pushunsigned, lua_tounsigned, +** luaL_checkint, luaL_checklong, etc.) +** (These macros were also officially removed in 5.3, but they are still +** available here.) +*/ +#define LUA_COMPAT_APIINTCASTS + + +/* +@@ LUA_COMPAT_LT_LE controls the emulation of the '__le' metamethod +** using '__lt'. +*/ +#define LUA_COMPAT_LT_LE + + +/* +@@ The following macros supply trivial compatibility for some +** changes in the API. The macros themselves document how to +** change your code to avoid using them. +** (Once more, these macros were officially removed in 5.3, but they are +** still available here.) +*/ +#define lua_strlen(L,i) lua_rawlen(L, (i)) + +#define lua_objlen(L,i) lua_rawlen(L, (i)) + +#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) +#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) + +#endif /* } */ + +/* }================================================================== */ + + + +/* +** {================================================================== +** Configuration for Numbers (low-level part). +** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_* +** satisfy your needs. +** =================================================================== +*/ + +/* +@@ LUAI_UACNUMBER is the result of a 'default argument promotion' +@@ over a floating number. +@@ l_floatatt(x) corrects float attribute 'x' to the proper float type +** by prefixing it with one of FLT/DBL/LDBL. +@@ LUA_NUMBER_FRMLEN is the length modifier for writing floats. +@@ LUA_NUMBER_FMT is the format for writing floats. +@@ lua_number2str converts a float to a string. +@@ l_mathop allows the addition of an 'l' or 'f' to all math operations. +@@ l_floor takes the floor of a float. +@@ lua_str2number converts a decimal numeral to a number. +*/ + + +/* The following definitions are good for most cases here */ + +#define l_floor(x) (l_mathop(floor)(x)) + +#define lua_number2str(s,sz,n) \ + l_sprintf((s), sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)(n)) + +/* +@@ lua_numbertointeger converts a float number with an integral value +** to an integer, or returns 0 if float is not within the range of +** a lua_Integer. (The range comparisons are tricky because of +** rounding. The tests here assume a two-complement representation, +** where MININTEGER always has an exact representation as a float; +** MAXINTEGER may not have one, and therefore its conversion to float +** may have an ill-defined value.) +*/ +#define lua_numbertointeger(n,p) \ + ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \ + (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \ + (*(p) = (LUA_INTEGER)(n), 1)) + + +/* now the variable definitions */ + +#if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT /* { single float */ + +#define LUA_NUMBER float + +#define l_floatatt(n) (FLT_##n) + +#define LUAI_UACNUMBER double + +#define LUA_NUMBER_FRMLEN "" +#define LUA_NUMBER_FMT "%.7g" + +#define l_mathop(op) op##f + +#define lua_str2number(s,p) strtof((s), (p)) + + +#elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE /* }{ long double */ + +#define LUA_NUMBER long double + +#define l_floatatt(n) (LDBL_##n) + +#define LUAI_UACNUMBER long double + +#define LUA_NUMBER_FRMLEN "L" +#define LUA_NUMBER_FMT "%.19Lg" + +#define l_mathop(op) op##l + +#define lua_str2number(s,p) strtold((s), (p)) + +#elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE /* }{ double */ + +#define LUA_NUMBER double + +#define l_floatatt(n) (DBL_##n) + +#define LUAI_UACNUMBER double + +#define LUA_NUMBER_FRMLEN "" +#define LUA_NUMBER_FMT "%.14g" + +#define l_mathop(op) op + +#define lua_str2number(s,p) strtod((s), (p)) + +#else /* }{ */ + +#error "numeric float type not defined" + +#endif /* } */ + + + +/* +@@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER. +@@ LUAI_UACINT is the result of a 'default argument promotion' +@@ over a LUA_INTEGER. +@@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers. +@@ LUA_INTEGER_FMT is the format for writing integers. +@@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER. +@@ LUA_MININTEGER is the minimum value for a LUA_INTEGER. +@@ LUA_MAXUNSIGNED is the maximum value for a LUA_UNSIGNED. +@@ lua_integer2str converts an integer to a string. +*/ + + +/* The following definitions are good for most cases here */ + +#define LUA_INTEGER_FMT "%" LUA_INTEGER_FRMLEN "d" + +#define LUAI_UACINT LUA_INTEGER + +#define lua_integer2str(s,sz,n) \ + l_sprintf((s), sz, LUA_INTEGER_FMT, (LUAI_UACINT)(n)) + +/* +** use LUAI_UACINT here to avoid problems with promotions (which +** can turn a comparison between unsigneds into a signed comparison) +*/ +#define LUA_UNSIGNED unsigned LUAI_UACINT + + +/* now the variable definitions */ + +#if LUA_INT_TYPE == LUA_INT_INT /* { int */ + +#define LUA_INTEGER int +#define LUA_INTEGER_FRMLEN "" + +#define LUA_MAXINTEGER INT_MAX +#define LUA_MININTEGER INT_MIN + +#define LUA_MAXUNSIGNED UINT_MAX + +#elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */ + +#define LUA_INTEGER long +#define LUA_INTEGER_FRMLEN "l" + +#define LUA_MAXINTEGER LONG_MAX +#define LUA_MININTEGER LONG_MIN + +#define LUA_MAXUNSIGNED ULONG_MAX + +#elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */ + +/* use presence of macro LLONG_MAX as proxy for C99 compliance */ +#if defined(LLONG_MAX) /* { */ +/* use ISO C99 stuff */ + +#define LUA_INTEGER long long +#define LUA_INTEGER_FRMLEN "ll" + +#define LUA_MAXINTEGER LLONG_MAX +#define LUA_MININTEGER LLONG_MIN + +#define LUA_MAXUNSIGNED ULLONG_MAX + +#elif defined(LUA_USE_WINDOWS) /* }{ */ +/* in Windows, can use specific Windows types */ + +#define LUA_INTEGER __int64 +#define LUA_INTEGER_FRMLEN "I64" + +#define LUA_MAXINTEGER _I64_MAX +#define LUA_MININTEGER _I64_MIN + +#define LUA_MAXUNSIGNED _UI64_MAX + +#else /* }{ */ + +#error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \ + or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)" + +#endif /* } */ + +#else /* }{ */ + +#error "numeric integer type not defined" + +#endif /* } */ + +/* }================================================================== */ + + +/* +** {================================================================== +** Dependencies with C99 and other C details +** =================================================================== +*/ + +/* +@@ l_sprintf is equivalent to 'snprintf' or 'sprintf' in C89. +** (All uses in Lua have only one format item.) +*/ +#if !defined(LUA_USE_C89) +#define l_sprintf(s,sz,f,i) snprintf(s,sz,f,i) +#else +#define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s,f,i)) +#endif + + +/* +@@ lua_strx2number converts a hexadecimal numeral to a number. +** In C99, 'strtod' does that conversion. Otherwise, you can +** leave 'lua_strx2number' undefined and Lua will provide its own +** implementation. +*/ +#if !defined(LUA_USE_C89) +#define lua_strx2number(s,p) lua_str2number(s,p) +#endif + + +/* +@@ lua_pointer2str converts a pointer to a readable string in a +** non-specified way. +*/ +#define lua_pointer2str(buff,sz,p) l_sprintf(buff,sz,"%p",p) + + +/* +@@ lua_number2strx converts a float to a hexadecimal numeral. +** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that. +** Otherwise, you can leave 'lua_number2strx' undefined and Lua will +** provide its own implementation. +*/ +#if !defined(LUA_USE_C89) +#define lua_number2strx(L,b,sz,f,n) \ + ((void)L, l_sprintf(b,sz,f,(LUAI_UACNUMBER)(n))) +#endif + + +/* +** 'strtof' and 'opf' variants for math functions are not valid in +** C89. Otherwise, the macro 'HUGE_VALF' is a good proxy for testing the +** availability of these variants. ('math.h' is already included in +** all files that use these macros.) +*/ +#if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF)) +#undef l_mathop /* variants not available */ +#undef lua_str2number +#define l_mathop(op) (lua_Number)op /* no variant */ +#define lua_str2number(s,p) ((lua_Number)strtod((s), (p))) +#endif + + +/* +@@ LUA_KCONTEXT is the type of the context ('ctx') for continuation +** functions. It must be a numerical type; Lua will use 'intptr_t' if +** available, otherwise it will use 'ptrdiff_t' (the nearest thing to +** 'intptr_t' in C89) +*/ +#define LUA_KCONTEXT ptrdiff_t + +#if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \ + __STDC_VERSION__ >= 199901L +#include +#if defined(INTPTR_MAX) /* even in C99 this type is optional */ +#undef LUA_KCONTEXT +#define LUA_KCONTEXT intptr_t +#endif +#endif + + +/* +@@ lua_getlocaledecpoint gets the locale "radix character" (decimal point). +** Change that if you do not want to use C locales. (Code using this +** macro must include the header 'locale.h'.) +*/ +#if !defined(lua_getlocaledecpoint) +#define lua_getlocaledecpoint() (localeconv()->decimal_point[0]) +#endif + + +/* +** macros to improve jump prediction, used mostly for error handling +** and debug facilities. (Some macros in the Lua API use these macros. +** Define LUA_NOBUILTIN if you do not want '__builtin_expect' in your +** code.) +*/ +#if !defined(luai_likely) + +#if defined(__GNUC__) && !defined(LUA_NOBUILTIN) +#define luai_likely(x) (__builtin_expect(((x) != 0), 1)) +#define luai_unlikely(x) (__builtin_expect(((x) != 0), 0)) +#else +#define luai_likely(x) (x) +#define luai_unlikely(x) (x) +#endif + +#endif + + +#if defined(LUA_CORE) || defined(LUA_LIB) +/* shorter names for Lua's own use */ +#define l_likely(x) luai_likely(x) +#define l_unlikely(x) luai_unlikely(x) +#endif + + + +/* }================================================================== */ + + +/* +** {================================================================== +** Language Variations +** ===================================================================== +*/ + +/* +@@ LUA_NOCVTN2S/LUA_NOCVTS2N control how Lua performs some +** coercions. Define LUA_NOCVTN2S to turn off automatic coercion from +** numbers to strings. Define LUA_NOCVTS2N to turn off automatic +** coercion from strings to numbers. +*/ +/* #define LUA_NOCVTN2S */ +/* #define LUA_NOCVTS2N */ + + +/* +@@ LUA_USE_APICHECK turns on several consistency checks on the C API. +** Define it as a help when debugging C code. +*/ +#if defined(LUA_USE_APICHECK) +#include +#define luai_apicheck(l,e) assert(e) +#endif + +/* }================================================================== */ + + +/* +** {================================================================== +** Macros that affect the API and must be stable (that is, must be the +** same when you compile Lua and when you compile code that links to +** Lua). +** ===================================================================== +*/ + +/* +@@ LUAI_MAXSTACK limits the size of the Lua stack. +** CHANGE it if you need a different limit. This limit is arbitrary; +** its only purpose is to stop Lua from consuming unlimited stack +** space (and to reserve some numbers for pseudo-indices). +** (It must fit into max(size_t)/32 and max(int)/2.) +*/ +#if LUAI_IS32INT +#define LUAI_MAXSTACK 1000000 +#else +#define LUAI_MAXSTACK 15000 +#endif + + +/* +@@ LUA_EXTRASPACE defines the size of a raw memory area associated with +** a Lua state with very fast access. +** CHANGE it if you need a different size. +*/ +#define LUA_EXTRASPACE (sizeof(void *)) + + +/* +@@ LUA_IDSIZE gives the maximum size for the description of the source +** of a function in debug information. +** CHANGE it if you want a different size. +*/ +#define LUA_IDSIZE 60 + + +/* +@@ LUAL_BUFFERSIZE is the initial buffer size used by the lauxlib +** buffer system. +*/ +#define LUAL_BUFFERSIZE ((int)(16 * sizeof(void*) * sizeof(lua_Number))) + + +/* +@@ LUAI_MAXALIGN defines fields that, when used in a union, ensure +** maximum alignment for the other items in that union. +*/ +#define LUAI_MAXALIGN lua_Number n; double u; void *s; lua_Integer i; long l + +/* }================================================================== */ + + + + + +/* =================================================================== */ + +/* +** Local configuration. You can use this space to add your redefinitions +** without modifying the main part of the file. +*/ + + + + + +#endif + diff --git a/LuaSkin/lua-5.4.7/src/luaconf.h.orig b/LuaSkin/lua-5.4.7/src/luaconf.h.orig new file mode 100644 index 000000000..33bb580d1 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/luaconf.h.orig @@ -0,0 +1,802 @@ +/* +** $Id: luaconf.h $ +** Configuration file for Lua +** See Copyright Notice in lua.h +*/ + + +#ifndef luaconf_h +#define luaconf_h + +#include +#include + + +/* +** =================================================================== +** General Configuration File for Lua +** +** Some definitions here can be changed externally, through the compiler +** (e.g., with '-D' options): They are commented out or protected +** by '#if !defined' guards. However, several other definitions +** should be changed directly here, either because they affect the +** Lua ABI (by making the changes here, you ensure that all software +** connected to Lua, such as C libraries, will be compiled with the same +** configuration); or because they are seldom changed. +** +** Search for "@@" to find all configurable definitions. +** =================================================================== +*/ + + +/* +** {==================================================================== +** System Configuration: macros to adapt (if needed) Lua to some +** particular platform, for instance restricting it to C89. +** ===================================================================== +*/ + +/* +@@ LUA_USE_C89 controls the use of non-ISO-C89 features. +** Define it if you want Lua to avoid the use of a few C99 features +** or Windows-specific features on Windows. +*/ +/* #define LUA_USE_C89 */ + + +/* +** By default, Lua on Windows use (some) specific Windows features +*/ +#if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE) +#define LUA_USE_WINDOWS /* enable goodies for regular Windows */ +#endif + + +#if defined(LUA_USE_WINDOWS) +#define LUA_DL_DLL /* enable support for DLL */ +#define LUA_USE_C89 /* broadly, Windows is C89 */ +#endif + + +#if defined(LUA_USE_LINUX) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ +#endif + + +#if defined(LUA_USE_MACOSX) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN /* MacOS does not need -ldl */ +#endif + + +#if defined(LUA_USE_IOS) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN +#endif + + +/* +@@ LUAI_IS32INT is true iff 'int' has (at least) 32 bits. +*/ +#define LUAI_IS32INT ((UINT_MAX >> 30) >= 3) + +/* }================================================================== */ + + + +/* +** {================================================================== +** Configuration for Number types. These options should not be +** set externally, because any other code connected to Lua must +** use the same configuration. +** =================================================================== +*/ + +/* +@@ LUA_INT_TYPE defines the type for Lua integers. +@@ LUA_FLOAT_TYPE defines the type for Lua floats. +** Lua should work fine with any mix of these options supported +** by your C compiler. The usual configurations are 64-bit integers +** and 'double' (the default), 32-bit integers and 'float' (for +** restricted platforms), and 'long'/'double' (for C compilers not +** compliant with C99, which may not have support for 'long long'). +*/ + +/* predefined options for LUA_INT_TYPE */ +#define LUA_INT_INT 1 +#define LUA_INT_LONG 2 +#define LUA_INT_LONGLONG 3 + +/* predefined options for LUA_FLOAT_TYPE */ +#define LUA_FLOAT_FLOAT 1 +#define LUA_FLOAT_DOUBLE 2 +#define LUA_FLOAT_LONGDOUBLE 3 + + +/* Default configuration ('long long' and 'double', for 64-bit Lua) */ +#define LUA_INT_DEFAULT LUA_INT_LONGLONG +#define LUA_FLOAT_DEFAULT LUA_FLOAT_DOUBLE + + +/* +@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. +*/ +#define LUA_32BITS 0 + + +/* +@@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for +** C89 ('long' and 'double'); Windows always has '__int64', so it does +** not need to use this case. +*/ +#if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) +#define LUA_C89_NUMBERS 1 +#else +#define LUA_C89_NUMBERS 0 +#endif + + +#if LUA_32BITS /* { */ +/* +** 32-bit integers and 'float' +*/ +#if LUAI_IS32INT /* use 'int' if big enough */ +#define LUA_INT_TYPE LUA_INT_INT +#else /* otherwise use 'long' */ +#define LUA_INT_TYPE LUA_INT_LONG +#endif +#define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT + +#elif LUA_C89_NUMBERS /* }{ */ +/* +** largest types available for C89 ('long' and 'double') +*/ +#define LUA_INT_TYPE LUA_INT_LONG +#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE + +#else /* }{ */ +/* use defaults */ + +#define LUA_INT_TYPE LUA_INT_DEFAULT +#define LUA_FLOAT_TYPE LUA_FLOAT_DEFAULT + +#endif /* } */ + + +/* }================================================================== */ + + + +/* +** {================================================================== +** Configuration for Paths. +** =================================================================== +*/ + +/* +** LUA_PATH_SEP is the character that separates templates in a path. +** LUA_PATH_MARK is the string that marks the substitution points in a +** template. +** LUA_EXEC_DIR in a Windows path is replaced by the executable's +** directory. +*/ +#define LUA_PATH_SEP ";" +#define LUA_PATH_MARK "?" +#define LUA_EXEC_DIR "!" + + +/* +@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for +** Lua libraries. +@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for +** C libraries. +** CHANGE them if your machine has a non-conventional directory +** hierarchy or if you want to install your libraries in +** non-conventional directories. +*/ + +#define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR +#if defined(_WIN32) /* { */ +/* +** In Windows, any exclamation mark ('!') in the path is replaced by the +** path of the directory of the executable file of the current process. +*/ +#define LUA_LDIR "!\\lua\\" +#define LUA_CDIR "!\\" +#define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\" + +#if !defined(LUA_PATH_DEFAULT) +#define LUA_PATH_DEFAULT \ + LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \ + LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \ + ".\\?.lua;" ".\\?\\init.lua" +#endif + +#if !defined(LUA_CPATH_DEFAULT) +#define LUA_CPATH_DEFAULT \ + LUA_CDIR"?.dll;" \ + LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \ + LUA_CDIR"loadall.dll;" ".\\?.dll" +#endif + +#else /* }{ */ + +#define LUA_ROOT "/usr/local/" +#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" +#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" + +#if !defined(LUA_PATH_DEFAULT) +#define LUA_PATH_DEFAULT \ + LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ + "./?.lua;" "./?/init.lua" +#endif + +#if !defined(LUA_CPATH_DEFAULT) +#define LUA_CPATH_DEFAULT \ + LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so" +#endif + +#endif /* } */ + + +/* +@@ LUA_DIRSEP is the directory separator (for submodules). +** CHANGE it if your machine does not use "/" as the directory separator +** and is not Windows. (On Windows Lua automatically uses "\".) +*/ +#if !defined(LUA_DIRSEP) + +#if defined(_WIN32) +#define LUA_DIRSEP "\\" +#else +#define LUA_DIRSEP "/" +#endif + +#endif + + +/* +** LUA_IGMARK is a mark to ignore all after it when building the +** module name (e.g., used to build the luaopen_ function name). +** Typically, the suffix after the mark is the module version, +** as in "mod-v1.2.so". +*/ +#define LUA_IGMARK "-" + +/* }================================================================== */ + + +/* +** {================================================================== +** Marks for exported symbols in the C code +** =================================================================== +*/ + +/* +@@ LUA_API is a mark for all core API functions. +@@ LUALIB_API is a mark for all auxiliary library functions. +@@ LUAMOD_API is a mark for all standard library opening functions. +** CHANGE them if you need to define those functions in some special way. +** For instance, if you want to create one Windows DLL with the core and +** the libraries, you may want to use the following definition (define +** LUA_BUILD_AS_DLL to get it). +*/ +#if defined(LUA_BUILD_AS_DLL) /* { */ + +#if defined(LUA_CORE) || defined(LUA_LIB) /* { */ +#define LUA_API __declspec(dllexport) +#else /* }{ */ +#define LUA_API __declspec(dllimport) +#endif /* } */ + +#else /* }{ */ + +#define LUA_API extern + +#endif /* } */ + + +/* +** More often than not the libs go together with the core. +*/ +#define LUALIB_API LUA_API +#define LUAMOD_API LUA_API + + +/* +@@ LUAI_FUNC is a mark for all extern functions that are not to be +** exported to outside modules. +@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables, +** none of which to be exported to outside modules (LUAI_DDEF for +** definitions and LUAI_DDEC for declarations). +** CHANGE them if you need to mark them in some special way. Elf/gcc +** (versions 3.2 and later) mark them as "hidden" to optimize access +** when Lua is compiled as a shared library. Not all elf targets support +** this attribute. Unfortunately, gcc does not offer a way to check +** whether the target offers that support, and those without support +** give a warning about it. To avoid these warnings, change to the +** default definition. +*/ +#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ + defined(__ELF__) /* { */ +#define LUAI_FUNC __attribute__((visibility("internal"))) extern +#else /* }{ */ +#define LUAI_FUNC extern +#endif /* } */ + +#define LUAI_DDEC(dec) LUAI_FUNC dec +#define LUAI_DDEF /* empty */ + +/* }================================================================== */ + + +/* +** {================================================================== +** Compatibility with previous versions +** =================================================================== +*/ + +/* +@@ LUA_COMPAT_5_3 controls other macros for compatibility with Lua 5.3. +** You can define it to get all options, or change specific options +** to fit your specific needs. +*/ +#if defined(LUA_COMPAT_5_3) /* { */ + +/* +@@ LUA_COMPAT_MATHLIB controls the presence of several deprecated +** functions in the mathematical library. +** (These functions were already officially removed in 5.3; +** nevertheless they are still available here.) +*/ +#define LUA_COMPAT_MATHLIB + +/* +@@ LUA_COMPAT_APIINTCASTS controls the presence of macros for +** manipulating other integer types (lua_pushunsigned, lua_tounsigned, +** luaL_checkint, luaL_checklong, etc.) +** (These macros were also officially removed in 5.3, but they are still +** available here.) +*/ +#define LUA_COMPAT_APIINTCASTS + + +/* +@@ LUA_COMPAT_LT_LE controls the emulation of the '__le' metamethod +** using '__lt'. +*/ +#define LUA_COMPAT_LT_LE + + +/* +@@ The following macros supply trivial compatibility for some +** changes in the API. The macros themselves document how to +** change your code to avoid using them. +** (Once more, these macros were officially removed in 5.3, but they are +** still available here.) +*/ +#define lua_strlen(L,i) lua_rawlen(L, (i)) + +#define lua_objlen(L,i) lua_rawlen(L, (i)) + +#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) +#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) + +#endif /* } */ + +/* }================================================================== */ + + + +/* +** {================================================================== +** Configuration for Numbers (low-level part). +** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_* +** satisfy your needs. +** =================================================================== +*/ + +/* +@@ LUAI_UACNUMBER is the result of a 'default argument promotion' +@@ over a floating number. +@@ l_floatatt(x) corrects float attribute 'x' to the proper float type +** by prefixing it with one of FLT/DBL/LDBL. +@@ LUA_NUMBER_FRMLEN is the length modifier for writing floats. +@@ LUA_NUMBER_FMT is the format for writing floats. +@@ lua_number2str converts a float to a string. +@@ l_mathop allows the addition of an 'l' or 'f' to all math operations. +@@ l_floor takes the floor of a float. +@@ lua_str2number converts a decimal numeral to a number. +*/ + + +/* The following definitions are good for most cases here */ + +#define l_floor(x) (l_mathop(floor)(x)) + +#define lua_number2str(s,sz,n) \ + l_sprintf((s), sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)(n)) + +/* +@@ lua_numbertointeger converts a float number with an integral value +** to an integer, or returns 0 if float is not within the range of +** a lua_Integer. (The range comparisons are tricky because of +** rounding. The tests here assume a two-complement representation, +** where MININTEGER always has an exact representation as a float; +** MAXINTEGER may not have one, and therefore its conversion to float +** may have an ill-defined value.) +*/ +#define lua_numbertointeger(n,p) \ + ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \ + (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \ + (*(p) = (LUA_INTEGER)(n), 1)) + + +/* now the variable definitions */ + +#if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT /* { single float */ + +#define LUA_NUMBER float + +#define l_floatatt(n) (FLT_##n) + +#define LUAI_UACNUMBER double + +#define LUA_NUMBER_FRMLEN "" +#define LUA_NUMBER_FMT "%.7g" + +#define l_mathop(op) op##f + +#define lua_str2number(s,p) strtof((s), (p)) + + +#elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE /* }{ long double */ + +#define LUA_NUMBER long double + +#define l_floatatt(n) (LDBL_##n) + +#define LUAI_UACNUMBER long double + +#define LUA_NUMBER_FRMLEN "L" +#define LUA_NUMBER_FMT "%.19Lg" + +#define l_mathop(op) op##l + +#define lua_str2number(s,p) strtold((s), (p)) + +#elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE /* }{ double */ + +#define LUA_NUMBER double + +#define l_floatatt(n) (DBL_##n) + +#define LUAI_UACNUMBER double + +#define LUA_NUMBER_FRMLEN "" +#define LUA_NUMBER_FMT "%.14g" + +#define l_mathop(op) op + +#define lua_str2number(s,p) strtod((s), (p)) + +#else /* }{ */ + +#error "numeric float type not defined" + +#endif /* } */ + + + +/* +@@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER. +@@ LUAI_UACINT is the result of a 'default argument promotion' +@@ over a LUA_INTEGER. +@@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers. +@@ LUA_INTEGER_FMT is the format for writing integers. +@@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER. +@@ LUA_MININTEGER is the minimum value for a LUA_INTEGER. +@@ LUA_MAXUNSIGNED is the maximum value for a LUA_UNSIGNED. +@@ lua_integer2str converts an integer to a string. +*/ + + +/* The following definitions are good for most cases here */ + +#define LUA_INTEGER_FMT "%" LUA_INTEGER_FRMLEN "d" + +#define LUAI_UACINT LUA_INTEGER + +#define lua_integer2str(s,sz,n) \ + l_sprintf((s), sz, LUA_INTEGER_FMT, (LUAI_UACINT)(n)) + +/* +** use LUAI_UACINT here to avoid problems with promotions (which +** can turn a comparison between unsigneds into a signed comparison) +*/ +#define LUA_UNSIGNED unsigned LUAI_UACINT + + +/* now the variable definitions */ + +#if LUA_INT_TYPE == LUA_INT_INT /* { int */ + +#define LUA_INTEGER int +#define LUA_INTEGER_FRMLEN "" + +#define LUA_MAXINTEGER INT_MAX +#define LUA_MININTEGER INT_MIN + +#define LUA_MAXUNSIGNED UINT_MAX + +#elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */ + +#define LUA_INTEGER long +#define LUA_INTEGER_FRMLEN "l" + +#define LUA_MAXINTEGER LONG_MAX +#define LUA_MININTEGER LONG_MIN + +#define LUA_MAXUNSIGNED ULONG_MAX + +#elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */ + +/* use presence of macro LLONG_MAX as proxy for C99 compliance */ +#if defined(LLONG_MAX) /* { */ +/* use ISO C99 stuff */ + +#define LUA_INTEGER long long +#define LUA_INTEGER_FRMLEN "ll" + +#define LUA_MAXINTEGER LLONG_MAX +#define LUA_MININTEGER LLONG_MIN + +#define LUA_MAXUNSIGNED ULLONG_MAX + +#elif defined(LUA_USE_WINDOWS) /* }{ */ +/* in Windows, can use specific Windows types */ + +#define LUA_INTEGER __int64 +#define LUA_INTEGER_FRMLEN "I64" + +#define LUA_MAXINTEGER _I64_MAX +#define LUA_MININTEGER _I64_MIN + +#define LUA_MAXUNSIGNED _UI64_MAX + +#else /* }{ */ + +#error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \ + or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)" + +#endif /* } */ + +#else /* }{ */ + +#error "numeric integer type not defined" + +#endif /* } */ + +/* }================================================================== */ + + +/* +** {================================================================== +** Dependencies with C99 and other C details +** =================================================================== +*/ + +/* +@@ l_sprintf is equivalent to 'snprintf' or 'sprintf' in C89. +** (All uses in Lua have only one format item.) +*/ +#if !defined(LUA_USE_C89) +#define l_sprintf(s,sz,f,i) snprintf(s,sz,f,i) +#else +#define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s,f,i)) +#endif + + +/* +@@ lua_strx2number converts a hexadecimal numeral to a number. +** In C99, 'strtod' does that conversion. Otherwise, you can +** leave 'lua_strx2number' undefined and Lua will provide its own +** implementation. +*/ +#if !defined(LUA_USE_C89) +#define lua_strx2number(s,p) lua_str2number(s,p) +#endif + + +/* +@@ lua_pointer2str converts a pointer to a readable string in a +** non-specified way. +*/ +#define lua_pointer2str(buff,sz,p) l_sprintf(buff,sz,"%p",p) + + +/* +@@ lua_number2strx converts a float to a hexadecimal numeral. +** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that. +** Otherwise, you can leave 'lua_number2strx' undefined and Lua will +** provide its own implementation. +*/ +#if !defined(LUA_USE_C89) +#define lua_number2strx(L,b,sz,f,n) \ + ((void)L, l_sprintf(b,sz,f,(LUAI_UACNUMBER)(n))) +#endif + + +/* +** 'strtof' and 'opf' variants for math functions are not valid in +** C89. Otherwise, the macro 'HUGE_VALF' is a good proxy for testing the +** availability of these variants. ('math.h' is already included in +** all files that use these macros.) +*/ +#if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF)) +#undef l_mathop /* variants not available */ +#undef lua_str2number +#define l_mathop(op) (lua_Number)op /* no variant */ +#define lua_str2number(s,p) ((lua_Number)strtod((s), (p))) +#endif + + +/* +@@ LUA_KCONTEXT is the type of the context ('ctx') for continuation +** functions. It must be a numerical type; Lua will use 'intptr_t' if +** available, otherwise it will use 'ptrdiff_t' (the nearest thing to +** 'intptr_t' in C89) +*/ +#define LUA_KCONTEXT ptrdiff_t + +#if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \ + __STDC_VERSION__ >= 199901L +#include +#if defined(INTPTR_MAX) /* even in C99 this type is optional */ +#undef LUA_KCONTEXT +#define LUA_KCONTEXT intptr_t +#endif +#endif + + +/* +@@ lua_getlocaledecpoint gets the locale "radix character" (decimal point). +** Change that if you do not want to use C locales. (Code using this +** macro must include the header 'locale.h'.) +*/ +#if !defined(lua_getlocaledecpoint) +#define lua_getlocaledecpoint() (localeconv()->decimal_point[0]) +#endif + + +/* +** macros to improve jump prediction, used mostly for error handling +** and debug facilities. (Some macros in the Lua API use these macros. +** Define LUA_NOBUILTIN if you do not want '__builtin_expect' in your +** code.) +*/ +#if !defined(luai_likely) + +#if defined(__GNUC__) && !defined(LUA_NOBUILTIN) +#define luai_likely(x) (__builtin_expect(((x) != 0), 1)) +#define luai_unlikely(x) (__builtin_expect(((x) != 0), 0)) +#else +#define luai_likely(x) (x) +#define luai_unlikely(x) (x) +#endif + +#endif + + +#if defined(LUA_CORE) || defined(LUA_LIB) +/* shorter names for Lua's own use */ +#define l_likely(x) luai_likely(x) +#define l_unlikely(x) luai_unlikely(x) +#endif + + + +/* }================================================================== */ + + +/* +** {================================================================== +** Language Variations +** ===================================================================== +*/ + +/* +@@ LUA_NOCVTN2S/LUA_NOCVTS2N control how Lua performs some +** coercions. Define LUA_NOCVTN2S to turn off automatic coercion from +** numbers to strings. Define LUA_NOCVTS2N to turn off automatic +** coercion from strings to numbers. +*/ +/* #define LUA_NOCVTN2S */ +/* #define LUA_NOCVTS2N */ + + +/* +@@ LUA_USE_APICHECK turns on several consistency checks on the C API. +** Define it as a help when debugging C code. +*/ +#if defined(LUA_USE_APICHECK) +#include +#define luai_apicheck(l,e) assert(e) +#endif + +/* }================================================================== */ + + +/* +** {================================================================== +** Macros that affect the API and must be stable (that is, must be the +** same when you compile Lua and when you compile code that links to +** Lua). +** ===================================================================== +*/ + +/* +@@ LUAI_MAXSTACK limits the size of the Lua stack. +** CHANGE it if you need a different limit. This limit is arbitrary; +** its only purpose is to stop Lua from consuming unlimited stack +** space (and to reserve some numbers for pseudo-indices). +** (It must fit into max(size_t)/32 and max(int)/2.) +*/ +#if LUAI_IS32INT +#define LUAI_MAXSTACK 1000000 +#else +#define LUAI_MAXSTACK 15000 +#endif + + +/* +@@ LUA_EXTRASPACE defines the size of a raw memory area associated with +** a Lua state with very fast access. +** CHANGE it if you need a different size. +*/ +#define LUA_EXTRASPACE (sizeof(void *)) + + +/* +@@ LUA_IDSIZE gives the maximum size for the description of the source +** of a function in debug information. +** CHANGE it if you want a different size. +*/ +#define LUA_IDSIZE 60 + + +/* +@@ LUAL_BUFFERSIZE is the initial buffer size used by the lauxlib +** buffer system. +*/ +#define LUAL_BUFFERSIZE ((int)(16 * sizeof(void*) * sizeof(lua_Number))) + + +/* +@@ LUAI_MAXALIGN defines fields that, when used in a union, ensure +** maximum alignment for the other items in that union. +*/ +#define LUAI_MAXALIGN lua_Number n; double u; void *s; lua_Integer i; long l + +/* }================================================================== */ + + + + + +/* =================================================================== */ + +/* +** Local configuration. You can use this space to add your redefinitions +** without modifying the main part of the file. +*/ + + + + + +#endif + diff --git a/LuaSkin/lua-5.3.4/src/lualib.h b/LuaSkin/lua-5.4.7/src/lualib.h similarity index 84% rename from LuaSkin/lua-5.3.4/src/lualib.h rename to LuaSkin/lua-5.4.7/src/lualib.h index 6c0bc4cb0..262552907 100644 --- a/LuaSkin/lua-5.3.4/src/lualib.h +++ b/LuaSkin/lua-5.4.7/src/lualib.h @@ -1,5 +1,5 @@ /* -** $Id: lualib.h,v 1.45 2017/01/12 17:14:26 roberto Exp $ +** $Id: lualib.h $ ** Lua standard libraries ** See Copyright Notice in lua.h */ @@ -35,9 +35,6 @@ LUAMOD_API int (luaopen_string) (lua_State *L); #define LUA_UTF8LIBNAME "utf8" LUAMOD_API int (luaopen_utf8) (lua_State *L); -#define LUA_BITLIBNAME "bit32" -LUAMOD_API int (luaopen_bit32) (lua_State *L); - #define LUA_MATHLIBNAME "math" LUAMOD_API int (luaopen_math) (lua_State *L); @@ -52,10 +49,4 @@ LUAMOD_API int (luaopen_package) (lua_State *L); LUALIB_API void (luaL_openlibs) (lua_State *L); - -#if !defined(lua_assert) -#define lua_assert(x) ((void)0) -#endif - - #endif diff --git a/LuaSkin/lua-5.4.7/src/lundump.c b/LuaSkin/lua-5.4.7/src/lundump.c new file mode 100644 index 000000000..e8d92a853 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lundump.c @@ -0,0 +1,335 @@ +/* +** $Id: lundump.c $ +** load precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#define lundump_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstring.h" +#include "lundump.h" +#include "lzio.h" + + +#if !defined(luai_verifycode) +#define luai_verifycode(L,f) /* empty */ +#endif + + +typedef struct { + lua_State *L; + ZIO *Z; + const char *name; +} LoadState; + + +static l_noret error (LoadState *S, const char *why) { + luaO_pushfstring(S->L, "%s: bad binary format (%s)", S->name, why); + luaD_throw(S->L, LUA_ERRSYNTAX); +} + + +/* +** All high-level loads go through loadVector; you can change it to +** adapt to the endianness of the input +*/ +#define loadVector(S,b,n) loadBlock(S,b,(n)*sizeof((b)[0])) + +static void loadBlock (LoadState *S, void *b, size_t size) { + if (luaZ_read(S->Z, b, size) != 0) + error(S, "truncated chunk"); +} + + +#define loadVar(S,x) loadVector(S,&x,1) + + +static lu_byte loadByte (LoadState *S) { + int b = zgetc(S->Z); + if (b == EOZ) + error(S, "truncated chunk"); + return cast_byte(b); +} + + +static size_t loadUnsigned (LoadState *S, size_t limit) { + size_t x = 0; + int b; + limit >>= 7; + do { + b = loadByte(S); + if (x >= limit) + error(S, "integer overflow"); + x = (x << 7) | (b & 0x7f); + } while ((b & 0x80) == 0); + return x; +} + + +static size_t loadSize (LoadState *S) { + return loadUnsigned(S, MAX_SIZET); +} + + +static int loadInt (LoadState *S) { + return cast_int(loadUnsigned(S, INT_MAX)); +} + + +static lua_Number loadNumber (LoadState *S) { + lua_Number x; + loadVar(S, x); + return x; +} + + +static lua_Integer loadInteger (LoadState *S) { + lua_Integer x; + loadVar(S, x); + return x; +} + + +/* +** Load a nullable string into prototype 'p'. +*/ +static TString *loadStringN (LoadState *S, Proto *p) { + lua_State *L = S->L; + TString *ts; + size_t size = loadSize(S); + if (size == 0) /* no string? */ + return NULL; + else if (--size <= LUAI_MAXSHORTLEN) { /* short string? */ + char buff[LUAI_MAXSHORTLEN]; + loadVector(S, buff, size); /* load string into buffer */ + ts = luaS_newlstr(L, buff, size); /* create string */ + } + else { /* long string */ + ts = luaS_createlngstrobj(L, size); /* create string */ + setsvalue2s(L, L->top.p, ts); /* anchor it ('loadVector' can GC) */ + luaD_inctop(L); + loadVector(S, getlngstr(ts), size); /* load directly in final place */ + L->top.p--; /* pop string */ + } + luaC_objbarrier(L, p, ts); + return ts; +} + + +/* +** Load a non-nullable string into prototype 'p'. +*/ +static TString *loadString (LoadState *S, Proto *p) { + TString *st = loadStringN(S, p); + if (st == NULL) + error(S, "bad format for constant string"); + return st; +} + + +static void loadCode (LoadState *S, Proto *f) { + int n = loadInt(S); + f->code = luaM_newvectorchecked(S->L, n, Instruction); + f->sizecode = n; + loadVector(S, f->code, n); +} + + +static void loadFunction(LoadState *S, Proto *f, TString *psource); + + +static void loadConstants (LoadState *S, Proto *f) { + int i; + int n = loadInt(S); + f->k = luaM_newvectorchecked(S->L, n, TValue); + f->sizek = n; + for (i = 0; i < n; i++) + setnilvalue(&f->k[i]); + for (i = 0; i < n; i++) { + TValue *o = &f->k[i]; + int t = loadByte(S); + switch (t) { + case LUA_VNIL: + setnilvalue(o); + break; + case LUA_VFALSE: + setbfvalue(o); + break; + case LUA_VTRUE: + setbtvalue(o); + break; + case LUA_VNUMFLT: + setfltvalue(o, loadNumber(S)); + break; + case LUA_VNUMINT: + setivalue(o, loadInteger(S)); + break; + case LUA_VSHRSTR: + case LUA_VLNGSTR: + setsvalue2n(S->L, o, loadString(S, f)); + break; + default: lua_assert(0); + } + } +} + + +static void loadProtos (LoadState *S, Proto *f) { + int i; + int n = loadInt(S); + f->p = luaM_newvectorchecked(S->L, n, Proto *); + f->sizep = n; + for (i = 0; i < n; i++) + f->p[i] = NULL; + for (i = 0; i < n; i++) { + f->p[i] = luaF_newproto(S->L); + luaC_objbarrier(S->L, f, f->p[i]); + loadFunction(S, f->p[i], f->source); + } +} + + +/* +** Load the upvalues for a function. The names must be filled first, +** because the filling of the other fields can raise read errors and +** the creation of the error message can call an emergency collection; +** in that case all prototypes must be consistent for the GC. +*/ +static void loadUpvalues (LoadState *S, Proto *f) { + int i, n; + n = loadInt(S); + f->upvalues = luaM_newvectorchecked(S->L, n, Upvaldesc); + f->sizeupvalues = n; + for (i = 0; i < n; i++) /* make array valid for GC */ + f->upvalues[i].name = NULL; + for (i = 0; i < n; i++) { /* following calls can raise errors */ + f->upvalues[i].instack = loadByte(S); + f->upvalues[i].idx = loadByte(S); + f->upvalues[i].kind = loadByte(S); + } +} + + +static void loadDebug (LoadState *S, Proto *f) { + int i, n; + n = loadInt(S); + f->lineinfo = luaM_newvectorchecked(S->L, n, ls_byte); + f->sizelineinfo = n; + loadVector(S, f->lineinfo, n); + n = loadInt(S); + f->abslineinfo = luaM_newvectorchecked(S->L, n, AbsLineInfo); + f->sizeabslineinfo = n; + for (i = 0; i < n; i++) { + f->abslineinfo[i].pc = loadInt(S); + f->abslineinfo[i].line = loadInt(S); + } + n = loadInt(S); + f->locvars = luaM_newvectorchecked(S->L, n, LocVar); + f->sizelocvars = n; + for (i = 0; i < n; i++) + f->locvars[i].varname = NULL; + for (i = 0; i < n; i++) { + f->locvars[i].varname = loadStringN(S, f); + f->locvars[i].startpc = loadInt(S); + f->locvars[i].endpc = loadInt(S); + } + n = loadInt(S); + if (n != 0) /* does it have debug information? */ + n = f->sizeupvalues; /* must be this many */ + for (i = 0; i < n; i++) + f->upvalues[i].name = loadStringN(S, f); +} + + +static void loadFunction (LoadState *S, Proto *f, TString *psource) { + f->source = loadStringN(S, f); + if (f->source == NULL) /* no source in dump? */ + f->source = psource; /* reuse parent's source */ + f->linedefined = loadInt(S); + f->lastlinedefined = loadInt(S); + f->numparams = loadByte(S); + f->is_vararg = loadByte(S); + f->maxstacksize = loadByte(S); + loadCode(S, f); + loadConstants(S, f); + loadUpvalues(S, f); + loadProtos(S, f); + loadDebug(S, f); +} + + +static void checkliteral (LoadState *S, const char *s, const char *msg) { + char buff[sizeof(LUA_SIGNATURE) + sizeof(LUAC_DATA)]; /* larger than both */ + size_t len = strlen(s); + loadVector(S, buff, len); + if (memcmp(s, buff, len) != 0) + error(S, msg); +} + + +static void fchecksize (LoadState *S, size_t size, const char *tname) { + if (loadByte(S) != size) + error(S, luaO_pushfstring(S->L, "%s size mismatch", tname)); +} + + +#define checksize(S,t) fchecksize(S,sizeof(t),#t) + +static void checkHeader (LoadState *S) { + /* skip 1st char (already read and checked) */ + checkliteral(S, &LUA_SIGNATURE[1], "not a binary chunk"); + if (loadByte(S) != LUAC_VERSION) + error(S, "version mismatch"); + if (loadByte(S) != LUAC_FORMAT) + error(S, "format mismatch"); + checkliteral(S, LUAC_DATA, "corrupted chunk"); + checksize(S, Instruction); + checksize(S, lua_Integer); + checksize(S, lua_Number); + if (loadInteger(S) != LUAC_INT) + error(S, "integer format mismatch"); + if (loadNumber(S) != LUAC_NUM) + error(S, "float format mismatch"); +} + + +/* +** Load precompiled chunk. +*/ +LClosure *luaU_undump(lua_State *L, ZIO *Z, const char *name) { + LoadState S; + LClosure *cl; + if (*name == '@' || *name == '=') + S.name = name + 1; + else if (*name == LUA_SIGNATURE[0]) + S.name = "binary string"; + else + S.name = name; + S.L = L; + S.Z = Z; + checkHeader(&S); + cl = luaF_newLclosure(L, loadByte(&S)); + setclLvalue2s(L, L->top.p, cl); + luaD_inctop(L); + cl->p = luaF_newproto(L); + luaC_objbarrier(L, cl, cl->p); + loadFunction(&S, cl->p, NULL); + lua_assert(cl->nupvalues == cl->p->sizeupvalues); + luai_verifycode(L, cl->p); + return cl; +} + diff --git a/LuaSkin/lua-5.3.4/src/lundump.h b/LuaSkin/lua-5.4.7/src/lundump.h similarity index 79% rename from LuaSkin/lua-5.3.4/src/lundump.h rename to LuaSkin/lua-5.4.7/src/lundump.h index aa5cc82f1..a97676ca1 100644 --- a/LuaSkin/lua-5.3.4/src/lundump.h +++ b/LuaSkin/lua-5.4.7/src/lundump.h @@ -1,5 +1,5 @@ /* -** $Id: lundump.h,v 1.45 2015/09/08 15:41:05 roberto Exp $ +** $Id: lundump.h $ ** load precompiled Lua chunks ** See Copyright Notice in lua.h */ @@ -18,8 +18,11 @@ #define LUAC_INT 0x5678 #define LUAC_NUM cast_num(370.5) -#define MYINT(s) (s[0]-'0') -#define LUAC_VERSION (MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR)) +/* +** Encode major-minor version in one byte, one nibble for each +*/ +#define LUAC_VERSION (((LUA_VERSION_NUM / 100) * 16) + LUA_VERSION_NUM % 100) + #define LUAC_FORMAT 0 /* this is the official format */ /* load one chunk; from lundump.c */ diff --git a/LuaSkin/lua-5.4.7/src/lutf8lib.c b/LuaSkin/lua-5.4.7/src/lutf8lib.c new file mode 100644 index 000000000..3a5b9bc38 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lutf8lib.c @@ -0,0 +1,291 @@ +/* +** $Id: lutf8lib.c $ +** Standard library for UTF-8 manipulation +** See Copyright Notice in lua.h +*/ + +#define lutf8lib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +#define MAXUNICODE 0x10FFFFu + +#define MAXUTF 0x7FFFFFFFu + + +#define MSGInvalid "invalid UTF-8 code" + +/* +** Integer type for decoded UTF-8 values; MAXUTF needs 31 bits. +*/ +#if (UINT_MAX >> 30) >= 1 +typedef unsigned int utfint; +#else +typedef unsigned long utfint; +#endif + + +#define iscont(c) (((c) & 0xC0) == 0x80) +#define iscontp(p) iscont(*(p)) + + +/* from strlib */ +/* translate a relative string position: negative means back from end */ +static lua_Integer u_posrelat (lua_Integer pos, size_t len) { + if (pos >= 0) return pos; + else if (0u - (size_t)pos > len) return 0; + else return (lua_Integer)len + pos + 1; +} + + +/* +** Decode one UTF-8 sequence, returning NULL if byte sequence is +** invalid. The array 'limits' stores the minimum value for each +** sequence length, to check for overlong representations. Its first +** entry forces an error for non-ascii bytes with no continuation +** bytes (count == 0). +*/ +static const char *utf8_decode (const char *s, utfint *val, int strict) { + static const utfint limits[] = + {~(utfint)0, 0x80, 0x800, 0x10000u, 0x200000u, 0x4000000u}; + unsigned int c = (unsigned char)s[0]; + utfint res = 0; /* final result */ + if (c < 0x80) /* ascii? */ + res = c; + else { + int count = 0; /* to count number of continuation bytes */ + for (; c & 0x40; c <<= 1) { /* while it needs continuation bytes... */ + unsigned int cc = (unsigned char)s[++count]; /* read next byte */ + if (!iscont(cc)) /* not a continuation byte? */ + return NULL; /* invalid byte sequence */ + res = (res << 6) | (cc & 0x3F); /* add lower 6 bits from cont. byte */ + } + res |= ((utfint)(c & 0x7F) << (count * 5)); /* add first byte */ + if (count > 5 || res > MAXUTF || res < limits[count]) + return NULL; /* invalid byte sequence */ + s += count; /* skip continuation bytes read */ + } + if (strict) { + /* check for invalid code points; too large or surrogates */ + if (res > MAXUNICODE || (0xD800u <= res && res <= 0xDFFFu)) + return NULL; + } + if (val) *val = res; + return s + 1; /* +1 to include first byte */ +} + + +/* +** utf8len(s [, i [, j [, lax]]]) --> number of characters that +** start in the range [i,j], or nil + current position if 's' is not +** well formed in that interval +*/ +static int utflen (lua_State *L) { + lua_Integer n = 0; /* counter for the number of characters */ + size_t len; /* string length in bytes */ + const char *s = luaL_checklstring(L, 1, &len); + lua_Integer posi = u_posrelat(luaL_optinteger(L, 2, 1), len); + lua_Integer posj = u_posrelat(luaL_optinteger(L, 3, -1), len); + int lax = lua_toboolean(L, 4); + luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 2, + "initial position out of bounds"); + luaL_argcheck(L, --posj < (lua_Integer)len, 3, + "final position out of bounds"); + while (posi <= posj) { + const char *s1 = utf8_decode(s + posi, NULL, !lax); + if (s1 == NULL) { /* conversion error? */ + luaL_pushfail(L); /* return fail ... */ + lua_pushinteger(L, posi + 1); /* ... and current position */ + return 2; + } + posi = s1 - s; + n++; + } + lua_pushinteger(L, n); + return 1; +} + + +/* +** codepoint(s, [i, [j [, lax]]]) -> returns codepoints for all +** characters that start in the range [i,j] +*/ +static int codepoint (lua_State *L) { + size_t len; + const char *s = luaL_checklstring(L, 1, &len); + lua_Integer posi = u_posrelat(luaL_optinteger(L, 2, 1), len); + lua_Integer pose = u_posrelat(luaL_optinteger(L, 3, posi), len); + int lax = lua_toboolean(L, 4); + int n; + const char *se; + luaL_argcheck(L, posi >= 1, 2, "out of bounds"); + luaL_argcheck(L, pose <= (lua_Integer)len, 3, "out of bounds"); + if (posi > pose) return 0; /* empty interval; return no values */ + if (pose - posi >= INT_MAX) /* (lua_Integer -> int) overflow? */ + return luaL_error(L, "string slice too long"); + n = (int)(pose - posi) + 1; /* upper bound for number of returns */ + luaL_checkstack(L, n, "string slice too long"); + n = 0; /* count the number of returns */ + se = s + pose; /* string end */ + for (s += posi - 1; s < se;) { + utfint code; + s = utf8_decode(s, &code, !lax); + if (s == NULL) + return luaL_error(L, MSGInvalid); + lua_pushinteger(L, code); + n++; + } + return n; +} + + +static void pushutfchar (lua_State *L, int arg) { + lua_Unsigned code = (lua_Unsigned)luaL_checkinteger(L, arg); + luaL_argcheck(L, code <= MAXUTF, arg, "value out of range"); + lua_pushfstring(L, "%U", (long)code); +} + + +/* +** utfchar(n1, n2, ...) -> char(n1)..char(n2)... +*/ +static int utfchar (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + if (n == 1) /* optimize common case of single char */ + pushutfchar(L, 1); + else { + int i; + luaL_Buffer b; + luaL_buffinit(L, &b); + for (i = 1; i <= n; i++) { + pushutfchar(L, i); + luaL_addvalue(&b); + } + luaL_pushresult(&b); + } + return 1; +} + + +/* +** offset(s, n, [i]) -> index where n-th character counting from +** position 'i' starts; 0 means character at 'i'. +*/ +static int byteoffset (lua_State *L) { + size_t len; + const char *s = luaL_checklstring(L, 1, &len); + lua_Integer n = luaL_checkinteger(L, 2); + lua_Integer posi = (n >= 0) ? 1 : len + 1; + posi = u_posrelat(luaL_optinteger(L, 3, posi), len); + luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 3, + "position out of bounds"); + if (n == 0) { + /* find beginning of current byte sequence */ + while (posi > 0 && iscontp(s + posi)) posi--; + } + else { + if (iscontp(s + posi)) + return luaL_error(L, "initial position is a continuation byte"); + if (n < 0) { + while (n < 0 && posi > 0) { /* move back */ + do { /* find beginning of previous character */ + posi--; + } while (posi > 0 && iscontp(s + posi)); + n++; + } + } + else { + n--; /* do not move for 1st character */ + while (n > 0 && posi < (lua_Integer)len) { + do { /* find beginning of next character */ + posi++; + } while (iscontp(s + posi)); /* (cannot pass final '\0') */ + n--; + } + } + } + if (n == 0) /* did it find given character? */ + lua_pushinteger(L, posi + 1); + else /* no such character */ + luaL_pushfail(L); + return 1; +} + + +static int iter_aux (lua_State *L, int strict) { + size_t len; + const char *s = luaL_checklstring(L, 1, &len); + lua_Unsigned n = (lua_Unsigned)lua_tointeger(L, 2); + if (n < len) { + while (iscontp(s + n)) n++; /* go to next character */ + } + if (n >= len) /* (also handles original 'n' being negative) */ + return 0; /* no more codepoints */ + else { + utfint code; + const char *next = utf8_decode(s + n, &code, strict); + if (next == NULL || iscontp(next)) + return luaL_error(L, MSGInvalid); + lua_pushinteger(L, n + 1); + lua_pushinteger(L, code); + return 2; + } +} + + +static int iter_auxstrict (lua_State *L) { + return iter_aux(L, 1); +} + +static int iter_auxlax (lua_State *L) { + return iter_aux(L, 0); +} + + +static int iter_codes (lua_State *L) { + int lax = lua_toboolean(L, 2); + const char *s = luaL_checkstring(L, 1); + luaL_argcheck(L, !iscontp(s), 1, MSGInvalid); + lua_pushcfunction(L, lax ? iter_auxlax : iter_auxstrict); + lua_pushvalue(L, 1); + lua_pushinteger(L, 0); + return 3; +} + + +/* pattern to match a single UTF-8 character */ +#define UTF8PATT "[\0-\x7F\xC2-\xFD][\x80-\xBF]*" + + +static const luaL_Reg funcs[] = { + {"offset", byteoffset}, + {"codepoint", codepoint}, + {"char", utfchar}, + {"len", utflen}, + {"codes", iter_codes}, + /* placeholders */ + {"charpattern", NULL}, + {NULL, NULL} +}; + + +LUAMOD_API int luaopen_utf8 (lua_State *L) { + luaL_newlib(L, funcs); + lua_pushlstring(L, UTF8PATT, sizeof(UTF8PATT)/sizeof(char) - 1); + lua_setfield(L, -2, "charpattern"); + return 1; +} + diff --git a/LuaSkin/lua-5.4.7/src/lvm.c b/LuaSkin/lua-5.4.7/src/lvm.c new file mode 100644 index 000000000..fcd24e11d --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lvm.c @@ -0,0 +1,1899 @@ +/* +** $Id: lvm.c $ +** Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#define lvm_c +#define LUA_CORE + +#include "lprefix.h" + +#include +#include +#include +#include +#include +#include + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lvm.h" + + +/* +** By default, use jump tables in the main interpreter loop on gcc +** and compatible compilers. +*/ +#if !defined(LUA_USE_JUMPTABLE) +#if defined(__GNUC__) +#define LUA_USE_JUMPTABLE 1 +#else +#define LUA_USE_JUMPTABLE 0 +#endif +#endif + + + +/* limit for table tag-method chains (to avoid infinite loops) */ +#define MAXTAGLOOP 2000 + + +/* +** 'l_intfitsf' checks whether a given integer is in the range that +** can be converted to a float without rounding. Used in comparisons. +*/ + +/* number of bits in the mantissa of a float */ +#define NBM (l_floatatt(MANT_DIG)) + +/* +** Check whether some integers may not fit in a float, testing whether +** (maxinteger >> NBM) > 0. (That implies (1 << NBM) <= maxinteger.) +** (The shifts are done in parts, to avoid shifting by more than the size +** of an integer. In a worst case, NBM == 113 for long double and +** sizeof(long) == 32.) +*/ +#if ((((LUA_MAXINTEGER >> (NBM / 4)) >> (NBM / 4)) >> (NBM / 4)) \ + >> (NBM - (3 * (NBM / 4)))) > 0 + +/* limit for integers that fit in a float */ +#define MAXINTFITSF ((lua_Unsigned)1 << NBM) + +/* check whether 'i' is in the interval [-MAXINTFITSF, MAXINTFITSF] */ +#define l_intfitsf(i) ((MAXINTFITSF + l_castS2U(i)) <= (2 * MAXINTFITSF)) + +#else /* all integers fit in a float precisely */ + +#define l_intfitsf(i) 1 + +#endif + + +/* +** Try to convert a value from string to a number value. +** If the value is not a string or is a string not representing +** a valid numeral (or if coercions from strings to numbers +** are disabled via macro 'cvt2num'), do not modify 'result' +** and return 0. +*/ +static int l_strton (const TValue *obj, TValue *result) { + lua_assert(obj != result); + if (!cvt2num(obj)) /* is object not a string? */ + return 0; + else { + TString *st = tsvalue(obj); + return (luaO_str2num(getstr(st), result) == tsslen(st) + 1); + } +} + + +/* +** Try to convert a value to a float. The float case is already handled +** by the macro 'tonumber'. +*/ +int luaV_tonumber_ (const TValue *obj, lua_Number *n) { + TValue v; + if (ttisinteger(obj)) { + *n = cast_num(ivalue(obj)); + return 1; + } + else if (l_strton(obj, &v)) { /* string coercible to number? */ + *n = nvalue(&v); /* convert result of 'luaO_str2num' to a float */ + return 1; + } + else + return 0; /* conversion failed */ +} + + +/* +** try to convert a float to an integer, rounding according to 'mode'. +*/ +int luaV_flttointeger (lua_Number n, lua_Integer *p, F2Imod mode) { + lua_Number f = l_floor(n); + if (n != f) { /* not an integral value? */ + if (mode == F2Ieq) return 0; /* fails if mode demands integral value */ + else if (mode == F2Iceil) /* needs ceil? */ + f += 1; /* convert floor to ceil (remember: n != f) */ + } + return lua_numbertointeger(f, p); +} + + +/* +** try to convert a value to an integer, rounding according to 'mode', +** without string coercion. +** ("Fast track" handled by macro 'tointegerns'.) +*/ +int luaV_tointegerns (const TValue *obj, lua_Integer *p, F2Imod mode) { + if (ttisfloat(obj)) + return luaV_flttointeger(fltvalue(obj), p, mode); + else if (ttisinteger(obj)) { + *p = ivalue(obj); + return 1; + } + else + return 0; +} + + +/* +** try to convert a value to an integer. +*/ +int luaV_tointeger (const TValue *obj, lua_Integer *p, F2Imod mode) { + TValue v; + if (l_strton(obj, &v)) /* does 'obj' point to a numerical string? */ + obj = &v; /* change it to point to its corresponding number */ + return luaV_tointegerns(obj, p, mode); +} + + +/* +** Try to convert a 'for' limit to an integer, preserving the semantics +** of the loop. Return true if the loop must not run; otherwise, '*p' +** gets the integer limit. +** (The following explanation assumes a positive step; it is valid for +** negative steps mutatis mutandis.) +** If the limit is an integer or can be converted to an integer, +** rounding down, that is the limit. +** Otherwise, check whether the limit can be converted to a float. If +** the float is too large, clip it to LUA_MAXINTEGER. If the float +** is too negative, the loop should not run, because any initial +** integer value is greater than such limit; so, the function returns +** true to signal that. (For this latter case, no integer limit would be +** correct; even a limit of LUA_MININTEGER would run the loop once for +** an initial value equal to LUA_MININTEGER.) +*/ +static int forlimit (lua_State *L, lua_Integer init, const TValue *lim, + lua_Integer *p, lua_Integer step) { + if (!luaV_tointeger(lim, p, (step < 0 ? F2Iceil : F2Ifloor))) { + /* not coercible to in integer */ + lua_Number flim; /* try to convert to float */ + if (!tonumber(lim, &flim)) /* cannot convert to float? */ + luaG_forerror(L, lim, "limit"); + /* else 'flim' is a float out of integer bounds */ + if (luai_numlt(0, flim)) { /* if it is positive, it is too large */ + if (step < 0) return 1; /* initial value must be less than it */ + *p = LUA_MAXINTEGER; /* truncate */ + } + else { /* it is less than min integer */ + if (step > 0) return 1; /* initial value must be greater than it */ + *p = LUA_MININTEGER; /* truncate */ + } + } + return (step > 0 ? init > *p : init < *p); /* not to run? */ +} + + +/* +** Prepare a numerical for loop (opcode OP_FORPREP). +** Return true to skip the loop. Otherwise, +** after preparation, stack will be as follows: +** ra : internal index (safe copy of the control variable) +** ra + 1 : loop counter (integer loops) or limit (float loops) +** ra + 2 : step +** ra + 3 : control variable +*/ +static int forprep (lua_State *L, StkId ra) { + TValue *pinit = s2v(ra); + TValue *plimit = s2v(ra + 1); + TValue *pstep = s2v(ra + 2); + if (ttisinteger(pinit) && ttisinteger(pstep)) { /* integer loop? */ + lua_Integer init = ivalue(pinit); + lua_Integer step = ivalue(pstep); + lua_Integer limit; + if (step == 0) + luaG_runerror(L, "'for' step is zero"); + setivalue(s2v(ra + 3), init); /* control variable */ + if (forlimit(L, init, plimit, &limit, step)) + return 1; /* skip the loop */ + else { /* prepare loop counter */ + lua_Unsigned count; + if (step > 0) { /* ascending loop? */ + count = l_castS2U(limit) - l_castS2U(init); + if (step != 1) /* avoid division in the too common case */ + count /= l_castS2U(step); + } + else { /* step < 0; descending loop */ + count = l_castS2U(init) - l_castS2U(limit); + /* 'step+1' avoids negating 'mininteger' */ + count /= l_castS2U(-(step + 1)) + 1u; + } + /* store the counter in place of the limit (which won't be + needed anymore) */ + setivalue(plimit, l_castU2S(count)); + } + } + else { /* try making all values floats */ + lua_Number init; lua_Number limit; lua_Number step; + if (l_unlikely(!tonumber(plimit, &limit))) + luaG_forerror(L, plimit, "limit"); + if (l_unlikely(!tonumber(pstep, &step))) + luaG_forerror(L, pstep, "step"); + if (l_unlikely(!tonumber(pinit, &init))) + luaG_forerror(L, pinit, "initial value"); + if (step == 0) + luaG_runerror(L, "'for' step is zero"); + if (luai_numlt(0, step) ? luai_numlt(limit, init) + : luai_numlt(init, limit)) + return 1; /* skip the loop */ + else { + /* make sure internal values are all floats */ + setfltvalue(plimit, limit); + setfltvalue(pstep, step); + setfltvalue(s2v(ra), init); /* internal index */ + setfltvalue(s2v(ra + 3), init); /* control variable */ + } + } + return 0; +} + + +/* +** Execute a step of a float numerical for loop, returning +** true iff the loop must continue. (The integer case is +** written online with opcode OP_FORLOOP, for performance.) +*/ +static int floatforloop (StkId ra) { + lua_Number step = fltvalue(s2v(ra + 2)); + lua_Number limit = fltvalue(s2v(ra + 1)); + lua_Number idx = fltvalue(s2v(ra)); /* internal index */ + idx = luai_numadd(L, idx, step); /* increment index */ + if (luai_numlt(0, step) ? luai_numle(idx, limit) + : luai_numle(limit, idx)) { + chgfltvalue(s2v(ra), idx); /* update internal index */ + setfltvalue(s2v(ra + 3), idx); /* and control variable */ + return 1; /* jump back */ + } + else + return 0; /* finish the loop */ +} + + +/* +** Finish the table access 'val = t[key]'. +** if 'slot' is NULL, 't' is not a table; otherwise, 'slot' points to +** t[k] entry (which must be empty). +*/ +void luaV_finishget (lua_State *L, const TValue *t, TValue *key, StkId val, + const TValue *slot) { + int loop; /* counter to avoid infinite loops */ + const TValue *tm; /* metamethod */ + for (loop = 0; loop < MAXTAGLOOP; loop++) { + if (slot == NULL) { /* 't' is not a table? */ + lua_assert(!ttistable(t)); + tm = luaT_gettmbyobj(L, t, TM_INDEX); + if (l_unlikely(notm(tm))) + luaG_typeerror(L, t, "index"); /* no metamethod */ + /* else will try the metamethod */ + } + else { /* 't' is a table */ + lua_assert(isempty(slot)); + tm = fasttm(L, hvalue(t)->metatable, TM_INDEX); /* table's metamethod */ + if (tm == NULL) { /* no metamethod? */ + setnilvalue(s2v(val)); /* result is nil */ + return; + } + /* else will try the metamethod */ + } + if (ttisfunction(tm)) { /* is metamethod a function? */ + luaT_callTMres(L, tm, t, key, val); /* call it */ + return; + } + t = tm; /* else try to access 'tm[key]' */ + if (luaV_fastget(L, t, key, slot, luaH_get)) { /* fast track? */ + setobj2s(L, val, slot); /* done */ + return; + } + /* else repeat (tail call 'luaV_finishget') */ + } + luaG_runerror(L, "'__index' chain too long; possible loop"); +} + + +/* +** Finish a table assignment 't[key] = val'. +** If 'slot' is NULL, 't' is not a table. Otherwise, 'slot' points +** to the entry 't[key]', or to a value with an absent key if there +** is no such entry. (The value at 'slot' must be empty, otherwise +** 'luaV_fastget' would have done the job.) +*/ +void luaV_finishset (lua_State *L, const TValue *t, TValue *key, + TValue *val, const TValue *slot) { + int loop; /* counter to avoid infinite loops */ + for (loop = 0; loop < MAXTAGLOOP; loop++) { + const TValue *tm; /* '__newindex' metamethod */ + if (slot != NULL) { /* is 't' a table? */ + Table *h = hvalue(t); /* save 't' table */ + lua_assert(isempty(slot)); /* slot must be empty */ + tm = fasttm(L, h->metatable, TM_NEWINDEX); /* get metamethod */ + if (tm == NULL) { /* no metamethod? */ + luaH_finishset(L, h, key, slot, val); /* set new value */ + invalidateTMcache(h); + luaC_barrierback(L, obj2gco(h), val); + return; + } + /* else will try the metamethod */ + } + else { /* not a table; check metamethod */ + tm = luaT_gettmbyobj(L, t, TM_NEWINDEX); + if (l_unlikely(notm(tm))) + luaG_typeerror(L, t, "index"); + } + /* try the metamethod */ + if (ttisfunction(tm)) { + luaT_callTM(L, tm, t, key, val); + return; + } + t = tm; /* else repeat assignment over 'tm' */ + if (luaV_fastget(L, t, key, slot, luaH_get)) { + luaV_finishfastset(L, t, slot, val); + return; /* done */ + } + /* else 'return luaV_finishset(L, t, key, val, slot)' (loop) */ + } + luaG_runerror(L, "'__newindex' chain too long; possible loop"); +} + + +/* +** Compare two strings 'ts1' x 'ts2', returning an integer less-equal- +** -greater than zero if 'ts1' is less-equal-greater than 'ts2'. +** The code is a little tricky because it allows '\0' in the strings +** and it uses 'strcoll' (to respect locales) for each segment +** of the strings. Note that segments can compare equal but still +** have different lengths. +*/ +static int l_strcmp (const TString *ts1, const TString *ts2) { + const char *s1 = getstr(ts1); + size_t rl1 = tsslen(ts1); /* real length */ + const char *s2 = getstr(ts2); + size_t rl2 = tsslen(ts2); + for (;;) { /* for each segment */ + int temp = strcoll(s1, s2); + if (temp != 0) /* not equal? */ + return temp; /* done */ + else { /* strings are equal up to a '\0' */ + size_t zl1 = strlen(s1); /* index of first '\0' in 's1' */ + size_t zl2 = strlen(s2); /* index of first '\0' in 's2' */ + if (zl2 == rl2) /* 's2' is finished? */ + return (zl1 == rl1) ? 0 : 1; /* check 's1' */ + else if (zl1 == rl1) /* 's1' is finished? */ + return -1; /* 's1' is less than 's2' ('s2' is not finished) */ + /* both strings longer than 'zl'; go on comparing after the '\0' */ + zl1++; zl2++; + s1 += zl1; rl1 -= zl1; s2 += zl2; rl2 -= zl2; + } + } +} + + +/* +** Check whether integer 'i' is less than float 'f'. If 'i' has an +** exact representation as a float ('l_intfitsf'), compare numbers as +** floats. Otherwise, use the equivalence 'i < f <=> i < ceil(f)'. +** If 'ceil(f)' is out of integer range, either 'f' is greater than +** all integers or less than all integers. +** (The test with 'l_intfitsf' is only for performance; the else +** case is correct for all values, but it is slow due to the conversion +** from float to int.) +** When 'f' is NaN, comparisons must result in false. +*/ +l_sinline int LTintfloat (lua_Integer i, lua_Number f) { + if (l_intfitsf(i)) + return luai_numlt(cast_num(i), f); /* compare them as floats */ + else { /* i < f <=> i < ceil(f) */ + lua_Integer fi; + if (luaV_flttointeger(f, &fi, F2Iceil)) /* fi = ceil(f) */ + return i < fi; /* compare them as integers */ + else /* 'f' is either greater or less than all integers */ + return f > 0; /* greater? */ + } +} + + +/* +** Check whether integer 'i' is less than or equal to float 'f'. +** See comments on previous function. +*/ +l_sinline int LEintfloat (lua_Integer i, lua_Number f) { + if (l_intfitsf(i)) + return luai_numle(cast_num(i), f); /* compare them as floats */ + else { /* i <= f <=> i <= floor(f) */ + lua_Integer fi; + if (luaV_flttointeger(f, &fi, F2Ifloor)) /* fi = floor(f) */ + return i <= fi; /* compare them as integers */ + else /* 'f' is either greater or less than all integers */ + return f > 0; /* greater? */ + } +} + + +/* +** Check whether float 'f' is less than integer 'i'. +** See comments on previous function. +*/ +l_sinline int LTfloatint (lua_Number f, lua_Integer i) { + if (l_intfitsf(i)) + return luai_numlt(f, cast_num(i)); /* compare them as floats */ + else { /* f < i <=> floor(f) < i */ + lua_Integer fi; + if (luaV_flttointeger(f, &fi, F2Ifloor)) /* fi = floor(f) */ + return fi < i; /* compare them as integers */ + else /* 'f' is either greater or less than all integers */ + return f < 0; /* less? */ + } +} + + +/* +** Check whether float 'f' is less than or equal to integer 'i'. +** See comments on previous function. +*/ +l_sinline int LEfloatint (lua_Number f, lua_Integer i) { + if (l_intfitsf(i)) + return luai_numle(f, cast_num(i)); /* compare them as floats */ + else { /* f <= i <=> ceil(f) <= i */ + lua_Integer fi; + if (luaV_flttointeger(f, &fi, F2Iceil)) /* fi = ceil(f) */ + return fi <= i; /* compare them as integers */ + else /* 'f' is either greater or less than all integers */ + return f < 0; /* less? */ + } +} + + +/* +** Return 'l < r', for numbers. +*/ +l_sinline int LTnum (const TValue *l, const TValue *r) { + lua_assert(ttisnumber(l) && ttisnumber(r)); + if (ttisinteger(l)) { + lua_Integer li = ivalue(l); + if (ttisinteger(r)) + return li < ivalue(r); /* both are integers */ + else /* 'l' is int and 'r' is float */ + return LTintfloat(li, fltvalue(r)); /* l < r ? */ + } + else { + lua_Number lf = fltvalue(l); /* 'l' must be float */ + if (ttisfloat(r)) + return luai_numlt(lf, fltvalue(r)); /* both are float */ + else /* 'l' is float and 'r' is int */ + return LTfloatint(lf, ivalue(r)); + } +} + + +/* +** Return 'l <= r', for numbers. +*/ +l_sinline int LEnum (const TValue *l, const TValue *r) { + lua_assert(ttisnumber(l) && ttisnumber(r)); + if (ttisinteger(l)) { + lua_Integer li = ivalue(l); + if (ttisinteger(r)) + return li <= ivalue(r); /* both are integers */ + else /* 'l' is int and 'r' is float */ + return LEintfloat(li, fltvalue(r)); /* l <= r ? */ + } + else { + lua_Number lf = fltvalue(l); /* 'l' must be float */ + if (ttisfloat(r)) + return luai_numle(lf, fltvalue(r)); /* both are float */ + else /* 'l' is float and 'r' is int */ + return LEfloatint(lf, ivalue(r)); + } +} + + +/* +** return 'l < r' for non-numbers. +*/ +static int lessthanothers (lua_State *L, const TValue *l, const TValue *r) { + lua_assert(!ttisnumber(l) || !ttisnumber(r)); + if (ttisstring(l) && ttisstring(r)) /* both are strings? */ + return l_strcmp(tsvalue(l), tsvalue(r)) < 0; + else + return luaT_callorderTM(L, l, r, TM_LT); +} + + +/* +** Main operation less than; return 'l < r'. +*/ +int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { + if (ttisnumber(l) && ttisnumber(r)) /* both operands are numbers? */ + return LTnum(l, r); + else return lessthanothers(L, l, r); +} + + +/* +** return 'l <= r' for non-numbers. +*/ +static int lessequalothers (lua_State *L, const TValue *l, const TValue *r) { + lua_assert(!ttisnumber(l) || !ttisnumber(r)); + if (ttisstring(l) && ttisstring(r)) /* both are strings? */ + return l_strcmp(tsvalue(l), tsvalue(r)) <= 0; + else + return luaT_callorderTM(L, l, r, TM_LE); +} + + +/* +** Main operation less than or equal to; return 'l <= r'. +*/ +int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r) { + if (ttisnumber(l) && ttisnumber(r)) /* both operands are numbers? */ + return LEnum(l, r); + else return lessequalothers(L, l, r); +} + + +/* +** Main operation for equality of Lua values; return 't1 == t2'. +** L == NULL means raw equality (no metamethods) +*/ +int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2) { + const TValue *tm; + if (ttypetag(t1) != ttypetag(t2)) { /* not the same variant? */ + if (ttype(t1) != ttype(t2) || ttype(t1) != LUA_TNUMBER) + return 0; /* only numbers can be equal with different variants */ + else { /* two numbers with different variants */ + /* One of them is an integer. If the other does not have an + integer value, they cannot be equal; otherwise, compare their + integer values. */ + lua_Integer i1, i2; + return (luaV_tointegerns(t1, &i1, F2Ieq) && + luaV_tointegerns(t2, &i2, F2Ieq) && + i1 == i2); + } + } + /* values have same type and same variant */ + switch (ttypetag(t1)) { + case LUA_VNIL: case LUA_VFALSE: case LUA_VTRUE: return 1; + case LUA_VNUMINT: return (ivalue(t1) == ivalue(t2)); + case LUA_VNUMFLT: return luai_numeq(fltvalue(t1), fltvalue(t2)); + case LUA_VLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); + case LUA_VLCF: return fvalue(t1) == fvalue(t2); + case LUA_VSHRSTR: return eqshrstr(tsvalue(t1), tsvalue(t2)); + case LUA_VLNGSTR: return luaS_eqlngstr(tsvalue(t1), tsvalue(t2)); + case LUA_VUSERDATA: { + if (uvalue(t1) == uvalue(t2)) return 1; + else if (L == NULL) return 0; + tm = fasttm(L, uvalue(t1)->metatable, TM_EQ); + if (tm == NULL) + tm = fasttm(L, uvalue(t2)->metatable, TM_EQ); + break; /* will try TM */ + } + case LUA_VTABLE: { + if (hvalue(t1) == hvalue(t2)) return 1; + else if (L == NULL) return 0; + tm = fasttm(L, hvalue(t1)->metatable, TM_EQ); + if (tm == NULL) + tm = fasttm(L, hvalue(t2)->metatable, TM_EQ); + break; /* will try TM */ + } + default: + return gcvalue(t1) == gcvalue(t2); + } + if (tm == NULL) /* no TM? */ + return 0; /* objects are different */ + else { + luaT_callTMres(L, tm, t1, t2, L->top.p); /* call TM */ + return !l_isfalse(s2v(L->top.p)); + } +} + + +/* macro used by 'luaV_concat' to ensure that element at 'o' is a string */ +#define tostring(L,o) \ + (ttisstring(o) || (cvt2str(o) && (luaO_tostring(L, o), 1))) + +#define isemptystr(o) (ttisshrstring(o) && tsvalue(o)->shrlen == 0) + +/* copy strings in stack from top - n up to top - 1 to buffer */ +static void copy2buff (StkId top, int n, char *buff) { + size_t tl = 0; /* size already copied */ + do { + TString *st = tsvalue(s2v(top - n)); + size_t l = tsslen(st); /* length of string being copied */ + memcpy(buff + tl, getstr(st), l * sizeof(char)); + tl += l; + } while (--n > 0); +} + + +/* +** Main operation for concatenation: concat 'total' values in the stack, +** from 'L->top.p - total' up to 'L->top.p - 1'. +*/ +void luaV_concat (lua_State *L, int total) { + if (total == 1) + return; /* "all" values already concatenated */ + do { + StkId top = L->top.p; + int n = 2; /* number of elements handled in this pass (at least 2) */ + if (!(ttisstring(s2v(top - 2)) || cvt2str(s2v(top - 2))) || + !tostring(L, s2v(top - 1))) + luaT_tryconcatTM(L); /* may invalidate 'top' */ + else if (isemptystr(s2v(top - 1))) /* second operand is empty? */ + cast_void(tostring(L, s2v(top - 2))); /* result is first operand */ + else if (isemptystr(s2v(top - 2))) { /* first operand is empty string? */ + setobjs2s(L, top - 2, top - 1); /* result is second op. */ + } + else { + /* at least two non-empty string values; get as many as possible */ + size_t tl = tsslen(tsvalue(s2v(top - 1))); + TString *ts; + /* collect total length and number of strings */ + for (n = 1; n < total && tostring(L, s2v(top - n - 1)); n++) { + size_t l = tsslen(tsvalue(s2v(top - n - 1))); + if (l_unlikely(l >= MAX_SIZE - sizeof(TString) - tl)) { + L->top.p = top - total; /* pop strings to avoid wasting stack */ + luaG_runerror(L, "string length overflow"); + } + tl += l; + } + if (tl <= LUAI_MAXSHORTLEN) { /* is result a short string? */ + char buff[LUAI_MAXSHORTLEN]; + copy2buff(top, n, buff); /* copy strings to buffer */ + ts = luaS_newlstr(L, buff, tl); + } + else { /* long string; copy strings directly to final result */ + ts = luaS_createlngstrobj(L, tl); + copy2buff(top, n, getlngstr(ts)); + } + setsvalue2s(L, top - n, ts); /* create result */ + } + total -= n - 1; /* got 'n' strings to create one new */ + L->top.p -= n - 1; /* popped 'n' strings and pushed one */ + } while (total > 1); /* repeat until only 1 result left */ +} + + +/* +** Main operation 'ra = #rb'. +*/ +void luaV_objlen (lua_State *L, StkId ra, const TValue *rb) { + const TValue *tm; + switch (ttypetag(rb)) { + case LUA_VTABLE: { + Table *h = hvalue(rb); + tm = fasttm(L, h->metatable, TM_LEN); + if (tm) break; /* metamethod? break switch to call it */ + setivalue(s2v(ra), luaH_getn(h)); /* else primitive len */ + return; + } + case LUA_VSHRSTR: { + setivalue(s2v(ra), tsvalue(rb)->shrlen); + return; + } + case LUA_VLNGSTR: { + setivalue(s2v(ra), tsvalue(rb)->u.lnglen); + return; + } + default: { /* try metamethod */ + tm = luaT_gettmbyobj(L, rb, TM_LEN); + if (l_unlikely(notm(tm))) /* no metamethod? */ + luaG_typeerror(L, rb, "get length of"); + break; + } + } + luaT_callTMres(L, tm, rb, rb, ra); +} + + +/* +** Integer division; return 'm // n', that is, floor(m/n). +** C division truncates its result (rounds towards zero). +** 'floor(q) == trunc(q)' when 'q >= 0' or when 'q' is integer, +** otherwise 'floor(q) == trunc(q) - 1'. +*/ +lua_Integer luaV_idiv (lua_State *L, lua_Integer m, lua_Integer n) { + if (l_unlikely(l_castS2U(n) + 1u <= 1u)) { /* special cases: -1 or 0 */ + if (n == 0) + luaG_runerror(L, "attempt to divide by zero"); + return intop(-, 0, m); /* n==-1; avoid overflow with 0x80000...//-1 */ + } + else { + lua_Integer q = m / n; /* perform C division */ + if ((m ^ n) < 0 && m % n != 0) /* 'm/n' would be negative non-integer? */ + q -= 1; /* correct result for different rounding */ + return q; + } +} + + +/* +** Integer modulus; return 'm % n'. (Assume that C '%' with +** negative operands follows C99 behavior. See previous comment +** about luaV_idiv.) +*/ +lua_Integer luaV_mod (lua_State *L, lua_Integer m, lua_Integer n) { + if (l_unlikely(l_castS2U(n) + 1u <= 1u)) { /* special cases: -1 or 0 */ + if (n == 0) + luaG_runerror(L, "attempt to perform 'n%%0'"); + return 0; /* m % -1 == 0; avoid overflow with 0x80000...%-1 */ + } + else { + lua_Integer r = m % n; + if (r != 0 && (r ^ n) < 0) /* 'm/n' would be non-integer negative? */ + r += n; /* correct result for different rounding */ + return r; + } +} + + +/* +** Float modulus +*/ +lua_Number luaV_modf (lua_State *L, lua_Number m, lua_Number n) { + lua_Number r; + luai_nummod(L, m, n, r); + return r; +} + + +/* number of bits in an integer */ +#define NBITS cast_int(sizeof(lua_Integer) * CHAR_BIT) + + +/* +** Shift left operation. (Shift right just negates 'y'.) +*/ +lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y) { + if (y < 0) { /* shift right? */ + if (y <= -NBITS) return 0; + else return intop(>>, x, -y); + } + else { /* shift left */ + if (y >= NBITS) return 0; + else return intop(<<, x, y); + } +} + + +/* +** create a new Lua closure, push it in the stack, and initialize +** its upvalues. +*/ +static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base, + StkId ra) { + int nup = p->sizeupvalues; + Upvaldesc *uv = p->upvalues; + int i; + LClosure *ncl = luaF_newLclosure(L, nup); + ncl->p = p; + setclLvalue2s(L, ra, ncl); /* anchor new closure in stack */ + for (i = 0; i < nup; i++) { /* fill in its upvalues */ + if (uv[i].instack) /* upvalue refers to local variable? */ + ncl->upvals[i] = luaF_findupval(L, base + uv[i].idx); + else /* get upvalue from enclosing function */ + ncl->upvals[i] = encup[uv[i].idx]; + luaC_objbarrier(L, ncl, ncl->upvals[i]); + } +} + + +/* +** finish execution of an opcode interrupted by a yield +*/ +void luaV_finishOp (lua_State *L) { + CallInfo *ci = L->ci; + StkId base = ci->func.p + 1; + Instruction inst = *(ci->u.l.savedpc - 1); /* interrupted instruction */ + OpCode op = GET_OPCODE(inst); + switch (op) { /* finish its execution */ + case OP_MMBIN: case OP_MMBINI: case OP_MMBINK: { + setobjs2s(L, base + GETARG_A(*(ci->u.l.savedpc - 2)), --L->top.p); + break; + } + case OP_UNM: case OP_BNOT: case OP_LEN: + case OP_GETTABUP: case OP_GETTABLE: case OP_GETI: + case OP_GETFIELD: case OP_SELF: { + setobjs2s(L, base + GETARG_A(inst), --L->top.p); + break; + } + case OP_LT: case OP_LE: + case OP_LTI: case OP_LEI: + case OP_GTI: case OP_GEI: + case OP_EQ: { /* note that 'OP_EQI'/'OP_EQK' cannot yield */ + int res = !l_isfalse(s2v(L->top.p - 1)); + L->top.p--; +#if defined(LUA_COMPAT_LT_LE) + if (ci->callstatus & CIST_LEQ) { /* "<=" using "<" instead? */ + ci->callstatus ^= CIST_LEQ; /* clear mark */ + res = !res; /* negate result */ + } +#endif + lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_JMP); + if (res != GETARG_k(inst)) /* condition failed? */ + ci->u.l.savedpc++; /* skip jump instruction */ + break; + } + case OP_CONCAT: { + StkId top = L->top.p - 1; /* top when 'luaT_tryconcatTM' was called */ + int a = GETARG_A(inst); /* first element to concatenate */ + int total = cast_int(top - 1 - (base + a)); /* yet to concatenate */ + setobjs2s(L, top - 2, top); /* put TM result in proper position */ + L->top.p = top - 1; /* top is one after last element (at top-2) */ + luaV_concat(L, total); /* concat them (may yield again) */ + break; + } + case OP_CLOSE: { /* yielded closing variables */ + ci->u.l.savedpc--; /* repeat instruction to close other vars. */ + break; + } + case OP_RETURN: { /* yielded closing variables */ + StkId ra = base + GETARG_A(inst); + /* adjust top to signal correct number of returns, in case the + return is "up to top" ('isIT') */ + L->top.p = ra + ci->u2.nres; + /* repeat instruction to close other vars. and complete the return */ + ci->u.l.savedpc--; + break; + } + default: { + /* only these other opcodes can yield */ + lua_assert(op == OP_TFORCALL || op == OP_CALL || + op == OP_TAILCALL || op == OP_SETTABUP || op == OP_SETTABLE || + op == OP_SETI || op == OP_SETFIELD); + break; + } + } +} + + + + +/* +** {================================================================== +** Macros for arithmetic/bitwise/comparison opcodes in 'luaV_execute' +** =================================================================== +*/ + +#define l_addi(L,a,b) intop(+, a, b) +#define l_subi(L,a,b) intop(-, a, b) +#define l_muli(L,a,b) intop(*, a, b) +#define l_band(a,b) intop(&, a, b) +#define l_bor(a,b) intop(|, a, b) +#define l_bxor(a,b) intop(^, a, b) + +#define l_lti(a,b) (a < b) +#define l_lei(a,b) (a <= b) +#define l_gti(a,b) (a > b) +#define l_gei(a,b) (a >= b) + + +/* +** Arithmetic operations with immediate operands. 'iop' is the integer +** operation, 'fop' is the float operation. +*/ +#define op_arithI(L,iop,fop) { \ + StkId ra = RA(i); \ + TValue *v1 = vRB(i); \ + int imm = GETARG_sC(i); \ + if (ttisinteger(v1)) { \ + lua_Integer iv1 = ivalue(v1); \ + pc++; setivalue(s2v(ra), iop(L, iv1, imm)); \ + } \ + else if (ttisfloat(v1)) { \ + lua_Number nb = fltvalue(v1); \ + lua_Number fimm = cast_num(imm); \ + pc++; setfltvalue(s2v(ra), fop(L, nb, fimm)); \ + }} + + +/* +** Auxiliary function for arithmetic operations over floats and others +** with two register operands. +*/ +#define op_arithf_aux(L,v1,v2,fop) { \ + lua_Number n1; lua_Number n2; \ + if (tonumberns(v1, n1) && tonumberns(v2, n2)) { \ + pc++; setfltvalue(s2v(ra), fop(L, n1, n2)); \ + }} + + +/* +** Arithmetic operations over floats and others with register operands. +*/ +#define op_arithf(L,fop) { \ + StkId ra = RA(i); \ + TValue *v1 = vRB(i); \ + TValue *v2 = vRC(i); \ + op_arithf_aux(L, v1, v2, fop); } + + +/* +** Arithmetic operations with K operands for floats. +*/ +#define op_arithfK(L,fop) { \ + StkId ra = RA(i); \ + TValue *v1 = vRB(i); \ + TValue *v2 = KC(i); lua_assert(ttisnumber(v2)); \ + op_arithf_aux(L, v1, v2, fop); } + + +/* +** Arithmetic operations over integers and floats. +*/ +#define op_arith_aux(L,v1,v2,iop,fop) { \ + StkId ra = RA(i); \ + if (ttisinteger(v1) && ttisinteger(v2)) { \ + lua_Integer i1 = ivalue(v1); lua_Integer i2 = ivalue(v2); \ + pc++; setivalue(s2v(ra), iop(L, i1, i2)); \ + } \ + else op_arithf_aux(L, v1, v2, fop); } + + +/* +** Arithmetic operations with register operands. +*/ +#define op_arith(L,iop,fop) { \ + TValue *v1 = vRB(i); \ + TValue *v2 = vRC(i); \ + op_arith_aux(L, v1, v2, iop, fop); } + + +/* +** Arithmetic operations with K operands. +*/ +#define op_arithK(L,iop,fop) { \ + TValue *v1 = vRB(i); \ + TValue *v2 = KC(i); lua_assert(ttisnumber(v2)); \ + op_arith_aux(L, v1, v2, iop, fop); } + + +/* +** Bitwise operations with constant operand. +*/ +#define op_bitwiseK(L,op) { \ + StkId ra = RA(i); \ + TValue *v1 = vRB(i); \ + TValue *v2 = KC(i); \ + lua_Integer i1; \ + lua_Integer i2 = ivalue(v2); \ + if (tointegerns(v1, &i1)) { \ + pc++; setivalue(s2v(ra), op(i1, i2)); \ + }} + + +/* +** Bitwise operations with register operands. +*/ +#define op_bitwise(L,op) { \ + StkId ra = RA(i); \ + TValue *v1 = vRB(i); \ + TValue *v2 = vRC(i); \ + lua_Integer i1; lua_Integer i2; \ + if (tointegerns(v1, &i1) && tointegerns(v2, &i2)) { \ + pc++; setivalue(s2v(ra), op(i1, i2)); \ + }} + + +/* +** Order operations with register operands. 'opn' actually works +** for all numbers, but the fast track improves performance for +** integers. +*/ +#define op_order(L,opi,opn,other) { \ + StkId ra = RA(i); \ + int cond; \ + TValue *rb = vRB(i); \ + if (ttisinteger(s2v(ra)) && ttisinteger(rb)) { \ + lua_Integer ia = ivalue(s2v(ra)); \ + lua_Integer ib = ivalue(rb); \ + cond = opi(ia, ib); \ + } \ + else if (ttisnumber(s2v(ra)) && ttisnumber(rb)) \ + cond = opn(s2v(ra), rb); \ + else \ + Protect(cond = other(L, s2v(ra), rb)); \ + docondjump(); } + + +/* +** Order operations with immediate operand. (Immediate operand is +** always small enough to have an exact representation as a float.) +*/ +#define op_orderI(L,opi,opf,inv,tm) { \ + StkId ra = RA(i); \ + int cond; \ + int im = GETARG_sB(i); \ + if (ttisinteger(s2v(ra))) \ + cond = opi(ivalue(s2v(ra)), im); \ + else if (ttisfloat(s2v(ra))) { \ + lua_Number fa = fltvalue(s2v(ra)); \ + lua_Number fim = cast_num(im); \ + cond = opf(fa, fim); \ + } \ + else { \ + int isf = GETARG_C(i); \ + Protect(cond = luaT_callorderiTM(L, s2v(ra), im, inv, isf, tm)); \ + } \ + docondjump(); } + +/* }================================================================== */ + + +/* +** {================================================================== +** Function 'luaV_execute': main interpreter loop +** =================================================================== +*/ + +/* +** some macros for common tasks in 'luaV_execute' +*/ + + +#define RA(i) (base+GETARG_A(i)) +#define RB(i) (base+GETARG_B(i)) +#define vRB(i) s2v(RB(i)) +#define KB(i) (k+GETARG_B(i)) +#define RC(i) (base+GETARG_C(i)) +#define vRC(i) s2v(RC(i)) +#define KC(i) (k+GETARG_C(i)) +#define RKC(i) ((TESTARG_k(i)) ? k + GETARG_C(i) : s2v(base + GETARG_C(i))) + + + +#define updatetrap(ci) (trap = ci->u.l.trap) + +#define updatebase(ci) (base = ci->func.p + 1) + + +#define updatestack(ci) \ + { if (l_unlikely(trap)) { updatebase(ci); ra = RA(i); } } + + +/* +** Execute a jump instruction. The 'updatetrap' allows signals to stop +** tight loops. (Without it, the local copy of 'trap' could never change.) +*/ +#define dojump(ci,i,e) { pc += GETARG_sJ(i) + e; updatetrap(ci); } + + +/* for test instructions, execute the jump instruction that follows it */ +#define donextjump(ci) { Instruction ni = *pc; dojump(ci, ni, 1); } + +/* +** do a conditional jump: skip next instruction if 'cond' is not what +** was expected (parameter 'k'), else do next instruction, which must +** be a jump. +*/ +#define docondjump() if (cond != GETARG_k(i)) pc++; else donextjump(ci); + + +/* +** Correct global 'pc'. +*/ +#define savepc(L) (ci->u.l.savedpc = pc) + + +/* +** Whenever code can raise errors, the global 'pc' and the global +** 'top' must be correct to report occasional errors. +*/ +#define savestate(L,ci) (savepc(L), L->top.p = ci->top.p) + + +/* +** Protect code that, in general, can raise errors, reallocate the +** stack, and change the hooks. +*/ +#define Protect(exp) (savestate(L,ci), (exp), updatetrap(ci)) + +/* special version that does not change the top */ +#define ProtectNT(exp) (savepc(L), (exp), updatetrap(ci)) + +/* +** Protect code that can only raise errors. (That is, it cannot change +** the stack or hooks.) +*/ +#define halfProtect(exp) (savestate(L,ci), (exp)) + +/* 'c' is the limit of live values in the stack */ +#define checkGC(L,c) \ + { luaC_condGC(L, (savepc(L), L->top.p = (c)), \ + updatetrap(ci)); \ + luai_threadyield(L); } + + +/* fetch an instruction and prepare its execution */ +#define vmfetch() { \ + if (l_unlikely(trap)) { /* stack reallocation or hooks? */ \ + trap = luaG_traceexec(L, pc); /* handle hooks */ \ + updatebase(ci); /* correct stack */ \ + } \ + i = *(pc++); \ +} + +#define vmdispatch(o) switch(o) +#define vmcase(l) case l: +#define vmbreak break + + +void luaV_execute (lua_State *L, CallInfo *ci) { + LClosure *cl; + TValue *k; + StkId base; + const Instruction *pc; + int trap; +#if LUA_USE_JUMPTABLE +#include "ljumptab.h" +#endif + startfunc: + trap = L->hookmask; + returning: /* trap already set */ + cl = ci_func(ci); + k = cl->p->k; + pc = ci->u.l.savedpc; + if (l_unlikely(trap)) + trap = luaG_tracecall(L); + base = ci->func.p + 1; + /* main loop of interpreter */ + for (;;) { + Instruction i; /* instruction being executed */ + vmfetch(); + #if 0 + /* low-level line tracing for debugging Lua */ + printf("line: %d\n", luaG_getfuncline(cl->p, pcRel(pc, cl->p))); + #endif + lua_assert(base == ci->func.p + 1); + lua_assert(base <= L->top.p && L->top.p <= L->stack_last.p); + /* invalidate top for instructions not expecting it */ + lua_assert(isIT(i) || (cast_void(L->top.p = base), 1)); + vmdispatch (GET_OPCODE(i)) { + vmcase(OP_MOVE) { + StkId ra = RA(i); + setobjs2s(L, ra, RB(i)); + vmbreak; + } + vmcase(OP_LOADI) { + StkId ra = RA(i); + lua_Integer b = GETARG_sBx(i); + setivalue(s2v(ra), b); + vmbreak; + } + vmcase(OP_LOADF) { + StkId ra = RA(i); + int b = GETARG_sBx(i); + setfltvalue(s2v(ra), cast_num(b)); + vmbreak; + } + vmcase(OP_LOADK) { + StkId ra = RA(i); + TValue *rb = k + GETARG_Bx(i); + setobj2s(L, ra, rb); + vmbreak; + } + vmcase(OP_LOADKX) { + StkId ra = RA(i); + TValue *rb; + rb = k + GETARG_Ax(*pc); pc++; + setobj2s(L, ra, rb); + vmbreak; + } + vmcase(OP_LOADFALSE) { + StkId ra = RA(i); + setbfvalue(s2v(ra)); + vmbreak; + } + vmcase(OP_LFALSESKIP) { + StkId ra = RA(i); + setbfvalue(s2v(ra)); + pc++; /* skip next instruction */ + vmbreak; + } + vmcase(OP_LOADTRUE) { + StkId ra = RA(i); + setbtvalue(s2v(ra)); + vmbreak; + } + vmcase(OP_LOADNIL) { + StkId ra = RA(i); + int b = GETARG_B(i); + do { + setnilvalue(s2v(ra++)); + } while (b--); + vmbreak; + } + vmcase(OP_GETUPVAL) { + StkId ra = RA(i); + int b = GETARG_B(i); + setobj2s(L, ra, cl->upvals[b]->v.p); + vmbreak; + } + vmcase(OP_SETUPVAL) { + StkId ra = RA(i); + UpVal *uv = cl->upvals[GETARG_B(i)]; + setobj(L, uv->v.p, s2v(ra)); + luaC_barrier(L, uv, s2v(ra)); + vmbreak; + } + vmcase(OP_GETTABUP) { + StkId ra = RA(i); + const TValue *slot; + TValue *upval = cl->upvals[GETARG_B(i)]->v.p; + TValue *rc = KC(i); + TString *key = tsvalue(rc); /* key must be a short string */ + if (luaV_fastget(L, upval, key, slot, luaH_getshortstr)) { + setobj2s(L, ra, slot); + } + else + Protect(luaV_finishget(L, upval, rc, ra, slot)); + vmbreak; + } + vmcase(OP_GETTABLE) { + StkId ra = RA(i); + const TValue *slot; + TValue *rb = vRB(i); + TValue *rc = vRC(i); + lua_Unsigned n; + if (ttisinteger(rc) /* fast track for integers? */ + ? (cast_void(n = ivalue(rc)), luaV_fastgeti(L, rb, n, slot)) + : luaV_fastget(L, rb, rc, slot, luaH_get)) { + setobj2s(L, ra, slot); + } + else + Protect(luaV_finishget(L, rb, rc, ra, slot)); + vmbreak; + } + vmcase(OP_GETI) { + StkId ra = RA(i); + const TValue *slot; + TValue *rb = vRB(i); + int c = GETARG_C(i); + if (luaV_fastgeti(L, rb, c, slot)) { + setobj2s(L, ra, slot); + } + else { + TValue key; + setivalue(&key, c); + Protect(luaV_finishget(L, rb, &key, ra, slot)); + } + vmbreak; + } + vmcase(OP_GETFIELD) { + StkId ra = RA(i); + const TValue *slot; + TValue *rb = vRB(i); + TValue *rc = KC(i); + TString *key = tsvalue(rc); /* key must be a short string */ + if (luaV_fastget(L, rb, key, slot, luaH_getshortstr)) { + setobj2s(L, ra, slot); + } + else + Protect(luaV_finishget(L, rb, rc, ra, slot)); + vmbreak; + } + vmcase(OP_SETTABUP) { + const TValue *slot; + TValue *upval = cl->upvals[GETARG_A(i)]->v.p; + TValue *rb = KB(i); + TValue *rc = RKC(i); + TString *key = tsvalue(rb); /* key must be a short string */ + if (luaV_fastget(L, upval, key, slot, luaH_getshortstr)) { + luaV_finishfastset(L, upval, slot, rc); + } + else + Protect(luaV_finishset(L, upval, rb, rc, slot)); + vmbreak; + } + vmcase(OP_SETTABLE) { + StkId ra = RA(i); + const TValue *slot; + TValue *rb = vRB(i); /* key (table is in 'ra') */ + TValue *rc = RKC(i); /* value */ + lua_Unsigned n; + if (ttisinteger(rb) /* fast track for integers? */ + ? (cast_void(n = ivalue(rb)), luaV_fastgeti(L, s2v(ra), n, slot)) + : luaV_fastget(L, s2v(ra), rb, slot, luaH_get)) { + luaV_finishfastset(L, s2v(ra), slot, rc); + } + else + Protect(luaV_finishset(L, s2v(ra), rb, rc, slot)); + vmbreak; + } + vmcase(OP_SETI) { + StkId ra = RA(i); + const TValue *slot; + int c = GETARG_B(i); + TValue *rc = RKC(i); + if (luaV_fastgeti(L, s2v(ra), c, slot)) { + luaV_finishfastset(L, s2v(ra), slot, rc); + } + else { + TValue key; + setivalue(&key, c); + Protect(luaV_finishset(L, s2v(ra), &key, rc, slot)); + } + vmbreak; + } + vmcase(OP_SETFIELD) { + StkId ra = RA(i); + const TValue *slot; + TValue *rb = KB(i); + TValue *rc = RKC(i); + TString *key = tsvalue(rb); /* key must be a short string */ + if (luaV_fastget(L, s2v(ra), key, slot, luaH_getshortstr)) { + luaV_finishfastset(L, s2v(ra), slot, rc); + } + else + Protect(luaV_finishset(L, s2v(ra), rb, rc, slot)); + vmbreak; + } + vmcase(OP_NEWTABLE) { + StkId ra = RA(i); + int b = GETARG_B(i); /* log2(hash size) + 1 */ + int c = GETARG_C(i); /* array size */ + Table *t; + if (b > 0) + b = 1 << (b - 1); /* size is 2^(b - 1) */ + lua_assert((!TESTARG_k(i)) == (GETARG_Ax(*pc) == 0)); + if (TESTARG_k(i)) /* non-zero extra argument? */ + c += GETARG_Ax(*pc) * (MAXARG_C + 1); /* add it to size */ + pc++; /* skip extra argument */ + L->top.p = ra + 1; /* correct top in case of emergency GC */ + t = luaH_new(L); /* memory allocation */ + sethvalue2s(L, ra, t); + if (b != 0 || c != 0) + luaH_resize(L, t, c, b); /* idem */ + checkGC(L, ra + 1); + vmbreak; + } + vmcase(OP_SELF) { + StkId ra = RA(i); + const TValue *slot; + TValue *rb = vRB(i); + TValue *rc = RKC(i); + TString *key = tsvalue(rc); /* key must be a string */ + setobj2s(L, ra + 1, rb); + if (luaV_fastget(L, rb, key, slot, luaH_getstr)) { + setobj2s(L, ra, slot); + } + else + Protect(luaV_finishget(L, rb, rc, ra, slot)); + vmbreak; + } + vmcase(OP_ADDI) { + op_arithI(L, l_addi, luai_numadd); + vmbreak; + } + vmcase(OP_ADDK) { + op_arithK(L, l_addi, luai_numadd); + vmbreak; + } + vmcase(OP_SUBK) { + op_arithK(L, l_subi, luai_numsub); + vmbreak; + } + vmcase(OP_MULK) { + op_arithK(L, l_muli, luai_nummul); + vmbreak; + } + vmcase(OP_MODK) { + savestate(L, ci); /* in case of division by 0 */ + op_arithK(L, luaV_mod, luaV_modf); + vmbreak; + } + vmcase(OP_POWK) { + op_arithfK(L, luai_numpow); + vmbreak; + } + vmcase(OP_DIVK) { + op_arithfK(L, luai_numdiv); + vmbreak; + } + vmcase(OP_IDIVK) { + savestate(L, ci); /* in case of division by 0 */ + op_arithK(L, luaV_idiv, luai_numidiv); + vmbreak; + } + vmcase(OP_BANDK) { + op_bitwiseK(L, l_band); + vmbreak; + } + vmcase(OP_BORK) { + op_bitwiseK(L, l_bor); + vmbreak; + } + vmcase(OP_BXORK) { + op_bitwiseK(L, l_bxor); + vmbreak; + } + vmcase(OP_SHRI) { + StkId ra = RA(i); + TValue *rb = vRB(i); + int ic = GETARG_sC(i); + lua_Integer ib; + if (tointegerns(rb, &ib)) { + pc++; setivalue(s2v(ra), luaV_shiftl(ib, -ic)); + } + vmbreak; + } + vmcase(OP_SHLI) { + StkId ra = RA(i); + TValue *rb = vRB(i); + int ic = GETARG_sC(i); + lua_Integer ib; + if (tointegerns(rb, &ib)) { + pc++; setivalue(s2v(ra), luaV_shiftl(ic, ib)); + } + vmbreak; + } + vmcase(OP_ADD) { + op_arith(L, l_addi, luai_numadd); + vmbreak; + } + vmcase(OP_SUB) { + op_arith(L, l_subi, luai_numsub); + vmbreak; + } + vmcase(OP_MUL) { + op_arith(L, l_muli, luai_nummul); + vmbreak; + } + vmcase(OP_MOD) { + savestate(L, ci); /* in case of division by 0 */ + op_arith(L, luaV_mod, luaV_modf); + vmbreak; + } + vmcase(OP_POW) { + op_arithf(L, luai_numpow); + vmbreak; + } + vmcase(OP_DIV) { /* float division (always with floats) */ + op_arithf(L, luai_numdiv); + vmbreak; + } + vmcase(OP_IDIV) { /* floor division */ + savestate(L, ci); /* in case of division by 0 */ + op_arith(L, luaV_idiv, luai_numidiv); + vmbreak; + } + vmcase(OP_BAND) { + op_bitwise(L, l_band); + vmbreak; + } + vmcase(OP_BOR) { + op_bitwise(L, l_bor); + vmbreak; + } + vmcase(OP_BXOR) { + op_bitwise(L, l_bxor); + vmbreak; + } + vmcase(OP_SHR) { + op_bitwise(L, luaV_shiftr); + vmbreak; + } + vmcase(OP_SHL) { + op_bitwise(L, luaV_shiftl); + vmbreak; + } + vmcase(OP_MMBIN) { + StkId ra = RA(i); + Instruction pi = *(pc - 2); /* original arith. expression */ + TValue *rb = vRB(i); + TMS tm = (TMS)GETARG_C(i); + StkId result = RA(pi); + lua_assert(OP_ADD <= GET_OPCODE(pi) && GET_OPCODE(pi) <= OP_SHR); + Protect(luaT_trybinTM(L, s2v(ra), rb, result, tm)); + vmbreak; + } + vmcase(OP_MMBINI) { + StkId ra = RA(i); + Instruction pi = *(pc - 2); /* original arith. expression */ + int imm = GETARG_sB(i); + TMS tm = (TMS)GETARG_C(i); + int flip = GETARG_k(i); + StkId result = RA(pi); + Protect(luaT_trybiniTM(L, s2v(ra), imm, flip, result, tm)); + vmbreak; + } + vmcase(OP_MMBINK) { + StkId ra = RA(i); + Instruction pi = *(pc - 2); /* original arith. expression */ + TValue *imm = KB(i); + TMS tm = (TMS)GETARG_C(i); + int flip = GETARG_k(i); + StkId result = RA(pi); + Protect(luaT_trybinassocTM(L, s2v(ra), imm, flip, result, tm)); + vmbreak; + } + vmcase(OP_UNM) { + StkId ra = RA(i); + TValue *rb = vRB(i); + lua_Number nb; + if (ttisinteger(rb)) { + lua_Integer ib = ivalue(rb); + setivalue(s2v(ra), intop(-, 0, ib)); + } + else if (tonumberns(rb, nb)) { + setfltvalue(s2v(ra), luai_numunm(L, nb)); + } + else + Protect(luaT_trybinTM(L, rb, rb, ra, TM_UNM)); + vmbreak; + } + vmcase(OP_BNOT) { + StkId ra = RA(i); + TValue *rb = vRB(i); + lua_Integer ib; + if (tointegerns(rb, &ib)) { + setivalue(s2v(ra), intop(^, ~l_castS2U(0), ib)); + } + else + Protect(luaT_trybinTM(L, rb, rb, ra, TM_BNOT)); + vmbreak; + } + vmcase(OP_NOT) { + StkId ra = RA(i); + TValue *rb = vRB(i); + if (l_isfalse(rb)) + setbtvalue(s2v(ra)); + else + setbfvalue(s2v(ra)); + vmbreak; + } + vmcase(OP_LEN) { + StkId ra = RA(i); + Protect(luaV_objlen(L, ra, vRB(i))); + vmbreak; + } + vmcase(OP_CONCAT) { + StkId ra = RA(i); + int n = GETARG_B(i); /* number of elements to concatenate */ + L->top.p = ra + n; /* mark the end of concat operands */ + ProtectNT(luaV_concat(L, n)); + checkGC(L, L->top.p); /* 'luaV_concat' ensures correct top */ + vmbreak; + } + vmcase(OP_CLOSE) { + StkId ra = RA(i); + Protect(luaF_close(L, ra, LUA_OK, 1)); + vmbreak; + } + vmcase(OP_TBC) { + StkId ra = RA(i); + /* create new to-be-closed upvalue */ + halfProtect(luaF_newtbcupval(L, ra)); + vmbreak; + } + vmcase(OP_JMP) { + dojump(ci, i, 0); + vmbreak; + } + vmcase(OP_EQ) { + StkId ra = RA(i); + int cond; + TValue *rb = vRB(i); + Protect(cond = luaV_equalobj(L, s2v(ra), rb)); + docondjump(); + vmbreak; + } + vmcase(OP_LT) { + op_order(L, l_lti, LTnum, lessthanothers); + vmbreak; + } + vmcase(OP_LE) { + op_order(L, l_lei, LEnum, lessequalothers); + vmbreak; + } + vmcase(OP_EQK) { + StkId ra = RA(i); + TValue *rb = KB(i); + /* basic types do not use '__eq'; we can use raw equality */ + int cond = luaV_rawequalobj(s2v(ra), rb); + docondjump(); + vmbreak; + } + vmcase(OP_EQI) { + StkId ra = RA(i); + int cond; + int im = GETARG_sB(i); + if (ttisinteger(s2v(ra))) + cond = (ivalue(s2v(ra)) == im); + else if (ttisfloat(s2v(ra))) + cond = luai_numeq(fltvalue(s2v(ra)), cast_num(im)); + else + cond = 0; /* other types cannot be equal to a number */ + docondjump(); + vmbreak; + } + vmcase(OP_LTI) { + op_orderI(L, l_lti, luai_numlt, 0, TM_LT); + vmbreak; + } + vmcase(OP_LEI) { + op_orderI(L, l_lei, luai_numle, 0, TM_LE); + vmbreak; + } + vmcase(OP_GTI) { + op_orderI(L, l_gti, luai_numgt, 1, TM_LT); + vmbreak; + } + vmcase(OP_GEI) { + op_orderI(L, l_gei, luai_numge, 1, TM_LE); + vmbreak; + } + vmcase(OP_TEST) { + StkId ra = RA(i); + int cond = !l_isfalse(s2v(ra)); + docondjump(); + vmbreak; + } + vmcase(OP_TESTSET) { + StkId ra = RA(i); + TValue *rb = vRB(i); + if (l_isfalse(rb) == GETARG_k(i)) + pc++; + else { + setobj2s(L, ra, rb); + donextjump(ci); + } + vmbreak; + } + vmcase(OP_CALL) { + StkId ra = RA(i); + CallInfo *newci; + int b = GETARG_B(i); + int nresults = GETARG_C(i) - 1; + if (b != 0) /* fixed number of arguments? */ + L->top.p = ra + b; /* top signals number of arguments */ + /* else previous instruction set top */ + savepc(L); /* in case of errors */ + if ((newci = luaD_precall(L, ra, nresults)) == NULL) + updatetrap(ci); /* C call; nothing else to be done */ + else { /* Lua call: run function in this same C frame */ + ci = newci; + goto startfunc; + } + vmbreak; + } + vmcase(OP_TAILCALL) { + StkId ra = RA(i); + int b = GETARG_B(i); /* number of arguments + 1 (function) */ + int n; /* number of results when calling a C function */ + int nparams1 = GETARG_C(i); + /* delta is virtual 'func' - real 'func' (vararg functions) */ + int delta = (nparams1) ? ci->u.l.nextraargs + nparams1 : 0; + if (b != 0) + L->top.p = ra + b; + else /* previous instruction set top */ + b = cast_int(L->top.p - ra); + savepc(ci); /* several calls here can raise errors */ + if (TESTARG_k(i)) { + luaF_closeupval(L, base); /* close upvalues from current call */ + lua_assert(L->tbclist.p < base); /* no pending tbc variables */ + lua_assert(base == ci->func.p + 1); + } + if ((n = luaD_pretailcall(L, ci, ra, b, delta)) < 0) /* Lua function? */ + goto startfunc; /* execute the callee */ + else { /* C function? */ + ci->func.p -= delta; /* restore 'func' (if vararg) */ + luaD_poscall(L, ci, n); /* finish caller */ + updatetrap(ci); /* 'luaD_poscall' can change hooks */ + goto ret; /* caller returns after the tail call */ + } + } + vmcase(OP_RETURN) { + StkId ra = RA(i); + int n = GETARG_B(i) - 1; /* number of results */ + int nparams1 = GETARG_C(i); + if (n < 0) /* not fixed? */ + n = cast_int(L->top.p - ra); /* get what is available */ + savepc(ci); + if (TESTARG_k(i)) { /* may there be open upvalues? */ + ci->u2.nres = n; /* save number of returns */ + if (L->top.p < ci->top.p) + L->top.p = ci->top.p; + luaF_close(L, base, CLOSEKTOP, 1); + updatetrap(ci); + updatestack(ci); + } + if (nparams1) /* vararg function? */ + ci->func.p -= ci->u.l.nextraargs + nparams1; + L->top.p = ra + n; /* set call for 'luaD_poscall' */ + luaD_poscall(L, ci, n); + updatetrap(ci); /* 'luaD_poscall' can change hooks */ + goto ret; + } + vmcase(OP_RETURN0) { + if (l_unlikely(L->hookmask)) { + StkId ra = RA(i); + L->top.p = ra; + savepc(ci); + luaD_poscall(L, ci, 0); /* no hurry... */ + trap = 1; + } + else { /* do the 'poscall' here */ + int nres; + L->ci = ci->previous; /* back to caller */ + L->top.p = base - 1; + for (nres = ci->nresults; l_unlikely(nres > 0); nres--) + setnilvalue(s2v(L->top.p++)); /* all results are nil */ + } + goto ret; + } + vmcase(OP_RETURN1) { + if (l_unlikely(L->hookmask)) { + StkId ra = RA(i); + L->top.p = ra + 1; + savepc(ci); + luaD_poscall(L, ci, 1); /* no hurry... */ + trap = 1; + } + else { /* do the 'poscall' here */ + int nres = ci->nresults; + L->ci = ci->previous; /* back to caller */ + if (nres == 0) + L->top.p = base - 1; /* asked for no results */ + else { + StkId ra = RA(i); + setobjs2s(L, base - 1, ra); /* at least this result */ + L->top.p = base; + for (; l_unlikely(nres > 1); nres--) + setnilvalue(s2v(L->top.p++)); /* complete missing results */ + } + } + ret: /* return from a Lua function */ + if (ci->callstatus & CIST_FRESH) + return; /* end this frame */ + else { + ci = ci->previous; + goto returning; /* continue running caller in this frame */ + } + } + vmcase(OP_FORLOOP) { + StkId ra = RA(i); + if (ttisinteger(s2v(ra + 2))) { /* integer loop? */ + lua_Unsigned count = l_castS2U(ivalue(s2v(ra + 1))); + if (count > 0) { /* still more iterations? */ + lua_Integer step = ivalue(s2v(ra + 2)); + lua_Integer idx = ivalue(s2v(ra)); /* internal index */ + chgivalue(s2v(ra + 1), count - 1); /* update counter */ + idx = intop(+, idx, step); /* add step to index */ + chgivalue(s2v(ra), idx); /* update internal index */ + setivalue(s2v(ra + 3), idx); /* and control variable */ + pc -= GETARG_Bx(i); /* jump back */ + } + } + else if (floatforloop(ra)) /* float loop */ + pc -= GETARG_Bx(i); /* jump back */ + updatetrap(ci); /* allows a signal to break the loop */ + vmbreak; + } + vmcase(OP_FORPREP) { + StkId ra = RA(i); + savestate(L, ci); /* in case of errors */ + if (forprep(L, ra)) + pc += GETARG_Bx(i) + 1; /* skip the loop */ + vmbreak; + } + vmcase(OP_TFORPREP) { + StkId ra = RA(i); + /* create to-be-closed upvalue (if needed) */ + halfProtect(luaF_newtbcupval(L, ra + 3)); + pc += GETARG_Bx(i); + i = *(pc++); /* go to next instruction */ + lua_assert(GET_OPCODE(i) == OP_TFORCALL && ra == RA(i)); + goto l_tforcall; + } + vmcase(OP_TFORCALL) { + l_tforcall: { + StkId ra = RA(i); + /* 'ra' has the iterator function, 'ra + 1' has the state, + 'ra + 2' has the control variable, and 'ra + 3' has the + to-be-closed variable. The call will use the stack after + these values (starting at 'ra + 4') + */ + /* push function, state, and control variable */ + memcpy(ra + 4, ra, 3 * sizeof(*ra)); + L->top.p = ra + 4 + 3; + ProtectNT(luaD_call(L, ra + 4, GETARG_C(i))); /* do the call */ + updatestack(ci); /* stack may have changed */ + i = *(pc++); /* go to next instruction */ + lua_assert(GET_OPCODE(i) == OP_TFORLOOP && ra == RA(i)); + goto l_tforloop; + }} + vmcase(OP_TFORLOOP) { + l_tforloop: { + StkId ra = RA(i); + if (!ttisnil(s2v(ra + 4))) { /* continue loop? */ + setobjs2s(L, ra + 2, ra + 4); /* save control variable */ + pc -= GETARG_Bx(i); /* jump back */ + } + vmbreak; + }} + vmcase(OP_SETLIST) { + StkId ra = RA(i); + int n = GETARG_B(i); + unsigned int last = GETARG_C(i); + Table *h = hvalue(s2v(ra)); + if (n == 0) + n = cast_int(L->top.p - ra) - 1; /* get up to the top */ + else + L->top.p = ci->top.p; /* correct top in case of emergency GC */ + last += n; + if (TESTARG_k(i)) { + last += GETARG_Ax(*pc) * (MAXARG_C + 1); + pc++; + } + if (last > luaH_realasize(h)) /* needs more space? */ + luaH_resizearray(L, h, last); /* preallocate it at once */ + for (; n > 0; n--) { + TValue *val = s2v(ra + n); + setobj2t(L, &h->array[last - 1], val); + last--; + luaC_barrierback(L, obj2gco(h), val); + } + vmbreak; + } + vmcase(OP_CLOSURE) { + StkId ra = RA(i); + Proto *p = cl->p->p[GETARG_Bx(i)]; + halfProtect(pushclosure(L, p, cl->upvals, base, ra)); + checkGC(L, ra + 1); + vmbreak; + } + vmcase(OP_VARARG) { + StkId ra = RA(i); + int n = GETARG_C(i) - 1; /* required results */ + Protect(luaT_getvarargs(L, ci, ra, n)); + vmbreak; + } + vmcase(OP_VARARGPREP) { + ProtectNT(luaT_adjustvarargs(L, GETARG_A(i), ci, cl->p)); + if (l_unlikely(trap)) { /* previous "Protect" updated trap */ + luaD_hookcall(L, ci); + L->oldpc = 1; /* next opcode will be seen as a "new" line */ + } + updatebase(ci); /* function has new base after adjustment */ + vmbreak; + } + vmcase(OP_EXTRAARG) { + lua_assert(0); + vmbreak; + } + } + } +} + +/* }================================================================== */ diff --git a/LuaSkin/lua-5.4.7/src/lvm.h b/LuaSkin/lua-5.4.7/src/lvm.h new file mode 100644 index 000000000..dba1ad277 --- /dev/null +++ b/LuaSkin/lua-5.4.7/src/lvm.h @@ -0,0 +1,141 @@ +/* +** $Id: lvm.h $ +** Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#ifndef lvm_h +#define lvm_h + + +#include "ldo.h" +#include "lobject.h" +#include "ltm.h" + + +#if !defined(LUA_NOCVTN2S) +#define cvt2str(o) ttisnumber(o) +#else +#define cvt2str(o) 0 /* no conversion from numbers to strings */ +#endif + + +#if !defined(LUA_NOCVTS2N) +#define cvt2num(o) ttisstring(o) +#else +#define cvt2num(o) 0 /* no conversion from strings to numbers */ +#endif + + +/* +** You can define LUA_FLOORN2I if you want to convert floats to integers +** by flooring them (instead of raising an error if they are not +** integral values) +*/ +#if !defined(LUA_FLOORN2I) +#define LUA_FLOORN2I F2Ieq +#endif + + +/* +** Rounding modes for float->integer coercion + */ +typedef enum { + F2Ieq, /* no rounding; accepts only integral values */ + F2Ifloor, /* takes the floor of the number */ + F2Iceil /* takes the ceil of the number */ +} F2Imod; + + +/* convert an object to a float (including string coercion) */ +#define tonumber(o,n) \ + (ttisfloat(o) ? (*(n) = fltvalue(o), 1) : luaV_tonumber_(o,n)) + + +/* convert an object to a float (without string coercion) */ +#define tonumberns(o,n) \ + (ttisfloat(o) ? ((n) = fltvalue(o), 1) : \ + (ttisinteger(o) ? ((n) = cast_num(ivalue(o)), 1) : 0)) + + +/* convert an object to an integer (including string coercion) */ +#define tointeger(o,i) \ + (l_likely(ttisinteger(o)) ? (*(i) = ivalue(o), 1) \ + : luaV_tointeger(o,i,LUA_FLOORN2I)) + + +/* convert an object to an integer (without string coercion) */ +#define tointegerns(o,i) \ + (l_likely(ttisinteger(o)) ? (*(i) = ivalue(o), 1) \ + : luaV_tointegerns(o,i,LUA_FLOORN2I)) + + +#define intop(op,v1,v2) l_castU2S(l_castS2U(v1) op l_castS2U(v2)) + +#define luaV_rawequalobj(t1,t2) luaV_equalobj(NULL,t1,t2) + + +/* +** fast track for 'gettable': if 't' is a table and 't[k]' is present, +** return 1 with 'slot' pointing to 't[k]' (position of final result). +** Otherwise, return 0 (meaning it will have to check metamethod) +** with 'slot' pointing to an empty 't[k]' (if 't' is a table) or NULL +** (otherwise). 'f' is the raw get function to use. +*/ +#define luaV_fastget(L,t,k,slot,f) \ + (!ttistable(t) \ + ? (slot = NULL, 0) /* not a table; 'slot' is NULL and result is 0 */ \ + : (slot = f(hvalue(t), k), /* else, do raw access */ \ + !isempty(slot))) /* result not empty? */ + + +/* +** Special case of 'luaV_fastget' for integers, inlining the fast case +** of 'luaH_getint'. +*/ +#define luaV_fastgeti(L,t,k,slot) \ + (!ttistable(t) \ + ? (slot = NULL, 0) /* not a table; 'slot' is NULL and result is 0 */ \ + : (slot = (l_castS2U(k) - 1u < hvalue(t)->alimit) \ + ? &hvalue(t)->array[k - 1] : luaH_getint(hvalue(t), k), \ + !isempty(slot))) /* result not empty? */ + + +/* +** Finish a fast set operation (when fast get succeeds). In that case, +** 'slot' points to the place to put the value. +*/ +#define luaV_finishfastset(L,t,slot,v) \ + { setobj2t(L, cast(TValue *,slot), v); \ + luaC_barrierback(L, gcvalue(t), v); } + + +/* +** Shift right is the same as shift left with a negative 'y' +*/ +#define luaV_shiftr(x,y) luaV_shiftl(x,intop(-, 0, y)) + + + +LUAI_FUNC int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2); +LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); +LUAI_FUNC int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r); +LUAI_FUNC int luaV_tonumber_ (const TValue *obj, lua_Number *n); +LUAI_FUNC int luaV_tointeger (const TValue *obj, lua_Integer *p, F2Imod mode); +LUAI_FUNC int luaV_tointegerns (const TValue *obj, lua_Integer *p, + F2Imod mode); +LUAI_FUNC int luaV_flttointeger (lua_Number n, lua_Integer *p, F2Imod mode); +LUAI_FUNC void luaV_finishget (lua_State *L, const TValue *t, TValue *key, + StkId val, const TValue *slot); +LUAI_FUNC void luaV_finishset (lua_State *L, const TValue *t, TValue *key, + TValue *val, const TValue *slot); +LUAI_FUNC void luaV_finishOp (lua_State *L); +LUAI_FUNC void luaV_execute (lua_State *L, CallInfo *ci); +LUAI_FUNC void luaV_concat (lua_State *L, int total); +LUAI_FUNC lua_Integer luaV_idiv (lua_State *L, lua_Integer x, lua_Integer y); +LUAI_FUNC lua_Integer luaV_mod (lua_State *L, lua_Integer x, lua_Integer y); +LUAI_FUNC lua_Number luaV_modf (lua_State *L, lua_Number x, lua_Number y); +LUAI_FUNC lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y); +LUAI_FUNC void luaV_objlen (lua_State *L, StkId ra, const TValue *rb); + +#endif diff --git a/LuaSkin/lua-5.3.4/src/lzio.c b/LuaSkin/lua-5.4.7/src/lzio.c similarity index 95% rename from LuaSkin/lua-5.3.4/src/lzio.c rename to LuaSkin/lua-5.4.7/src/lzio.c index c9e1f491f..cd0a02d5f 100644 --- a/LuaSkin/lua-5.3.4/src/lzio.c +++ b/LuaSkin/lua-5.4.7/src/lzio.c @@ -1,5 +1,5 @@ /* -** $Id: lzio.c,v 1.37 2015/09/08 15:41:05 roberto Exp $ +** $Id: lzio.c $ ** Buffered streams ** See Copyright Notice in lua.h */ diff --git a/LuaSkin/lua-5.3.4/src/lzio.h b/LuaSkin/lua-5.4.7/src/lzio.h similarity index 96% rename from LuaSkin/lua-5.3.4/src/lzio.h rename to LuaSkin/lua-5.4.7/src/lzio.h index e7b6f34b1..38f397fd2 100644 --- a/LuaSkin/lua-5.3.4/src/lzio.h +++ b/LuaSkin/lua-5.4.7/src/lzio.h @@ -1,5 +1,5 @@ /* -** $Id: lzio.h,v 1.31 2015/09/08 15:41:05 roberto Exp $ +** $Id: lzio.h $ ** Buffered streams ** See Copyright Notice in lua.h */ diff --git a/Makefile b/Makefile deleted file mode 100644 index 4d451c4d2..000000000 --- a/Makefile +++ /dev/null @@ -1,64 +0,0 @@ -VERSION = $(shell defaults read `pwd`/Hammerspoon/CommandPost-Info CFBundleVersion) -APPFILE = build/CommandPost.app -ZIPFILE = build/CommandPost-$(VERSION).zip -SCHEME = Hammerspoon -CONFIGURATION = Debug -DOCS_SEARCH_DIRS = Hammerspoon/ extensions/ - -all: $(APPFILE) - -release: SCHEME = Release -release: CONFIGURATION = Release -release: all - -$(APPFILE): PRODUCT_DIR = $(shell xcodebuild -workspace Hammerspoon.xcworkspace -scheme $(SCHEME) -configuration $(CONFIGURATION) -showBuildSettings | sort | uniq | grep " BUILT_PRODUCTS_DIR =" | awk '{ print $$3 }') -$(APPFILE): build $(shell find Hammerspoon -type f) - echo "Building CommandPost in $(CONFIGURATION) configuration" - rm -rf $@ - xcodebuild -workspace Hammerspoon.xcworkspace -scheme $(SCHEME) -configuration $(CONFIGURATION) clean build > build/$(CONFIGURATION)-build.log - cp -R ${PRODUCT_DIR}/CommandPost.app $@ - cp -R ${PRODUCT_DIR}/CommandPost.app.dSYM build/ - cp -R ${PRODUCT_DIR}/LuaSkin.framework.dSYM build/ - -docs: build/Hammerspoon.docset - -build/Hammerspoon.docset: build/docs.sqlite build/html - rm -rf $@ - cp -R scripts/docs/templates/Hammerspoon.docset $@ - mv build/docs.sqlite $@/Contents/Resources/docSet.dsidx - cp build/html/* $@/Contents/Resources/Documents/ - tar -czf build/Hammerspoon.tgz -C build Hammerspoon.docset - -build/html: build/docs.json - mkdir -p $@ - rm -rf $@/* - cp scripts/docs/templates/docs.css $@ - cp scripts/docs/templates/jquery.js $@ - cp build/docs.json $@ - cp build/docs_index.json $@ - scripts/docs/bin/build_docs.py -o build/ --html $(DOCS_SEARCH_DIRS) - scripts/docs/bin/build_docs.py -o build/ --markdown $(DOCS_SEARCH_DIRS) - -build/html/LuaSkin: - headerdoc2html -u -o $@ LuaSkin/LuaSkin/Skin.h - resolveLinks $@ - mv $@/Skin_h/* $@ - rmdir $@/Skin_h - -build/docs.sqlite: build/docs.json - scripts/docs/bin/build_docs.py -o build/ --sql $(DOCS_SEARCH_DIRS) - -build/docs.json: build - scripts/docs/bin/build_docs.py -o build/ --json $(DOCS_SEARCH_DIRS) - -build: - mkdir -p build - -clean: - rm -rf build/ - rm -rf LuaSkin.framework - -clean-docs: - rm -fr build/Hammerspoon.docset build/Hammerspoon.tgz build/html build/docs.json build/docs.sqlite - -.PHONY: all release clean clean-docs diff --git a/PFMoveApplication.h b/PFMoveApplication.h deleted file mode 100755 index cc9bfa4d6..000000000 --- a/PFMoveApplication.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// PFMoveApplication.h, version 1.24 -// LetsMove -// -// Created by Andy Kim at Potion Factory LLC on 9/17/09 -// -// The contents of this file are dedicated to the public domain. - -#ifdef __cplusplus -extern "C" { -#endif - -#import - -/** - Moves the running application to ~/Applications or /Applications if the former does not exist. - After the move, it relaunches app from the new location. - DOES NOT work for sandboxed applications. - - Call from \c NSApplication's delegate method \c -applicationWillFinishLaunching: method. */ -void PFMoveToApplicationsFolderIfNecessary(void); - -/** - Check whether an app move is currently in progress. - Returns YES if LetsMove is currently in-progress trying to move the app to the Applications folder, or NO otherwise. - This can be used to work around a crash with apps that terminate after last window is closed. - See https://github.com/potionfactory/LetsMove/issues/64 for details. */ -BOOL PFMoveIsInProgress(void); - -#ifdef __cplusplus -} -#endif diff --git a/PFMoveApplication.m b/PFMoveApplication.m deleted file mode 100755 index bac507bc1..000000000 --- a/PFMoveApplication.m +++ /dev/null @@ -1,563 +0,0 @@ -// -// PFMoveApplication.m, version 1.24 -// LetsMove -// -// Created by Andy Kim at Potion Factory LLC on 9/17/09 -// -// The contents of this file are dedicated to the public domain. - -#import "PFMoveApplication.h" - -#import -#import -#import -#import - -@interface LetsMove : NSObject -@end - -@implementation LetsMove -+ (NSBundle *)bundle { - return [NSBundle bundleForClass:self]; -} -@end - -// Strings -// These are macros to be able to use custom i18n tools -#define _I10NS(nsstr) NSLocalizedStringFromTableInBundle(nsstr, @"MoveApplication", [LetsMove bundle], nil) -#define kStrMoveApplicationCouldNotMove _I10NS(@"Could not move to Applications folder") -#define kStrMoveApplicationQuestionTitle _I10NS(@"Move to Applications folder?") -#define kStrMoveApplicationQuestionTitleHome _I10NS(@"Move to Applications folder in your Home folder?") -#define kStrMoveApplicationQuestionMessage _I10NS(@"I can move myself to the Applications folder if you'd like.") -#define kStrMoveApplicationButtonMove _I10NS(@"Move to Applications Folder") -#define kStrMoveApplicationButtonDoNotMove _I10NS(@"Do Not Move") -#define kStrMoveApplicationQuestionInfoWillRequirePasswd _I10NS(@"Note that this will require an administrator password.") -#define kStrMoveApplicationQuestionInfoInDownloadsFolder _I10NS(@"This will keep your Downloads folder uncluttered.") - -// Needs to be defined for compiling under 10.5 SDK -#ifndef NSAppKitVersionNumber10_5 - #define NSAppKitVersionNumber10_5 949 -#endif - -// By default, we use a small control/font for the suppression button. -// If you prefer to use the system default (to match your other alerts), -// set this to 0. -#define PFUseSmallAlertSuppressCheckbox 1 - - -static NSString *AlertSuppressKey = @"moveToApplicationsFolderAlertSuppress"; -static BOOL MoveInProgress = NO; - -// Helper functions -static NSString *PreferredInstallLocation(BOOL *isUserDirectory); -static BOOL IsInApplicationsFolder(NSString *path); -static BOOL IsInDownloadsFolder(NSString *path); -static BOOL IsApplicationAtPathRunning(NSString *path); -static BOOL IsApplicationAtPathNested(NSString *path); -static NSString *ContainingDiskImageDevice(NSString *path); -static BOOL Trash(NSString *path); -static BOOL DeleteOrTrash(NSString *path); -static BOOL AuthorizedInstall(NSString *srcPath, NSString *dstPath, BOOL *canceled); -static BOOL CopyBundle(NSString *srcPath, NSString *dstPath); -static NSString *ShellQuotedString(NSString *string); -static void Relaunch(NSString *destinationPath); - -// Main worker function -void PFMoveToApplicationsFolderIfNecessary(void) { - - // Make sure to do our work on the main thread. - // Apparently Electron apps need this for things to work properly. - if (![NSThread isMainThread]) { - dispatch_async(dispatch_get_main_queue(), ^{ - PFMoveToApplicationsFolderIfNecessary(); - }); - return; - } - - // Skip if user suppressed the alert before - if ([[NSUserDefaults standardUserDefaults] boolForKey:AlertSuppressKey]) return; - - // Path of the bundle - NSString *bundlePath = [[NSBundle mainBundle] bundlePath]; - - // Check if the bundle is embedded in another application - BOOL isNestedApplication = IsApplicationAtPathNested(bundlePath); - - // Skip if the application is already in some Applications folder, - // unless it's inside another app's bundle. - if (IsInApplicationsFolder(bundlePath) && !isNestedApplication) return; - - // OK, looks like we'll need to do a move - set the status variable appropriately - MoveInProgress = YES; - - // File Manager - NSFileManager *fm = [NSFileManager defaultManager]; - - // Are we on a disk image? - NSString *diskImageDevice = ContainingDiskImageDevice(bundlePath); - - // Since we are good to go, get the preferred installation directory. - BOOL installToUserApplications = NO; - NSString *applicationsDirectory = PreferredInstallLocation(&installToUserApplications); - NSString *bundleName = [bundlePath lastPathComponent]; - NSString *destinationPath = [applicationsDirectory stringByAppendingPathComponent:bundleName]; - - // Check if we need admin password to write to the Applications directory - BOOL needAuthorization = ([fm isWritableFileAtPath:applicationsDirectory] == NO); - - // Check if the destination bundle is already there but not writable - needAuthorization |= ([fm fileExistsAtPath:destinationPath] && ![fm isWritableFileAtPath:destinationPath]); - - // Setup the alert - NSAlert *alert = [[[NSAlert alloc] init] autorelease]; - { - NSString *informativeText = nil; - - [alert setMessageText:(installToUserApplications ? kStrMoveApplicationQuestionTitleHome : kStrMoveApplicationQuestionTitle)]; - - informativeText = kStrMoveApplicationQuestionMessage; - - if (needAuthorization) { - informativeText = [informativeText stringByAppendingString:@" "]; - informativeText = [informativeText stringByAppendingString:kStrMoveApplicationQuestionInfoWillRequirePasswd]; - } - else if (IsInDownloadsFolder(bundlePath)) { - // Don't mention this stuff if we need authentication. The informative text is long enough as it is in that case. - informativeText = [informativeText stringByAppendingString:@" "]; - informativeText = [informativeText stringByAppendingString:kStrMoveApplicationQuestionInfoInDownloadsFolder]; - } - - [alert setInformativeText:informativeText]; - - // Add accept button - [alert addButtonWithTitle:kStrMoveApplicationButtonMove]; - - // Add deny button - NSButton *cancelButton = [alert addButtonWithTitle:kStrMoveApplicationButtonDoNotMove]; - [cancelButton setKeyEquivalent:[NSString stringWithFormat:@"%C", 0x1b]]; // Escape key - - // Setup suppression button - [alert setShowsSuppressionButton:YES]; - - if (PFUseSmallAlertSuppressCheckbox) { - NSCell *cell = [[alert suppressionButton] cell]; - [cell setControlSize:NSSmallControlSize]; - [cell setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; - } - } - - // Activate app -- work-around for focus issues related to "scary file from internet" OS dialog. - if (![NSApp isActive]) { - [NSApp activateIgnoringOtherApps:YES]; - } - - if ([alert runModal] == NSAlertFirstButtonReturn) { - NSLog(@"INFO -- Moving myself to the Applications folder"); - - // Move - if (needAuthorization) { - BOOL authorizationCanceled; - - if (!AuthorizedInstall(bundlePath, destinationPath, &authorizationCanceled)) { - if (authorizationCanceled) { - NSLog(@"INFO -- Not moving because user canceled authorization"); - MoveInProgress = NO; - return; - } - else { - NSLog(@"ERROR -- Could not copy myself to /Applications with authorization"); - goto fail; - } - } - } - else { - // If a copy already exists in the Applications folder, put it in the Trash - if ([fm fileExistsAtPath:destinationPath]) { - // But first, make sure that it's not running - if (IsApplicationAtPathRunning(destinationPath)) { - // Give the running app focus and terminate myself - NSLog(@"INFO -- Switching to an already running version"); - [[NSTask launchedTaskWithLaunchPath:@"/usr/bin/open" arguments:[NSArray arrayWithObject:destinationPath]] waitUntilExit]; - MoveInProgress = NO; - exit(0); - } - else { - if (!Trash([applicationsDirectory stringByAppendingPathComponent:bundleName])) - goto fail; - } - } - - if (!CopyBundle(bundlePath, destinationPath)) { - NSLog(@"ERROR -- Could not copy myself to %@", destinationPath); - goto fail; - } - } - - // Trash the original app. It's okay if this fails. - // NOTE: This final delete does not work if the source bundle is in a network mounted volume. - // Calling rm or file manager's delete method doesn't work either. It's unlikely to happen - // but it'd be great if someone could fix this. - if (!isNestedApplication && diskImageDevice == nil && !DeleteOrTrash(bundlePath)) { - NSLog(@"WARNING -- Could not delete application after moving it to Applications folder"); - } - - // Relaunch. - Relaunch(destinationPath); - - // Launched from within a disk image? -- unmount (if no files are open after 5 seconds, - // otherwise leave it mounted). - if (diskImageDevice && !isNestedApplication) { - NSString *script = [NSString stringWithFormat:@"(/bin/sleep 5 && /usr/bin/hdiutil detach %@) &", ShellQuotedString(diskImageDevice)]; - [NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", script, nil]]; - } - - MoveInProgress = NO; - exit(0); - } - // Save the alert suppress preference if checked - else if ([[alert suppressionButton] state] == NSOnState) { - [[NSUserDefaults standardUserDefaults] setBool:YES forKey:AlertSuppressKey]; - } - - MoveInProgress = NO; - return; - -fail: - { - // Show failure message - alert = [[[NSAlert alloc] init] autorelease]; - [alert setMessageText:kStrMoveApplicationCouldNotMove]; - [alert runModal]; - MoveInProgress = NO; - } -} - -BOOL PFMoveIsInProgress() { - return MoveInProgress; -} - -#pragma mark - -#pragma mark Helper Functions - -static NSString *PreferredInstallLocation(BOOL *isUserDirectory) { - // Return the preferred install location. - // Assume that if the user has a ~/Applications folder, they'd prefer their - // applications to go there. - - NSFileManager *fm = [NSFileManager defaultManager]; - - NSArray *userApplicationsDirs = NSSearchPathForDirectoriesInDomains(NSApplicationDirectory, NSUserDomainMask, YES); - - if ([userApplicationsDirs count] > 0) { - NSString *userApplicationsDir = [userApplicationsDirs objectAtIndex:0]; - BOOL isDirectory; - - if ([fm fileExistsAtPath:userApplicationsDir isDirectory:&isDirectory] && isDirectory) { - // User Applications directory exists. Get the directory contents. - NSArray *contents = [fm contentsOfDirectoryAtPath:userApplicationsDir error:NULL]; - - // Check if there is at least one ".app" inside the directory. - for (NSString *contentsPath in contents) { - if ([[contentsPath pathExtension] isEqualToString:@"app"]) { - if (isUserDirectory) *isUserDirectory = YES; - return [userApplicationsDir stringByResolvingSymlinksInPath]; - } - } - } - } - - // No user Applications directory in use. Return the machine local Applications directory - if (isUserDirectory) *isUserDirectory = NO; - - return [[NSSearchPathForDirectoriesInDomains(NSApplicationDirectory, NSLocalDomainMask, YES) lastObject] stringByResolvingSymlinksInPath]; -} - -static BOOL IsInApplicationsFolder(NSString *path) { - // Check all the normal Application directories - NSArray *applicationDirs = NSSearchPathForDirectoriesInDomains(NSApplicationDirectory, NSAllDomainsMask, YES); - for (NSString *appDir in applicationDirs) { - if ([path hasPrefix:appDir]) return YES; - } - - // Also, handle the case that the user has some other Application directory (perhaps on a separate data partition). - if ([[path pathComponents] containsObject:@"Applications"]) return YES; - - return NO; -} - -static BOOL IsInDownloadsFolder(NSString *path) { - NSArray *downloadDirs = NSSearchPathForDirectoriesInDomains(NSDownloadsDirectory, NSAllDomainsMask, YES); - for (NSString *downloadsDirPath in downloadDirs) { - if ([path hasPrefix:downloadsDirPath]) return YES; - } - - return NO; -} - -static BOOL IsApplicationAtPathRunning(NSString *bundlePath) { - bundlePath = [bundlePath stringByStandardizingPath]; - -#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 - // Use the new API on 10.6 or higher to determine if the app is already running - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5) { - for (NSRunningApplication *runningApplication in [[NSWorkspace sharedWorkspace] runningApplications]) { - NSString *runningAppBundlePath = [[[runningApplication bundleURL] path] stringByStandardizingPath]; - if ([runningAppBundlePath isEqualToString:bundlePath]) { - return YES; - } - } - return NO; - } -#endif - // Use the shell to determine if the app is already running on systems 10.5 or lower - NSString *script = [NSString stringWithFormat:@"/bin/ps ax -o comm | /usr/bin/grep %@/ | /usr/bin/grep -v grep >/dev/null", ShellQuotedString(bundlePath)]; - NSTask *task = [NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", script, nil]]; - [task waitUntilExit]; - - // If the task terminated with status 0, it means that the final grep produced 1 or more lines of output. - // Which means that the app is already running - return [task terminationStatus] == 0; -} - -static BOOL IsApplicationAtPathNested(NSString *path) { - NSString *containingPath = [path stringByDeletingLastPathComponent]; - - NSArray *components = [containingPath pathComponents]; - for (NSString *component in components) { - if ([[component pathExtension] isEqualToString:@"app"]) { - return YES; - } - } - - return NO; -} - -static NSString *ContainingDiskImageDevice(NSString *path) { - NSString *containingPath = [path stringByDeletingLastPathComponent]; - - struct statfs fs; - if (statfs([containingPath fileSystemRepresentation], &fs) || (fs.f_flags & MNT_ROOTFS)) - return nil; - - NSString *device = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:fs.f_mntfromname length:strlen(fs.f_mntfromname)]; - - NSTask *hdiutil = [[[NSTask alloc] init] autorelease]; - [hdiutil setLaunchPath:@"/usr/bin/hdiutil"]; - [hdiutil setArguments:[NSArray arrayWithObjects:@"info", @"-plist", nil]]; - [hdiutil setStandardOutput:[NSPipe pipe]]; - [hdiutil launch]; - [hdiutil waitUntilExit]; - - NSData *data = [[[hdiutil standardOutput] fileHandleForReading] readDataToEndOfFile]; - NSDictionary *info = nil; -#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5) { - info = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListImmutable format:NULL error:NULL]; - } - else { -#endif -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10 - info = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:NSPropertyListImmutable format:NULL errorDescription:NULL]; -#endif -#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 - } -#endif - - if (![info isKindOfClass:[NSDictionary class]]) return nil; - - NSArray *images = (NSArray *)[info objectForKey:@"images"]; - if (![images isKindOfClass:[NSArray class]]) return nil; - - for (NSDictionary *image in images) { - if (![image isKindOfClass:[NSDictionary class]]) return nil; - - id systemEntities = [image objectForKey:@"system-entities"]; - if (![systemEntities isKindOfClass:[NSArray class]]) return nil; - - for (NSDictionary *systemEntity in systemEntities) { - if (![systemEntity isKindOfClass:[NSDictionary class]]) return nil; - - NSString *devEntry = [systemEntity objectForKey:@"dev-entry"]; - if (![devEntry isKindOfClass:[NSString class]]) return nil; - - if ([devEntry isEqualToString:device]) - return device; - } - } - - return nil; -} - -static BOOL Trash(NSString *path) { - BOOL result = NO; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 - if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_8) { - result = [[NSFileManager defaultManager] trashItemAtURL:[NSURL fileURLWithPath:path] resultingItemURL:NULL error:NULL]; - } -#endif -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_11 - if (!result) { - result = [[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation - source:[path stringByDeletingLastPathComponent] - destination:@"" - files:[NSArray arrayWithObject:[path lastPathComponent]] - tag:NULL]; - } -#endif - - // As a last resort try trashing with AppleScript. - // This allows us to trash the app in macOS Sierra even when the app is running inside - // an app translocation image. - if (!result) { - NSAppleScript *appleScript = [[[NSAppleScript alloc] initWithSource: - [NSString stringWithFormat:@"\ - set theFile to POSIX file \"%@\" \n\ - tell application \"Finder\" \n\ - move theFile to trash \n\ - end tell", path]] autorelease]; - NSDictionary *errorDict = nil; - NSAppleEventDescriptor *scriptResult = [appleScript executeAndReturnError:&errorDict]; - if (scriptResult == nil) { - NSLog(@"Trash AppleScript error: %@", errorDict); - } - result = (scriptResult != nil); - } - - if (!result) { - NSLog(@"ERROR -- Could not trash '%@'", path); - } - - return result; -} - -static BOOL DeleteOrTrash(NSString *path) { - NSError *error; - - if ([[NSFileManager defaultManager] removeItemAtPath:path error:&error]) { - return YES; - } - else { - // Don't log warning if on Sierra and running inside App Translocation path - if ([path rangeOfString:@"/AppTranslocation/"].location == NSNotFound) - NSLog(@"WARNING -- Could not delete '%@': %@", path, [error localizedDescription]); - - return Trash(path); - } -} - -static BOOL AuthorizedInstall(NSString *srcPath, NSString *dstPath, BOOL *canceled) { - if (canceled) *canceled = NO; - - // Make sure that the destination path is an app bundle. We're essentially running 'sudo rm -rf' - // so we really don't want to fuck this up. - if (![[dstPath pathExtension] isEqualToString:@"app"]) return NO; - - // Do some more checks - if ([[dstPath stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length] == 0) return NO; - if ([[srcPath stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length] == 0) return NO; - - int pid, status; - AuthorizationRef myAuthorizationRef; - - // Get the authorization - OSStatus err = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &myAuthorizationRef); - if (err != errAuthorizationSuccess) return NO; - - AuthorizationItem myItems = {kAuthorizationRightExecute, 0, NULL, 0}; - AuthorizationRights myRights = {1, &myItems}; - AuthorizationFlags myFlags = (AuthorizationFlags)(kAuthorizationFlagInteractionAllowed | kAuthorizationFlagExtendRights | kAuthorizationFlagPreAuthorize); - - err = AuthorizationCopyRights(myAuthorizationRef, &myRights, NULL, myFlags, NULL); - if (err != errAuthorizationSuccess) { - if (err == errAuthorizationCanceled && canceled) - *canceled = YES; - goto fail; - } - - static OSStatus (*security_AuthorizationExecuteWithPrivileges)(AuthorizationRef authorization, const char *pathToTool, - AuthorizationFlags options, char * const *arguments, - FILE **communicationsPipe) = NULL; - if (!security_AuthorizationExecuteWithPrivileges) { - // On 10.7, AuthorizationExecuteWithPrivileges is deprecated. We want to still use it since there's no - // good alternative (without requiring code signing). We'll look up the function through dyld and fail - // if it is no longer accessible. If Apple removes the function entirely this will fail gracefully. If - // they keep the function and throw some sort of exception, this won't fail gracefully, but that's a - // risk we'll have to take for now. - security_AuthorizationExecuteWithPrivileges = (OSStatus (*)(AuthorizationRef, const char*, - AuthorizationFlags, char* const*, - FILE **)) dlsym(RTLD_DEFAULT, "AuthorizationExecuteWithPrivileges"); - } - if (!security_AuthorizationExecuteWithPrivileges) goto fail; - - // Delete the destination - { - char *args[] = {"-rf", (char *)[dstPath fileSystemRepresentation], NULL}; - err = security_AuthorizationExecuteWithPrivileges(myAuthorizationRef, "/bin/rm", kAuthorizationFlagDefaults, args, NULL); - if (err != errAuthorizationSuccess) goto fail; - - // Wait until it's done - pid = wait(&status); - if (pid == -1 || !WIFEXITED(status)) goto fail; // We don't care about exit status as the destination most likely does not exist - } - - // Copy - { - char *args[] = {"-pR", (char *)[srcPath fileSystemRepresentation], (char *)[dstPath fileSystemRepresentation], NULL}; - err = security_AuthorizationExecuteWithPrivileges(myAuthorizationRef, "/bin/cp", kAuthorizationFlagDefaults, args, NULL); - if (err != errAuthorizationSuccess) goto fail; - - // Wait until it's done - pid = wait(&status); - if (pid == -1 || !WIFEXITED(status) || WEXITSTATUS(status)) goto fail; - } - - AuthorizationFree(myAuthorizationRef, kAuthorizationFlagDefaults); - return YES; - -fail: - AuthorizationFree(myAuthorizationRef, kAuthorizationFlagDefaults); - return NO; -} - -static BOOL CopyBundle(NSString *srcPath, NSString *dstPath) { - NSFileManager *fm = [NSFileManager defaultManager]; - NSError *error = nil; - - if ([fm copyItemAtPath:srcPath toPath:dstPath error:&error]) { - return YES; - } - else { - NSLog(@"ERROR -- Could not copy '%@' to '%@' (%@)", srcPath, dstPath, error); - return NO; - } -} - -static NSString *ShellQuotedString(NSString *string) { - return [NSString stringWithFormat:@"'%@'", [string stringByReplacingOccurrencesOfString:@"'" withString:@"'\\''"]]; -} - -static void Relaunch(NSString *destinationPath) { - // The shell script waits until the original app process terminates. - // This is done so that the relaunched app opens as the front-most app. - int pid = [[NSProcessInfo processInfo] processIdentifier]; - - // Command run just before running open /final/path - NSString *preOpenCmd = @""; - - NSString *quotedDestinationPath = ShellQuotedString(destinationPath); - - // OS X >=10.5: - // Before we launch the new app, clear xattr:com.apple.quarantine to avoid - // duplicate "scary file from the internet" dialog. - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5) { - // Add the -r flag on 10.6 - preOpenCmd = [NSString stringWithFormat:@"/usr/bin/xattr -d -r com.apple.quarantine %@", quotedDestinationPath]; - } - else { - preOpenCmd = [NSString stringWithFormat:@"/usr/bin/xattr -d com.apple.quarantine %@", quotedDestinationPath]; - } - - NSString *script = [NSString stringWithFormat:@"(while /bin/kill -0 %d >&/dev/null; do /bin/sleep 0.1; done; %@; /usr/bin/open %@) &", pid, preOpenCmd, quotedDestinationPath]; - - [NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", script, nil]]; -} diff --git a/Podfile b/Podfile index c1352a2e0..01be9c89e 100644 --- a/Podfile +++ b/Podfile @@ -1,16 +1,47 @@ # Uncomment this line to define a global platform for your project -platform :osx, '10.10' +platform :osx, '13.0' + +inhibit_all_warnings! source 'https://github.com/CocoaPods/Specs.git' +project 'Hammerspoon', 'Profile' => :debug + target 'Hammerspoon' do pod 'ASCIImage', '1.0.0' -pod 'CocoaLumberjack', '3.4.1' -pod 'CocoaAsyncSocket', '7.6.2' -pod 'CocoaHTTPServer', '2.3' +pod 'CocoaLumberjack', '3.8.5' +pod 'CocoaAsyncSocket', '7.6.5' +pod 'CocoaHTTPServer', :git => 'https://github.com/Hammerspoon/CocoaHTTPServer.git' pod 'PocketSocket/Client', '1.0.1' -pod 'Crashlytics', '3.9.3' -pod 'Fabric', '1.7.2' -pod 'Sparkle', '1.18.1', :configurations => ['Release'] -pod 'MIKMIDI' +pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git', :tag => '9.1.0' +pod 'Sparkle', '2.7.1', :configurations => ['Release'] +pod 'MIKMIDI', '1.7.1' +pod 'SocketRocket', '0.7.1' +pod 'ORSSerialPort', '2.1.0' +pod 'F53OSC', :git => 'https://github.com/Figure53/F53OSC.git', :tag => '1.2.0' +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + puts "Enabling assertions in #{target.name}" + + target.build_configurations.each do |config| + config.build_settings['ENABLE_NS_ASSERTIONS'] = 'YES' + if ['10.6', '10.7', '10.8', '10.9', '10.10', '10.11', '10.12', '10.13', '10.14', '10.15', '11.0', '11.1', '11.2', '11.3', '11.4', '11.5', '12.0'].include? config.build_settings['MACOSX_DEPLOYMENT_TARGET'] + config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '13.0' + end + end + + puts "Removing hard-coded architecture in #{target.name}" + target.build_configurations.each do |config| + config.build_settings.delete 'ARCHS' + end + + puts "Configuring Sentry" + target.build_configurations.each do |config| + if target.name == 'Sentry' + config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'SENTRY_NO_UIKIT=1'] + end + end + end end diff --git a/Podfile.lock b/Podfile.lock index 889109d97..a0af7562d 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,46 +1,82 @@ PODS: - ASCIImage (1.0.0) - - CocoaAsyncSocket (7.6.2) + - CocoaAsyncSocket (7.6.5) - CocoaHTTPServer (2.3): - CocoaAsyncSocket - CocoaLumberjack - - CocoaLumberjack (3.4.1): - - CocoaLumberjack/Default (= 3.4.1) - - CocoaLumberjack/Extensions (= 3.4.1) - - CocoaLumberjack/Default (3.4.1) - - CocoaLumberjack/Extensions (3.4.1): - - CocoaLumberjack/Default - - Crashlytics (3.9.3): - - Fabric (~> 1.7.2) - - Fabric (1.7.2) - - MIKMIDI (1.6.2) + - CocoaLumberjack (3.8.5): + - CocoaLumberjack/Core (= 3.8.5) + - CocoaLumberjack/Core (3.8.5) + - F53OSC (1.2.0) + - MIKMIDI (1.7.1) + - ORSSerialPort (2.1) - PocketSocket/Client (1.0.1): - PocketSocket/Core - PocketSocket/Core (1.0.1) - - Sparkle (1.18.1) + - Sentry (9.1.0): + - Sentry/Core (= 9.1.0) + - Sentry/Core (9.1.0) + - SocketRocket (0.7.1) + - Sparkle (2.7.1) DEPENDENCIES: - ASCIImage (= 1.0.0) - - CocoaAsyncSocket (= 7.6.2) - - CocoaHTTPServer (= 2.3) - - CocoaLumberjack (= 3.4.1) - - Crashlytics (= 3.9.3) - - Fabric (= 1.7.2) - - MIKMIDI + - CocoaAsyncSocket (= 7.6.5) + - CocoaHTTPServer (from `https://github.com/Hammerspoon/CocoaHTTPServer.git`) + - CocoaLumberjack (= 3.8.5) + - F53OSC (from `https://github.com/Figure53/F53OSC.git`, tag `1.2.0`) + - MIKMIDI (= 1.7.1) + - ORSSerialPort (= 2.1.0) - PocketSocket/Client (= 1.0.1) - - Sparkle (= 1.18.1) + - Sentry (from `https://github.com/getsentry/sentry-cocoa.git`, tag `9.1.0`) + - SocketRocket (= 0.7.1) + - Sparkle (= 2.7.1) + +SPEC REPOS: + https://github.com/CocoaPods/Specs.git: + - ASCIImage + - CocoaAsyncSocket + - CocoaLumberjack + - MIKMIDI + - ORSSerialPort + - PocketSocket + - SocketRocket + - Sparkle + +EXTERNAL SOURCES: + CocoaHTTPServer: + :git: https://github.com/Hammerspoon/CocoaHTTPServer.git + F53OSC: + :git: https://github.com/Figure53/F53OSC.git + :tag: 1.2.0 + Sentry: + :git: https://github.com/getsentry/sentry-cocoa.git + :tag: 9.1.0 + +CHECKOUT OPTIONS: + CocoaHTTPServer: + :commit: aa05e484e2f5c8b6454590ed06a97b2bf636a1ca + :git: https://github.com/Hammerspoon/CocoaHTTPServer.git + F53OSC: + :git: https://github.com/Figure53/F53OSC.git + :tag: 1.2.0 + Sentry: + :git: https://github.com/getsentry/sentry-cocoa.git + :tag: 9.1.0 SPEC CHECKSUMS: ASCIImage: bcff9650deae86e0e0ac310145cc628948201ab8 - CocoaAsyncSocket: 3541e024f48c54b251638ef72d51dd42808de932 + CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 CocoaHTTPServer: 5624681fc3473d43b18202f635f9b3abb013b530 - CocoaLumberjack: 2e258a064cacc8eb9a2aca318e24d02a0a7fd56d - Crashlytics: dbb07d01876c171c5ccbdf7826410380189e452c - Fabric: 9cd6a848efcf1b8b07497e0b6a2e7d336353ba15 - MIKMIDI: fa6df0bfa8427a0dc9e179bcf068b2b4b6747e6c + CocoaLumberjack: 6a459bc897d6d80bd1b8c78482ec7ad05dffc3f0 + F53OSC: 03b06a1da4cfc40d8841f8a5f4eacbc68ce8e289 + MIKMIDI: f53dca2f372e71183ecdd2b35c984c1c2cd11cbc + ORSSerialPort: d2d5d131797453430c557ba8dc7dcbcae20ff2e5 PocketSocket: 9c6867d66fb4f962af96b9b07f4b45bb561b2c2a - Sparkle: 06ea33170007c5937ee54da481b4481af98fac79 + Sentry: be734c121a4181156ca993a61cac33bb723f3834 + SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748 + Sparkle: 5f93557176b762f712e8cd80680778bf23c7348c -PODFILE CHECKSUM: 0190c25c88bfb32f1c33c6b475ba535918ceb6f4 +PODFILE CHECKSUM: d3da6af5587e882b2ac20269ff92fb631b1ef906 -COCOAPODS: 1.4.0 +COCOAPODS: 1.16.2 diff --git a/Pods/CocoaAsyncSocket/README.markdown b/Pods/CocoaAsyncSocket/README.markdown index 4776884bf..155a8dab5 100644 --- a/Pods/CocoaAsyncSocket/README.markdown +++ b/Pods/CocoaAsyncSocket/README.markdown @@ -2,13 +2,13 @@ [![Build Status](https://travis-ci.org/robbiehanson/CocoaAsyncSocket.svg?branch=master)](https://travis-ci.org/robbiehanson/CocoaAsyncSocket) [![Version Status](https://img.shields.io/cocoapods/v/CocoaAsyncSocket.svg?style=flat)](http://cocoadocs.org/docsets/CocoaAsyncSocket) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Platform](http://img.shields.io/cocoapods/p/CocoaAsyncSocket.svg?style=flat)](http://cocoapods.org/?q=CocoaAsyncSocket) [![license Public Domain](https://img.shields.io/badge/license-Public%20Domain-orange.svg?style=flat)](https://en.wikipedia.org/wiki/Public_domain) -CocoaAsyncSocket provides easy-to-use and powerful asynchronous socket libraries for Mac and iOS. The classes are described below. +CocoaAsyncSocket provides easy-to-use and powerful asynchronous socket libraries for macOS, iOS, and tvOS. The classes are described below. ## Installation #### CocoaPods -Install using [CocoaPods](http://cocoapods.org) by adding this line to your Podfile: +Install using [CocoaPods](https://cocoapods.org) by adding this line to your Podfile: ````ruby use_frameworks! # Add this if you are targeting iOS 8+ or using Swift @@ -31,6 +31,15 @@ The project is currently configured to build for **iOS**, **tvOS** and **Mac**. Select the correct framework(s) and drag it into your project. +#### Swift Package Manager + +Simply add the package dependency to your Package.swift and depend on "CocoaAsyncSocket" in the necessary targets: +```swift +dependencies: [ + .package(url: "https://github.com/robbiehanson/CocoaAsyncSocket", from: "7.6.4") +] +``` + #### Manual You can also include it into your project by adding the source files directly, but you should probably be using a dependency manager to keep up to date. @@ -40,10 +49,10 @@ You can also include it into your project by adding the source files directly, b Using Objective-C: ```obj-c -// When using iOS 8+ frameworks +// When using Clang Modules: @import CocoaAsyncSocket; -// OR when not using frameworks, targeting iOS 7 or below +// or when not: #import "GCDAsyncSocket.h" // for TCP #import "GCDAsyncUdpSocket.h" // for UDP ``` @@ -58,7 +67,7 @@ import CocoaAsyncSocket **GCDAsyncSocket** is a TCP/IP socket networking library built atop Grand Central Dispatch. Here are the key features available: -- Native objective-c, fully self-contained in one class.
    +- Native Objective-C, fully self-contained in one class.
    _No need to muck around with sockets or streams. This class handles everything for you._ - Full delegate support
    @@ -79,14 +88,11 @@ import CocoaAsyncSocket - Fully GCD based and Thread-Safe
    _It runs entirely within its own GCD dispatch_queue, and is completely thread-safe. Further, the delegate methods are all invoked asynchronously onto a dispatch_queue of your choosing. This means parallel operation of your socket code, and your delegate/processing code._ -- The Latest Technology & Performance Optimizations
    - _Internally the library takes advantage of technologies such as [kqueue's](http://en.wikipedia.org/wiki/Kqueue) to limit [system calls](http://en.wikipedia.org/wiki/System_call) and optimize buffer allocations. In other words, peak performance._ - ## UDP **GCDAsyncUdpSocket** is a UDP/IP socket networking library built atop Grand Central Dispatch. Here are the key features available: -- Native objective-c, fully self-contained in one class.
    +- Native Objective-C, fully self-contained in one class.
    _No need to muck around with low-level sockets. This class handles everything for you._ - Full delegate support.
    @@ -105,7 +111,7 @@ import CocoaAsyncSocket For those new(ish) to networking, it's recommended you **[read the wiki](https://github.com/robbiehanson/CocoaAsyncSocket/wiki)**.
    _Sockets might not work exactly like you think they do..._ -**Still got questions?** Try the **[CocoaAsyncSocket Mailing List](http://groups.google.com/group/cocoaasyncsocket)**. +**Still got questions?** Try the **[CocoaAsyncSocket Mailing List](https://groups.google.com/group/cocoaasyncsocket)**. *** Love the project? Wanna buy me a ☕️  ? (or a 🍺  😀 ): diff --git a/Pods/CocoaAsyncSocket/Source/GCD/GCDAsyncSocket.h b/Pods/CocoaAsyncSocket/Source/GCD/GCDAsyncSocket.h index bf285b37e..c339f8abc 100644 --- a/Pods/CocoaAsyncSocket/Source/GCD/GCDAsyncSocket.h +++ b/Pods/CocoaAsyncSocket/Source/GCD/GCDAsyncSocket.h @@ -42,6 +42,7 @@ extern NSString *const GCDAsyncSocketSSLProtocolVersionMax; extern NSString *const GCDAsyncSocketSSLSessionOptionFalseStart; extern NSString *const GCDAsyncSocketSSLSessionOptionSendOneByteRecord; extern NSString *const GCDAsyncSocketSSLCipherSuites; +extern NSString *const GCDAsyncSocketSSLALPN; #if !TARGET_OS_IPHONE extern NSString *const GCDAsyncSocketSSLDiffieHellmanParameters; #endif @@ -49,7 +50,7 @@ extern NSString *const GCDAsyncSocketSSLDiffieHellmanParameters; #define GCDAsyncSocketLoggingContext 65535 -typedef NS_ENUM(NSInteger, GCDAsyncSocketError) { +typedef NS_ERROR_ENUM(GCDAsyncSocketErrorDomain, GCDAsyncSocketError) { GCDAsyncSocketNoError = 0, // Never used GCDAsyncSocketBadConfigError, // Invalid configuration GCDAsyncSocketBadParamError, // Invalid parameter was passed @@ -87,7 +88,7 @@ typedef NS_ENUM(NSInteger, GCDAsyncSocketError) { - (instancetype)init; - (instancetype)initWithSocketQueue:(nullable dispatch_queue_t)sq; - (instancetype)initWithDelegate:(nullable id)aDelegate delegateQueue:(nullable dispatch_queue_t)dq; -- (instancetype)initWithDelegate:(nullable id)aDelegate delegateQueue:(nullable dispatch_queue_t)dq socketQueue:(nullable dispatch_queue_t)sq; +- (instancetype)initWithDelegate:(nullable id)aDelegate delegateQueue:(nullable dispatch_queue_t)dq socketQueue:(nullable dispatch_queue_t)sq NS_DESIGNATED_INITIALIZER; /** * Create GCDAsyncSocket from already connect BSD socket file descriptor @@ -254,7 +255,7 @@ typedef NS_ENUM(NSInteger, GCDAsyncSocketError) { * struct sockaddr sa -> NSData *dsa = [NSData dataWithBytes:&remoteAddr length:remoteAddr.sa_len]; * struct sockaddr *sa -> NSData *dsa = [NSData dataWithBytes:remoteAddr length:remoteAddr->sa_len]; * - * This method invokes connectToAdd + * This method invokes connectToAddress:remoteAddr viaInterface:nil withTimeout:-1 error:errPtr. **/ - (BOOL)connectToAddress:(NSData *)remoteAddr error:(NSError **)errPtr; @@ -308,6 +309,12 @@ typedef NS_ENUM(NSInteger, GCDAsyncSocketError) { */ - (BOOL)connectToUrl:(NSURL *)url withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr; +/** + * Iterates over the given NetService's addresses in order, and invokes connectToAddress:error:. Stops at the + * first invocation that succeeds and returns YES; otherwise returns NO. + */ +- (BOOL)connectToNetService:(NSNetService *)netService error:(NSError **)errPtr; + #pragma mark Disconnecting /** @@ -429,7 +436,7 @@ typedef NS_ENUM(NSInteger, GCDAsyncSocketError) { * The given buffer will automatically be increased in size if needed. * * If the timeout value is negative, the read operation will not use a timeout. - * If the buffer if nil, the socket will create a buffer for you. + * If the buffer is nil, the socket will create a buffer for you. * * If the bufferOffset is greater than the length of the given buffer, * the method will do nothing, and the delegate will not be called. @@ -451,7 +458,7 @@ typedef NS_ENUM(NSInteger, GCDAsyncSocketError) { * A maximum of length bytes will be read. * * If the timeout value is negative, the read operation will not use a timeout. - * If the buffer if nil, a buffer will automatically be created for you. + * If the buffer is nil, a buffer will automatically be created for you. * If maxLength is zero, no length restriction is enforced. * * If the bufferOffset is greater than the length of the given buffer, @@ -483,7 +490,7 @@ typedef NS_ENUM(NSInteger, GCDAsyncSocketError) { * The given buffer will automatically be increased in size if needed. * * If the timeout value is negative, the read operation will not use a timeout. - * If the buffer if nil, a buffer will automatically be created for you. + * If the buffer is nil, a buffer will automatically be created for you. * * If the length is 0, this method does nothing and the delegate is not called. * If the bufferOffset is greater than the length of the given buffer, @@ -521,7 +528,7 @@ typedef NS_ENUM(NSInteger, GCDAsyncSocketError) { * For performance reasons, the socket will retain it, not copy it. * So if it is immutable, don't modify it while the socket is using it. **/ -- (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag; +- (void)readDataToData:(nullable NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag; /** * Reads bytes until (and including) the passed "data" parameter, which acts as a separator. @@ -529,7 +536,7 @@ typedef NS_ENUM(NSInteger, GCDAsyncSocketError) { * The given buffer will automatically be increased in size if needed. * * If the timeout value is negative, the read operation will not use a timeout. - * If the buffer if nil, a buffer will automatically be created for you. + * If the buffer is nil, a buffer will automatically be created for you. * * If the bufferOffset is greater than the length of the given buffer, * the method will do nothing (except maybe print a warning), and the delegate will not be called. @@ -594,7 +601,7 @@ typedef NS_ENUM(NSInteger, GCDAsyncSocketError) { * The given buffer will automatically be increased in size if needed. * * If the timeout value is negative, the read operation will not use a timeout. - * If the buffer if nil, a buffer will automatically be created for you. + * If the buffer is nil, a buffer will automatically be created for you. * * If maxLength is zero, no length restriction is enforced. * Otherwise if maxLength bytes are read without completing the read, @@ -656,7 +663,7 @@ typedef NS_ENUM(NSInteger, GCDAsyncSocketError) { * completes writing the bytes (which is NOT immediately after this method returns, but rather at a later time * when the delegate method notifies you), then you should first copy the bytes, and pass the copy to this method. **/ -- (void)writeData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag; +- (void)writeData:(nullable NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag; /** * Returns progress of the current write, from 0.0 to 1.0, or NaN if no current write (use isnan() to check). @@ -747,7 +754,7 @@ typedef NS_ENUM(NSInteger, GCDAsyncSocketError) { * * - GCDAsyncSocketSSLCipherSuites * The values must be of type NSArray. - * Each item within the array must be a NSNumber, encapsulating + * Each item within the array must be a NSNumber, encapsulating an SSLCipherSuite. * See Apple's documentation for SSLSetEnabledCiphers. * See also the SSLCipherSuite typedef. * @@ -1110,7 +1117,7 @@ typedef NS_ENUM(NSInteger, GCDAsyncSocketError) { /** * Called when a socket has read in data, but has not yet completed the read. * This would occur if using readToData: or readToLength: methods. - * It may be used to for things such as updating progress bars. + * It may be used for things such as updating progress bars. **/ - (void)socket:(GCDAsyncSocket *)sock didReadPartialDataOfLength:(NSUInteger)partialLength tag:(long)tag; @@ -1121,7 +1128,7 @@ typedef NS_ENUM(NSInteger, GCDAsyncSocketError) { /** * Called when a socket has written some data, but has not yet completed the entire write. - * It may be used to for things such as updating progress bars. + * It may be used for things such as updating progress bars. **/ - (void)socket:(GCDAsyncSocket *)sock didWritePartialDataOfLength:(NSUInteger)partialLength tag:(long)tag; diff --git a/Pods/CocoaAsyncSocket/Source/GCD/GCDAsyncSocket.m b/Pods/CocoaAsyncSocket/Source/GCD/GCDAsyncSocket.m old mode 100644 new mode 100755 index 38865a724..f3d1c1716 --- a/Pods/CocoaAsyncSocket/Source/GCD/GCDAsyncSocket.m +++ b/Pods/CocoaAsyncSocket/Source/GCD/GCDAsyncSocket.m @@ -125,6 +125,7 @@ NSString *const GCDAsyncSocketSSLSessionOptionFalseStart = @"GCDAsyncSocketSSLSessionOptionFalseStart"; NSString *const GCDAsyncSocketSSLSessionOptionSendOneByteRecord = @"GCDAsyncSocketSSLSessionOptionSendOneByteRecord"; NSString *const GCDAsyncSocketSSLCipherSuites = @"GCDAsyncSocketSSLCipherSuites"; +NSString *const GCDAsyncSocketSSLALPN = @"GCDAsyncSocketSSLALPN"; #if !TARGET_OS_IPHONE NSString *const GCDAsyncSocketSSLDiffieHellmanParameters = @"GCDAsyncSocketSSLDiffieHellmanParameters"; #endif @@ -202,7 +203,7 @@ @interface GCDAsyncSocketPreBuffer : NSObject uint8_t *writePointer; } -- (id)initWithCapacity:(size_t)numBytes; +- (instancetype)initWithCapacity:(size_t)numBytes NS_DESIGNATED_INITIALIZER; - (void)ensureCapacityForWrite:(size_t)numBytes; @@ -225,7 +226,14 @@ - (void)reset; @implementation GCDAsyncSocketPreBuffer -- (id)initWithCapacity:(size_t)numBytes +// Cover the superclass' designated initializer +- (instancetype)init NS_UNAVAILABLE +{ + NSAssert(0, @"Use the designated initializer"); + return nil; +} + +- (instancetype)initWithCapacity:(size_t)numBytes { if ((self = [super init])) { @@ -348,13 +356,13 @@ @interface GCDAsyncReadPacket : NSObject NSUInteger originalBufferLength; long tag; } -- (id)initWithData:(NSMutableData *)d - startOffset:(NSUInteger)s - maxLength:(NSUInteger)m - timeout:(NSTimeInterval)t - readLength:(NSUInteger)l - terminator:(NSData *)e - tag:(long)i; +- (instancetype)initWithData:(NSMutableData *)d + startOffset:(NSUInteger)s + maxLength:(NSUInteger)m + timeout:(NSTimeInterval)t + readLength:(NSUInteger)l + terminator:(NSData *)e + tag:(long)i NS_DESIGNATED_INITIALIZER; - (void)ensureCapacityForAdditionalDataOfLength:(NSUInteger)bytesToRead; @@ -370,13 +378,20 @@ - (NSInteger)searchForTermAfterPreBuffering:(ssize_t)numBytes; @implementation GCDAsyncReadPacket -- (id)initWithData:(NSMutableData *)d - startOffset:(NSUInteger)s - maxLength:(NSUInteger)m - timeout:(NSTimeInterval)t - readLength:(NSUInteger)l - terminator:(NSData *)e - tag:(long)i +// Cover the superclass' designated initializer +- (instancetype)init NS_UNAVAILABLE +{ + NSAssert(0, @"Use the designated initializer"); + return nil; +} + +- (instancetype)initWithData:(NSMutableData *)d + startOffset:(NSUInteger)s + maxLength:(NSUInteger)m + timeout:(NSTimeInterval)t + readLength:(NSUInteger)l + terminator:(NSData *)e + tag:(long)i { if((self = [super init])) { @@ -441,8 +456,7 @@ - (NSUInteger)optimalReadLengthWithDefault:(NSUInteger)defaultValue shouldPreBuf if (readLength > 0) { // Read a specific length of data - - result = MIN(defaultValue, (readLength - bytesDone)); + result = readLength - bytesDone; // There is no need to prebuffer since we know exactly how much data we need to read. // Even if the buffer isn't currently big enough to fit this amount of data, @@ -808,12 +822,19 @@ @interface GCDAsyncWritePacket : NSObject long tag; NSTimeInterval timeout; } -- (id)initWithData:(NSData *)d timeout:(NSTimeInterval)t tag:(long)i; +- (instancetype)initWithData:(NSData *)d timeout:(NSTimeInterval)t tag:(long)i NS_DESIGNATED_INITIALIZER; @end @implementation GCDAsyncWritePacket -- (id)initWithData:(NSData *)d timeout:(NSTimeInterval)t tag:(long)i +// Cover the superclass' designated initializer +- (instancetype)init NS_UNAVAILABLE +{ + NSAssert(0, @"Use the designated initializer"); + return nil; +} + +- (instancetype)initWithData:(NSData *)d timeout:(NSTimeInterval)t tag:(long)i { if((self = [super init])) { @@ -841,12 +862,19 @@ @interface GCDAsyncSpecialPacket : NSObject @public NSDictionary *tlsSettings; } -- (id)initWithTLSSettings:(NSDictionary *)settings; +- (instancetype)initWithTLSSettings:(NSDictionary *)settings NS_DESIGNATED_INITIALIZER; @end @implementation GCDAsyncSpecialPacket -- (id)initWithTLSSettings:(NSDictionary *)settings +// Cover the superclass' designated initializer +- (instancetype)init NS_UNAVAILABLE +{ + NSAssert(0, @"Use the designated initializer"); + return nil; +} + +- (instancetype)initWithTLSSettings:(NSDictionary *)settings { if((self = [super init])) { @@ -917,22 +945,22 @@ @implementation GCDAsyncSocket NSTimeInterval alternateAddressDelay; } -- (id)init +- (instancetype)init { return [self initWithDelegate:nil delegateQueue:NULL socketQueue:NULL]; } -- (id)initWithSocketQueue:(dispatch_queue_t)sq +- (instancetype)initWithSocketQueue:(dispatch_queue_t)sq { return [self initWithDelegate:nil delegateQueue:NULL socketQueue:sq]; } -- (id)initWithDelegate:(id)aDelegate delegateQueue:(dispatch_queue_t)dq +- (instancetype)initWithDelegate:(id)aDelegate delegateQueue:(dispatch_queue_t)dq { return [self initWithDelegate:aDelegate delegateQueue:dq socketQueue:NULL]; } -- (id)initWithDelegate:(id)aDelegate delegateQueue:(dispatch_queue_t)dq socketQueue:(dispatch_queue_t)sq +- (instancetype)initWithDelegate:(id)aDelegate delegateQueue:(dispatch_queue_t)dq socketQueue:(dispatch_queue_t)sq { if((self = [super init])) { @@ -1062,7 +1090,7 @@ + (nullable instancetype)socketFromConnectedSocketFD:(int)socketFD delegate:(nul @"GCDAsyncSocket", [NSBundle mainBundle], @"Attempt to create socket from socket FD failed. getpeername() failed", nil); - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; errorOccured = YES; if (error) @@ -1084,7 +1112,7 @@ + (nullable instancetype)socketFromConnectedSocketFD:(int)socketFD delegate:(nul @"GCDAsyncSocket", [NSBundle mainBundle], @"Attempt to create socket from socket FD failed. socket FD is neither IPv4 nor IPv6", nil); - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; errorOccured = YES; if (error) @@ -1114,7 +1142,7 @@ - (id)delegate __block id result; dispatch_sync(socketQueue, ^{ - result = delegate; + result = self->delegate; }); return result; @@ -1124,7 +1152,7 @@ - (id)delegate - (void)setDelegate:(id)newDelegate synchronously:(BOOL)synchronously { dispatch_block_t block = ^{ - delegate = newDelegate; + self->delegate = newDelegate; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { @@ -1138,12 +1166,12 @@ - (void)setDelegate:(id)newDelegate synchronously:(BOOL)synchronously } } -- (void)setDelegate:(id)newDelegate +- (void)setDelegate:(id)newDelegate { [self setDelegate:newDelegate synchronously:NO]; } -- (void)synchronouslySetDelegate:(id)newDelegate +- (void)synchronouslySetDelegate:(id)newDelegate { [self setDelegate:newDelegate synchronously:YES]; } @@ -1159,7 +1187,7 @@ - (dispatch_queue_t)delegateQueue __block dispatch_queue_t result; dispatch_sync(socketQueue, ^{ - result = delegateQueue; + result = self->delegateQueue; }); return result; @@ -1171,11 +1199,11 @@ - (void)setDelegateQueue:(dispatch_queue_t)newDelegateQueue synchronously:(BOOL) dispatch_block_t block = ^{ #if !OS_OBJECT_USE_OBJC - if (delegateQueue) dispatch_release(delegateQueue); + if (self->delegateQueue) dispatch_release(self->delegateQueue); if (newDelegateQueue) dispatch_retain(newDelegateQueue); #endif - delegateQueue = newDelegateQueue; + self->delegateQueue = newDelegateQueue; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { @@ -1212,8 +1240,8 @@ - (void)getDelegate:(id *)delegatePtr delegateQueue:(dis __block dispatch_queue_t dqPtr = NULL; dispatch_sync(socketQueue, ^{ - dPtr = delegate; - dqPtr = delegateQueue; + dPtr = self->delegate; + dqPtr = self->delegateQueue; }); if (delegatePtr) *delegatePtr = dPtr; @@ -1225,14 +1253,14 @@ - (void)setDelegate:(id)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQ { dispatch_block_t block = ^{ - delegate = newDelegate; + self->delegate = newDelegate; #if !OS_OBJECT_USE_OBJC - if (delegateQueue) dispatch_release(delegateQueue); + if (self->delegateQueue) dispatch_release(self->delegateQueue); if (newDelegateQueue) dispatch_retain(newDelegateQueue); #endif - delegateQueue = newDelegateQueue; + self->delegateQueue = newDelegateQueue; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { @@ -1246,12 +1274,12 @@ - (void)setDelegate:(id)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQ } } -- (void)setDelegate:(id)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue +- (void)setDelegate:(id)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue { [self setDelegate:newDelegate delegateQueue:newDelegateQueue synchronously:NO]; } -- (void)synchronouslySetDelegate:(id)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue +- (void)synchronouslySetDelegate:(id)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue { [self setDelegate:newDelegate delegateQueue:newDelegateQueue synchronously:YES]; } @@ -1269,7 +1297,7 @@ - (BOOL)isIPv4Enabled __block BOOL result; dispatch_sync(socketQueue, ^{ - result = ((config & kIPv4Disabled) == 0); + result = ((self->config & kIPv4Disabled) == 0); }); return result; @@ -1283,9 +1311,9 @@ - (void)setIPv4Enabled:(BOOL)flag dispatch_block_t block = ^{ if (flag) - config &= ~kIPv4Disabled; + self->config &= ~kIPv4Disabled; else - config |= kIPv4Disabled; + self->config |= kIPv4Disabled; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -1307,7 +1335,7 @@ - (BOOL)isIPv6Enabled __block BOOL result; dispatch_sync(socketQueue, ^{ - result = ((config & kIPv6Disabled) == 0); + result = ((self->config & kIPv6Disabled) == 0); }); return result; @@ -1321,9 +1349,9 @@ - (void)setIPv6Enabled:(BOOL)flag dispatch_block_t block = ^{ if (flag) - config &= ~kIPv6Disabled; + self->config &= ~kIPv6Disabled; else - config |= kIPv6Disabled; + self->config |= kIPv6Disabled; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -1345,7 +1373,7 @@ - (BOOL)isIPv4PreferredOverIPv6 __block BOOL result; dispatch_sync(socketQueue, ^{ - result = ((config & kPreferIPv6) == 0); + result = ((self->config & kPreferIPv6) == 0); }); return result; @@ -1359,9 +1387,9 @@ - (void)setIPv4PreferredOverIPv6:(BOOL)flag dispatch_block_t block = ^{ if (flag) - config &= ~kPreferIPv6; + self->config &= ~kPreferIPv6; else - config |= kPreferIPv6; + self->config |= kPreferIPv6; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -1373,7 +1401,7 @@ - (void)setIPv4PreferredOverIPv6:(BOOL)flag - (NSTimeInterval) alternateAddressDelay { __block NSTimeInterval delay; dispatch_block_t block = ^{ - delay = alternateAddressDelay; + delay = self->alternateAddressDelay; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); @@ -1384,7 +1412,7 @@ - (NSTimeInterval) alternateAddressDelay { - (void) setAlternateAddressDelay:(NSTimeInterval)delay { dispatch_block_t block = ^{ - alternateAddressDelay = delay; + self->alternateAddressDelay = delay; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); @@ -1398,7 +1426,7 @@ - (id)userData dispatch_block_t block = ^{ - result = userData; + result = self->userData; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -1413,9 +1441,9 @@ - (void)setUserData:(id)arbitraryUserData { dispatch_block_t block = ^{ - if (userData != arbitraryUserData) + if (self->userData != arbitraryUserData) { - userData = arbitraryUserData; + self->userData = arbitraryUserData; } }; @@ -1454,7 +1482,7 @@ - (BOOL)acceptOnInterface:(NSString *)inInterface port:(uint16_t)port error:(NSE if (socketFD == SOCKET_NULL) { NSString *reason = @"Error in socket() function"; - err = [self errnoErrorWithReason:reason]; + err = [self errorWithErrno:errno reason:reason]; return SOCKET_NULL; } @@ -1467,7 +1495,7 @@ - (BOOL)acceptOnInterface:(NSString *)inInterface port:(uint16_t)port error:(NSE if (status == -1) { NSString *reason = @"Error enabling non-blocking IO on socket (fcntl)"; - err = [self errnoErrorWithReason:reason]; + err = [self errorWithErrno:errno reason:reason]; LogVerbose(@"close(socketFD)"); close(socketFD); @@ -1479,7 +1507,7 @@ - (BOOL)acceptOnInterface:(NSString *)inInterface port:(uint16_t)port error:(NSE if (status == -1) { NSString *reason = @"Error enabling address reuse (setsockopt)"; - err = [self errnoErrorWithReason:reason]; + err = [self errorWithErrno:errno reason:reason]; LogVerbose(@"close(socketFD)"); close(socketFD); @@ -1492,7 +1520,7 @@ - (BOOL)acceptOnInterface:(NSString *)inInterface port:(uint16_t)port error:(NSE if (status == -1) { NSString *reason = @"Error in bind() function"; - err = [self errnoErrorWithReason:reason]; + err = [self errorWithErrno:errno reason:reason]; LogVerbose(@"close(socketFD)"); close(socketFD); @@ -1505,7 +1533,7 @@ - (BOOL)acceptOnInterface:(NSString *)inInterface port:(uint16_t)port error:(NSE if (status == -1) { NSString *reason = @"Error in listen() function"; - err = [self errnoErrorWithReason:reason]; + err = [self errorWithErrno:errno reason:reason]; LogVerbose(@"close(socketFD)"); close(socketFD); @@ -1519,7 +1547,7 @@ - (BOOL)acceptOnInterface:(NSString *)inInterface port:(uint16_t)port error:(NSE dispatch_block_t block = ^{ @autoreleasepool { - if (delegate == nil) // Must have delegate set + if (self->delegate == nil) // Must have delegate set { NSString *msg = @"Attempting to accept without a delegate. Set a delegate first."; err = [self badConfigError:msg]; @@ -1527,7 +1555,7 @@ - (BOOL)acceptOnInterface:(NSString *)inInterface port:(uint16_t)port error:(NSE return_from_block; } - if (delegateQueue == NULL) // Must have delegate queue set + if (self->delegateQueue == NULL) // Must have delegate queue set { NSString *msg = @"Attempting to accept without a delegate queue. Set a delegate queue first."; err = [self badConfigError:msg]; @@ -1535,8 +1563,8 @@ - (BOOL)acceptOnInterface:(NSString *)inInterface port:(uint16_t)port error:(NSE return_from_block; } - BOOL isIPv4Disabled = (config & kIPv4Disabled) ? YES : NO; - BOOL isIPv6Disabled = (config & kIPv6Disabled) ? YES : NO; + BOOL isIPv4Disabled = (self->config & kIPv4Disabled) ? YES : NO; + BOOL isIPv6Disabled = (self->config & kIPv6Disabled) ? YES : NO; if (isIPv4Disabled && isIPv6Disabled) // Must have IPv4 or IPv6 enabled { @@ -1555,8 +1583,8 @@ - (BOOL)acceptOnInterface:(NSString *)inInterface port:(uint16_t)port error:(NSE } // Clear queues (spurious read/write requests post disconnect) - [readQueue removeAllObjects]; - [writeQueue removeAllObjects]; + [self->readQueue removeAllObjects]; + [self->writeQueue removeAllObjects]; // Resolve interface from description @@ -1597,9 +1625,9 @@ - (BOOL)acceptOnInterface:(NSString *)inInterface port:(uint16_t)port error:(NSE if (enableIPv4) { LogVerbose(@"Creating IPv4 socket"); - socket4FD = createSocket(AF_INET, interface4); + self->socket4FD = createSocket(AF_INET, interface4); - if (socket4FD == SOCKET_NULL) + if (self->socket4FD == SOCKET_NULL) { return_from_block; } @@ -1618,14 +1646,15 @@ - (BOOL)acceptOnInterface:(NSString *)inInterface port:(uint16_t)port error:(NSE addr6->sin6_port = htons([self localPort4]); } - socket6FD = createSocket(AF_INET6, interface6); + self->socket6FD = createSocket(AF_INET6, interface6); - if (socket6FD == SOCKET_NULL) + if (self->socket6FD == SOCKET_NULL) { - if (socket4FD != SOCKET_NULL) + if (self->socket4FD != SOCKET_NULL) { LogVerbose(@"close(socket4FD)"); - close(socket4FD); + close(self->socket4FD); + self->socket4FD = SOCKET_NULL; } return_from_block; @@ -1636,14 +1665,14 @@ - (BOOL)acceptOnInterface:(NSString *)inInterface port:(uint16_t)port error:(NSE if (enableIPv4) { - accept4Source = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, socket4FD, 0, socketQueue); + self->accept4Source = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, self->socket4FD, 0, self->socketQueue); - int socketFD = socket4FD; - dispatch_source_t acceptSource = accept4Source; + int socketFD = self->socket4FD; + dispatch_source_t acceptSource = self->accept4Source; __weak GCDAsyncSocket *weakSelf = self; - dispatch_source_set_event_handler(accept4Source, ^{ @autoreleasepool { + dispatch_source_set_event_handler(self->accept4Source, ^{ @autoreleasepool { #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" @@ -1663,7 +1692,7 @@ - (BOOL)acceptOnInterface:(NSString *)inInterface port:(uint16_t)port error:(NSE }}); - dispatch_source_set_cancel_handler(accept4Source, ^{ + dispatch_source_set_cancel_handler(self->accept4Source, ^{ #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" @@ -1679,19 +1708,19 @@ - (BOOL)acceptOnInterface:(NSString *)inInterface port:(uint16_t)port error:(NSE }); LogVerbose(@"dispatch_resume(accept4Source)"); - dispatch_resume(accept4Source); + dispatch_resume(self->accept4Source); } if (enableIPv6) { - accept6Source = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, socket6FD, 0, socketQueue); + self->accept6Source = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, self->socket6FD, 0, self->socketQueue); - int socketFD = socket6FD; - dispatch_source_t acceptSource = accept6Source; + int socketFD = self->socket6FD; + dispatch_source_t acceptSource = self->accept6Source; __weak GCDAsyncSocket *weakSelf = self; - dispatch_source_set_event_handler(accept6Source, ^{ @autoreleasepool { + dispatch_source_set_event_handler(self->accept6Source, ^{ @autoreleasepool { #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" @@ -1710,7 +1739,7 @@ - (BOOL)acceptOnInterface:(NSString *)inInterface port:(uint16_t)port error:(NSE #pragma clang diagnostic pop }}); - dispatch_source_set_cancel_handler(accept6Source, ^{ + dispatch_source_set_cancel_handler(self->accept6Source, ^{ #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" @@ -1726,10 +1755,10 @@ - (BOOL)acceptOnInterface:(NSString *)inInterface port:(uint16_t)port error:(NSE }); LogVerbose(@"dispatch_resume(accept6Source)"); - dispatch_resume(accept6Source); + dispatch_resume(self->accept6Source); } - flags |= kSocketStarted; + self->flags |= kSocketStarted; result = YES; }}; @@ -1750,7 +1779,7 @@ - (BOOL)acceptOnInterface:(NSString *)inInterface port:(uint16_t)port error:(NSE return result; } -- (BOOL)acceptOnUrl:(NSURL *)url error:(NSError **)errPtr; +- (BOOL)acceptOnUrl:(NSURL *)url error:(NSError **)errPtr { LogTrace(); @@ -1767,7 +1796,7 @@ - (BOOL)acceptOnUrl:(NSURL *)url error:(NSError **)errPtr; if (socketFD == SOCKET_NULL) { NSString *reason = @"Error in socket() function"; - err = [self errnoErrorWithReason:reason]; + err = [self errorWithErrno:errno reason:reason]; return SOCKET_NULL; } @@ -1780,7 +1809,7 @@ - (BOOL)acceptOnUrl:(NSURL *)url error:(NSError **)errPtr; if (status == -1) { NSString *reason = @"Error enabling non-blocking IO on socket (fcntl)"; - err = [self errnoErrorWithReason:reason]; + err = [self errorWithErrno:errno reason:reason]; LogVerbose(@"close(socketFD)"); close(socketFD); @@ -1792,7 +1821,7 @@ - (BOOL)acceptOnUrl:(NSURL *)url error:(NSError **)errPtr; if (status == -1) { NSString *reason = @"Error enabling address reuse (setsockopt)"; - err = [self errnoErrorWithReason:reason]; + err = [self errorWithErrno:errno reason:reason]; LogVerbose(@"close(socketFD)"); close(socketFD); @@ -1805,7 +1834,7 @@ - (BOOL)acceptOnUrl:(NSURL *)url error:(NSError **)errPtr; if (status == -1) { NSString *reason = @"Error in bind() function"; - err = [self errnoErrorWithReason:reason]; + err = [self errorWithErrno:errno reason:reason]; LogVerbose(@"close(socketFD)"); close(socketFD); @@ -1818,7 +1847,7 @@ - (BOOL)acceptOnUrl:(NSURL *)url error:(NSError **)errPtr; if (status == -1) { NSString *reason = @"Error in listen() function"; - err = [self errnoErrorWithReason:reason]; + err = [self errorWithErrno:errno reason:reason]; LogVerbose(@"close(socketFD)"); close(socketFD); @@ -1832,7 +1861,7 @@ - (BOOL)acceptOnUrl:(NSURL *)url error:(NSError **)errPtr; dispatch_block_t block = ^{ @autoreleasepool { - if (delegate == nil) // Must have delegate set + if (self->delegate == nil) // Must have delegate set { NSString *msg = @"Attempting to accept without a delegate. Set a delegate first."; err = [self badConfigError:msg]; @@ -1840,7 +1869,7 @@ - (BOOL)acceptOnUrl:(NSURL *)url error:(NSError **)errPtr; return_from_block; } - if (delegateQueue == NULL) // Must have delegate queue set + if (self->delegateQueue == NULL) // Must have delegate queue set { NSString *msg = @"Attempting to accept without a delegate queue. Set a delegate queue first."; err = [self badConfigError:msg]; @@ -1857,15 +1886,16 @@ - (BOOL)acceptOnUrl:(NSURL *)url error:(NSError **)errPtr; } // Clear queues (spurious read/write requests post disconnect) - [readQueue removeAllObjects]; - [writeQueue removeAllObjects]; + [self->readQueue removeAllObjects]; + [self->writeQueue removeAllObjects]; // Remove a previous socket NSError *error = nil; NSFileManager *fileManager = [NSFileManager defaultManager]; - if ([fileManager fileExistsAtPath:url.path]) { - if (![[NSFileManager defaultManager] removeItemAtURL:url error:&error]) { + NSString *urlPath = url.path; + if (urlPath && [fileManager fileExistsAtPath:urlPath]) { + if (![fileManager removeItemAtURL:url error:&error]) { NSString *msg = @"Could not remove previous unix domain socket at given url."; err = [self otherError:msg]; @@ -1888,23 +1918,27 @@ - (BOOL)acceptOnUrl:(NSURL *)url error:(NSError **)errPtr; // Create sockets, configure, bind, and listen LogVerbose(@"Creating unix domain socket"); - socketUN = createSocket(AF_UNIX, interface); + self->socketUN = createSocket(AF_UNIX, interface); - if (socketUN == SOCKET_NULL) + if (self->socketUN == SOCKET_NULL) { return_from_block; } - socketUrl = url; + self->socketUrl = url; // Create accept sources - acceptUNSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, socketUN, 0, socketQueue); + self->acceptUNSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, self->socketUN, 0, self->socketQueue); - int socketFD = socketUN; - dispatch_source_t acceptSource = acceptUNSource; + int socketFD = self->socketUN; + dispatch_source_t acceptSource = self->acceptUNSource; + + __weak GCDAsyncSocket *weakSelf = self; - dispatch_source_set_event_handler(acceptUNSource, ^{ @autoreleasepool { + dispatch_source_set_event_handler(self->acceptUNSource, ^{ @autoreleasepool { + + __strong GCDAsyncSocket *strongSelf = weakSelf; LogVerbose(@"eventUNBlock"); @@ -1913,24 +1947,24 @@ - (BOOL)acceptOnUrl:(NSURL *)url error:(NSError **)errPtr; LogVerbose(@"numPendingConnections: %lu", numPendingConnections); - while ([self doAccept:socketFD] && (++i < numPendingConnections)); + while ([strongSelf doAccept:socketFD] && (++i < numPendingConnections)); }}); - dispatch_source_set_cancel_handler(acceptUNSource, ^{ + dispatch_source_set_cancel_handler(self->acceptUNSource, ^{ -#if NEEDS_DISPATCH_RETAIN_RELEASE - LogVerbose(@"dispatch_release(accept4Source)"); +#if !OS_OBJECT_USE_OBJC + LogVerbose(@"dispatch_release(acceptUNSource)"); dispatch_release(acceptSource); #endif - LogVerbose(@"close(socket4FD)"); + LogVerbose(@"close(socketUN)"); close(socketFD); }); - LogVerbose(@"dispatch_resume(accept4Source)"); - dispatch_resume(acceptUNSource); + LogVerbose(@"dispatch_resume(acceptUNSource)"); + dispatch_resume(self->acceptUNSource); - flags |= kSocketStarted; + self->flags |= kSocketStarted; result = YES; }}; @@ -2031,7 +2065,7 @@ - (BOOL)doAccept:(int)parentSocketFD if (delegateQueue) { - __strong id theDelegate = delegate; + __strong id theDelegate = delegate; dispatch_async(delegateQueue, ^{ @autoreleasepool { @@ -2048,7 +2082,7 @@ - (BOOL)doAccept:(int)parentSocketFD // Create GCDAsyncSocket instance for accepted socket GCDAsyncSocket *acceptedSocket = [[[self class] alloc] initWithDelegate:theDelegate - delegateQueue:delegateQueue + delegateQueue:self->delegateQueue socketQueue:childSocketQueue]; if (socketType == 0) @@ -2296,7 +2330,7 @@ - (BOOL)connectToHost:(NSString *)inHost // We've made it past all the checks. // It's time to start the connection process. - flags |= kSocketStarted; + self->flags |= kSocketStarted; LogVerbose(@"Dispatching DNS lookup..."); @@ -2306,7 +2340,7 @@ - (BOOL)connectToHost:(NSString *)inHost NSString *hostCpy = [host copy]; - int aStateIndex = stateIndex; + int aStateIndex = self->stateIndex; __weak GCDAsyncSocket *weakSelf = self; dispatch_queue_t globalConcurrentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); @@ -2427,8 +2461,8 @@ - (BOOL)connectToAddress:(NSData *)inRemoteAddr return_from_block; } - BOOL isIPv4Disabled = (config & kIPv4Disabled) ? YES : NO; - BOOL isIPv6Disabled = (config & kIPv6Disabled) ? YES : NO; + BOOL isIPv4Disabled = (self->config & kIPv4Disabled) ? YES : NO; + BOOL isIPv6Disabled = (self->config & kIPv6Disabled) ? YES : NO; if (isIPv4Disabled && (address4 != nil)) { @@ -2461,7 +2495,7 @@ - (BOOL)connectToAddress:(NSData *)inRemoteAddr return_from_block; } - flags |= kSocketStarted; + self->flags |= kSocketStarted; [self startConnectTimeout:timeout]; @@ -2482,7 +2516,7 @@ - (BOOL)connectToAddress:(NSData *)inRemoteAddr return result; } -- (BOOL)connectToUrl:(NSURL *)url withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr; +- (BOOL)connectToUrl:(NSURL *)url withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr { LogTrace(); @@ -2511,12 +2545,12 @@ - (BOOL)connectToUrl:(NSURL *)url withTimeout:(NSTimeInterval)timeout error:(NSE // We've made it past all the checks. // It's time to start the connection process. - flags |= kSocketStarted; + self->flags |= kSocketStarted; // Start the normal connection process NSError *connectError = nil; - if (![self connectWithAddressUN:connectInterfaceUN error:&connectError]) + if (![self connectWithAddressUN:self->connectInterfaceUN error:&connectError]) { [self closeWithError:connectError]; @@ -2542,6 +2576,21 @@ - (BOOL)connectToUrl:(NSURL *)url withTimeout:(NSTimeInterval)timeout error:(NSE return result; } +- (BOOL)connectToNetService:(NSNetService *)netService error:(NSError **)errPtr +{ + NSArray* addresses = [netService addresses]; + for (NSData* address in addresses) + { + BOOL result = [self connectToAddress:address error:errPtr]; + if (result) + { + return YES; + } + } + + return NO; +} + - (void)lookup:(int)aStateIndex didSucceedWithAddress4:(NSData *)address4 address6:(NSData *)address6 { LogTrace(); @@ -2639,7 +2688,7 @@ - (BOOL)bindSocket:(int)socketFD toInterface:(NSData *)connectInterface error:(N if (result != 0) { if (errPtr) - *errPtr = [self errnoErrorWithReason:@"Error in bind() function"]; + *errPtr = [self errorWithErrno:errno reason:@"Error in bind() function"]; return NO; } @@ -2655,7 +2704,7 @@ - (int)createSocket:(int)family connectInterface:(NSData *)connectInterface errP if (socketFD == SOCKET_NULL) { if (errPtr) - *errPtr = [self errnoErrorWithReason:@"Error in socket() function"]; + *errPtr = [self errorWithErrno:errno reason:@"Error in socket() function"]; return socketFD; } @@ -2694,6 +2743,7 @@ - (void)connectSocket:(int)socketFD address:(NSData *)address stateIndex:(int)aS #pragma clang diagnostic warning "-Wimplicit-retain-self" int result = connect(socketFD, (const struct sockaddr *)[address bytes], (socklen_t)[address length]); + int err = errno; __strong GCDAsyncSocket *strongSelf = weakSelf; if (strongSelf == nil) return_from_block; @@ -2719,7 +2769,7 @@ - (void)connectSocket:(int)socketFD address:(NSData *)address stateIndex:(int)aS // If there are no more sockets trying to connect, we inform the error to the delegate if (strongSelf.socket4FD == SOCKET_NULL && strongSelf.socket6FD == SOCKET_NULL) { - NSError *error = [strongSelf errnoErrorWithReason:@"Error in connect() function"]; + NSError *error = [strongSelf errorWithErrno:err reason:@"Error in connect() function"]; [strongSelf didNotConnect:aStateIndex error:error]; } } @@ -2848,7 +2898,7 @@ - (BOOL)connectWithAddressUN:(NSData *)address error:(NSError **)errPtr if (socketFD == SOCKET_NULL) { if (errPtr) - *errPtr = [self errnoErrorWithReason:@"Error in socket() function"]; + *errPtr = [self errorWithErrno:errno reason:@"Error in socket() function"]; return NO; } @@ -2887,7 +2937,7 @@ - (BOOL)connectWithAddressUN:(NSData *)address error:(NSError **)errPtr int result = connect(socketFD, addr, addr->sa_len); if (result == 0) { - dispatch_async(socketQueue, ^{ @autoreleasepool { + dispatch_async(self->socketQueue, ^{ @autoreleasepool { [self didConnect:aStateIndex]; }}); @@ -2896,9 +2946,9 @@ - (BOOL)connectWithAddressUN:(NSData *)address error:(NSError **)errPtr { // TODO: Bad file descriptor perror("connect"); - NSError *error = [self errnoErrorWithReason:@"Error in connect() function"]; + NSError *error = [self errorWithErrno:errno reason:@"Error in connect() function"]; - dispatch_async(socketQueue, ^{ @autoreleasepool { + dispatch_async(self->socketQueue, ^{ @autoreleasepool { [self didNotConnect:aStateIndex error:error]; }}); @@ -2964,7 +3014,7 @@ - (void)didConnect:(int)aStateIndex dispatch_block_t SetupStreamsPart2 = ^{ #if TARGET_OS_IPHONE - if (aStateIndex != stateIndex) + if (aStateIndex != self->stateIndex) { // The socket has been disconnected. return; @@ -2991,7 +3041,7 @@ - (void)didConnect:(int)aStateIndex uint16_t port = [self connectedPort]; NSURL *url = [self connectedUrl]; - __strong id theDelegate = delegate; + __strong id theDelegate = delegate; if (delegateQueue && host != nil && [theDelegate respondsToSelector:@selector(socket:didConnectToHost:port:)]) { @@ -3001,7 +3051,7 @@ - (void)didConnect:(int)aStateIndex [theDelegate socket:self didConnectToHost:host port:port]; - dispatch_async(socketQueue, ^{ @autoreleasepool { + dispatch_async(self->socketQueue, ^{ @autoreleasepool { SetupStreamsPart2(); }}); @@ -3015,7 +3065,7 @@ - (void)didConnect:(int)aStateIndex [theDelegate socket:self didConnectToUrl:url]; - dispatch_async(socketQueue, ^{ @autoreleasepool { + dispatch_async(self->socketQueue, ^{ @autoreleasepool { SetupStreamsPart2(); }}); @@ -3312,7 +3362,7 @@ - (void)closeWithError:(NSError *)error if (shouldCallDelegate) { - __strong id theDelegate = delegate; + __strong id theDelegate = delegate; __strong id theSelf = isDeallocating ? nil : self; if (delegateQueue && [theDelegate respondsToSelector: @selector(socketDidDisconnect:withError:)]) @@ -3329,7 +3379,7 @@ - (void)disconnect { dispatch_block_t block = ^{ @autoreleasepool { - if (flags & kSocketStarted) + if (self->flags & kSocketStarted) { [self closeWithError:nil]; } @@ -3347,9 +3397,9 @@ - (void)disconnectAfterReading { dispatch_async(socketQueue, ^{ @autoreleasepool { - if (flags & kSocketStarted) + if (self->flags & kSocketStarted) { - flags |= (kForbidReadsWrites | kDisconnectAfterReads); + self->flags |= (kForbidReadsWrites | kDisconnectAfterReads); [self maybeClose]; } }}); @@ -3359,9 +3409,9 @@ - (void)disconnectAfterWriting { dispatch_async(socketQueue, ^{ @autoreleasepool { - if (flags & kSocketStarted) + if (self->flags & kSocketStarted) { - flags |= (kForbidReadsWrites | kDisconnectAfterWrites); + self->flags |= (kForbidReadsWrites | kDisconnectAfterWrites); [self maybeClose]; } }}); @@ -3371,9 +3421,9 @@ - (void)disconnectAfterReadingAndWriting { dispatch_async(socketQueue, ^{ @autoreleasepool { - if (flags & kSocketStarted) + if (self->flags & kSocketStarted) { - flags |= (kForbidReadsWrites | kDisconnectAfterReads | kDisconnectAfterWrites); + self->flags |= (kForbidReadsWrites | kDisconnectAfterReads | kDisconnectAfterWrites); [self maybeClose]; } }}); @@ -3427,14 +3477,14 @@ - (void)maybeClose - (NSError *)badConfigError:(NSString *)errMsg { - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketBadConfigError userInfo:userInfo]; } - (NSError *)badParamError:(NSString *)errMsg { - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketBadParamError userInfo:userInfo]; } @@ -3442,24 +3492,24 @@ - (NSError *)badParamError:(NSString *)errMsg + (NSError *)gaiError:(int)gai_error { NSString *errMsg = [NSString stringWithCString:gai_strerror(gai_error) encoding:NSASCIIStringEncoding]; - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; return [NSError errorWithDomain:@"kCFStreamErrorDomainNetDB" code:gai_error userInfo:userInfo]; } -- (NSError *)errnoErrorWithReason:(NSString *)reason +- (NSError *)errorWithErrno:(int)err reason:(NSString *)reason { - NSString *errMsg = [NSString stringWithUTF8String:strerror(errno)]; - NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:errMsg, NSLocalizedDescriptionKey, - reason, NSLocalizedFailureReasonErrorKey, nil]; + NSString *errMsg = [NSString stringWithUTF8String:strerror(err)]; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg, + NSLocalizedFailureReasonErrorKey : reason}; - return [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:userInfo]; + return [NSError errorWithDomain:NSPOSIXErrorDomain code:err userInfo:userInfo]; } - (NSError *)errnoError { NSString *errMsg = [NSString stringWithUTF8String:strerror(errno)]; - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; return [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:userInfo]; } @@ -3467,7 +3517,7 @@ - (NSError *)errnoError - (NSError *)sslError:(OSStatus)ssl_error { NSString *msg = @"Error code definition can be found in Apple's SecureTransport.h"; - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:msg forKey:NSLocalizedRecoverySuggestionErrorKey]; + NSDictionary *userInfo = @{NSLocalizedRecoverySuggestionErrorKey : msg}; return [NSError errorWithDomain:@"kCFStreamErrorDomainSSL" code:ssl_error userInfo:userInfo]; } @@ -3478,7 +3528,7 @@ - (NSError *)connectTimeoutError @"GCDAsyncSocket", [NSBundle mainBundle], @"Attempt to connect to host timed out", nil); - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketConnectTimeoutError userInfo:userInfo]; } @@ -3492,7 +3542,7 @@ - (NSError *)readMaxedOutError @"GCDAsyncSocket", [NSBundle mainBundle], @"Read operation reached set maximum length", nil); - NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; + NSDictionary *info = @{NSLocalizedDescriptionKey : errMsg}; return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketReadMaxedOutError userInfo:info]; } @@ -3506,7 +3556,7 @@ - (NSError *)readTimeoutError @"GCDAsyncSocket", [NSBundle mainBundle], @"Read operation timed out", nil); - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketReadTimeoutError userInfo:userInfo]; } @@ -3520,7 +3570,7 @@ - (NSError *)writeTimeoutError @"GCDAsyncSocket", [NSBundle mainBundle], @"Write operation timed out", nil); - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketWriteTimeoutError userInfo:userInfo]; } @@ -3531,14 +3581,14 @@ - (NSError *)connectionClosedError @"GCDAsyncSocket", [NSBundle mainBundle], @"Socket closed by remote peer", nil); - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketClosedError userInfo:userInfo]; } - (NSError *)otherError:(NSString *)errMsg { - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketOtherError userInfo:userInfo]; } @@ -3552,7 +3602,7 @@ - (BOOL)isDisconnected __block BOOL result = NO; dispatch_block_t block = ^{ - result = (flags & kSocketStarted) ? NO : YES; + result = (self->flags & kSocketStarted) ? NO : YES; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -3568,7 +3618,7 @@ - (BOOL)isConnected __block BOOL result = NO; dispatch_block_t block = ^{ - result = (flags & kConnected) ? YES : NO; + result = (self->flags & kConnected) ? YES : NO; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -3596,10 +3646,10 @@ - (NSString *)connectedHost dispatch_sync(socketQueue, ^{ @autoreleasepool { - if (socket4FD != SOCKET_NULL) - result = [self connectedHostFromSocket4:socket4FD]; - else if (socket6FD != SOCKET_NULL) - result = [self connectedHostFromSocket6:socket6FD]; + if (self->socket4FD != SOCKET_NULL) + result = [self connectedHostFromSocket4:self->socket4FD]; + else if (self->socket6FD != SOCKET_NULL) + result = [self connectedHostFromSocket6:self->socket6FD]; }}); return result; @@ -3624,10 +3674,10 @@ - (uint16_t)connectedPort dispatch_sync(socketQueue, ^{ // No need for autorelease pool - if (socket4FD != SOCKET_NULL) - result = [self connectedPortFromSocket4:socket4FD]; - else if (socket6FD != SOCKET_NULL) - result = [self connectedPortFromSocket6:socket6FD]; + if (self->socket4FD != SOCKET_NULL) + result = [self connectedPortFromSocket4:self->socket4FD]; + else if (self->socket6FD != SOCKET_NULL) + result = [self connectedPortFromSocket6:self->socket6FD]; }); return result; @@ -3649,8 +3699,8 @@ - (NSURL *)connectedUrl dispatch_sync(socketQueue, ^{ @autoreleasepool { - if (socketUN != SOCKET_NULL) - result = [self connectedUrlFromSocketUN:socketUN]; + if (self->socketUN != SOCKET_NULL) + result = [self connectedUrlFromSocketUN:self->socketUN]; }}); return result; @@ -3674,10 +3724,10 @@ - (NSString *)localHost dispatch_sync(socketQueue, ^{ @autoreleasepool { - if (socket4FD != SOCKET_NULL) - result = [self localHostFromSocket4:socket4FD]; - else if (socket6FD != SOCKET_NULL) - result = [self localHostFromSocket6:socket6FD]; + if (self->socket4FD != SOCKET_NULL) + result = [self localHostFromSocket4:self->socket4FD]; + else if (self->socket6FD != SOCKET_NULL) + result = [self localHostFromSocket6:self->socket6FD]; }}); return result; @@ -3702,10 +3752,10 @@ - (uint16_t)localPort dispatch_sync(socketQueue, ^{ // No need for autorelease pool - if (socket4FD != SOCKET_NULL) - result = [self localPortFromSocket4:socket4FD]; - else if (socket6FD != SOCKET_NULL) - result = [self localPortFromSocket6:socket6FD]; + if (self->socket4FD != SOCKET_NULL) + result = [self localPortFromSocket4:self->socket4FD]; + else if (self->socket6FD != SOCKET_NULL) + result = [self localPortFromSocket6:self->socket6FD]; }); return result; @@ -3889,23 +3939,23 @@ - (NSData *)connectedAddress __block NSData *result = nil; dispatch_block_t block = ^{ - if (socket4FD != SOCKET_NULL) + if (self->socket4FD != SOCKET_NULL) { struct sockaddr_in sockaddr4; socklen_t sockaddr4len = sizeof(sockaddr4); - if (getpeername(socket4FD, (struct sockaddr *)&sockaddr4, &sockaddr4len) == 0) + if (getpeername(self->socket4FD, (struct sockaddr *)&sockaddr4, &sockaddr4len) == 0) { result = [[NSData alloc] initWithBytes:&sockaddr4 length:sockaddr4len]; } } - if (socket6FD != SOCKET_NULL) + if (self->socket6FD != SOCKET_NULL) { struct sockaddr_in6 sockaddr6; socklen_t sockaddr6len = sizeof(sockaddr6); - if (getpeername(socket6FD, (struct sockaddr *)&sockaddr6, &sockaddr6len) == 0) + if (getpeername(self->socket6FD, (struct sockaddr *)&sockaddr6, &sockaddr6len) == 0) { result = [[NSData alloc] initWithBytes:&sockaddr6 length:sockaddr6len]; } @@ -3925,23 +3975,23 @@ - (NSData *)localAddress __block NSData *result = nil; dispatch_block_t block = ^{ - if (socket4FD != SOCKET_NULL) + if (self->socket4FD != SOCKET_NULL) { struct sockaddr_in sockaddr4; socklen_t sockaddr4len = sizeof(sockaddr4); - if (getsockname(socket4FD, (struct sockaddr *)&sockaddr4, &sockaddr4len) == 0) + if (getsockname(self->socket4FD, (struct sockaddr *)&sockaddr4, &sockaddr4len) == 0) { result = [[NSData alloc] initWithBytes:&sockaddr4 length:sockaddr4len]; } } - if (socket6FD != SOCKET_NULL) + if (self->socket6FD != SOCKET_NULL) { struct sockaddr_in6 sockaddr6; socklen_t sockaddr6len = sizeof(sockaddr6); - if (getsockname(socket6FD, (struct sockaddr *)&sockaddr6, &sockaddr6len) == 0) + if (getsockname(self->socket6FD, (struct sockaddr *)&sockaddr6, &sockaddr6len) == 0) { result = [[NSData alloc] initWithBytes:&sockaddr6 length:sockaddr6len]; } @@ -3967,7 +4017,7 @@ - (BOOL)isIPv4 __block BOOL result = NO; dispatch_sync(socketQueue, ^{ - result = (socket4FD != SOCKET_NULL); + result = (self->socket4FD != SOCKET_NULL); }); return result; @@ -3985,7 +4035,7 @@ - (BOOL)isIPv6 __block BOOL result = NO; dispatch_sync(socketQueue, ^{ - result = (socket6FD != SOCKET_NULL); + result = (self->socket6FD != SOCKET_NULL); }); return result; @@ -4003,7 +4053,7 @@ - (BOOL)isSecure __block BOOL result; dispatch_sync(socketQueue, ^{ - result = (flags & kSocketSecure) ? YES : NO; + result = (self->flags & kSocketSecure) ? YES : NO; }); return result; @@ -4044,7 +4094,8 @@ - (void)getInterfaceAddress4:(NSMutableData **)interfaceAddr4Ptr } if ([components count] > 1 && port == 0) { - long portL = strtol([[components objectAtIndex:1] UTF8String], NULL, 10); + NSString *temp = [components objectAtIndex:1]; + long portL = strtol([temp UTF8String], NULL, 10); if (portL > 0 && portL <= UINT16_MAX) { @@ -4184,7 +4235,7 @@ - (void)getInterfaceAddress4:(NSMutableData **)interfaceAddr4Ptr if (interfaceAddr6Ptr) *interfaceAddr6Ptr = addr6; } -- (NSData *)getInterfaceAddressFromUrl:(NSURL *)url; +- (NSData *)getInterfaceAddressFromUrl:(NSURL *)url { NSString *path = url.path; if (path.length == 0) { @@ -4194,7 +4245,7 @@ - (NSData *)getInterfaceAddressFromUrl:(NSURL *)url; struct sockaddr_un nativeAddr; nativeAddr.sun_family = AF_UNIX; strlcpy(nativeAddr.sun_path, path.fileSystemRepresentation, sizeof(nativeAddr.sun_path)); - nativeAddr.sun_len = SUN_LEN(&nativeAddr); + nativeAddr.sun_len = (unsigned char)SUN_LEN(&nativeAddr); NSData *interface = [NSData dataWithBytes:&nativeAddr length:sizeof(struct sockaddr_un)]; return interface; @@ -4424,9 +4475,9 @@ - (void)readDataWithTimeout:(NSTimeInterval)timeout LogTrace(); - if ((flags & kSocketStarted) && !(flags & kForbidReadsWrites)) + if ((self->flags & kSocketStarted) && !(self->flags & kForbidReadsWrites)) { - [readQueue addObject:packet]; + [self->readQueue addObject:packet]; [self maybeDequeueRead]; } }}); @@ -4467,9 +4518,9 @@ - (void)readDataToLength:(NSUInteger)length LogTrace(); - if ((flags & kSocketStarted) && !(flags & kForbidReadsWrites)) + if ((self->flags & kSocketStarted) && !(self->flags & kForbidReadsWrites)) { - [readQueue addObject:packet]; + [self->readQueue addObject:packet]; [self maybeDequeueRead]; } }}); @@ -4529,9 +4580,9 @@ - (void)readDataToData:(NSData *)data LogTrace(); - if ((flags & kSocketStarted) && !(flags & kForbidReadsWrites)) + if ((self->flags & kSocketStarted) && !(self->flags & kForbidReadsWrites)) { - [readQueue addObject:packet]; + [self->readQueue addObject:packet]; [self maybeDequeueRead]; } }}); @@ -4546,7 +4597,7 @@ - (float)progressOfReadReturningTag:(long *)tagPtr bytesDone:(NSUInteger *)doneP dispatch_block_t block = ^{ - if (!currentRead || ![currentRead isKindOfClass:[GCDAsyncReadPacket class]]) + if (!self->currentRead || ![self->currentRead isKindOfClass:[GCDAsyncReadPacket class]]) { // We're not reading anything right now. @@ -4562,10 +4613,10 @@ - (float)progressOfReadReturningTag:(long *)tagPtr bytesDone:(NSUInteger *)doneP // If we're reading to data, we of course have no idea when the data will arrive. // If we're reading to timeout, then we have no idea when the next chunk of data will arrive. - NSUInteger done = currentRead->bytesDone; - NSUInteger total = currentRead->readLength; + NSUInteger done = self->currentRead->bytesDone; + NSUInteger total = self->currentRead->readLength; - if (tagPtr != NULL) *tagPtr = currentRead->tag; + if (tagPtr != NULL) *tagPtr = self->currentRead->tag; if (donePtr != NULL) *donePtr = done; if (totalPtr != NULL) *totalPtr = total; @@ -4729,10 +4780,10 @@ - (void)flushSSLBuffers // from the encrypted bytes in the sslPreBuffer. // However, we do know this is an upper bound on the estimation. - estimatedBytesAvailable = socketFDBytesAvailable + [sslPreBuffer availableBytes]; + estimatedBytesAvailable = self->socketFDBytesAvailable + [self->sslPreBuffer availableBytes]; size_t sslInternalBufSize = 0; - SSLGetBufferedReadSize(sslContext, &sslInternalBufSize); + SSLGetBufferedReadSize(self->sslContext, &sslInternalBufSize); estimatedBytesAvailable += sslInternalBufSize; }; @@ -5270,7 +5321,7 @@ - (void)doReadData if (errno == EWOULDBLOCK) waiting = YES; else - error = [self errnoErrorWithReason:@"Error in read() function"]; + error = [self errorWithErrno:errno reason:@"Error in read() function"]; socketFDBytesAvailable = 0; } @@ -5492,8 +5543,14 @@ - (void)doReadData else if (totalBytesReadForCurrentRead > 0) { // We're not done read type #2 or #3 yet, but we have read in some bytes + // + // We ensure that `waiting` is set in order to resume the readSource (if it is suspended). It is + // possible to reach this point and `waiting` not be set, if the current read's length is + // sufficiently large. In that case, we may have read to some upperbound successfully, but + // that upperbound could be smaller than the desired length. + waiting = YES; - __strong id theDelegate = delegate; + __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(socket:didReadPartialDataOfLength:tag:)]) { @@ -5607,7 +5664,7 @@ - (void)doReadEOF // Notify the delegate that we're going half-duplex - __strong id theDelegate = delegate; + __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(socketDidCloseReadStream:)]) { @@ -5699,7 +5756,7 @@ - (void)completeCurrentRead result = [NSData dataWithBytesNoCopy:buffer length:currentRead->bytesDone freeWhenDone:NO]; } - __strong id theDelegate = delegate; + __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(socket:didReadData:withTag:)]) { @@ -5774,7 +5831,7 @@ - (void)doReadTimeout flags |= kReadsPaused; - __strong id theDelegate = delegate; + __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(socket:shouldTimeoutReadWithTag:elapsed:bytesDone:)]) { @@ -5788,7 +5845,7 @@ - (void)doReadTimeout elapsed:theRead->timeout bytesDone:theRead->bytesDone]; - dispatch_async(socketQueue, ^{ @autoreleasepool { + dispatch_async(self->socketQueue, ^{ @autoreleasepool { [self doReadTimeoutWithExtension:timeoutExtension]; }}); @@ -5839,9 +5896,9 @@ - (void)writeData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)t LogTrace(); - if ((flags & kSocketStarted) && !(flags & kForbidReadsWrites)) + if ((self->flags & kSocketStarted) && !(self->flags & kForbidReadsWrites)) { - [writeQueue addObject:packet]; + [self->writeQueue addObject:packet]; [self maybeDequeueWrite]; } }}); @@ -5856,7 +5913,7 @@ - (float)progressOfWriteReturningTag:(long *)tagPtr bytesDone:(NSUInteger *)done dispatch_block_t block = ^{ - if (!currentWrite || ![currentWrite isKindOfClass:[GCDAsyncWritePacket class]]) + if (!self->currentWrite || ![self->currentWrite isKindOfClass:[GCDAsyncWritePacket class]]) { // We're not writing anything right now. @@ -5868,10 +5925,10 @@ - (float)progressOfWriteReturningTag:(long *)tagPtr bytesDone:(NSUInteger *)done } else { - NSUInteger done = currentWrite->bytesDone; - NSUInteger total = [currentWrite->buffer length]; + NSUInteger done = self->currentWrite->bytesDone; + NSUInteger total = [self->currentWrite->buffer length]; - if (tagPtr != NULL) *tagPtr = currentWrite->tag; + if (tagPtr != NULL) *tagPtr = self->currentWrite->tag; if (donePtr != NULL) *donePtr = done; if (totalPtr != NULL) *totalPtr = total; @@ -6236,7 +6293,7 @@ - (void)doWriteData } else { - error = [self errnoErrorWithReason:@"Error in write() function"]; + error = [self errorWithErrno:errno reason:@"Error in write() function"]; } } else @@ -6311,7 +6368,7 @@ - (void)doWriteData { // We're not done with the entire write, but we have written some bytes - __strong id theDelegate = delegate; + __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(socket:didWritePartialDataOfLength:tag:)]) { @@ -6329,7 +6386,7 @@ - (void)doWriteData if (error) { - [self closeWithError:[self errnoErrorWithReason:@"Error in write() function"]]; + [self closeWithError:[self errorWithErrno:errno reason:@"Error in write() function"]]; } // Do not add any code here without first adding a return statement in the error case above. @@ -6342,7 +6399,7 @@ - (void)completeCurrentWrite NSAssert(currentWrite, @"Trying to complete current write when there is no current write."); - __strong id theDelegate = delegate; + __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(socket:didWriteDataWithTag:)]) { @@ -6417,7 +6474,7 @@ - (void)doWriteTimeout flags |= kWritesPaused; - __strong id theDelegate = delegate; + __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(socket:shouldTimeoutWriteWithTag:elapsed:bytesDone:)]) { @@ -6431,7 +6488,7 @@ - (void)doWriteTimeout elapsed:theWrite->timeout bytesDone:theWrite->bytesDone]; - dispatch_async(socketQueue, ^{ @autoreleasepool { + dispatch_async(self->socketQueue, ^{ @autoreleasepool { [self doWriteTimeoutWithExtension:timeoutExtension]; }}); @@ -6493,12 +6550,12 @@ - (void)startTLS:(NSDictionary *)tlsSettings dispatch_async(socketQueue, ^{ @autoreleasepool { - if ((flags & kSocketStarted) && !(flags & kQueuedTLS) && !(flags & kForbidReadsWrites)) + if ((self->flags & kSocketStarted) && !(self->flags & kQueuedTLS) && !(self->flags & kForbidReadsWrites)) { - [readQueue addObject:packet]; - [writeQueue addObject:packet]; + [self->readQueue addObject:packet]; + [self->writeQueue addObject:packet]; - flags |= kQueuedTLS; + self->flags |= kQueuedTLS; [self maybeDequeueRead]; [self maybeDequeueWrite]; @@ -6806,7 +6863,8 @@ - (void)ssl_startTLS // Create SSLContext, and setup IO callbacks and connection ref - BOOL isServer = [[tlsSettings objectForKey:(__bridge NSString *)kCFStreamSSLIsServer] boolValue]; + NSNumber *isServerNumber = [tlsSettings objectForKey:(__bridge NSString *)kCFStreamSSLIsServer]; + BOOL isServer = [isServerNumber boolValue]; #if TARGET_OS_IPHONE || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1080) { @@ -6847,8 +6905,8 @@ - (void)ssl_startTLS } - BOOL shouldManuallyEvaluateTrust = [[tlsSettings objectForKey:GCDAsyncSocketManuallyEvaluateTrust] boolValue]; - if (shouldManuallyEvaluateTrust) + NSNumber *shouldManuallyEvaluateTrust = [tlsSettings objectForKey:GCDAsyncSocketManuallyEvaluateTrust]; + if ([shouldManuallyEvaluateTrust boolValue]) { if (isServer) { @@ -6894,6 +6952,7 @@ - (void)ssl_startTLS // 7. GCDAsyncSocketSSLSessionOptionSendOneByteRecord // 8. GCDAsyncSocketSSLCipherSuites // 9. GCDAsyncSocketSSLDiffieHellmanParameters (Mac) + // 10. GCDAsyncSocketSSLALPN // // Deprecated (throw error): // 10. kCFStreamSSLAllowsAnyRoot @@ -6902,7 +6961,7 @@ - (void)ssl_startTLS // 13. kCFStreamSSLValidatesCertificateChain // 14. kCFStreamSSLLevel - id value; + NSObject *value; // 1. kCFStreamSSLPeerName @@ -6934,9 +6993,9 @@ - (void)ssl_startTLS value = [tlsSettings objectForKey:(__bridge NSString *)kCFStreamSSLCertificates]; if ([value isKindOfClass:[NSArray class]]) { - CFArrayRef certs = (__bridge CFArrayRef)value; + NSArray *certs = (NSArray *)value; - status = SSLSetCertificate(sslContext, certs); + status = SSLSetCertificate(sslContext, (__bridge CFArrayRef)certs); if (status != noErr) { [self closeWithError:[self otherError:@"Error in SSLSetCertificate"]]; @@ -7028,7 +7087,8 @@ - (void)ssl_startTLS value = [tlsSettings objectForKey:GCDAsyncSocketSSLSessionOptionFalseStart]; if ([value isKindOfClass:[NSNumber class]]) { - status = SSLSetSessionOption(sslContext, kSSLSessionOptionFalseStart, [value boolValue]); + NSNumber *falseStart = (NSNumber *)value; + status = SSLSetSessionOption(sslContext, kSSLSessionOptionFalseStart, [falseStart boolValue]); if (status != noErr) { [self closeWithError:[self otherError:@"Error in SSLSetSessionOption (kSSLSessionOptionFalseStart)"]]; @@ -7048,7 +7108,8 @@ - (void)ssl_startTLS value = [tlsSettings objectForKey:GCDAsyncSocketSSLSessionOptionSendOneByteRecord]; if ([value isKindOfClass:[NSNumber class]]) { - status = SSLSetSessionOption(sslContext, kSSLSessionOptionSendOneByteRecord, [value boolValue]); + NSNumber *oneByteRecord = (NSNumber *)value; + status = SSLSetSessionOption(sslContext, kSSLSessionOptionSendOneByteRecord, [oneByteRecord boolValue]); if (status != noErr) { [self closeWithError: @@ -7078,7 +7139,7 @@ - (void)ssl_startTLS for (cipherIndex = 0; cipherIndex < numberCiphers; cipherIndex++) { NSNumber *cipherObject = [cipherSuites objectAtIndex:cipherIndex]; - ciphers[cipherIndex] = [cipherObject shortValue]; + ciphers[cipherIndex] = (SSLCipherSuite)[cipherObject unsignedIntValue]; } status = SSLSetEnabledCiphers(sslContext, ciphers, numberCiphers); @@ -7119,7 +7180,36 @@ - (void)ssl_startTLS return; } #endif - + + // 10. kCFStreamSSLCertificates + value = [tlsSettings objectForKey:GCDAsyncSocketSSLALPN]; + if ([value isKindOfClass:[NSArray class]]) + { + if (@available(iOS 11.0, macOS 10.13, tvOS 11.0, *)) + { + CFArrayRef protocols = (__bridge CFArrayRef)((NSArray *) value); + status = SSLSetALPNProtocols(sslContext, protocols); + if (status != noErr) + { + [self closeWithError:[self otherError:@"Error in SSLSetALPNProtocols"]]; + return; + } + } + else + { + NSAssert(NO, @"Security option unavailable - GCDAsyncSocketSSLALPN" + @" - iOS 11.0, macOS 10.13 required"); + [self closeWithError:[self otherError:@"Security option unavailable - GCDAsyncSocketSSLALPN"]]; + } + } + else if (value) + { + NSAssert(NO, @"Invalid value for GCDAsyncSocketSSLALPN. Value must be of type NSArray."); + + [self closeWithError:[self otherError:@"Invalid value for GCDAsyncSocketSSLALPN."]]; + return; + } + // DEPRECATED checks // 10. kCFStreamSSLAllowsAnyRoot @@ -7245,7 +7335,7 @@ - (void)ssl_continueSSLHandshake flags |= kSocketSecure; - __strong id theDelegate = delegate; + __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(socketDidSecure:)]) { @@ -7299,7 +7389,7 @@ - (void)ssl_continueSSLHandshake #pragma clang diagnostic pop }}; - __strong id theDelegate = delegate; + __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(socket:didReceiveTrust:completionHandler:)]) { @@ -7383,7 +7473,7 @@ - (void)cf_finishSSLHandshake flags |= kSocketSecure; - __strong id theDelegate = delegate; + __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(socketDidSecure:)]) { @@ -7528,7 +7618,7 @@ + (void)startCFStreamThreadIfNeeded if (++cfstreamThreadRetainCount == 1) { cfstreamThread = [[NSThread alloc] initWithTarget:self - selector:@selector(cfstreamThread) + selector:@selector(cfstreamThread:) object:nil]; [cfstreamThread start]; } @@ -7574,7 +7664,7 @@ + (void)stopCFStreamThreadIfNeeded }}); } -+ (void)cfstreamThread { @autoreleasepool ++ (void)cfstreamThread:(id)unused { @autoreleasepool { [[NSThread currentThread] setName:GCDAsyncSocketThreadName]; @@ -7955,7 +8045,7 @@ - (BOOL)autoDisconnectOnClosedReadStream __block BOOL result; dispatch_sync(socketQueue, ^{ - result = ((config & kAllowHalfDuplexConnection) == 0); + result = ((self->config & kAllowHalfDuplexConnection) == 0); }); return result; @@ -7972,9 +8062,9 @@ - (void)setAutoDisconnectOnClosedReadStream:(BOOL)flag dispatch_block_t block = ^{ if (flag) - config &= ~kAllowHalfDuplexConnection; + self->config &= ~kAllowHalfDuplexConnection; else - config |= kAllowHalfDuplexConnection; + self->config |= kAllowHalfDuplexConnection; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -8105,9 +8195,12 @@ - (BOOL)enableBackgroundingOnSocketWithCaveat:(BOOL)caveat LogVerbose(@"Enabling backgrouding on socket"); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" r1 = CFReadStreamSetProperty(readStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); r2 = CFWriteStreamSetProperty(writeStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); - +#pragma clang diagnostic pop + if (!r1 || !r2) { return NO; @@ -8255,7 +8348,7 @@ + (NSMutableArray *)lookupHost:(NSString *)host port:(uint16_t)port error:(NSErr // Found IPv6 address. // Wrap the native address structure, and add to results. - struct sockaddr_in6 *sockaddr = (struct sockaddr_in6 *)res->ai_addr; + struct sockaddr_in6 *sockaddr = (struct sockaddr_in6 *)(void *)res->ai_addr; in_port_t *portPtr = &sockaddr->sin6_port; if ((portPtr != NULL) && (*portPtr == 0)) { *portPtr = htons(port); diff --git a/Pods/CocoaAsyncSocket/Source/GCD/GCDAsyncUdpSocket.h b/Pods/CocoaAsyncSocket/Source/GCD/GCDAsyncUdpSocket.h index b0b244d1a..af327e086 100644 --- a/Pods/CocoaAsyncSocket/Source/GCD/GCDAsyncUdpSocket.h +++ b/Pods/CocoaAsyncSocket/Source/GCD/GCDAsyncUdpSocket.h @@ -20,7 +20,7 @@ extern NSString *const GCDAsyncUdpSocketErrorDomain; extern NSString *const GCDAsyncUdpSocketQueueName; extern NSString *const GCDAsyncUdpSocketThreadName; -typedef NS_ENUM(NSInteger, GCDAsyncUdpSocketError) { +typedef NS_ERROR_ENUM(GCDAsyncUdpSocketErrorDomain, GCDAsyncUdpSocketError) { GCDAsyncUdpSocketNoError = 0, // Never used GCDAsyncUdpSocketBadConfigError, // Invalid configuration GCDAsyncUdpSocketBadParamError, // Invalid parameter was passed @@ -180,22 +180,22 @@ typedef BOOL (^GCDAsyncUdpSocketSendFilterBlock)(NSData *data, NSData *address, **/ - (instancetype)init; - (instancetype)initWithSocketQueue:(nullable dispatch_queue_t)sq; -- (instancetype)initWithDelegate:(nullable id )aDelegate delegateQueue:(nullable dispatch_queue_t)dq; -- (instancetype)initWithDelegate:(nullable id )aDelegate delegateQueue:(nullable dispatch_queue_t)dq socketQueue:(nullable dispatch_queue_t)sq; +- (instancetype)initWithDelegate:(nullable id)aDelegate delegateQueue:(nullable dispatch_queue_t)dq; +- (instancetype)initWithDelegate:(nullable id)aDelegate delegateQueue:(nullable dispatch_queue_t)dq socketQueue:(nullable dispatch_queue_t)sq NS_DESIGNATED_INITIALIZER; #pragma mark Configuration -- (nullable id )delegate; -- (void)setDelegate:(nullable id )delegate; -- (void)synchronouslySetDelegate:(nullable id )delegate; +- (nullable id)delegate; +- (void)setDelegate:(nullable id)delegate; +- (void)synchronouslySetDelegate:(nullable id)delegate; - (nullable dispatch_queue_t)delegateQueue; - (void)setDelegateQueue:(nullable dispatch_queue_t)delegateQueue; - (void)synchronouslySetDelegateQueue:(nullable dispatch_queue_t)delegateQueue; -- (void)getDelegate:(id __nullable * __nullable)delegatePtr delegateQueue:(dispatch_queue_t __nullable * __nullable)delegateQueuePtr; -- (void)setDelegate:(nullable id )delegate delegateQueue:(nullable dispatch_queue_t)delegateQueue; -- (void)synchronouslySetDelegate:(nullable id )delegate delegateQueue:(nullable dispatch_queue_t)delegateQueue; +- (void)getDelegate:(id __nullable * __nullable)delegatePtr delegateQueue:(dispatch_queue_t __nullable * __nullable)delegateQueuePtr; +- (void)setDelegate:(nullable id)delegate delegateQueue:(nullable dispatch_queue_t)delegateQueue; +- (void)synchronouslySetDelegate:(nullable id)delegate delegateQueue:(nullable dispatch_queue_t)delegateQueue; /** * By default, both IPv4 and IPv6 are enabled. @@ -490,6 +490,18 @@ typedef BOOL (^GCDAsyncUdpSocketSendFilterBlock)(NSData *data, NSData *address, - (BOOL)leaveMulticastGroup:(NSString *)group error:(NSError **)errPtr; - (BOOL)leaveMulticastGroup:(NSString *)group onInterface:(nullable NSString *)interface error:(NSError **)errPtr; +/** + * Send multicast on a specified interface. + * For IPv4, interface should be the the IP address of the interface (eg @"192.168.10.1"). + * For IPv6, interface should be the a network interface name (eg @"en0"). + * + * On success, returns YES. + * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass nil for errPtr. +**/ + +- (BOOL)sendIPv4MulticastOnInterface:(NSString*)interface error:(NSError **)errPtr; +- (BOOL)sendIPv6MulticastOnInterface:(NSString*)interface error:(NSError **)errPtr; + #pragma mark Reuse Port /** diff --git a/Pods/CocoaAsyncSocket/Source/GCD/GCDAsyncUdpSocket.m b/Pods/CocoaAsyncSocket/Source/GCD/GCDAsyncUdpSocket.m old mode 100644 new mode 100755 index 0106f93ba..b0c59c319 --- a/Pods/CocoaAsyncSocket/Source/GCD/GCDAsyncUdpSocket.m +++ b/Pods/CocoaAsyncSocket/Source/GCD/GCDAsyncUdpSocket.m @@ -34,7 +34,7 @@ // Logging Enabled - See log level below // Logging uses the CocoaLumberjack framework (which is also GCD based). -// http://code.google.com/p/cocoalumberjack/ +// https://github.com/robbiehanson/CocoaLumberjack // // It allows us to do a lot of logging without significantly slowing down the code. #import "DDLog.h" @@ -253,7 +253,7 @@ + (uint16_t)portFromSockaddr6:(const struct sockaddr_in6 *)pSockaddr6; #if TARGET_OS_IPHONE // Forward declaration -+ (void)listenerThread; ++ (void)listenerThread:(id)unused; #endif @end @@ -281,13 +281,20 @@ @interface GCDAsyncUdpSendPacket : NSObject { int addressFamily; } -- (id)initWithData:(NSData *)d timeout:(NSTimeInterval)t tag:(long)i; +- (instancetype)initWithData:(NSData *)d timeout:(NSTimeInterval)t tag:(long)i NS_DESIGNATED_INITIALIZER; @end @implementation GCDAsyncUdpSendPacket -- (id)initWithData:(NSData *)d timeout:(NSTimeInterval)t tag:(long)i +// Cover the superclass' designated initializer +- (instancetype)init NS_UNAVAILABLE +{ + NSAssert(0, @"Use the designated initializer"); + return nil; +} + +- (instancetype)initWithData:(NSData *)d timeout:(NSTimeInterval)t tag:(long)i { if ((self = [super init])) { @@ -317,13 +324,13 @@ @interface GCDAsyncUdpSpecialPacket : NSObject { NSError *error; } -- (id)init; +- (instancetype)init NS_DESIGNATED_INITIALIZER; @end @implementation GCDAsyncUdpSpecialPacket -- (id)init +- (instancetype)init { self = [super init]; return self; @@ -338,28 +345,28 @@ - (id)init @implementation GCDAsyncUdpSocket -- (id)init +- (instancetype)init { LogTrace(); return [self initWithDelegate:nil delegateQueue:NULL socketQueue:NULL]; } -- (id)initWithSocketQueue:(dispatch_queue_t)sq +- (instancetype)initWithSocketQueue:(dispatch_queue_t)sq { LogTrace(); return [self initWithDelegate:nil delegateQueue:NULL socketQueue:sq]; } -- (id)initWithDelegate:(id )aDelegate delegateQueue:(dispatch_queue_t)dq +- (instancetype)initWithDelegate:(id)aDelegate delegateQueue:(dispatch_queue_t)dq { LogTrace(); return [self initWithDelegate:aDelegate delegateQueue:dq socketQueue:NULL]; } -- (id)initWithDelegate:(id )aDelegate delegateQueue:(dispatch_queue_t)dq socketQueue:(dispatch_queue_t)sq +- (instancetype)initWithDelegate:(id)aDelegate delegateQueue:(dispatch_queue_t)dq socketQueue:(dispatch_queue_t)sq { LogTrace(); @@ -474,7 +481,7 @@ - (void)dealloc #pragma mark Configuration //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- (id)delegate +- (id)delegate { if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { @@ -485,17 +492,17 @@ - (id)delegate __block id result = nil; dispatch_sync(socketQueue, ^{ - result = delegate; + result = self->delegate; }); return result; } } -- (void)setDelegate:(id )newDelegate synchronously:(BOOL)synchronously +- (void)setDelegate:(id)newDelegate synchronously:(BOOL)synchronously { dispatch_block_t block = ^{ - delegate = newDelegate; + self->delegate = newDelegate; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { @@ -509,12 +516,12 @@ - (void)setDelegate:(id )newDelegate synchronously:(B } } -- (void)setDelegate:(id )newDelegate +- (void)setDelegate:(id)newDelegate { [self setDelegate:newDelegate synchronously:NO]; } -- (void)synchronouslySetDelegate:(id )newDelegate +- (void)synchronouslySetDelegate:(id)newDelegate { [self setDelegate:newDelegate synchronously:YES]; } @@ -530,7 +537,7 @@ - (dispatch_queue_t)delegateQueue __block dispatch_queue_t result = NULL; dispatch_sync(socketQueue, ^{ - result = delegateQueue; + result = self->delegateQueue; }); return result; @@ -542,11 +549,11 @@ - (void)setDelegateQueue:(dispatch_queue_t)newDelegateQueue synchronously:(BOOL) dispatch_block_t block = ^{ #if !OS_OBJECT_USE_OBJC - if (delegateQueue) dispatch_release(delegateQueue); + if (self->delegateQueue) dispatch_release(self->delegateQueue); if (newDelegateQueue) dispatch_retain(newDelegateQueue); #endif - delegateQueue = newDelegateQueue; + self->delegateQueue = newDelegateQueue; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { @@ -570,7 +577,7 @@ - (void)synchronouslySetDelegateQueue:(dispatch_queue_t)newDelegateQueue [self setDelegateQueue:newDelegateQueue synchronously:YES]; } -- (void)getDelegate:(id *)delegatePtr delegateQueue:(dispatch_queue_t *)delegateQueuePtr +- (void)getDelegate:(id *)delegatePtr delegateQueue:(dispatch_queue_t *)delegateQueuePtr { if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { @@ -583,8 +590,8 @@ - (void)getDelegate:(id *)delegatePtr delegateQueue: __block dispatch_queue_t dqPtr = NULL; dispatch_sync(socketQueue, ^{ - dPtr = delegate; - dqPtr = delegateQueue; + dPtr = self->delegate; + dqPtr = self->delegateQueue; }); if (delegatePtr) *delegatePtr = dPtr; @@ -592,18 +599,18 @@ - (void)getDelegate:(id *)delegatePtr delegateQueue: } } -- (void)setDelegate:(id )newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue synchronously:(BOOL)synchronously +- (void)setDelegate:(id)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue synchronously:(BOOL)synchronously { dispatch_block_t block = ^{ - delegate = newDelegate; + self->delegate = newDelegate; #if !OS_OBJECT_USE_OBJC - if (delegateQueue) dispatch_release(delegateQueue); + if (self->delegateQueue) dispatch_release(self->delegateQueue); if (newDelegateQueue) dispatch_retain(newDelegateQueue); #endif - delegateQueue = newDelegateQueue; + self->delegateQueue = newDelegateQueue; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { @@ -617,12 +624,12 @@ - (void)setDelegate:(id )newDelegate delegateQueue:(d } } -- (void)setDelegate:(id )newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue +- (void)setDelegate:(id)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue { [self setDelegate:newDelegate delegateQueue:newDelegateQueue synchronously:NO]; } -- (void)synchronouslySetDelegate:(id )newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue +- (void)synchronouslySetDelegate:(id)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue { [self setDelegate:newDelegate delegateQueue:newDelegateQueue synchronously:YES]; } @@ -635,7 +642,7 @@ - (BOOL)isIPv4Enabled dispatch_block_t block = ^{ - result = ((config & kIPv4Disabled) == 0); + result = ((self->config & kIPv4Disabled) == 0); }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -655,9 +662,9 @@ - (void)setIPv4Enabled:(BOOL)flag LogVerbose(@"%@ %@", THIS_METHOD, (flag ? @"YES" : @"NO")); if (flag) - config &= ~kIPv4Disabled; + self->config &= ~kIPv4Disabled; else - config |= kIPv4Disabled; + self->config |= kIPv4Disabled; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -674,7 +681,7 @@ - (BOOL)isIPv6Enabled dispatch_block_t block = ^{ - result = ((config & kIPv6Disabled) == 0); + result = ((self->config & kIPv6Disabled) == 0); }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -694,9 +701,9 @@ - (void)setIPv6Enabled:(BOOL)flag LogVerbose(@"%@ %@", THIS_METHOD, (flag ? @"YES" : @"NO")); if (flag) - config &= ~kIPv6Disabled; + self->config &= ~kIPv6Disabled; else - config |= kIPv6Disabled; + self->config |= kIPv6Disabled; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -710,7 +717,7 @@ - (BOOL)isIPv4Preferred __block BOOL result = NO; dispatch_block_t block = ^{ - result = (config & kPreferIPv4) ? YES : NO; + result = (self->config & kPreferIPv4) ? YES : NO; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -726,7 +733,7 @@ - (BOOL)isIPv6Preferred __block BOOL result = NO; dispatch_block_t block = ^{ - result = (config & kPreferIPv6) ? YES : NO; + result = (self->config & kPreferIPv6) ? YES : NO; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -742,7 +749,7 @@ - (BOOL)isIPVersionNeutral __block BOOL result = NO; dispatch_block_t block = ^{ - result = (config & (kPreferIPv4 | kPreferIPv6)) == 0; + result = (self->config & (kPreferIPv4 | kPreferIPv6)) == 0; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -759,8 +766,8 @@ - (void)setPreferIPv4 LogTrace(); - config |= kPreferIPv4; - config &= ~kPreferIPv6; + self->config |= kPreferIPv4; + self->config &= ~kPreferIPv6; }; @@ -776,8 +783,8 @@ - (void)setPreferIPv6 LogTrace(); - config &= ~kPreferIPv4; - config |= kPreferIPv6; + self->config &= ~kPreferIPv4; + self->config |= kPreferIPv6; }; @@ -793,8 +800,8 @@ - (void)setIPVersionNeutral LogTrace(); - config &= ~kPreferIPv4; - config &= ~kPreferIPv6; + self->config &= ~kPreferIPv4; + self->config &= ~kPreferIPv6; }; @@ -810,7 +817,7 @@ - (uint16_t)maxReceiveIPv4BufferSize dispatch_block_t block = ^{ - result = max4ReceiveSize; + result = self->max4ReceiveSize; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -827,7 +834,7 @@ - (void)setMaxReceiveIPv4BufferSize:(uint16_t)max LogVerbose(@"%@ %u", THIS_METHOD, (unsigned)max); - max4ReceiveSize = max; + self->max4ReceiveSize = max; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -842,7 +849,7 @@ - (uint32_t)maxReceiveIPv6BufferSize dispatch_block_t block = ^{ - result = max6ReceiveSize; + result = self->max6ReceiveSize; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -859,7 +866,7 @@ - (void)setMaxReceiveIPv6BufferSize:(uint32_t)max LogVerbose(@"%@ %u", THIS_METHOD, (unsigned)max); - max6ReceiveSize = max; + self->max6ReceiveSize = max; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -874,7 +881,7 @@ - (void)setMaxSendBufferSize:(uint16_t)max LogVerbose(@"%@ %u", THIS_METHOD, (unsigned)max); - maxSendSize = max; + self->maxSendSize = max; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -889,7 +896,7 @@ - (uint16_t)maxSendBufferSize dispatch_block_t block = ^{ - result = maxSendSize; + result = self->maxSendSize; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -906,7 +913,7 @@ - (id)userData dispatch_block_t block = ^{ - result = userData; + result = self->userData; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -921,9 +928,9 @@ - (void)setUserData:(id)arbitraryUserData { dispatch_block_t block = ^{ - if (userData != arbitraryUserData) + if (self->userData != arbitraryUserData) { - userData = arbitraryUserData; + self->userData = arbitraryUserData; } }; @@ -941,7 +948,7 @@ - (void)notifyDidConnectToAddress:(NSData *)anAddress { LogTrace(); - __strong id theDelegate = delegate; + __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(udpSocket:didConnectToAddress:)]) { NSData *address = [anAddress copy]; // In case param is NSMutableData @@ -957,7 +964,7 @@ - (void)notifyDidNotConnect:(NSError *)error { LogTrace(); - __strong id theDelegate = delegate; + __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(udpSocket:didNotConnect:)]) { dispatch_async(delegateQueue, ^{ @autoreleasepool { @@ -971,7 +978,7 @@ - (void)notifyDidSendDataWithTag:(long)tag { LogTrace(); - __strong id theDelegate = delegate; + __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(udpSocket:didSendDataWithTag:)]) { dispatch_async(delegateQueue, ^{ @autoreleasepool { @@ -985,7 +992,7 @@ - (void)notifyDidNotSendDataWithTag:(long)tag dueToError:(NSError *)error { LogTrace(); - __strong id theDelegate = delegate; + __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(udpSocket:didNotSendDataWithTag:dueToError:)]) { dispatch_async(delegateQueue, ^{ @autoreleasepool { @@ -1001,7 +1008,7 @@ - (void)notifyDidReceiveData:(NSData *)data fromAddress:(NSData *)address withFi SEL selector = @selector(udpSocket:didReceiveData:fromAddress:withFilterContext:); - __strong id theDelegate = delegate; + __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:selector]) { dispatch_async(delegateQueue, ^{ @autoreleasepool { @@ -1015,7 +1022,7 @@ - (void)notifyDidCloseWithError:(NSError *)error { LogTrace(); - __strong id theDelegate = delegate; + __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(udpSocketDidClose:withError:)]) { dispatch_async(delegateQueue, ^{ @autoreleasepool { @@ -1031,7 +1038,7 @@ - (void)notifyDidCloseWithError:(NSError *)error - (NSError *)badConfigError:(NSString *)errMsg { - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; return [NSError errorWithDomain:GCDAsyncUdpSocketErrorDomain code:GCDAsyncUdpSocketBadConfigError @@ -1040,7 +1047,7 @@ - (NSError *)badConfigError:(NSString *)errMsg - (NSError *)badParamError:(NSString *)errMsg { - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; return [NSError errorWithDomain:GCDAsyncUdpSocketErrorDomain code:GCDAsyncUdpSocketBadParamError @@ -1050,7 +1057,7 @@ - (NSError *)badParamError:(NSString *)errMsg - (NSError *)gaiError:(int)gai_error { NSString *errMsg = [NSString stringWithCString:gai_strerror(gai_error) encoding:NSASCIIStringEncoding]; - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; return [NSError errorWithDomain:@"kCFStreamErrorDomainNetDB" code:gai_error userInfo:userInfo]; } @@ -1061,10 +1068,10 @@ - (NSError *)errnoErrorWithReason:(NSString *)reason NSDictionary *userInfo; if (reason) - userInfo = [NSDictionary dictionaryWithObjectsAndKeys:errMsg, NSLocalizedDescriptionKey, - reason, NSLocalizedFailureReasonErrorKey, nil]; + userInfo = @{NSLocalizedDescriptionKey : errMsg, + NSLocalizedFailureReasonErrorKey : reason}; else - userInfo = [NSDictionary dictionaryWithObjectsAndKeys:errMsg, NSLocalizedDescriptionKey, nil]; + userInfo = @{NSLocalizedDescriptionKey : errMsg}; return [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:userInfo]; } @@ -1083,7 +1090,7 @@ - (NSError *)sendTimeoutError @"GCDAsyncUdpSocket", [NSBundle mainBundle], @"Send operation timed out", nil); - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; return [NSError errorWithDomain:GCDAsyncUdpSocketErrorDomain code:GCDAsyncUdpSocketSendTimeoutError @@ -1096,14 +1103,14 @@ - (NSError *)socketClosedError @"GCDAsyncUdpSocket", [NSBundle mainBundle], @"Socket closed", nil); - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; return [NSError errorWithDomain:GCDAsyncUdpSocketErrorDomain code:GCDAsyncUdpSocketClosedError userInfo:userInfo]; } - (NSError *)otherError:(NSString *)errMsg { - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; + NSDictionary *userInfo = @{NSLocalizedDescriptionKey : errMsg}; return [NSError errorWithDomain:GCDAsyncUdpSocketErrorDomain code:GCDAsyncUdpSocketOtherError @@ -1237,7 +1244,7 @@ - (void)asyncResolveHost:(NSString *)aHost // Fixes connection issues with IPv6, it is the same solution for udp socket. // https://github.com/robbiehanson/CocoaAsyncSocket/issues/429#issuecomment-222477158 - struct sockaddr_in6 *sockaddr = (struct sockaddr_in6 *)res->ai_addr; + struct sockaddr_in6 *sockaddr = (struct sockaddr_in6 *)(void *)res->ai_addr; in_port_t *portPtr = &sockaddr->sin6_port; if ((portPtr != NULL) && (*portPtr == 0)) { *portPtr = htons(port); @@ -1257,7 +1264,7 @@ - (void)asyncResolveHost:(NSString *)aHost } } - dispatch_async(socketQueue, ^{ @autoreleasepool { + dispatch_async(self->socketQueue, ^{ @autoreleasepool { completionBlock(addresses, error); }}); @@ -1486,7 +1493,7 @@ - (void)convertIntefaceDescription:(NSString *)interfaceDescription { // IPv4 - struct sockaddr_in *addr = (struct sockaddr_in *)cursor->ifa_addr; + struct sockaddr_in *addr = (struct sockaddr_in *)(void *)cursor->ifa_addr; if (strcmp(cursor->ifa_name, iface) == 0) { @@ -1519,7 +1526,7 @@ - (void)convertIntefaceDescription:(NSString *)interfaceDescription { // IPv6 - struct sockaddr_in6 *addr = (struct sockaddr_in6 *)cursor->ifa_addr; + const struct sockaddr_in6 *addr = (const struct sockaddr_in6 *)(const void *)cursor->ifa_addr; if (strcmp(cursor->ifa_name, iface) == 0) { @@ -1620,8 +1627,8 @@ - (BOOL)isConnectedToAddress4:(NSData *)someAddr4 return NO; } - const struct sockaddr_in *sSockaddr4 = (struct sockaddr_in *)[someAddr4 bytes]; - const struct sockaddr_in *cSockaddr4 = (struct sockaddr_in *)[cachedConnectedAddress bytes]; + const struct sockaddr_in *sSockaddr4 = (const struct sockaddr_in *)[someAddr4 bytes]; + const struct sockaddr_in *cSockaddr4 = (const struct sockaddr_in *)[cachedConnectedAddress bytes]; if (memcmp(&sSockaddr4->sin_addr, &cSockaddr4->sin_addr, sizeof(struct in_addr)) != 0) { @@ -1646,8 +1653,8 @@ - (BOOL)isConnectedToAddress6:(NSData *)someAddr6 return NO; } - const struct sockaddr_in6 *sSockaddr6 = (struct sockaddr_in6 *)[someAddr6 bytes]; - const struct sockaddr_in6 *cSockaddr6 = (struct sockaddr_in6 *)[cachedConnectedAddress bytes]; + const struct sockaddr_in6 *sSockaddr6 = (const struct sockaddr_in6 *)[someAddr6 bytes]; + const struct sockaddr_in6 *cSockaddr6 = (const struct sockaddr_in6 *)[cachedConnectedAddress bytes]; if (memcmp(&sSockaddr6->sin6_addr, &cSockaddr6->sin6_addr, sizeof(struct in6_addr)) != 0) { @@ -1669,7 +1676,7 @@ - (unsigned int)indexOfInterfaceAddr4:(NSData *)interfaceAddr4 return 0; int result = 0; - struct sockaddr_in *ifaceAddr = (struct sockaddr_in *)[interfaceAddr4 bytes]; + const struct sockaddr_in *ifaceAddr = (const struct sockaddr_in *)[interfaceAddr4 bytes]; struct ifaddrs *addrs; const struct ifaddrs *cursor; @@ -1683,7 +1690,7 @@ - (unsigned int)indexOfInterfaceAddr4:(NSData *)interfaceAddr4 { // IPv4 - struct sockaddr_in *addr = (struct sockaddr_in *)cursor->ifa_addr; + const struct sockaddr_in *addr = (const struct sockaddr_in *)(const void *)cursor->ifa_addr; if (memcmp(&addr->sin_addr, &ifaceAddr->sin_addr, sizeof(struct in_addr)) == 0) { @@ -1709,7 +1716,7 @@ - (unsigned int)indexOfInterfaceAddr6:(NSData *)interfaceAddr6 return 0; int result = 0; - struct sockaddr_in6 *ifaceAddr = (struct sockaddr_in6 *)[interfaceAddr6 bytes]; + const struct sockaddr_in6 *ifaceAddr = (const struct sockaddr_in6 *)[interfaceAddr6 bytes]; struct ifaddrs *addrs; const struct ifaddrs *cursor; @@ -1723,7 +1730,7 @@ - (unsigned int)indexOfInterfaceAddr6:(NSData *)interfaceAddr6 { // IPv6 - struct sockaddr_in6 *addr = (struct sockaddr_in6 *)cursor->ifa_addr; + const struct sockaddr_in6 *addr = (const struct sockaddr_in6 *)(const void *)cursor->ifa_addr; if (memcmp(&addr->sin6_addr, &ifaceAddr->sin6_addr, sizeof(struct in6_addr)) == 0) { @@ -1756,22 +1763,22 @@ - (void)setupSendAndReceiveSourcesForSocket4 LogVerbose(@"send4EventBlock"); LogVerbose(@"dispatch_source_get_data(send4Source) = %lu", dispatch_source_get_data(send4Source)); - flags |= kSock4CanAcceptBytes; + self->flags |= kSock4CanAcceptBytes; // If we're ready to send data, do so immediately. // Otherwise pause the send source or it will continue to fire over and over again. - if (currentSend == nil) + if (self->currentSend == nil) { LogVerbose(@"Nothing to send"); [self suspendSend4Source]; } - else if (currentSend->resolveInProgress) + else if (self->currentSend->resolveInProgress) { LogVerbose(@"currentSend - waiting for address resolve"); [self suspendSend4Source]; } - else if (currentSend->filterInProgress) + else if (self->currentSend->filterInProgress) { LogVerbose(@"currentSend - waiting on sendFilter"); [self suspendSend4Source]; @@ -1787,10 +1794,10 @@ - (void)setupSendAndReceiveSourcesForSocket4 LogVerbose(@"receive4EventBlock"); - socket4FDBytesAvailable = dispatch_source_get_data(receive4Source); + self->socket4FDBytesAvailable = dispatch_source_get_data(self->receive4Source); LogVerbose(@"socket4FDBytesAvailable: %lu", socket4FDBytesAvailable); - if (socket4FDBytesAvailable > 0) + if (self->socket4FDBytesAvailable > 0) [self doReceive]; else [self doReceiveEOF]; @@ -1867,22 +1874,22 @@ - (void)setupSendAndReceiveSourcesForSocket6 LogVerbose(@"send6EventBlock"); LogVerbose(@"dispatch_source_get_data(send6Source) = %lu", dispatch_source_get_data(send6Source)); - flags |= kSock6CanAcceptBytes; + self->flags |= kSock6CanAcceptBytes; // If we're ready to send data, do so immediately. // Otherwise pause the send source or it will continue to fire over and over again. - if (currentSend == nil) + if (self->currentSend == nil) { LogVerbose(@"Nothing to send"); [self suspendSend6Source]; } - else if (currentSend->resolveInProgress) + else if (self->currentSend->resolveInProgress) { LogVerbose(@"currentSend - waiting for address resolve"); [self suspendSend6Source]; } - else if (currentSend->filterInProgress) + else if (self->currentSend->filterInProgress) { LogVerbose(@"currentSend - waiting on sendFilter"); [self suspendSend6Source]; @@ -1898,10 +1905,10 @@ - (void)setupSendAndReceiveSourcesForSocket6 LogVerbose(@"receive6EventBlock"); - socket6FDBytesAvailable = dispatch_source_get_data(receive6Source); + self->socket6FDBytesAvailable = dispatch_source_get_data(self->receive6Source); LogVerbose(@"socket6FDBytesAvailable: %lu", socket6FDBytesAvailable); - if (socket6FDBytesAvailable > 0) + if (self->socket6FDBytesAvailable > 0) [self doReceive]; else [self doReceiveEOF]; @@ -2035,7 +2042,7 @@ - (BOOL)createSocket4:(BOOL)useIPv4 socket6:(BOOL)useIPv6 error:(NSError * __aut * I can not ensure the protocol type now so that the max size is set to 65535 :) **/ - status = setsockopt(socketFD, SOL_SOCKET, SO_SNDBUF, (const char*)&maxSendSize, sizeof(int)); + status = setsockopt(socketFD, SOL_SOCKET, SO_SNDBUF, (const char*)&self->maxSendSize, sizeof(int)); if (status == -1) { if (errPtr) @@ -2044,7 +2051,7 @@ - (BOOL)createSocket4:(BOOL)useIPv4 socket6:(BOOL)useIPv6 error:(NSError * __aut return SOCKET_NULL; } - status = setsockopt(socketFD, SOL_SOCKET, SO_RCVBUF, (const char*)&maxSendSize, sizeof(int)); + status = setsockopt(socketFD, SOL_SOCKET, SO_RCVBUF, (const char*)&self->maxSendSize, sizeof(int)); if (status == -1) { if (errPtr) @@ -2388,15 +2395,15 @@ - (NSData *)localAddress dispatch_block_t block = ^{ - if (socket4FD != SOCKET_NULL) + if (self->socket4FD != SOCKET_NULL) { [self maybeUpdateCachedLocalAddress4Info]; - result = cachedLocalAddress4; + result = self->cachedLocalAddress4; } else { [self maybeUpdateCachedLocalAddress6Info]; - result = cachedLocalAddress6; + result = self->cachedLocalAddress6; } }; @@ -2415,15 +2422,15 @@ - (NSString *)localHost dispatch_block_t block = ^{ - if (socket4FD != SOCKET_NULL) + if (self->socket4FD != SOCKET_NULL) { [self maybeUpdateCachedLocalAddress4Info]; - result = cachedLocalHost4; + result = self->cachedLocalHost4; } else { [self maybeUpdateCachedLocalAddress6Info]; - result = cachedLocalHost6; + result = self->cachedLocalHost6; } }; @@ -2441,15 +2448,15 @@ - (uint16_t)localPort dispatch_block_t block = ^{ - if (socket4FD != SOCKET_NULL) + if (self->socket4FD != SOCKET_NULL) { [self maybeUpdateCachedLocalAddress4Info]; - result = cachedLocalPort4; + result = self->cachedLocalPort4; } else { [self maybeUpdateCachedLocalAddress6Info]; - result = cachedLocalPort6; + result = self->cachedLocalPort6; } }; @@ -2468,7 +2475,7 @@ - (NSData *)localAddress_IPv4 dispatch_block_t block = ^{ [self maybeUpdateCachedLocalAddress4Info]; - result = cachedLocalAddress4; + result = self->cachedLocalAddress4; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -2486,7 +2493,7 @@ - (NSString *)localHost_IPv4 dispatch_block_t block = ^{ [self maybeUpdateCachedLocalAddress4Info]; - result = cachedLocalHost4; + result = self->cachedLocalHost4; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -2504,7 +2511,7 @@ - (uint16_t)localPort_IPv4 dispatch_block_t block = ^{ [self maybeUpdateCachedLocalAddress4Info]; - result = cachedLocalPort4; + result = self->cachedLocalPort4; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -2522,7 +2529,7 @@ - (NSData *)localAddress_IPv6 dispatch_block_t block = ^{ [self maybeUpdateCachedLocalAddress6Info]; - result = cachedLocalAddress6; + result = self->cachedLocalAddress6; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -2540,7 +2547,7 @@ - (NSString *)localHost_IPv6 dispatch_block_t block = ^{ [self maybeUpdateCachedLocalAddress6Info]; - result = cachedLocalHost6; + result = self->cachedLocalHost6; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -2558,7 +2565,7 @@ - (uint16_t)localPort_IPv6 dispatch_block_t block = ^{ [self maybeUpdateCachedLocalAddress6Info]; - result = cachedLocalPort6; + result = self->cachedLocalPort6; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -2632,7 +2639,7 @@ - (NSData *)connectedAddress dispatch_block_t block = ^{ [self maybeUpdateCachedConnectedAddressInfo]; - result = cachedConnectedAddress; + result = self->cachedConnectedAddress; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -2650,7 +2657,7 @@ - (NSString *)connectedHost dispatch_block_t block = ^{ [self maybeUpdateCachedConnectedAddressInfo]; - result = cachedConnectedHost; + result = self->cachedConnectedHost; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -2668,7 +2675,7 @@ - (uint16_t)connectedPort dispatch_block_t block = ^{ [self maybeUpdateCachedConnectedAddressInfo]; - result = cachedConnectedPort; + result = self->cachedConnectedPort; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -2684,7 +2691,7 @@ - (BOOL)isConnected __block BOOL result = NO; dispatch_block_t block = ^{ - result = (flags & kDidConnect) ? YES : NO; + result = (self->flags & kDidConnect) ? YES : NO; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -2701,7 +2708,7 @@ - (BOOL)isClosed dispatch_block_t block = ^{ - result = (flags & kDidCreateSockets) ? NO : YES; + result = (self->flags & kDidCreateSockets) ? NO : YES; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -2718,9 +2725,9 @@ - (BOOL)isIPv4 dispatch_block_t block = ^{ - if (flags & kDidCreateSockets) + if (self->flags & kDidCreateSockets) { - result = (socket4FD != SOCKET_NULL); + result = (self->socket4FD != SOCKET_NULL); } else { @@ -2742,9 +2749,9 @@ - (BOOL)isIPv6 dispatch_block_t block = ^{ - if (flags & kDidCreateSockets) + if (self->flags & kDidCreateSockets) { - result = (socket6FD != SOCKET_NULL); + result = (self->socket6FD != SOCKET_NULL); } else { @@ -2845,8 +2852,8 @@ - (BOOL)bindToPort:(uint16_t)port interface:(NSString *)interface error:(NSError return_from_block; } - BOOL isIPv4Disabled = (config & kIPv4Disabled) ? YES : NO; - BOOL isIPv6Disabled = (config & kIPv6Disabled) ? YES : NO; + BOOL isIPv4Disabled = (self->config & kIPv4Disabled) ? YES : NO; + BOOL isIPv6Disabled = (self->config & kIPv6Disabled) ? YES : NO; if (isIPv4Disabled && (interface6 == nil)) { @@ -2871,7 +2878,7 @@ - (BOOL)bindToPort:(uint16_t)port interface:(NSString *)interface error:(NSError // Create the socket(s) if needed - if ((flags & kDidCreateSockets) == 0) + if ((self->flags & kDidCreateSockets) == 0) { if (![self createSocket4:useIPv4 socket6:useIPv6 error:&err]) { @@ -2885,7 +2892,7 @@ - (BOOL)bindToPort:(uint16_t)port interface:(NSString *)interface error:(NSError if (useIPv4) { - int status = bind(socket4FD, (struct sockaddr *)[interface4 bytes], (socklen_t)[interface4 length]); + int status = bind(self->socket4FD, (const struct sockaddr *)[interface4 bytes], (socklen_t)[interface4 length]); if (status == -1) { [self closeSockets]; @@ -2899,7 +2906,7 @@ - (BOOL)bindToPort:(uint16_t)port interface:(NSString *)interface error:(NSError if (useIPv6) { - int status = bind(socket6FD, (struct sockaddr *)[interface6 bytes], (socklen_t)[interface6 length]); + int status = bind(self->socket6FD, (const struct sockaddr *)[interface6 bytes], (socklen_t)[interface6 length]); if (status == -1) { [self closeSockets]; @@ -2913,10 +2920,10 @@ - (BOOL)bindToPort:(uint16_t)port interface:(NSString *)interface error:(NSError // Update flags - flags |= kDidBind; + self->flags |= kDidBind; - if (!useIPv4) flags |= kIPv4Deactivated; - if (!useIPv6) flags |= kIPv6Deactivated; + if (!useIPv4) self->flags |= kIPv4Deactivated; + if (!useIPv6) self->flags |= kIPv6Deactivated; result = YES; @@ -2965,8 +2972,8 @@ - (BOOL)bindToAddress:(NSData *)localAddr error:(NSError **)errPtr NSData *localAddr4 = (addressFamily == AF_INET) ? localAddr : nil; NSData *localAddr6 = (addressFamily == AF_INET6) ? localAddr : nil; - BOOL isIPv4Disabled = (config & kIPv4Disabled) ? YES : NO; - BOOL isIPv6Disabled = (config & kIPv6Disabled) ? YES : NO; + BOOL isIPv4Disabled = (self->config & kIPv4Disabled) ? YES : NO; + BOOL isIPv6Disabled = (self->config & kIPv6Disabled) ? YES : NO; if (isIPv4Disabled && localAddr4) { @@ -2991,7 +2998,7 @@ - (BOOL)bindToAddress:(NSData *)localAddr error:(NSError **)errPtr // Create the socket(s) if needed - if ((flags & kDidCreateSockets) == 0) + if ((self->flags & kDidCreateSockets) == 0) { if (![self createSocket4:useIPv4 socket6:useIPv6 error:&err]) { @@ -3007,7 +3014,7 @@ - (BOOL)bindToAddress:(NSData *)localAddr error:(NSError **)errPtr [[self class] hostFromAddress:localAddr4], [[self class] portFromAddress:localAddr4]); - int status = bind(socket4FD, (struct sockaddr *)[localAddr4 bytes], (socklen_t)[localAddr4 length]); + int status = bind(self->socket4FD, (const struct sockaddr *)[localAddr4 bytes], (socklen_t)[localAddr4 length]); if (status == -1) { [self closeSockets]; @@ -3024,7 +3031,7 @@ - (BOOL)bindToAddress:(NSData *)localAddr error:(NSError **)errPtr [[self class] hostFromAddress:localAddr6], [[self class] portFromAddress:localAddr6]); - int status = bind(socket6FD, (struct sockaddr *)[localAddr6 bytes], (socklen_t)[localAddr6 length]); + int status = bind(self->socket6FD, (const struct sockaddr *)[localAddr6 bytes], (socklen_t)[localAddr6 length]); if (status == -1) { [self closeSockets]; @@ -3038,10 +3045,10 @@ - (BOOL)bindToAddress:(NSData *)localAddr error:(NSError **)errPtr // Update flags - flags |= kDidBind; + self->flags |= kDidBind; - if (!useIPv4) flags |= kIPv4Deactivated; - if (!useIPv6) flags |= kIPv6Deactivated; + if (!useIPv4) self->flags |= kIPv4Deactivated; + if (!useIPv6) self->flags |= kIPv6Deactivated; result = YES; @@ -3128,7 +3135,7 @@ - (BOOL)connectToHost:(NSString *)host onPort:(uint16_t)port error:(NSError **)e // Create the socket(s) if needed - if ((flags & kDidCreateSockets) == 0) + if ((self->flags & kDidCreateSockets) == 0) { if (![self createSockets:&err]) { @@ -3161,9 +3168,9 @@ - (BOOL)connectToHost:(NSString *)host onPort:(uint16_t)port error:(NSError **)e // Updates flags, add connect packet to send queue, and pump send queue - flags |= kConnecting; + self->flags |= kConnecting; - [sendQueue addObject:packet]; + [self->sendQueue addObject:packet]; [self maybeDequeueSend]; result = YES; @@ -3209,7 +3216,7 @@ - (BOOL)connectToAddress:(NSData *)remoteAddr error:(NSError **)errPtr // Create the socket(s) if needed - if ((flags & kDidCreateSockets) == 0) + if ((self->flags & kDidCreateSockets) == 0) { if (![self createSockets:&err]) { @@ -3228,9 +3235,9 @@ - (BOOL)connectToAddress:(NSData *)remoteAddr error:(NSError **)errPtr // Updates flags, add connect packet to send queue, and pump send queue - flags |= kConnecting; + self->flags |= kConnecting; - [sendQueue addObject:packet]; + [self->sendQueue addObject:packet]; [self maybeDequeueSend]; result = YES; @@ -3320,7 +3327,7 @@ - (BOOL)connectWithAddress4:(NSData *)address4 error:(NSError **)errPtr LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); - int status = connect(socket4FD, (struct sockaddr *)[address4 bytes], (socklen_t)[address4 length]); + int status = connect(socket4FD, (const struct sockaddr *)[address4 bytes], (socklen_t)[address4 length]); if (status != 0) { if (errPtr) @@ -3340,7 +3347,7 @@ - (BOOL)connectWithAddress6:(NSData *)address6 error:(NSError **)errPtr LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); - int status = connect(socket6FD, (struct sockaddr *)[address6 bytes], (socklen_t)[address6 length]); + int status = connect(socket6FD, (const struct sockaddr *)[address6 bytes], (socklen_t)[address6 length]); if (status != 0) { if (errPtr) @@ -3460,16 +3467,16 @@ - (BOOL)performMulticastRequest:(int)requestType // Perform join - if ((socket4FD != SOCKET_NULL) && groupAddr4 && interfaceAddr4) + if ((self->socket4FD != SOCKET_NULL) && groupAddr4 && interfaceAddr4) { - const struct sockaddr_in *nativeGroup = (struct sockaddr_in *)[groupAddr4 bytes]; - const struct sockaddr_in *nativeIface = (struct sockaddr_in *)[interfaceAddr4 bytes]; + const struct sockaddr_in *nativeGroup = (const struct sockaddr_in *)[groupAddr4 bytes]; + const struct sockaddr_in *nativeIface = (const struct sockaddr_in *)[interfaceAddr4 bytes]; struct ip_mreq imreq; imreq.imr_multiaddr = nativeGroup->sin_addr; imreq.imr_interface = nativeIface->sin_addr; - int status = setsockopt(socket4FD, IPPROTO_IP, requestType, (const void *)&imreq, sizeof(imreq)); + int status = setsockopt(self->socket4FD, IPPROTO_IP, requestType, (const void *)&imreq, sizeof(imreq)); if (status != 0) { err = [self errnoErrorWithReason:@"Error in setsockopt() function"]; @@ -3482,15 +3489,15 @@ - (BOOL)performMulticastRequest:(int)requestType result = YES; } - else if ((socket6FD != SOCKET_NULL) && groupAddr6 && interfaceAddr6) + else if ((self->socket6FD != SOCKET_NULL) && groupAddr6 && interfaceAddr6) { - const struct sockaddr_in6 *nativeGroup = (struct sockaddr_in6 *)[groupAddr6 bytes]; + const struct sockaddr_in6 *nativeGroup = (const struct sockaddr_in6 *)[groupAddr6 bytes]; struct ipv6_mreq imreq; imreq.ipv6mr_multiaddr = nativeGroup->sin6_addr; imreq.ipv6mr_interface = [self indexOfInterfaceAddr6:interfaceAddr6]; - int status = setsockopt(socket6FD, IPPROTO_IPV6, requestType, (const void *)&imreq, sizeof(imreq)); + int status = setsockopt(self->socket6FD, IPPROTO_IPV6, requestType, (const void *)&imreq, sizeof(imreq)); if (status != 0) { err = [self errnoErrorWithReason:@"Error in setsockopt() function"]; @@ -3524,6 +3531,121 @@ - (BOOL)performMulticastRequest:(int)requestType return result; } +- (BOOL)sendIPv4MulticastOnInterface:(NSString*)interface error:(NSError **)errPtr +{ + __block BOOL result = NO; + __block NSError *err = nil; + + dispatch_block_t block = ^{ @autoreleasepool { + + if (![self preOp:&err]) + { + return_from_block; + } + + if ((self->flags & kDidCreateSockets) == 0) + { + if (![self createSockets:&err]) + { + return_from_block; + } + } + + // Convert interface to address + + NSData *interfaceAddr4 = nil; + NSData *interfaceAddr6 = nil; + + [self convertIntefaceDescription:interface port:0 intoAddress4:&interfaceAddr4 address6:&interfaceAddr6]; + + if (interfaceAddr4 == nil) + { + NSString *msg = @"Unknown interface. Specify valid interface by IP address."; + err = [self badParamError:msg]; + return_from_block; + } + + if (self->socket4FD != SOCKET_NULL) { + const struct sockaddr_in *nativeIface = (struct sockaddr_in *)[interfaceAddr4 bytes]; + struct in_addr interface_addr = nativeIface->sin_addr; + int status = setsockopt(self->socket4FD, IPPROTO_IP, IP_MULTICAST_IF, &interface_addr, sizeof(interface_addr)); + if (status != 0) { + err = [self errnoErrorWithReason:@"Error in setsockopt() function"]; + return_from_block; + result = YES; + } + } + + }}; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_sync(socketQueue, block); + + if (errPtr) + *errPtr = err; + + return result; +} + +- (BOOL)sendIPv6MulticastOnInterface:(NSString*)interface error:(NSError **)errPtr +{ + __block BOOL result = NO; + __block NSError *err = nil; + + dispatch_block_t block = ^{ @autoreleasepool { + + if (![self preOp:&err]) + { + return_from_block; + } + + if ((self->flags & kDidCreateSockets) == 0) + { + if (![self createSockets:&err]) + { + return_from_block; + } + } + + // Convert interface to address + + NSData *interfaceAddr4 = nil; + NSData *interfaceAddr6 = nil; + + [self convertIntefaceDescription:interface port:0 intoAddress4:&interfaceAddr4 address6:&interfaceAddr6]; + + if (interfaceAddr6 == nil) + { + NSString *msg = @"Unknown interface. Specify valid interface by name (e.g. \"en1\")."; + err = [self badParamError:msg]; + return_from_block; + } + + if ((self->socket6FD != SOCKET_NULL)) { + uint32_t scope_id = [self indexOfInterfaceAddr6:interfaceAddr6]; + int status = setsockopt(self->socket6FD, IPPROTO_IPV6, IPV6_MULTICAST_IF, &scope_id, sizeof(scope_id)); + if (status != 0) { + err = [self errnoErrorWithReason:@"Error in setsockopt() function"]; + return_from_block; + } + result = YES; + } + + }}; + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + block(); + else + dispatch_sync(socketQueue, block); + + if (errPtr) + *errPtr = err; + + return result; +} + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Reuse port //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -3540,7 +3662,7 @@ - (BOOL)enableReusePort:(BOOL)flag error:(NSError **)errPtr return_from_block; } - if ((flags & kDidCreateSockets) == 0) + if ((self->flags & kDidCreateSockets) == 0) { if (![self createSockets:&err]) { @@ -3549,9 +3671,9 @@ - (BOOL)enableReusePort:(BOOL)flag error:(NSError **)errPtr } int value = flag ? 1 : 0; - if (socket4FD != SOCKET_NULL) + if (self->socket4FD != SOCKET_NULL) { - int error = setsockopt(socket4FD, SOL_SOCKET, SO_REUSEPORT, (const void *)&value, sizeof(value)); + int error = setsockopt(self->socket4FD, SOL_SOCKET, SO_REUSEPORT, (const void *)&value, sizeof(value)); if (error) { @@ -3562,9 +3684,9 @@ - (BOOL)enableReusePort:(BOOL)flag error:(NSError **)errPtr result = YES; } - if (socket6FD != SOCKET_NULL) + if (self->socket6FD != SOCKET_NULL) { - int error = setsockopt(socket6FD, SOL_SOCKET, SO_REUSEPORT, (const void *)&value, sizeof(value)); + int error = setsockopt(self->socket6FD, SOL_SOCKET, SO_REUSEPORT, (const void *)&value, sizeof(value)); if (error) { @@ -3604,7 +3726,7 @@ - (BOOL)enableBroadcast:(BOOL)flag error:(NSError **)errPtr return_from_block; } - if ((flags & kDidCreateSockets) == 0) + if ((self->flags & kDidCreateSockets) == 0) { if (![self createSockets:&err]) { @@ -3612,10 +3734,10 @@ - (BOOL)enableBroadcast:(BOOL)flag error:(NSError **)errPtr } } - if (socket4FD != SOCKET_NULL) + if (self->socket4FD != SOCKET_NULL) { int value = flag ? 1 : 0; - int error = setsockopt(socket4FD, SOL_SOCKET, SO_BROADCAST, (const void *)&value, sizeof(value)); + int error = setsockopt(self->socket4FD, SOL_SOCKET, SO_BROADCAST, (const void *)&value, sizeof(value)); if (error) { @@ -3667,7 +3789,7 @@ - (void)sendData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)ta dispatch_async(socketQueue, ^{ @autoreleasepool { - [sendQueue addObject:packet]; + [self->sendQueue addObject:packet]; [self maybeDequeueSend]; }}); @@ -3701,7 +3823,7 @@ - (void)sendData:(NSData *)data packet->resolvedAddresses = addresses; packet->resolveError = error; - if (packet == currentSend) + if (packet == self->currentSend) { LogVerbose(@"currentSend - address resolved"); [self doPreSend]; @@ -3710,7 +3832,7 @@ - (void)sendData:(NSData *)data dispatch_async(socketQueue, ^{ @autoreleasepool { - [sendQueue addObject:packet]; + [self->sendQueue addObject:packet]; [self maybeDequeueSend]; }}); @@ -3733,7 +3855,7 @@ - (void)sendData:(NSData *)data toAddress:(NSData *)remoteAddr withTimeout:(NSTi dispatch_async(socketQueue, ^{ @autoreleasepool { - [sendQueue addObject:packet]; + [self->sendQueue addObject:packet]; [self maybeDequeueSend]; }}); } @@ -3764,12 +3886,12 @@ - (void)setSendFilter:(GCDAsyncUdpSocketSendFilterBlock)filterBlock dispatch_block_t block = ^{ #if !OS_OBJECT_USE_OBJC - if (sendFilterQueue) dispatch_release(sendFilterQueue); + if (self->sendFilterQueue) dispatch_release(self->sendFilterQueue); #endif - sendFilterBlock = newFilterBlock; - sendFilterQueue = newFilterQueue; - sendFilterAsync = isAsynchronous; + self->sendFilterBlock = newFilterBlock; + self->sendFilterQueue = newFilterQueue; + self->sendFilterAsync = isAsynchronous; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -3948,12 +4070,12 @@ - (void)doPreSend dispatch_async(sendFilterQueue, ^{ @autoreleasepool { - BOOL allowed = sendFilterBlock(sendPacket->buffer, sendPacket->address, sendPacket->tag); + BOOL allowed = self->sendFilterBlock(sendPacket->buffer, sendPacket->address, sendPacket->tag); - dispatch_async(socketQueue, ^{ @autoreleasepool { + dispatch_async(self->socketQueue, ^{ @autoreleasepool { sendPacket->filterInProgress = NO; - if (sendPacket == currentSend) + if (sendPacket == self->currentSend) { if (allowed) { @@ -3963,7 +4085,7 @@ - (void)doPreSend { LogVerbose(@"currentSend - silently dropped by sendFilter"); - [self notifyDidSendDataWithTag:currentSend->tag]; + [self notifyDidSendDataWithTag:self->currentSend->tag]; [self endCurrentSend]; [self maybeDequeueSend]; } @@ -3979,7 +4101,7 @@ - (void)doPreSend dispatch_sync(sendFilterQueue, ^{ @autoreleasepool { - allowed = sendFilterBlock(currentSend->buffer, currentSend->address, currentSend->tag); + allowed = self->sendFilterBlock(self->currentSend->buffer, self->currentSend->address, self->currentSend->tag); }}); if (allowed) @@ -4187,9 +4309,9 @@ - (BOOL)receiveOnce:(NSError **)errPtr dispatch_block_t block = ^{ - if ((flags & kReceiveOnce) == 0) + if ((self->flags & kReceiveOnce) == 0) { - if ((flags & kDidCreateSockets) == 0) + if ((self->flags & kDidCreateSockets) == 0) { NSString *msg = @"Must bind socket before you can receive data. " @"You can do this explicitly via bind, or implicitly via connect or by sending data."; @@ -4198,10 +4320,10 @@ - (BOOL)receiveOnce:(NSError **)errPtr return_from_block; } - flags |= kReceiveOnce; // Enable - flags &= ~kReceiveContinuous; // Disable + self->flags |= kReceiveOnce; // Enable + self->flags &= ~kReceiveContinuous; // Disable - dispatch_async(socketQueue, ^{ @autoreleasepool { + dispatch_async(self->socketQueue, ^{ @autoreleasepool { [self doReceive]; }}); @@ -4233,9 +4355,9 @@ - (BOOL)beginReceiving:(NSError **)errPtr dispatch_block_t block = ^{ - if ((flags & kReceiveContinuous) == 0) + if ((self->flags & kReceiveContinuous) == 0) { - if ((flags & kDidCreateSockets) == 0) + if ((self->flags & kDidCreateSockets) == 0) { NSString *msg = @"Must bind socket before you can receive data. " @"You can do this explicitly via bind, or implicitly via connect or by sending data."; @@ -4244,10 +4366,10 @@ - (BOOL)beginReceiving:(NSError **)errPtr return_from_block; } - flags |= kReceiveContinuous; // Enable - flags &= ~kReceiveOnce; // Disable + self->flags |= kReceiveContinuous; // Enable + self->flags &= ~kReceiveOnce; // Disable - dispatch_async(socketQueue, ^{ @autoreleasepool { + dispatch_async(self->socketQueue, ^{ @autoreleasepool { [self doReceive]; }}); @@ -4276,13 +4398,13 @@ - (void)pauseReceiving dispatch_block_t block = ^{ - flags &= ~kReceiveOnce; // Disable - flags &= ~kReceiveContinuous; // Disable + self->flags &= ~kReceiveOnce; // Disable + self->flags &= ~kReceiveContinuous; // Disable - if (socket4FDBytesAvailable > 0) { + if (self->socket4FDBytesAvailable > 0) { [self suspendReceive4Source]; } - if (socket6FDBytesAvailable > 0) { + if (self->socket6FDBytesAvailable > 0) { [self suspendReceive6Source]; } }; @@ -4319,12 +4441,12 @@ - (void)setReceiveFilter:(GCDAsyncUdpSocketReceiveFilterBlock)filterBlock dispatch_block_t block = ^{ #if !OS_OBJECT_USE_OBJC - if (receiveFilterQueue) dispatch_release(receiveFilterQueue); + if (self->receiveFilterQueue) dispatch_release(self->receiveFilterQueue); #endif - receiveFilterBlock = newFilterBlock; - receiveFilterQueue = newFilterQueue; - receiveFilterAsync = isAsynchronous; + self->receiveFilterBlock = newFilterBlock; + self->receiveFilterQueue = newFilterQueue; + self->receiveFilterAsync = isAsynchronous; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) @@ -4541,12 +4663,12 @@ - (void)doReceive pendingFilterOperations++; dispatch_async(receiveFilterQueue, ^{ @autoreleasepool { - allowed = receiveFilterBlock(data, addr, &filterContext); + allowed = self->receiveFilterBlock(data, addr, &filterContext); // Transition back to socketQueue to get the current delegate / delegateQueue - dispatch_async(socketQueue, ^{ @autoreleasepool { + dispatch_async(self->socketQueue, ^{ @autoreleasepool { - pendingFilterOperations--; + self->pendingFilterOperations--; if (allowed) { @@ -4557,15 +4679,15 @@ - (void)doReceive LogVerbose(@"received packet silently dropped by receiveFilter"); } - if (flags & kReceiveOnce) + if (self->flags & kReceiveOnce) { if (allowed) { // The delegate has been notified, // so our receive once operation has completed. - flags &= ~kReceiveOnce; + self->flags &= ~kReceiveOnce; } - else if (pendingFilterOperations == 0) + else if (self->pendingFilterOperations == 0) { // All pending filter operations have completed, // and none were allowed through. @@ -4580,7 +4702,7 @@ - (void)doReceive { dispatch_sync(receiveFilterQueue, ^{ @autoreleasepool { - allowed = receiveFilterBlock(data, addr, &filterContext); + allowed = self->receiveFilterBlock(data, addr, &filterContext); }}); if (allowed) @@ -4707,9 +4829,9 @@ - (void)closeAfterSending dispatch_block_t block = ^{ @autoreleasepool { - flags |= kCloseAfterSends; + self->flags |= kCloseAfterSends; - if (currentSend == nil && [sendQueue count] == 0) + if (self->currentSend == nil && [self->sendQueue count] == 0) { [self closeWithError:nil]; } @@ -4738,13 +4860,13 @@ + (void)startListenerThreadIfNeeded dispatch_once(&predicate, ^{ listenerThread = [[NSThread alloc] initWithTarget:self - selector:@selector(listenerThread) + selector:@selector(listenerThread:) object:nil]; [listenerThread start]; }); } -+ (void)listenerThread ++ (void)listenerThread:(id)unused { @autoreleasepool { @@ -5185,6 +5307,7 @@ - (void)closeReadAndWriteStreams #endif +#if TARGET_OS_IPHONE - (void)applicationWillEnterForeground:(NSNotification *)notification { LogTrace(); @@ -5203,6 +5326,7 @@ - (void)applicationWillEnterForeground:(NSNotification *)notification else dispatch_async(socketQueue, block); } +#endif //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Advanced @@ -5474,7 +5598,7 @@ + (BOOL)getHost:(NSString **)hostPtr port:(uint16_t *)portPtr family:(int *)afPt { if ([address length] >= sizeof(struct sockaddr_in)) { - const struct sockaddr_in *addr4 = (const struct sockaddr_in *)addrX; + const struct sockaddr_in *addr4 = (const struct sockaddr_in *)(const void *)addrX; if (hostPtr) *hostPtr = [self hostFromSockaddr4:addr4]; if (portPtr) *portPtr = [self portFromSockaddr4:addr4]; @@ -5487,7 +5611,7 @@ + (BOOL)getHost:(NSString **)hostPtr port:(uint16_t *)portPtr family:(int *)afPt { if ([address length] >= sizeof(struct sockaddr_in6)) { - const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *)addrX; + const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *)(const void *)addrX; if (hostPtr) *hostPtr = [self hostFromSockaddr6:addr6]; if (portPtr) *portPtr = [self portFromSockaddr6:addr6]; diff --git a/Pods/CocoaHTTPServer/Core/HTTPConnection.m b/Pods/CocoaHTTPServer/Core/HTTPConnection.m index 0a65d3d71..d4ac82f54 100644 --- a/Pods/CocoaHTTPServer/Core/HTTPConnection.m +++ b/Pods/CocoaHTTPServer/Core/HTTPConnection.m @@ -16,31 +16,6 @@ #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). #endif -// Does ARC support support GCD objects? -// It does if the minimum deployment target is iOS 6+ or Mac OS X 8+ - -#if TARGET_OS_IPHONE - - // Compiling for iOS - - #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later - #define NEEDS_DISPATCH_RETAIN_RELEASE 0 - #else // iOS 5.X or earlier - #define NEEDS_DISPATCH_RETAIN_RELEASE 1 - #endif - -#else - - // Compiling for Mac OS X - - #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later - #define NEEDS_DISPATCH_RETAIN_RELEASE 0 - #else - #define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier - #endif - -#endif - // Log levels: off, error, warn, info, verbose // Other flags: trace static const int httpLogLevel = HTTP_LOG_LEVEL_WARN; // | HTTP_LOG_FLAG_TRACE; @@ -48,16 +23,16 @@ // Define chunk size used to read in data for responses // This is how much data will be read from disk into RAM at a time #if TARGET_OS_IPHONE - #define READ_CHUNKSIZE (1024 * 128) + #define READ_CHUNKSIZE (1024 * 256) #else #define READ_CHUNKSIZE (1024 * 512) #endif // Define chunk size used to read in POST upload data #if TARGET_OS_IPHONE - #define POST_CHUNKSIZE (1024 * 32) + #define POST_CHUNKSIZE (1024 * 256) #else - #define POST_CHUNKSIZE (1024 * 128) + #define POST_CHUNKSIZE (1024 * 512) #endif // Define the various timeouts (in seconds) for various parts of the HTTP process @@ -207,7 +182,7 @@ - (id)initWithAsyncSocket:(GCDAsyncSocket *)newSocket configuration:(HTTPConfig if (aConfig.queue) { connectionQueue = aConfig.queue; - #if NEEDS_DISPATCH_RETAIN_RELEASE + #if !OS_OBJECT_USE_OBJC dispatch_retain(connectionQueue); #endif } @@ -245,7 +220,7 @@ - (void)dealloc { HTTPLogTrace(); - #if NEEDS_DISPATCH_RETAIN_RELEASE + #if !OS_OBJECT_USE_OBJC dispatch_release(connectionQueue); #endif @@ -2388,7 +2363,9 @@ - (void)socket:(GCDAsyncSocket *)sock didWriteDataWithTag:(long)tag if (tag == HTTP_PARTIAL_RESPONSE_BODY) { // Update the amount of data we have in asyncSocket's write queue - [responseDataSizes removeObjectAtIndex:0]; + if ([responseDataSizes count] > 0) { + [responseDataSizes removeObjectAtIndex:0]; + } // We only wrote a part of the response - there may be more [self continueSendingStandardResponseBody]; @@ -2397,8 +2374,9 @@ - (void)socket:(GCDAsyncSocket *)sock didWriteDataWithTag:(long)tag { // Update the amount of data we have in asyncSocket's write queue. // This will allow asynchronous responses to continue sending more data. - [responseDataSizes removeObjectAtIndex:0]; - + if ([responseDataSizes count] > 0) { + [responseDataSizes removeObjectAtIndex:0]; + } // Don't continue sending the response yet. // The chunked footer that was sent after the body will tell us if we have more data to send. } @@ -2410,16 +2388,18 @@ - (void)socket:(GCDAsyncSocket *)sock didWriteDataWithTag:(long)tag else if (tag == HTTP_PARTIAL_RANGE_RESPONSE_BODY) { // Update the amount of data we have in asyncSocket's write queue - [responseDataSizes removeObjectAtIndex:0]; - + if ([responseDataSizes count] > 0) { + [responseDataSizes removeObjectAtIndex:0]; + } // We only wrote a part of the range - there may be more [self continueSendingSingleRangeResponseBody]; } else if (tag == HTTP_PARTIAL_RANGES_RESPONSE_BODY) { // Update the amount of data we have in asyncSocket's write queue - [responseDataSizes removeObjectAtIndex:0]; - + if ([responseDataSizes count] > 0) { + [responseDataSizes removeObjectAtIndex:0]; + } // We only wrote part of the range - there may be more, or there may be more ranges [self continueSendingMultiRangeResponseBody]; } @@ -2710,7 +2690,7 @@ - (id)initWithServer:(HTTPServer *)aServer documentRoot:(NSString *)aDocumentRoo if (q) { queue = q; - #if NEEDS_DISPATCH_RETAIN_RELEASE + #if !OS_OBJECT_USE_OBJC dispatch_retain(queue); #endif } @@ -2720,7 +2700,7 @@ - (id)initWithServer:(HTTPServer *)aServer documentRoot:(NSString *)aDocumentRoo - (void)dealloc { - #if NEEDS_DISPATCH_RETAIN_RELEASE + #if !OS_OBJECT_USE_OBJC if (queue) dispatch_release(queue); #endif } diff --git a/Pods/CocoaHTTPServer/Core/HTTPServer.h b/Pods/CocoaHTTPServer/Core/HTTPServer.h index 848d391bf..1d37cb697 100644 --- a/Pods/CocoaHTTPServer/Core/HTTPServer.h +++ b/Pods/CocoaHTTPServer/Core/HTTPServer.h @@ -21,9 +21,13 @@ @interface HTTPServer : NSObject IMPLEMENTED_PROTOCOLS { // Underlying asynchronous TCP/IP socket + GCDAsyncSocket *asyncSocket; + + // Dispatch queues dispatch_queue_t serverQueue; dispatch_queue_t connectionQueue; - GCDAsyncSocket *asyncSocket; + void *IsOnServerQueueKey; + void *IsOnConnectionQueueKey; // HTTP server configuration NSString *documentRoot; diff --git a/Pods/CocoaHTTPServer/Core/HTTPServer.m b/Pods/CocoaHTTPServer/Core/HTTPServer.m index 57adf2b24..57384f79b 100644 --- a/Pods/CocoaHTTPServer/Core/HTTPServer.m +++ b/Pods/CocoaHTTPServer/Core/HTTPServer.m @@ -8,31 +8,6 @@ #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). #endif -// Does ARC support support GCD objects? -// It does if the minimum deployment target is iOS 6+ or Mac OS X 8+ - -#if TARGET_OS_IPHONE - - // Compiling for iOS - - #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later - #define NEEDS_DISPATCH_RETAIN_RELEASE 0 - #else // iOS 5.X or earlier - #define NEEDS_DISPATCH_RETAIN_RELEASE 1 - #endif - -#else - - // Compiling for Mac OS X - - #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later - #define NEEDS_DISPATCH_RETAIN_RELEASE 0 - #else - #define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier - #endif - -#endif - // Log levels: off, error, warn, info, verbose // Other flags: trace static const int httpLogLevel = HTTP_LOG_LEVEL_INFO; // | HTTP_LOG_FLAG_TRACE; @@ -63,12 +38,22 @@ - (id)init { HTTPLogTrace(); - // Initialize underlying dispatch queue and GCD based tcp socket + // Setup underlying dispatch queues serverQueue = dispatch_queue_create("HTTPServer", NULL); + connectionQueue = dispatch_queue_create("HTTPConnection", NULL); + + IsOnServerQueueKey = &IsOnServerQueueKey; + IsOnConnectionQueueKey = &IsOnConnectionQueueKey; + + void *nonNullUnusedPointer = (__bridge void *)self; // Whatever, just not null + + dispatch_queue_set_specific(serverQueue, IsOnServerQueueKey, nonNullUnusedPointer, NULL); + dispatch_queue_set_specific(connectionQueue, IsOnConnectionQueueKey, nonNullUnusedPointer, NULL); + + // Initialize underlying GCD based tcp socket asyncSocket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:serverQueue]; // Use default connection class of HTTPConnection - connectionQueue = dispatch_queue_create("HTTPConnection", NULL); connectionClass = [HTTPConnection self]; // By default bind on all available interfaces, en1, wifi etc @@ -129,7 +114,7 @@ - (void)dealloc // Release all instance variables - #if NEEDS_DISPATCH_RETAIN_RELEASE + #if !OS_OBJECT_USE_OBJC dispatch_release(serverQueue); dispatch_release(connectionQueue); #endif @@ -383,6 +368,7 @@ - (NSDictionary *)TXTRecordDictionary return result; } + - (void)setTXTRecordDictionary:(NSDictionary *)value { HTTPLogTrace(); @@ -577,7 +563,7 @@ - (void)publishBonjour { HTTPLogTrace(); - NSAssert(dispatch_get_current_queue() == serverQueue, @"Invalid queue"); + NSAssert(dispatch_get_specific(IsOnServerQueueKey) != NULL, @"Must be on serverQueue"); if (type) { @@ -612,7 +598,7 @@ - (void)unpublishBonjour { HTTPLogTrace(); - NSAssert(dispatch_get_current_queue() == serverQueue, @"Invalid queue"); + NSAssert(dispatch_get_specific(IsOnServerQueueKey) != NULL, @"Must be on serverQueue"); if (netService) { @@ -748,13 +734,15 @@ + (void)bonjourThread // We can't run the run loop unless it has an associated input source or a timer. // So we'll just create a timer that will never fire - unless the server runs for 10,000 years. - +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wundeclared-selector" [NSTimer scheduledTimerWithTimeInterval:[[NSDate distantFuture] timeIntervalSinceNow] target:self selector:@selector(donothingatall:) userInfo:nil repeats:YES]; - +#pragma clang diagnostic pop + [[NSRunLoop currentRunLoop] run]; HTTPLogVerbose(@"%@: BonjourThread: Aborted", THIS_FILE); diff --git a/Pods/CocoaHTTPServer/Core/Mime/MultipartFormDataParser.m b/Pods/CocoaHTTPServer/Core/Mime/MultipartFormDataParser.m index 87eb4283d..4a19aee5b 100644 --- a/Pods/CocoaHTTPServer/Core/Mime/MultipartFormDataParser.m +++ b/Pods/CocoaHTTPServer/Core/Mime/MultipartFormDataParser.m @@ -3,7 +3,6 @@ #import "DDData.h" #import "HTTPLogging.h" -//----------------------------------------------------------------- #pragma mark log level #ifdef DEBUG @@ -12,6 +11,12 @@ static const int httpLogLevel = HTTP_LOG_LEVEL_WARN; #endif +#ifdef __x86_64__ +#define FMTNSINT "li" +#else +#define FMTNSINT "i" +#endif + //----------------------------------------------------------------- // interface MultipartFormDataParser (private) @@ -24,7 +29,7 @@ + (NSData*) decodedDataFromData:(NSData*) data encoding:(int) encoding; - (int) findHeaderEnd:(NSData*) workingData fromOffset:(int) offset; - (int) findContentEnd:(NSData*) data fromOffset:(int) offset; -- (int) numberOfBytesToLeavePendingWithData:(NSData*) data length:(int) length encoding:(int) encoding; +- (int) numberOfBytesToLeavePendingWithData:(NSData*) data length:(NSUInteger) length encoding:(int) encoding; - (int) offsetTillNewlineSinceOffset:(int) offset inData:(NSData*) data; - (int) processPreamble:(NSData*) workingData; @@ -84,7 +89,7 @@ - (BOOL) appendData:(NSData *)data { // don't parse data unless its size is greater then boundary length, so we couldn't // misfind the boundary, if it got split into different data chunks - int sizeToLeavePending = boundaryData.length; + NSUInteger sizeToLeavePending = boundaryData.length; if( !reachedEpilogue && workingData.length <= sizeToLeavePending ) { // not enough data even to start parsing. @@ -239,7 +244,7 @@ - (BOOL) appendData:(NSData *)data { // this case, we didn't find the boundary, so the data is related to the current part. // we leave the sizeToLeavePending amount of bytes to make sure we don't include // boundary part in processed data. - int sizeToPass = workingData.length - offset - sizeToLeavePending; + NSUInteger sizeToPass = workingData.length - offset - sizeToLeavePending; // if we parse BASE64 encoded data, or Quoted-Printable data, we will make sure we don't break the format int leaveTrailing = [self numberOfBytesToLeavePendingWithData:data length:sizeToPass encoding:currentEncoding]; @@ -256,7 +261,7 @@ - (BOOL) appendData:(NSData *)data { NSData* decodedData = [MultipartFormDataParser decodedDataFromData:[NSData dataWithBytesNoCopy:(char*)workingData.bytes + offset length:workingData.length - offset - sizeToLeavePending freeWhenDone:NO] encoding:currentEncoding]; if( [delegate respondsToSelector:@selector(processContent:WithHeader:)] ) { - HTTPLogVerbose(@"MultipartFormDataParser: Processed %d bytes of body",sizeToPass); + HTTPLogVerbose(@"MultipartFormDataParser: Processed %"FMTNSINT" bytes of body",sizeToPass); [delegate processContent: decodedData WithHeader:currentHeader]; } @@ -280,7 +285,8 @@ - (BOOL) appendData:(NSData *)data { currentHeader = nil; // set up offset to continue with the remaining data (if any) - offset = contentEnd + boundaryData.length; + // cast to int because above comment suggests a small number + offset = contentEnd + (int)boundaryData.length; checkForContentEnd = YES; // setting the flag tells the parser to skip all the data till CRLF } @@ -294,7 +300,7 @@ - (BOOL) appendData:(NSData *)data { - (int) offsetTillNewlineSinceOffset:(int) offset inData:(NSData*) data { char* bytes = (char*) data.bytes; - int length = data.length; + NSUInteger length = data.length; if( offset >= length - 1 ) return -1; @@ -327,8 +333,8 @@ - (int) processPreamble:(NSData*) data { char* boundaryBytes = (char*) boundaryData.bytes + 2; // the first boundary won't have CRLF preceding. char* dataBytes = (char*) data.bytes; - int boundaryLength = boundaryData.length - 2; - int dataLength = data.length; + NSUInteger boundaryLength = boundaryData.length - 2; + NSUInteger dataLength = data.length; // find the boundary without leading CRLF. while( offset < dataLength - boundaryLength +1 ) { @@ -345,7 +351,7 @@ - (int) processPreamble:(NSData*) data { if( offset == dataLength ) { // the end of preamble wasn't found in this chunk - int sizeToProcess = dataLength - boundaryLength; + NSUInteger sizeToProcess = dataLength - boundaryLength; if( sizeToProcess > 0) { if( [delegate respondsToSelector:@selector(processPreambleData:)] ) { NSData* preambleData = [NSData dataWithBytesNoCopy: (char*) data.bytes length: data.length - offset - boundaryLength freeWhenDone:NO]; @@ -373,7 +379,7 @@ - (int) processPreamble:(NSData*) data { - (int) findHeaderEnd:(NSData*) workingData fromOffset:(int)offset { char* bytes = (char*) workingData.bytes; - int inputLength = workingData.length; + NSUInteger inputLength = workingData.length; uint16_t separatorBytes = 0x0A0D; while( true ) { @@ -393,8 +399,8 @@ - (int) findHeaderEnd:(NSData*) workingData fromOffset:(int)offset { - (int) findContentEnd:(NSData*) data fromOffset:(int) offset { char* boundaryBytes = (char*) boundaryData.bytes; char* dataBytes = (char*) data.bytes; - int boundaryLength = boundaryData.length; - int dataLength = data.length; + NSUInteger boundaryLength = boundaryData.length; + NSUInteger dataLength = data.length; while( offset < dataLength - boundaryLength +1 ) { int i; @@ -475,7 +481,7 @@ + (NSData*) decodedDataFromQuotedPrintableData:(NSData *)data { NSMutableData* result = [[NSMutableData alloc] initWithLength:data.length]; const char* bytes = (const char*) data.bytes; int count = 0; - int length = data.length; + NSUInteger length = data.length; while( count < length ) { if( bytes[count] == '=' ) { [result appendBytes:bytes length:count]; diff --git a/Pods/CocoaHTTPServer/Core/Mime/MultipartMessageHeader.m b/Pods/CocoaHTTPServer/Core/Mime/MultipartMessageHeader.m index a9c930f88..9d91d4694 100644 --- a/Pods/CocoaHTTPServer/Core/Mime/MultipartMessageHeader.m +++ b/Pods/CocoaHTTPServer/Core/Mime/MultipartMessageHeader.m @@ -39,7 +39,7 @@ - (id) initWithData:(NSData *)data formEncoding:(NSStringEncoding) formEncoding encoding = contentTransferEncoding_unknown; char* bytes = (char*)data.bytes; - int length = data.length; + NSUInteger length = data.length; int offset = 0; // split header into header fields, separated by \r\n diff --git a/Pods/CocoaHTTPServer/Core/Mime/MultipartMessageHeaderField.m b/Pods/CocoaHTTPServer/Core/Mime/MultipartMessageHeaderField.m index 5dea457be..00ecac840 100644 --- a/Pods/CocoaHTTPServer/Core/Mime/MultipartMessageHeaderField.m +++ b/Pods/CocoaHTTPServer/Core/Mime/MultipartMessageHeaderField.m @@ -13,8 +13,8 @@ // helpers -int findChar(const char* str,int length, char c); -NSString* extractParamValue(const char* bytes, int length, NSStringEncoding encoding); +int findChar(const char* str,NSUInteger length, char c); +NSString* extractParamValue(const char* bytes, NSUInteger length, NSStringEncoding encoding); //----------------------------------------------------------------- // interface MultipartMessageHeaderField (private) @@ -22,7 +22,7 @@ @interface MultipartMessageHeaderField (private) --(BOOL) parseHeaderValueBytes:(char*) bytes length:(int) length encoding:(NSStringEncoding) encoding; +-(BOOL) parseHeaderValueBytes:(char*) bytes length:(NSUInteger) length encoding:(NSStringEncoding) encoding; @end @@ -34,11 +34,10 @@ @implementation MultipartMessageHeaderField @synthesize name,value,params; - (id) initWithData:(NSData *)data contentEncoding:(NSStringEncoding)encoding { - params = [[NSMutableDictionary alloc] initWithCapacity:1]; char* bytes = (char*)data.bytes; - int length = data.length; + NSUInteger length = data.length; int separatorOffset = findChar(bytes, length, ':'); if( (-1 == separatorOffset) || (separatorOffset >= length-2) ) { @@ -89,8 +88,7 @@ - (id) initWithData:(NSData *)data contentEncoding:(NSStringEncoding)encoding { return self; } - --(BOOL) parseHeaderValueBytes:(char*) bytes length:(int) length encoding:(NSStringEncoding) encoding { +-(BOOL) parseHeaderValueBytes:(char*) bytes length:(NSUInteger) length encoding:(NSStringEncoding) encoding { int offset = 0; NSString* currentParam = nil; BOOL insideQuote = NO; @@ -154,7 +152,7 @@ -(BOOL) parseHeaderValueBytes:(char*) bytes length:(int) length encoding:(NSStri // return YES; } if( currentParam ) { - NSString* paramValue = extractParamValue(bytes, length,encoding); + NSString* paramValue = extractParamValue(bytes, length, encoding); if( nil == paramValue ) { HTTPLogError(@"MultipartFormDataParser: Failed to exctract paramValue for key %@ in header %@",currentParam,name); @@ -173,16 +171,13 @@ -(BOOL) parseHeaderValueBytes:(char*) bytes length:(int) length encoding:(NSStri return YES; } - - (NSString *)description { return [NSString stringWithFormat:@"%@:%@\n params: %@",name,value,params]; } - @end - -int findChar(const char* str,int length, char c) { +int findChar(const char* str, NSUInteger length, char c) { int offset = 0; while( offset < length ) { if( str[offset] == c ) @@ -192,8 +187,7 @@ int findChar(const char* str,int length, char c) { return -1; } - -NSString* extractParamValue(const char* bytes, int length, NSStringEncoding encoding) { +NSString* extractParamValue(const char* bytes, NSUInteger length, NSStringEncoding encoding) { if( !length ) return nil; NSMutableString* value = nil; diff --git a/Pods/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.h b/Pods/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.h index 93e33828b..fd60ea839 100644 --- a/Pods/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.h +++ b/Pods/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.h @@ -72,4 +72,4 @@ * Doing so would disrupt proper support for range requests. * If, however, the response is chunked then we don't need to worry about this. * Chunked responses inheritly don't support range requests. -**/ \ No newline at end of file +**/ diff --git a/Pods/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.m b/Pods/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.m index 51678417e..edcbd48af 100644 --- a/Pods/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.m +++ b/Pods/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.m @@ -9,32 +9,6 @@ #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). #endif -/** - * Does ARC support support GCD objects? - * It does if the minimum deployment target is iOS 6+ or Mac OS X 8+ -**/ -#if TARGET_OS_IPHONE - - // Compiling for iOS - - #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later - #define NEEDS_DISPATCH_RETAIN_RELEASE 0 - #else // iOS 5.X or earlier - #define NEEDS_DISPATCH_RETAIN_RELEASE 1 - #endif - -#else - - // Compiling for Mac OS X - - #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later - #define NEEDS_DISPATCH_RETAIN_RELEASE 0 - #else - #define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier - #endif - -#endif - // Log levels : off, error, warn, info, verbose // Other flags: trace static const int httpLogLevel = HTTP_LOG_LEVEL_WARN; // | HTTP_LOG_FLAG_TRACE; @@ -258,7 +232,7 @@ - (BOOL)openFileAndSetupReadSource }); int theFileFD = fileFD; - #if NEEDS_DISPATCH_RETAIN_RELEASE + #if !OS_OBJECT_USE_OBJC dispatch_source_t theReadSource = readSource; #endif @@ -270,7 +244,7 @@ - (BOOL)openFileAndSetupReadSource HTTPLogTrace2(@"%@: cancelBlock - Close fd[%i]", THIS_FILE, theFileFD); - #if NEEDS_DISPATCH_RETAIN_RELEASE + #if !OS_OBJECT_USE_OBJC dispatch_release(theReadSource); #endif close(theFileFD); @@ -420,7 +394,7 @@ - (void)dealloc { HTTPLogTrace(); - #if NEEDS_DISPATCH_RETAIN_RELEASE + #if !OS_OBJECT_USE_OBJC if (readQueue) dispatch_release(readQueue); #endif diff --git a/Pods/CocoaHTTPServer/Core/Responses/HTTPErrorResponse.h b/Pods/CocoaHTTPServer/Core/Responses/HTTPErrorResponse.h new file mode 100644 index 000000000..7aa9c7eaa --- /dev/null +++ b/Pods/CocoaHTTPServer/Core/Responses/HTTPErrorResponse.h @@ -0,0 +1,9 @@ +#import "HTTPResponse.h" + +@interface HTTPErrorResponse : NSObject { + NSInteger _status; +} + +- (id)initWithErrorCode:(int)httpErrorCode; + +@end diff --git a/Pods/CocoaHTTPServer/Core/Responses/HTTPErrorResponse.m b/Pods/CocoaHTTPServer/Core/Responses/HTTPErrorResponse.m new file mode 100644 index 000000000..02871ae19 --- /dev/null +++ b/Pods/CocoaHTTPServer/Core/Responses/HTTPErrorResponse.m @@ -0,0 +1,38 @@ +#import "HTTPErrorResponse.h" + +@implementation HTTPErrorResponse + +-(id)initWithErrorCode:(int)httpErrorCode +{ + if ((self = [super init])) + { + _status = httpErrorCode; + } + + return self; +} + +- (UInt64) contentLength { + return 0; +} + +- (UInt64) offset { + return 0; +} + +- (void)setOffset:(UInt64)offset { + ; +} + +- (NSData*) readDataOfLength:(NSUInteger)length { + return nil; +} + +- (BOOL) isDone { + return YES; +} + +- (NSInteger) status { + return _status; +} +@end diff --git a/Pods/CocoaHTTPServer/Core/WebSocket.h b/Pods/CocoaHTTPServer/Core/WebSocket.h index 4d1fcc943..866274a33 100644 --- a/Pods/CocoaHTTPServer/Core/WebSocket.h +++ b/Pods/CocoaHTTPServer/Core/WebSocket.h @@ -9,16 +9,16 @@ @interface WebSocket : NSObject { dispatch_queue_t websocketQueue; - + HTTPMessage *request; GCDAsyncSocket *asyncSocket; - + NSData *term; - + BOOL isStarted; BOOL isOpen; BOOL isVersion76; - + id __unsafe_unretained delegate; } @@ -28,7 +28,7 @@ /** * Delegate option. - * + * * In most cases it will be easier to subclass WebSocket, * but some circumstances may lead one to prefer standard delegate callbacks instead. **/ @@ -43,7 +43,7 @@ /** * Public API - * + * * These methods are automatically called by the HTTPServer. * You may invoke the stop method yourself to close the WebSocket manually. **/ @@ -52,19 +52,28 @@ /** * Public API - * + * * Sends a message over the WebSocket. * This method is thread-safe. -**/ + **/ - (void)sendMessage:(NSString *)msg; +/** + * Public API + * + * Sends a message over the WebSocket. + * This method is thread-safe. + **/ +- (void)sendData:(NSData *)msg; + /** * Subclass API - * + * * These methods are designed to be overriden by subclasses. **/ - (void)didOpen; - (void)didReceiveMessage:(NSString *)msg; +- (void)didReceiveData:(NSData *)data; - (void)didClose; @end @@ -75,10 +84,10 @@ /** * There are two ways to create your own custom WebSocket: - * + * * - Subclass it and override the methods you're interested in. * - Use traditional delegate paradigm along with your own custom class. - * + * * They both exist to allow for maximum flexibility. * In most cases it will be easier to subclass WebSocket. * However some circumstances may lead one to prefer standard delegate callbacks instead. @@ -92,6 +101,8 @@ - (void)webSocket:(WebSocket *)ws didReceiveMessage:(NSString *)msg; +- (void)webSocket:(WebSocket *)ws didReceiveData:(NSData *)data; + - (void)webSocketDidClose:(WebSocket *)ws; -@end \ No newline at end of file +@end diff --git a/Pods/CocoaHTTPServer/Core/WebSocket.m b/Pods/CocoaHTTPServer/Core/WebSocket.m index 880064fe6..5f05d66fd 100644 --- a/Pods/CocoaHTTPServer/Core/WebSocket.m +++ b/Pods/CocoaHTTPServer/Core/WebSocket.m @@ -9,31 +9,6 @@ #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). #endif -// Does ARC support support GCD objects? -// It does if the minimum deployment target is iOS 6+ or Mac OS X 8+ - -#if TARGET_OS_IPHONE - - // Compiling for iOS - - #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later - #define NEEDS_DISPATCH_RETAIN_RELEASE 0 - #else // iOS 5.X or earlier - #define NEEDS_DISPATCH_RETAIN_RELEASE 1 - #endif - -#else - - // Compiling for Mac OS X - - #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later - #define NEEDS_DISPATCH_RETAIN_RELEASE 0 - #else - #define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier - #endif - -#endif - // Log levels: off, error, warn, info, verbose // Other flags : trace static const int httpLogLevel = HTTP_LOG_LEVEL_WARN; // | HTTP_LOG_FLAG_TRACE; @@ -99,15 +74,15 @@ @implementation WebSocket + (BOOL)isWebSocketRequest:(HTTPMessage *)request { // Request (Draft 75): - // + // // GET /demo HTTP/1.1 // Upgrade: WebSocket // Connection: Upgrade // Host: example.com // Origin: http://example.com // WebSocket-Protocol: sample - // - // + // + // // Request (Draft 76): // // GET /demo HTTP/1.1 @@ -118,18 +93,18 @@ + (BOOL)isWebSocketRequest:(HTTPMessage *)request // Sec-WebSocket-Protocol: sample // Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5 // Sec-WebSocket-Key2: 12998 5 Y3 1 .P00 - // + // // ^n:ds[4U - + // Look for Upgrade: and Connection: headers. // If we find them, and they have the proper value, // we can safely assume this is a websocket request. - + NSString *upgradeHeaderValue = [request headerField:@"Upgrade"]; NSString *connectionHeaderValue = [request headerField:@"Connection"]; - + BOOL isWebSocket = YES; - + if (!upgradeHeaderValue || !connectionHeaderValue) { isWebSocket = NO; } @@ -139,9 +114,9 @@ + (BOOL)isWebSocketRequest:(HTTPMessage *)request else if ([connectionHeaderValue rangeOfString:@"Upgrade" options:NSCaseInsensitiveSearch].location == NSNotFound) { isWebSocket = NO; } - + HTTPLogTrace2(@"%@: %@ - %@", THIS_FILE, THIS_METHOD, (isWebSocket ? @"YES" : @"NO")); - + return isWebSocket; } @@ -149,18 +124,18 @@ + (BOOL)isVersion76Request:(HTTPMessage *)request { NSString *key1 = [request headerField:@"Sec-WebSocket-Key1"]; NSString *key2 = [request headerField:@"Sec-WebSocket-Key2"]; - + BOOL isVersion76; - + if (!key1 || !key2) { isVersion76 = NO; } else { isVersion76 = YES; } - + HTTPLogTrace2(@"%@: %@ - %@", THIS_FILE, THIS_METHOD, (isVersion76 ? @"YES" : @"NO")); - + return isVersion76; } @@ -183,32 +158,32 @@ + (BOOL)isRFC6455Request:(HTTPMessage *)request - (id)initWithRequest:(HTTPMessage *)aRequest socket:(GCDAsyncSocket *)socket { HTTPLogTrace(); - + if (aRequest == nil) { return nil; } - + if ((self = [super init])) { if (HTTP_LOG_VERBOSE) { NSData *requestHeaders = [aRequest messageData]; - + NSString *temp = [[NSString alloc] initWithData:requestHeaders encoding:NSUTF8StringEncoding]; HTTPLogVerbose(@"%@[%p] Request Headers:\n%@", THIS_FILE, self, temp); } - + websocketQueue = dispatch_queue_create("WebSocket", NULL); request = aRequest; - + asyncSocket = socket; [asyncSocket setDelegate:self delegateQueue:websocketQueue]; - + isOpen = NO; isVersion76 = [[self class] isVersion76Request:request]; isRFC6455 = [[self class] isRFC6455Request:request]; - + term = [[NSData alloc] initWithBytes:"\xFF" length:1]; } return self; @@ -217,11 +192,11 @@ - (id)initWithRequest:(HTTPMessage *)aRequest socket:(GCDAsyncSocket *)socket - (void)dealloc { HTTPLogTrace(); - - #if NEEDS_DISPATCH_RETAIN_RELEASE + + #if !OS_OBJECT_USE_OBJC dispatch_release(websocketQueue); #endif - + [asyncSocket setDelegate:nil delegateQueue:NULL]; [asyncSocket disconnect]; } @@ -229,11 +204,11 @@ - (void)dealloc - (id)delegate { __block id result = nil; - + dispatch_sync(websocketQueue, ^{ result = delegate; }); - + return result; } @@ -256,12 +231,12 @@ - (void)start { // This method is not exactly designed to be overriden. // Subclasses are encouraged to override the didOpen method instead. - + dispatch_async(websocketQueue, ^{ @autoreleasepool { - + if (isStarted) return; isStarted = YES; - + if (isVersion76) { [self readRequestBody]; @@ -282,9 +257,9 @@ - (void)stop { // This method is not exactly designed to be overriden. // Subclasses are encouraged to override the didClose method instead. - + dispatch_async(websocketQueue, ^{ @autoreleasepool { - + [asyncSocket disconnect]; }}); } @@ -296,22 +271,22 @@ - (void)stop - (void)readRequestBody { HTTPLogTrace(); - + NSAssert(isVersion76, @"WebSocket version 75 doesn't contain a request body"); - + [asyncSocket readDataToLength:8 withTimeout:TIMEOUT_NONE tag:TAG_HTTP_REQUEST_BODY]; } - (NSString *)originResponseHeaderValue { HTTPLogTrace(); - + NSString *origin = [request headerField:@"Origin"]; - + if (origin == nil) { NSString *port = [NSString stringWithFormat:@"%hu", [asyncSocket localPort]]; - + return [NSString stringWithFormat:@"http://localhost:%@", port]; } else @@ -323,25 +298,25 @@ - (NSString *)originResponseHeaderValue - (NSString *)locationResponseHeaderValue { HTTPLogTrace(); - + NSString *location; - + NSString *scheme = [asyncSocket isSecure] ? @"wss" : @"ws"; NSString *host = [request headerField:@"Host"]; - + NSString *requestUri = [[request url] relativeString]; - + if (host == nil) { NSString *port = [NSString stringWithFormat:@"%hu", [asyncSocket localPort]]; - + location = [NSString stringWithFormat:@"%@://localhost:%@%@", scheme, port, requestUri]; } else { location = [NSString stringWithFormat:@"%@://%@%@", scheme, host, requestUri]; } - + return location; } @@ -354,17 +329,17 @@ - (NSString *)secWebSocketKeyResponseHeaderValue { - (void)sendResponseHeaders { HTTPLogTrace(); - + // Request (Draft 75): - // + // // GET /demo HTTP/1.1 // Upgrade: WebSocket // Connection: Upgrade // Host: example.com // Origin: http://example.com // WebSocket-Protocol: sample - // - // + // + // // Request (Draft 76): // // GET /demo HTTP/1.1 @@ -375,20 +350,20 @@ - (void)sendResponseHeaders // Sec-WebSocket-Protocol: sample // Sec-WebSocket-Key2: 12998 5 Y3 1 .P00 // Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5 - // + // // ^n:ds[4U - + // Response (Draft 75): - // + // // HTTP/1.1 101 Web Socket Protocol Handshake // Upgrade: WebSocket // Connection: Upgrade // WebSocket-Origin: http://example.com // WebSocket-Location: ws://example.com/demo // WebSocket-Protocol: sample - // - // + // + // // Response (Draft 76): // // HTTP/1.1 101 WebSocket Protocol Handshake @@ -397,70 +372,70 @@ - (void)sendResponseHeaders // Sec-WebSocket-Origin: http://example.com // Sec-WebSocket-Location: ws://example.com/demo // Sec-WebSocket-Protocol: sample - // + // // 8jKS'y:G*Co,Wxa- - + HTTPMessage *wsResponse = [[HTTPMessage alloc] initResponseWithStatusCode:101 description:@"Web Socket Protocol Handshake" version:HTTPVersion1_1]; - + [wsResponse setHeaderField:@"Upgrade" value:@"WebSocket"]; [wsResponse setHeaderField:@"Connection" value:@"Upgrade"]; - + // Note: It appears that WebSocket-Origin and WebSocket-Location // are required for Google's Chrome implementation to work properly. - // + // // If we don't send either header, Chrome will never report the WebSocket as open. // If we only send one of the two, Chrome will immediately close the WebSocket. - // + // // In addition to this it appears that Chrome's implementation is very picky of the values of the headers. // They have to match exactly with what Chrome sent us or it will close the WebSocket. - + NSString *originValue = [self originResponseHeaderValue]; NSString *locationValue = [self locationResponseHeaderValue]; - + NSString *originField = isVersion76 ? @"Sec-WebSocket-Origin" : @"WebSocket-Origin"; NSString *locationField = isVersion76 ? @"Sec-WebSocket-Location" : @"WebSocket-Location"; - + [wsResponse setHeaderField:originField value:originValue]; [wsResponse setHeaderField:locationField value:locationValue]; - + NSString *acceptValue = [self secWebSocketKeyResponseHeaderValue]; if (acceptValue) { [wsResponse setHeaderField: @"Sec-WebSocket-Accept" value: acceptValue]; } NSData *responseHeaders = [wsResponse messageData]; - - + + if (HTTP_LOG_VERBOSE) { NSString *temp = [[NSString alloc] initWithData:responseHeaders encoding:NSUTF8StringEncoding]; HTTPLogVerbose(@"%@[%p] Response Headers:\n%@", THIS_FILE, self, temp); } - + [asyncSocket writeData:responseHeaders withTimeout:TIMEOUT_NONE tag:TAG_HTTP_RESPONSE_HEADERS]; } - (NSData *)processKey:(NSString *)key { HTTPLogTrace(); - + unichar c; NSUInteger i; NSUInteger length = [key length]; - + // Concatenate the digits into a string, // and count the number of spaces. - + NSMutableString *numStr = [NSMutableString stringWithCapacity:10]; long long numSpaces = 0; - + for (i = 0; i < length; i++) { c = [key characterAtIndex:i]; - + if (c >= '0' && c <= '9') { [numStr appendFormat:@"%C", c]; @@ -470,68 +445,68 @@ - (NSData *)processKey:(NSString *)key numSpaces++; } } - + long long num = strtoll([numStr UTF8String], NULL, 10); - + long long resultHostNum; - + if (numSpaces == 0) resultHostNum = 0; else resultHostNum = num / numSpaces; - + HTTPLogVerbose(@"key(%@) -> %qi / %qi = %qi", key, num, numSpaces, resultHostNum); - + // Convert result to 4 byte big-endian (network byte order) // and then convert to raw data. - + UInt32 result = OSSwapHostToBigInt32((uint32_t)resultHostNum); - + return [NSData dataWithBytes:&result length:4]; } - (void)sendResponseBody:(NSData *)d3 { HTTPLogTrace(); - + NSAssert(isVersion76, @"WebSocket version 75 doesn't contain a response body"); NSAssert([d3 length] == 8, @"Invalid requestBody length"); - + NSString *key1 = [request headerField:@"Sec-WebSocket-Key1"]; NSString *key2 = [request headerField:@"Sec-WebSocket-Key2"]; - + NSData *d1 = [self processKey:key1]; NSData *d2 = [self processKey:key2]; - + // Concatenated d1, d2 & d3 - + NSMutableData *d0 = [NSMutableData dataWithCapacity:(4+4+8)]; [d0 appendData:d1]; [d0 appendData:d2]; [d0 appendData:d3]; - + // Hash the data using MD5 - + NSData *responseBody = [d0 md5Digest]; - + [asyncSocket writeData:responseBody withTimeout:TIMEOUT_NONE tag:TAG_HTTP_RESPONSE_BODY]; - + if (HTTP_LOG_VERBOSE) { NSString *s1 = [[NSString alloc] initWithData:d1 encoding:NSASCIIStringEncoding]; NSString *s2 = [[NSString alloc] initWithData:d2 encoding:NSASCIIStringEncoding]; NSString *s3 = [[NSString alloc] initWithData:d3 encoding:NSASCIIStringEncoding]; - + NSString *s0 = [[NSString alloc] initWithData:d0 encoding:NSASCIIStringEncoding]; - + NSString *sH = [[NSString alloc] initWithData:responseBody encoding:NSASCIIStringEncoding]; - + HTTPLogVerbose(@"key1 result : raw(%@) str(%@)", d1, s1); HTTPLogVerbose(@"key2 result : raw(%@) str(%@)", d2, s2); HTTPLogVerbose(@"key3 passed : raw(%@) str(%@)", d3, s3); HTTPLogVerbose(@"key0 concat : raw(%@) str(%@)", d0, s0); HTTPLogVerbose(@"responseBody: raw(%@) str(%@)", responseBody, sH); - + } } @@ -542,15 +517,15 @@ - (void)sendResponseBody:(NSData *)d3 - (void)didOpen { HTTPLogTrace(); - + // Override me to perform any custom actions once the WebSocket has been opened. // This method is invoked on the websocketQueue. - // + // // Don't forget to invoke [super didOpen] in your method. - + // Start reading for messages [asyncSocket readDataToLength:1 withTimeout:TIMEOUT_NONE tag:(isRFC6455 ? TAG_PAYLOAD_PREFIX : TAG_PREFIX)]; - + // Notify delegate if ([delegate respondsToSelector:@selector(webSocketDidOpen:)]) { @@ -560,11 +535,16 @@ - (void)didOpen - (void)sendMessage:(NSString *)msg { - HTTPLogTrace(); - NSData *msgData = [msg dataUsingEncoding:NSUTF8StringEncoding]; - NSMutableData *data = nil; - + [self sendData:msgData]; +} + +- (void)sendData:(NSData *)msgData +{ + HTTPLogTrace(); + + NSMutableData *data = nil; + if (isRFC6455) { NSUInteger length = msgData.length; @@ -600,21 +580,21 @@ - (void)sendMessage:(NSString *)msg [data appendData:msgData]; [data appendBytes:"\xFF" length:1]; } - + // Remember: GCDAsyncSocket is thread-safe - + [asyncSocket writeData:data withTimeout:TIMEOUT_NONE tag:0]; } - (void)didReceiveMessage:(NSString *)msg { HTTPLogTrace(); - + // Override me to process incoming messages. // This method is invoked on the websocketQueue. - // + // // For completeness, you should invoke [super didReceiveMessage:msg] in your method. - + // Notify delegate if ([delegate respondsToSelector:@selector(webSocket:didReceiveMessage:)]) { @@ -622,21 +602,37 @@ - (void)didReceiveMessage:(NSString *)msg } } +- (void)didReceiveData:(NSData *)data + { + HTTPLogTrace(); + + // Override me to process incoming data. + // This method is invoked on the websocketQueue. + // + // For completeness, you should invoke [super didReceiveData:data] in your method. + + // Notify delegate + if ([delegate respondsToSelector:@selector(webSocket:didReceiveData:)]) + { + [delegate webSocket:self didReceiveData:data]; + } + } + - (void)didClose { HTTPLogTrace(); - + // Override me to perform any cleanup when the socket is closed // This method is invoked on the websocketQueue. - // + // // Don't forget to invoke [super didClose] at the end of your method. - + // Notify delegate if ([delegate respondsToSelector:@selector(webSocketDidClose:)]) { [delegate webSocketDidClose:self]; } - + // Notify HTTPServer [[NSNotificationCenter defaultCenter] postNotificationName:WebSocketDidDieNotification object:self]; } @@ -680,7 +676,7 @@ - (BOOL)isValidWebSocketFrame:(UInt8)frame - (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag { HTTPLogTrace(); - + if (tag == TAG_HTTP_REQUEST_BODY) { [self sendResponseHeaders]; @@ -691,7 +687,7 @@ - (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)t { UInt8 *pFrame = (UInt8 *)[data bytes]; UInt8 frame = *pFrame; - + if (frame <= 0x7F) { [asyncSocket readDataToData:term withTimeout:TIMEOUT_NONE tag:TAG_MSG_PLUS_SUFFIX]; @@ -774,6 +770,10 @@ - (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)t NSString *msg = [[NSString alloc] initWithBytes:[data bytes] length:msgLength encoding:NSUTF8StringEncoding]; [self didReceiveMessage:msg]; } + else if (nextOpCode == WS_OP_BINARY_FRAME) + { + [self didReceiveData:data]; + } else { [self didClose]; @@ -790,12 +790,12 @@ - (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)t else { NSUInteger msgLength = [data length] - 1; // Excluding ending 0xFF frame - + NSString *msg = [[NSString alloc] initWithBytes:[data bytes] length:msgLength encoding:NSUTF8StringEncoding]; - + [self didReceiveMessage:msg]; - - + + // Read next message [asyncSocket readDataToLength:1 withTimeout:TIMEOUT_NONE tag:TAG_PREFIX]; } @@ -804,7 +804,7 @@ - (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)t - (void)socketDidDisconnect:(GCDAsyncSocket *)sock withError:(NSError *)error { HTTPLogTrace2(@"%@[%p]: socketDidDisconnect:withError: %@", THIS_FILE, self, error); - + [self didClose]; } diff --git a/Pods/CocoaHTTPServer/Extensions/WebDAV/DAVResponse.m b/Pods/CocoaHTTPServer/Extensions/WebDAV/DAVResponse.m index 6a73d6f1f..7bd69ace4 100644 --- a/Pods/CocoaHTTPServer/Extensions/WebDAV/DAVResponse.m +++ b/Pods/CocoaHTTPServer/Extensions/WebDAV/DAVResponse.m @@ -244,6 +244,7 @@ - (id) initWithMethod:(NSString*)method headers:(NSDictionary*)headers bodyData: NSString* scope = nil; NSString* type = nil; NSString* owner = nil; + NSString* token = nil; xmlDocPtr document = xmlReadMemory(body.bytes, (int)body.length, NULL, NULL, kXMLParseOptions); if (document) { xmlNodePtr node = _XMLChildWithName(document->children, (const xmlChar*)"lockinfo"); @@ -267,15 +268,26 @@ - (id) initWithMethod:(NSString*)method headers:(NSDictionary*)headers bodyData: HTTPLogWarn(@"HTTP Server: Invalid DAV properties\n%@", [[NSString alloc] initWithData:body encoding:NSUTF8StringEncoding]); } xmlFreeDoc(document); - } + } else { + // No body, see if they're trying to refresh an existing lock. If so, then just fake up the scope, type and depth so we fall + // into the lock create case. + NSString* lockToken; + if ((lockToken = [headers objectForKey:@"If"]) != nil) { + scope = @"exclusive"; + type = @"write"; + depth = @"0"; + token = [lockToken stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"(<>)"]]; + } + } if ([scope isEqualToString:@"exclusive"] && [type isEqualToString:@"write"] && [depth isEqualToString:@"0"] && ([[NSFileManager defaultManager] fileExistsAtPath:path] || [[NSData data] writeToFile:path atomically:YES])) { NSString* timeout = [headers objectForKey:@"Timeout"]; - - CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault); - NSString *uuidStr = (__bridge_transfer NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid); - NSString* token = [NSString stringWithFormat:@"urn:uuid:%@", uuidStr]; - CFRelease(uuid); + if (!token) { + CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault); + NSString *uuidStr = (__bridge_transfer NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid); + token = [NSString stringWithFormat:@"urn:uuid:%@", uuidStr]; + CFRelease(uuid); + } NSMutableString* xmlString = [NSMutableString stringWithString:@""]; [xmlString appendString:@"\n"]; @@ -290,7 +302,8 @@ - (id) initWithMethod:(NSString*)method headers:(NSDictionary*)headers bodyData: [xmlString appendFormat:@"%@\n", timeout]; } [xmlString appendFormat:@"%@\n", token]; - // [xmlString appendFormat:@"%@\n", root]; + NSString* lockroot = [@"http://" stringByAppendingString:[[headers objectForKey:@"Host"] stringByAppendingString:[@"/" stringByAppendingString:resourcePath]]]; + [xmlString appendFormat:@"%@\n", lockroot]; [xmlString appendString:@"\n\n"]; [xmlString appendString:@""]; diff --git a/Pods/CocoaHTTPServer/README.markdown b/Pods/CocoaHTTPServer/README.markdown index 088f4ab14..75985472c 100644 --- a/Pods/CocoaHTTPServer/README.markdown +++ b/Pods/CocoaHTTPServer/README.markdown @@ -1,3 +1,10 @@ +# CocoaHTTPServer + +[![Build Status](https://travis-ci.org/robbiehanson/CocoaHTTPServer.svg)](https://travis-ci.org/robbiehanson/CocoaHTTPServer) + [![Version](http://img.shields.io/cocoapods/v/CocoaHTTPServer.svg?style=flat)](http://cocoapods.org/?q=CocoaHTTPServer) + [![Platform](http://img.shields.io/cocoapods/p/CocoaHTTPServer.svg?style=flat)]() + [![License](http://img.shields.io/cocoapods/l/CocoaHTTPServer.svg?style=flat)](https://github.com/robbiehanson/CocoaHTTPServer/blob/master/LICENSE) + CocoaHTTPServer is a small, lightweight, embeddable HTTP server for Mac OS X or iOS applications. Sometimes developers need an embedded HTTP server in their app. Perhaps it's a server application with remote monitoring. Or perhaps it's a desktop application using HTTP for the communication backend. Or perhaps it's an iOS app providing over-the-air access to documents. Whatever your reason, CocoaHTTPServer can get the job done. It provides: diff --git a/Pods/CocoaLumberjack/CHANGELOG.md b/Pods/CocoaLumberjack/CHANGELOG.md new file mode 100644 index 000000000..7a519a3fa --- /dev/null +++ b/Pods/CocoaLumberjack/CHANGELOG.md @@ -0,0 +1,638 @@ +# [3.8.5 - Xcode 15.3 on Mar 8th, 2024](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tags/3.8.5) + +### Public + +- Fix build failure due to privacy manifest when using static linking with CocoaPods (#1408) +- Allow custom mapping of `DDLogFlag` to `os_log_type_t`, fix default mapping for `DDLogFlagWarn` (#1410) + + +# [3.8.4 - Xcode 15.2 on Feb 8th, 2024](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tags/3.8.4) + +### Public + +- Extend privacy manifest to fulfill validation criteria (#1403) +- Fix crash when fetching registered classes (#1406) + + +# [3.8.3 - Xcode 15.2 on Feb 5th, 2024](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tags/3.8.3) + +### Public + +- Add privacy manifest (#1403) +- Update doc from DDLogLevelWarn to DDLogLevelWarning to match library (#1383) +- Only cleanup files on configuration change if the manager is used by a file logger (#1398) +- Fix #1386 again by adding a missing return and adjusting the preprocessor conditionals +- Fix some C++ warnings + +### Internal + +- Update copyright for 2024 (#1400) +- Improve asserts (#1385) + + +# [3.8.2 - Xcode 15.0 on Oct 31st, 2023](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.8.2) + +### Public + +- App background-mode not correctly detected in app extensions (#1359) +- Fix DDFileLogger rollingFrequency and maximumFileSize not being honored (#1361) +- Fix potential crashes when using the new `DDLogMessageFormat` with messages that contain '%' +- Fix simulator issues when using dynamic registered logging on iOS 17 (#1386) +- Allow `DDFileLogger` to write in different file formats (#1380) + +### Internal + +- Generate Podspec (#1360) + + +# [3.8.1 - Xcode 14.3 on Aug 21st, 2023](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.8.1) + +### Public + +- Silence double conversion warnings for 32-bit watchOS (#1320) +- Enable ALLOW_TARGET_PLATFORM_SPECIALIZATION (#1321) +- Update to swift-log 1.5.2, implement metadata providers (#1329) +- Preserve `messageFormat` in `DDLogMessage` (#1347) + +### Internal + +- Update copyright for 2023 + + +## [3.8.0 - Xcode 14.1 on Nov 2nd, 2022](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.8.0) + +### Public + +- Add support for Xcode 14 / Swift 5.7 - drop support for Swift < 5.5, iOS/tvOS < 11, macOS < 10.13, watchOS < 4 (#1316) +- Update README about swift-log usage (#1275) +- Use dispatch_walltime for scheduling log file rolling timer (#1309) + +### Internal + +- Add consistent newline to file endings (#1272) +- Fix error checking in DDFileLogger (#1274) +- Avoid using NSString format (#1280) +- Prevent logging to symlink files (#1314) + + +## [3.7.4 - Xcode 13.2 on Dec 16, 2021](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.7.4) + +### Public + +- Fix swift-tools-version in Package@swift-5.3.swift + + +## [3.7.3 - Xcode 13.2 on Dec 16, 2021](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.7.3) + +### Public + +- Fix "DDFileLogger: Failed to get offset" when setting maximumFileSize (#1234) +- Follow-up to add annotations to DDOSLogger (#1248) +- Fixed nullability conflict in DDDispatchQueueLogFormatter.h (#1252) +- Add Swift 5.5 support, fix archive build on Xcode 13 (#1253) +- Fix file access issue in Catalyst apps (#1257) +- Fix excluded archs in debug build when not mac catalyst (#1260) +- Bump Xcode last upgraded version to 13.2 (#1265) +- Don't log warnings for CLI apps in DDTTYLogger (#1269) + + +## [3.7.2 - Xcode 12.4 on Apr 9th, 2021](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.7.2) + +### Public + +- Re-introduce (and deprecate) `_tag` field to fix breakage in 3.7.1 (#1224) + + +## [3.7.1 - Xcode 12.4 on Apr 7th, 2021](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.7.1) + +### Public + +- Deprecate `tag` property of `DDLogMessage`, use `representedObject` instead. (#1177, #532) +- Add per-message synchronous logging control for messages logged via SwiftLog using `DDLogHandler` (#1209) +- Add TargetConditionals import for Xcode 12.5 (#1210) +- Prevent logging an error when archiving an already deleted file (#1212) +- Use inclusive words - denylist / allowlist (#1218) +- Add `DDAssertionFailure` macro for Objective-C (#1220) + +### Internal + +- Use setter to replace kvo for `NSFileLogger` (#1180) +- Use new API for `NSFileHandle` on supported platforms (#1181) +- Remove unnecessary checks in `DDFileLogger` (#1182) +- Add an assertion to avoid potential deadlock issues for `flushLog` (#1183) + + +## [3.7.0 - Xcode 12 on Oct 2nd, 2020](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.7.0) + +### Public + +- **Breaking change**: Dropped support for iOS 8 (#1153) +- Update SPM tools-version to 5.3 to enable Swift 5.3 support (#1148) +- Add backend for swift-log (#1164) +- Specify CocoaPods version to ensure `swift_version` attribute works (#1167) +- Simplify `DDLogFileManager` callbacks for archived log files (#1166) + + +## [3.6.2 - Xcode 11.6 on July 31st, 2020](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.6.2) + +### Public +- Fix warnings when building with SPM bundled with Swift 5.2 / Xcode 11.4 (#1132) +- Added Swift name for DDQualityOfServiceName constants. +- Don't localize timestamps in `DDefaultFileLogFormatter` (#1151) +- Allow logging arbitrary objects via Swift log functions (#1146) + +### Repository +- Switch from Travis to GitHub Actions (#1135, #1140, #1150, #1152) + + +## [3.6.1 - Xcode 11.3.1 on Jan 25th, 2020](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.6.1) + +### Public +- Improve error handling during log file creation in DDFileLogger & DDLogFileManager (#1103 / #1111) +- Improve nullability annotations in public headers (#1111 / #1112 / #1119) +- Added support for thread QOS in DDLogMessage class (#1124) + +### Internal +- Fix rolling timer being rescheduled rapidly due to leeway (#1106 / #1107) +- Fix -didArchiveLogFile: returning the file name instead of the file path (#1078) +- Fix setxattr() function usage (#1118) +- Fix NSDateFormatter thread safety (#1121) +- Fix -lt_dataForMessage: duplicated code (#1122) + + +## [3.6.0 - Xcode 11 on October 2nd, 2019](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.6.0) + +### Public +- Swift Package Manager Support (#1083) +- New `willLogMessage:` and `didLogMessage:` methods on `DDFileLogger` which provide access to the current log file info. + +### Internal +- Fix issue with log archiving in the simulator (#1098) +- Limit assertion to non-simulator build (#1100) + + +## [3.5.3 - Xcode 10.2 on Apr 24th, 2019](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.5.3) + +### Public +- Additional compatibility with Swift 5 (backwards compatible with Swift 4) (#1043) +- Fix warning building with Xcode 10.2 (#1059) +- Set Xcode 10.2 and Swift 5.0 as a default (#1064) +- Fix format string crash (#1066) + +### Internal +- Fix warning about syntax (#1054) (#1065) +- Remove banned APIs (#1056) (#1057) +- Add CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER & fix warnings (#1059) +- Use LLONG_MAX instead of LONG_LONG_MAX (#1062) + + +## [3.5.2 - Xcode 10.1 on Mar 15th, 2019](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.5.2) + +### Public +- Fix reusing of log files after rolling (#1042) +- Fix creation of too many log files (#1049) +- Preliminary compatibility with Swift 5 (backwards compatible with Swift 4) (#1044) +- core: loggers os logger variations have been added (#1039) + +### Internal +- Sync internal queues to prevent cleaning up log files too soon in tests (#1053) +- DDLog checks for NULL values and for global queue dispatching has been added (#1045) + + +## [3.5.1 - Xcode 10 on Feb 4th, 2019](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.5.1) + +### Public +- Fix high CPU usage because of empty fileAttributes and / or too high rollingFrequceny (#1028) + + +## [3.5.0 - Xcode 10 on Jan 25th, 2019](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.5.0) + +### Public +- Added `logFileHeader` property to `DDLogFileManagerDefault`. Override to set header for each created file. #998 +- `DDFileLogger` now accepts a `dispatch_queue_t` which it uses to run callbacks. If not provided, the default global queue is used. #1003 +- Added opt-in buffering to `DDFileLogger`. Call `wrapWithBuffer` to create a file logger which buffers. #1001, #1012 +- Add `DDAssert` and `DDAssertionFailure` functions for Swift #934 +- Add `DD_LOG_LEVEL` define (which can be set in `GCC_PREPROCESSOR_DEFINITIONS`) for Swift to set default log level (enables stripping for strings that are not logged). #952 +- Add `asyncLoggingEnabled` global variable to control asynchronous logging. #1019 + +### Internal +- Prevent memory access errors caused by a failed fetch #944 +- Fix common warnings emitted by `-Wall`, `-Wconversion`, `-Wextra`, etc #943, #931 +- Fixes issue that could cause log messages to become interleaved when there are multiple `DDFileLogger`s #985 +- `DispatchQueueFormatter` knows about `com.apple.root.default-qos.overcommit` now #932 +- Fix thread safety issues in `DDFileLogger`. Makes it a little harder to deadlock in some cases. #986, #1003, #946 +- Fix availability checks and memory leak #996 + +### Repository +- Reduce podspec to two subspecs and remove customized modulemap #976 +- Add danger support for PR checks #962 - fixes #956 +- Merged framework targets + using `xcconfig` + deployment target `iOS 8` and `Mac OS 10.10` #959 e97da34 +- Documentation update #955 e7414ae 0239196 #933 +- Full links to Docs and other resources so they are resolved on external pages (i.e. https://cocoapods.org/pods/CocoaLumberjack) e9d6971 +- Replace `OSAtomic` with `stdatomic` in `DDDispatchQueueLogFormatter` #957 #958 +- Add Stale Bot + configuration #953 +- Update to Xcode 10 and Swift 4.2 compiler #950 +- Xcode 10 scheme changes #949 +- Update incomplete BSD 3-Clause License #942 +- Updated to CocoaPods 1.5.3 2d0590f +- Use Xcode 9.4 image for tests #939 +- Xcode (schemes) version bumps #938 +- Update demo and documentation about CustomLogLevels #1023 + + +## [3.4.2 - Xcode 9.3 on Apr 17th, 2018](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.4.2) +- Update README.md #912 +- Fixed typo in pull request template #913 +- Fix `-Wimplicit-retain-self` warnings #915 +- Update memory management in dynamic logging #916 +- Xcode 9.3 support #921 #923 #926 #927 +- Add extern "C" for Objective-C++ #922 +- Add `flush` method to the `DDFileLogger` #928 + + +## [3.4.1 - Xcode 9.1 on Jan 26th, 2018](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.4.1) +- Fix `DDLogFileManagerDefault` `-isLogFile` #909 +- Fix locking the main thread #911 + + +## [3.4.0 - Xcode 9.1 on Jan 3rd, 2018](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.4.0) +- Fix Travis CI #895 +- Fix typos #896 +- Fix schemes and link errors #897 #899 #903 #907 + + +## [3.3.0 - Xcode 9 on Oct 3rd, 2017](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.3.0) +- Xcode 9 support and Swift 4 support #890 #893 +- Replace `OSSpinLock` with `pthread_mutex` #889 + + +## [3.2.1 - Xcode 9 beta on Aug 21st, 2017](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.2.1) +- Xcode 9 beta support #874 #873 #884 #883 #882 +- Fixed some issues around deleting log files #868 #879 +- update 'Use Log Level per Logger' doc #888 +- Remove empty asset catalogs so that they don't show up in Open Quickly #877 +- Fixed typo in pull request template #880 + + +## [3.2.0 - Swift 3.0.0, Xcode 8.3 on May 3rd, 2017](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.2.0) +- Xcode 8.3 support #860 #853 +- added a very basic `os_log` (unified logging) logger #850 #856 +- Use `NSFileProtectionType` instead of `NSString` #866 +- Optimized timestamp calculation in `DDTTYLogger` #851 +- Updated docs #864 +- Fix Travis #863 +- Fixed nullability of `DDLogMessage.function` #849 `DDExtractFileNameWithoutExtension` #845 +- Ignore `Carthage/Build` directory #862 +- Updated schemes #859 #857 + + +## [3.1.0 - Swift 3.0.1, Xcode 8.1 on Feb 22nd, 2017](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.1.0) +- Swift 3.0.1 and Xcode 8.1 support via #816 +- Fix Carthage build and updated the podspec structure #819 #818 #784 #790 #782 #778 #815 +- Fix CLIColor.h not included in umbrella header #781 #796 #813 #783 +- Fix crash in `[DDLog log:level:flag:context:file:function:line:tag:format:]` #831 #830 +- Code improvements: + - using class properties #779 + - nullability #803 #809 #776 + - fix static analyzer issues #822 #828 + - optimized `USE_DISPATCH_CURRENT_QUEUE_LABEL` and `USE_DISPATCH_GET_CURRENT_QUEUE` macros #829 + - fixed dispatch_source_set_timer() usage #834 + - fixed misuse of non null parameter in `DDFileLogger fileAttributes` #835 + - store calendar in logger queue specifics for multi-thread safety #837 + - reenable default `init` method for `DDLogMessage` class #838 +- Added option to not copy messages #832 +- Added new hooks when adding loggers and formatters #836 +- Ability to create new log files every day #736 +- Skip messages in ASL logger which are filtered out by the formatter #786 #742 +- Fixed #823 by adding a `hash` implementation for `DDFileLogger` - same as `isEqual`, it only considers the `filePath` 7ceed08 +- Fix Travis CI build #807 +- Updated docs #798 #808 #811 #810 #820 + + +## [3.0.0 - Swift 3.0, Xcode 8 on Sep 21st, 2016](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.0.0) +- Swift 3.0 and Xcode 8 support via #769, fixes #771 and #772. Many thanks to @ffried @max-potapov @chrisdoc @BarakRL @devxoul and the others who contributed + + +## [2.4.0 - Swift 2.3 on Sep 19th, 2016](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.4.0) +- Swift 2.3 explicit so that the project compiles on Xcode 8 - #747 #773 fix #762 #763 #766 +- CocoaPods 1.0.0 fully adopted - 0f5a793 637dfc1 70439fe #729 +- Fix CLIColor.h not found for non-AppKit binaries w/o clang modules #745 +- Retrieve the `DDLogLevel` of each logger associated to `DDLog` #753 +- updated doc: #727 a9f54c9 #741, diagrams in 8bd128d +- Added CONTRIBUTING, ISSUE and PULL_REQUEST TEMPLATE and added a small Communication section to the Readme +- Fixed an issue with one demo #760 + + +## [2.3.0 - Swift 2.2, Xcode7.3 on May 2nd, 2016](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.3.0) +- Updated to Swift 2.2 - #704 +- replaced deprecated `__FUNCTION__`, `__FILE__`, `__LINE__` with newly added to Swift 2.2: `#function`, `#file`, `#line` +- Xcode 7.3 update - #692 #662 +- simplify usage and integration of the static library target - #657 +- DDLog usable via instances - #679 +- Swift cleanup - #649 +- Enable Application extension API only for tvOS - #701 +- Added `appletvos` and `appletvsimulator` to `SUPPORTED_PLATFORMS` and set `TVOS_DEPLOYMENT_TARGET` - #707 +- fixed `OSSpinLock` init issue - #653 +- Added check to prevent duplicate loggers - #682 +- fixed typo in import - #693 +- updated the docs - #646 #650 #656 #655 #661 #664 #667 #684 #724 + + +## [2.2.0 - TVOS, Xcode7.1 on Oct 28th, 2015](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.2.0) +- added `tvOS` support (thanks [@sinoru](https://github.com/sinoru)) - [#634](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/634) [#640](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/640) [#630](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/630) [#628](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/628) [#618](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/618) [#611](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/611) +- Remove `(escaping)` from the Swift `@autoclosure` parameters - [#642](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/642) + + +## [2.1.0 - Swift 2.0, WatchOS, Xcode7 on Oct 23rd, 2015](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.1.0) +- Fixed the version for the Carthage builds - see [#633](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/633) +- Improved documentation + + +## [2.1.0 RC - Swift 2.0, WatchOS, Xcode7 on Oct 22nd, 2015](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.1.0-rc) +- Refactored the `NSDateFormatter` related code to fix a bunch of issues: [#621](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/621) +- Fix Issue [#488](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/488): Support `DDLog` without `AppKit Dependency` (`#define DD_CLI`): [#627](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/627) +- Re-add `NS_DESIGNATED_INITIALIZER` [#619](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/619) + + +## [2.1.0 Beta - Swift 2.0, WatchOS, Xcode7 on Oct 12th, 2015](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.1.0-beta) +- Updated the library to use Swift 2.0 and Xcode 7 [#617](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/617) [#545](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/545) [#534](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/534) +- WatchOS support (2.0) [#583](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/583) [#581](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/581) [#579](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/579) + + +## [2.0.3 Patch for 2.0.0 on Oct 13th, 2015](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.0.3) + +- Compatibility with Xcode 6 that was broken by the 2.0.2 patch - [f042fd3](https://github.com/CocoaLumberjack/CocoaLumberjack/commit/f042fd3) + + +## [2.0.2 Patch for 2.0.0 on Oct 12th, 2015](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.0.2) + +- Swift 1.2 fixes [#546](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/546) [#578](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/578) plus and update to Swift 2.0 [5627dff](https://github.com/CocoaLumberjack/CocoaLumberjack/commit/5627dff) imported from our swift_2.0 branch +- Make build work on `tvOS` [#597](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/597) +- Make `CocoaLumberjackSwift-iOS` target depends on `CocoaLumberjack-iOS` [#575](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/575) +- `APPLICATION_EXTENSION_API_ONLY` to `YES` for Extensions [#576](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/576) +- Remove unnecessary `NS_DESIGNATED_INITIALIZER`s [#593](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/593) fixes [#592](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/592) +- Add ignore warning mark for `DDMakeColor` [#553](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/553) +- Kill unused function warnings from `DDTTYLogger.h` [#613](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/613) +- Flag unused parameters as being unused to silence strict warnings [#566](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/566) +- Extend ignore unused warning pragma to cover all platforms [#559](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/559) +- Removed images.xcassets from Mobile project [#580](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/580) +- Silence the Xcode 7 upgrade check - [#595](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/595) +- Fix import for when CL framework files are manually imported into project [#560](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/560) +- Don't override defines in case they're already set at project level [#551](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/551) +- log full filepath when failing to set attribute [#550](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/550) +- Fix issue in standalone build with `DDLegacyMacros.h` [#552](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/552) +- Update `CustomFormatters.md` with proper thread-safe blurb [#555](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/555) +- typo in parameter's variable name fixed [#568](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/568) +- Typo: minor fix [#571](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/571) +- Surely we should be adding 1, not 0 for `OSAtomicAdd32` ? [#587](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/587) +- `rollLogFileWithCompletionBlock` calls back on background queue instead of main queue [#589](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/589) +- Removing extraneous `\` on line 55 [#600](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/600) +- Updated `GettingStarted.md` to include `ddLogLevel` [#602](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/602) +- Remove redundant check for `processorCount` availability [#604](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/604) + + +## [2.0.1 Patch for 2.0.0 on Jun 25th, 2015](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.0.1) + +- **Carthage support** [#521](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/521) [#526](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/526) +- fixed crash on `DDASLLogCapture` when `TIME` or `TIME_NSEC` is `NULL` [#484](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/484) +- **Swift** fixes and improvements: [#483](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/483) [#509](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/509) [#518](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/518) [#522](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/522) [5eafceb](https://github.com/CocoaLumberjack/CocoaLumberjack/commit/5eafceb) +- Unit tests: [#500](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/500) [#498](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/498) [#499](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/499) +- Fix [#478](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/478) by reverting [#473](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/473) +- Add `armv7s` to static library [#538](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/538) +- Fix `NSLog` `threadid` mismatch with iOS 8+/OSX 10.10+ [#514](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/514) +- Fixed the `LogV` macros so that avalist is no longer undefined [#511](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/511) +- Using type safe `DDColor` alias instead of #define directive [#506](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/506) +- Several fixes/tweaks to `DDASLLogCapture` [#512](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/512) +- Prevent duplicate log entries when both `DDASLLogCapture` and `DDASLLogger` are used [#515](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/515) +- Fix memory leaks in `DDTTYLogger`, add self annotations to blocks [#536](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/536) +- Update older syntax to modern subscripting for array access [#482](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/482) +- Remove execute permission on non-executable files [#517](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/517) +- Change code samples to use `DDLogFlagWarning` [#520](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/520) +- Fix seemingly obvious typo in the `toLogLevel` function [#508](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/508) + + +## [CocoaLumberjack 2.0.0 on Mar 13th, 2015](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.0.0) + +The library was strongly refactored, with a few goals in mind: +- Swift support - that we will release in a separate milestone, since CocoaPods 0.36.0 just got out +- Unit tests support +- reorganised things (on disk) +- better coding style + +See [Migration from 1.x to 2.x](https://github.com/CocoaLumberjack/CocoaLumberjack#migrating-to-2x) + + +## [2.0.0-rc2 on Feb 20th, 2015](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.0.0-rc2) + +- Bucket of Swift improvements - [#434](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/434) [#437](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/437) [#449](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/449) [#440](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/440) +- Fixed [#433](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/433) (build issue due to dispatch_queue properties) - [#455](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/455) +- Enable codesign for iOS device framework builds - [#444](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/444) +- Declare `automaticallyAppendNewlineForCustomFormatters` properties as `nonatomic` - [#443](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/443) +- Warning fixes & type standardization - [#419](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/419) +- Legacy checks updated - [#424](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/424) +- Documentation updates + + +## [2.0.0-rc on Dec 11th, 2014](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.0.0-rc) + +- Fix `dispatch_queue_t` properties. +- Fix `registeredClasses` crashes at launch. + + +## [2.0.0-beta4 on Nov 7th, 2014](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.0.0-beta4) + +- Major refactoring and clean up. +- Remove superfluous `log` from property names and use underscore for direct variable access. +- Preliminary Swift support through `CocoaLumberjack.swift`. +- Automatic 1.9.x legacy support when `DDLog.h` is imported instead of the new `CocoaLumberjack.h`. + + +## [2.0.0-beta3 on Oct 21st, 2014](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.0.0-beta3) + +- Modernize flag variables to be `NS_OPTIONS`/`NS_ENUM`. +- Change the log flags and levels to `NSUInteger`. +- Fix warning when compiled with assertions blocked. +- Crash fixes. + + +## [2.0.0-beta2 on Sep 30th, 2014](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.0.0-beta2) + +- Cleanup code. +- Match `NSLog` read UID functionality in `DDASLLogger`. +- Update framework and static libraries. + + +## [2.0.0 Beta on Aug 12th, 2014](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/2.0.0-beta) + +See [Migrate from 1.x to 2.x](https://github.com/CocoaLumberjack/CocoaLumberjack#migrating-to-2x) + + +## [1.9.2 Updated patch release for 1.9.0 on Aug 11th, 2014](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.9.2) + +- Fixed `NSCalendar components:fromDate:` crash - [#140](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/140) [#307](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/307) [#216](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/216) +- New `DDAssert` macros - [#306](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/306) +- Limit log growth by disk space only, not the number of files - [#195](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/195) [#303](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/303) +- Change the mechanism for adding new line character (i.e. '\n\) to log messages in some logger - [#308](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/308) [#310](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/310) +- Fixed deprecations - [#320](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/320) [#312](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/312) [#317](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/317) +- `aslmsg` not freed and causing memory leak - [#314](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/314) +- Fixed `CompressingLogFileManager` compression bug - [#315](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/315) +- Remove unnecessary `NULL` check before `free()` - [#316](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/316) + + +## [1.9.1 Patch release for 1.9.0 on Jun 30th, 2014](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.9.1) + +- Fixed issues in rolling frequency - [#243](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/243) [#295](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/295) [@georgekola](https://github.com/georgekola) +- Fixed critical issue, `addLogger` method should use a full bit mask instead of `LOG_LEVEL_VERBOSE`, otherwise extended logs or extra flags are ignored [fe6824c](https://github.com/CocoaLumberjack/CocoaLumberjack/commit/fe6824c) [@robbiehanson](https://github.com/robbiehanson) +- Performance optimisation: use compiler macros to skip iOS version checks - [4656d3b](https://github.com/CocoaLumberjack/CocoaLumberjack/commit/4656d3b) [#298](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/298) [#291](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/291) [@robbiehanson](https://github.com/robbiehanson) [@liviur](https://github.com/liviur) +- Changed the `Build Active Architecture Only` to `NO` [#294](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/294) [#293](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/293) +- Optimisation by reusing `NSDateFormatter` instances [#296](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/296) [#301](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/301) + + +## [1.9.0 New ASL capture module, several File logger fixes on May 23rd, 2014](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.9.0) + +- New ASL capture module [#242](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/242) [#263](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/263) +- Override default `NSFileProtection` handling [#285](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/285) +- Replaced warnings when ARC was not enabled with errors [#284](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/284) +- Fix for issue [#278](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/278) where really large log files can keep growing [#280](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/280) +- Fixed Xcode warnings [#279](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/279) +- Update `calendarUnitFlags` with new iOS SDK values [#277](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/277) +- Fix possible crash in `[NSCalendar components:fromDate:]` [#277](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/277) +- Fix [#262](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/262) inverted ifs when renaming log [#264](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/264) +- Proper way of doing singletons (via `dispatch_once`) [#259](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/259) +- Explicitly declare `DDFileLogger` and `DDDispatchQueueLogFormatter ` properties as atomic to avoid Xcode warnings [#258](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/258) +- Set `NSFileProtectionKey` on the temporary file created during compression [#256](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/256) +- Fix a rare crash in `CompressingLogFileManager` caused by an unchecked result from read [#255](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/255) +- Add explicit casts for integer conversion [#253](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/253) +- Replace use of `NSThread.detachNewThreadSelector` [#251](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/251) +- Add a constructor override for `initWithLogsDirectory:` [#252](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/252) +- Check and log the streamError whenever we fail to write during compression and log any failures when removing the original file or cleaning up the temporary file after compression failed [#250](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/250) +- Following Apple's guidelines for iOS Static Libraries [#249](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/249) +- Some extra warnings for the mobile framework xcode project [a2e5666](https://github.com/CocoaLumberjack/CocoaLumberjack/commit/a2e5666) +- Update `FineGrainedLoggingAppDelegate.m` [#244](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/244) +- New `[DDLog log:message:]` primitive [7f8af2e](https://github.com/CocoaLumberjack/CocoaLumberjack/commit/7f8af2e) +- Fixed issue [#181](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/181) when logging messages in iOS7 devices aren't properly retrieved by `asl_search` [#240](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/240) +- Allow prevention of log file reuse [#238](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/238) +- `DDTTYLogger`: Favour XcodeColors environment variable [#237](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/237) +- `DDLog`: calling `atexit_b` in CLI applications, that use Foundation framework [#234](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/234) + + +## [1.8.1 AllLoggers and bugfixes on Feb 14th, 2014](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.8.1) + +- read access to all loggers - [#217](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/217) [#219](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/219) +- fixed bug with archived logs not being handled correctly on iOS simulator - [#218](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/218) +- log the `strerror(errno)` value when `setxattr()` fails - [#211](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/211) +- Add a check for an archived log before overwriting - [#214](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/214) +- improved safety by using assertions instead of comments (`DDLog` in the core) - [#221](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/221) +- added Lumberjack logo :) + + +## [1.8.0 Better CL support, custom logfile name format, bugfixes on Jan 21st, 2014](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.8.0) + +- `DDFileLogger` custom logfile (name) format - [#208](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/208) +- Security static analysis fix - [#202](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/202) +- `DDFileLogger`: using `CFBundleIdentifier` as a log filename prefix on OSX and iOS - [#206](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/206) +- Allow disabling of specific levels per-logger - [#204](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/204) +- Improve support for OS X command line tools - [#194](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/194) +- `DDFileLogger`: fixed crash that occurred in case if application name == nil - [#198](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/198) +- `DDFileLogger`: fixed comment - [#199](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/199) +- Fix Travis - [#205](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/205) + + +## [1.7.0 New log file naming convention and CocoaLumberjack organisation on Dec 10th, 2013](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.7.0) + +- new log file naming convention - [#191](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/191) +- completed transition to **CocoaLumberjack** organisation - [#188](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/188) + + +## [1.6.5.1 Patch release for Xcode 4.4+ compatibility on Dec 4th, 2013](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.6.5.1) + +- fixed compatibility with Xcode 4.4+ [#187](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/187) + + +## [1.6.5 File Logger refactoring, Multi Formatter, preffixed extension classes on Dec 3rd, 2013](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.6.5) + +`DDFileLogger` refactoring and fixes (thanks [@dvor](https://github.com/dvor) and [@an0](https://github.com/an0)): +- Fixed [#63](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/63) Loggers don't flush in Command Line Tool [#184](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/184) +- Fixed [#52](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/52) Force log rotation [#183](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/183) +- Fixed [#55](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/55) After deleting log file or log dir they aren't created again without relaunching the app [#183](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/183) +- Fixed [#129](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/129) [iOS] `DDFileLogger` causes crash when logging from background app [#183](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/183) +- Fixed [#153](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/153) Log file on iPhone only contains a single line [#177](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/177) +- Fixed [#155](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/155) How do I combine all my log levels into one file? [#177](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/177) +- Fixed [#175](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/175) `DFileLogger` `creationDate` bug on 64-bit iOS system [#177](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/177) +- Allow customizing the naming convention for log files to use timestamps [#174](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/174) + +Other: +- Implemented multiple formatter (`DDMultiFormatter` - alows chaining of formatters) [#178](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/178) +- Added DD prefix to extension classes (`ContextFilterLogFormatter` and `DispatchQueueLogFormatter`) [#178](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/178) +- Updated code indentation: Tabs changed to spaces [#180](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/180) +- Included `DDLog+LOGV.h` in Cocoapods sources [d253bd7](https://github.com/CocoaLumberjack/CocoaLumberjack/commit/d253bd7) +- other fixes/improvements + + +## [1.6.4 Fix compatibility with 3rd party frameworks on Nov 21st, 2013](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.6.4) + +* "Fix" conflicts with 3rd party libraries using `CocoaLumberjack` [#172](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/172) +* Ignore deprecated warning for `dispatch_get_current_queue` [#167](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/167) +* Add new `DEBUG` log level support to included loggers [#166](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/166) +* Method declarations that make it easier to extend/modify `DispatchQueueLogFormatter` [#164](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/164) + + +## [1.6.3 New macros, updated podspec and bug fixes on Apr 2nd, 2013](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.6.3) + +* Add `LOGV`-style macros [#161](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/161) +* Fix getting queue's label [#159](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/159) +* New log level `DEBUG` [#145](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/145) +* Use `DISPATCH_CURRENT_QUEUE_LABEL` if available [#159](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/159) +* Different `logLevel` per each logger [#151](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/151) +* Created 2 subspecs, `Core` and `Extensions` [#152](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/152) +* Updated observer for keypath using `NSStringFromSelector` + `@selector` [38e5da3](https://github.com/CocoaLumberjack/CocoaLumberjack/commit/38e5da3) +* Replaced `id` return type with `instancetype` [ebee454](https://github.com/CocoaLumberjack/CocoaLumberjack/commit/ebee454) +* Remove implicit conversion warnings [#149](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/149) +* `DDTTYLogger`: Allow to set default color profiles for all contexts at once [#146](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/146) [#158](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/158) +* `DDTTYLogger`: By default apply `setForegroundColor:backgroundColor:forFlag:` to `LOG_CONTEXT_ALL` [#154](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/154) +* `DispatchQueueLogFormatter`: Use modern Objective-C [#142](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/142) +* `DispatchQueueLogFormatter`: Make sure to always use a `NSGregorianCalendar` for date formatter [#142](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/142) +* Replaced explicit reference to class name in `logFileWithPath` factory method [#131](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/131) +* Catch exceptions in `logMessage:` [#130](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/130) +* Fix enum type conversion warnings [#124](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/124) +* Add deployment target condition for workaround [#121](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/121) +* Fix static analyzer warnings about `nil` values in dictionary [#122](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/122) +* Fix `dispatch_get_current_queue` crash [#121](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/121) +* Fixing colors in greyscale color-space not working [d019cfd](https://github.com/CocoaLumberjack/CocoaLumberjack/commit/d019cfd) +* Guard around `dispatch_resume()` being called with null pointer [#107](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/107) +* `NULL` safety checks [#107](https://github.com/CocoaLumberjack/CocoaLumberjack/pull/107) + + +## [1.6.2 on Apr 2nd, 2013](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.6.2) + +## [1.6.1 on Apr 2nd, 2013](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.6.1) + +## [1.6 on Jul 3rd, 2012](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.6) + +## [1.5.1 on Jul 3rd, 2012](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.5.1) + +## [1.5 on Jul 3rd, 2012](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.5) + +## [1.4.1 on Jul 3rd, 2012](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.4.1) + +## [1.4 on Jul 3rd, 2012](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.4) + +## [1.3.3 on Mar 30th, 2012](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.3.3) + +## [1.3.2 on Dec 23rd, 2011](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.3.2) + +## [1.3.1 on Dec 9th, 2011](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.3.1) + +## [1.3 on Dec 9th, 2011](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.3) + +## [1.2.3 on Dec 9th, 2011](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.2.3) + +## [1.2.2 on Dec 9th, 2011](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.2.2) + +## [1.2.1 on Oct 13th, 2011](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.2.1) + +## [1.2 on Oct 13th, 2011](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.2) + +## [1.1 on Oct 13th, 2011](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.1) + +## [1.0 on Oct 13th, 2011](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/1.0) diff --git a/Pods/CocoaLumberjack/Classes/CocoaLumberjack.h b/Pods/CocoaLumberjack/Classes/CocoaLumberjack.h deleted file mode 100644 index 22731219b..000000000 --- a/Pods/CocoaLumberjack/Classes/CocoaLumberjack.h +++ /dev/null @@ -1,86 +0,0 @@ -// Software License Agreement (BSD License) -// -// Copyright (c) 2010-2016, Deusty, LLC -// All rights reserved. -// -// Redistribution and use of this software in source and binary forms, -// with or without modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Neither the name of Deusty nor the names of its contributors may be used -// to endorse or promote products derived from this software without specific -// prior written permission of Deusty, LLC. - -/** - * Welcome to CocoaLumberjack! - * - * The project page has a wealth of documentation if you have any questions. - * https://github.com/CocoaLumberjack/CocoaLumberjack - * - * If you're new to the project you may wish to read "Getting Started" at: - * Documentation/GettingStarted.md - * - * Otherwise, here is a quick refresher. - * There are three steps to using the macros: - * - * Step 1: - * Import the header in your implementation or prefix file: - * - * #import - * - * Step 2: - * Define your logging level in your implementation file: - * - * // Log levels: off, error, warn, info, verbose - * static const DDLogLevel ddLogLevel = DDLogLevelVerbose; - * - * Step 2 [3rd party frameworks]: - * - * Define your LOG_LEVEL_DEF to a different variable/function than ddLogLevel: - * - * // #undef LOG_LEVEL_DEF // Undefine first only if needed - * #define LOG_LEVEL_DEF myLibLogLevel - * - * Define your logging level in your implementation file: - * - * // Log levels: off, error, warn, info, verbose - * static const DDLogLevel myLibLogLevel = DDLogLevelVerbose; - * - * Step 3: - * Replace your NSLog statements with DDLog statements according to the severity of the message. - * - * NSLog(@"Fatal error, no dohickey found!"); -> DDLogError(@"Fatal error, no dohickey found!"); - * - * DDLog works exactly the same as NSLog. - * This means you can pass it multiple variables just like NSLog. - **/ - -#import - -// Disable legacy macros -#ifndef DD_LEGACY_MACROS - #define DD_LEGACY_MACROS 0 -#endif - -// Core -#import "DDLog.h" - -// Main macros -#import "DDLogMacros.h" -#import "DDAssertMacros.h" - -// Capture ASL -#import "DDASLLogCapture.h" - -// Loggers -#import "DDTTYLogger.h" -#import "DDASLLogger.h" -#import "DDFileLogger.h" -#import "DDOSLogger.h" - -// CLI -#if __has_include("CLIColor.h") && TARGET_OS_OSX -#import "CLIColor.h" -#endif diff --git a/Pods/CocoaLumberjack/Classes/CocoaLumberjack.swift b/Pods/CocoaLumberjack/Classes/CocoaLumberjack.swift deleted file mode 100644 index 07573f960..000000000 --- a/Pods/CocoaLumberjack/Classes/CocoaLumberjack.swift +++ /dev/null @@ -1,95 +0,0 @@ -// Software License Agreement (BSD License) -// -// Copyright (c) 2014-2016, Deusty, LLC -// All rights reserved. -// -// Redistribution and use of this software in source and binary forms, -// with or without modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Neither the name of Deusty nor the names of its contributors may be used -// to endorse or promote products derived from this software without specific -// prior written permission of Deusty, LLC. - -import Foundation - -extension DDLogFlag { - public static func from(_ logLevel: DDLogLevel) -> DDLogFlag { - return DDLogFlag(rawValue: logLevel.rawValue) - } - - public init(_ logLevel: DDLogLevel) { - self = DDLogFlag(rawValue: logLevel.rawValue) - } - - ///returns the log level, or the lowest equivalant. - public func toLogLevel() -> DDLogLevel { - if let ourValid = DDLogLevel(rawValue: rawValue) { - return ourValid - } else { - if contains(.verbose) { - return .verbose - } else if contains(.debug) { - return .debug - } else if contains(.info) { - return .info - } else if contains(.warning) { - return .warning - } else if contains(.error) { - return .error - } else { - return .off - } - } - } -} - -public var defaultDebugLevel = DDLogLevel.verbose - -public func resetDefaultDebugLevel() { - defaultDebugLevel = DDLogLevel.verbose -} - -public func _DDLogMessage(_ message: @autoclosure () -> String, level: DDLogLevel, flag: DDLogFlag, context: Int, file: StaticString, function: StaticString, line: UInt, tag: Any?, asynchronous: Bool, ddlog: DDLog) { - if level.rawValue & flag.rawValue != 0 { - // Tell the DDLogMessage constructor to copy the C strings that get passed to it. - let logMessage = DDLogMessage(message: message(), level: level, flag: flag, context: context, file: String(describing: file), function: String(describing: function), line: line, tag: tag, options: [.copyFile, .copyFunction], timestamp: nil) - ddlog.log(asynchronous: asynchronous, message: logMessage) - } -} - -public func DDLogDebug(_ message: @autoclosure () -> String, level: DDLogLevel = defaultDebugLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: Any? = nil, asynchronous async: Bool = true, ddlog: DDLog = DDLog.sharedInstance) { - _DDLogMessage(message, level: level, flag: .debug, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog) -} - -public func DDLogInfo(_ message: @autoclosure () -> String, level: DDLogLevel = defaultDebugLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: Any? = nil, asynchronous async: Bool = true, ddlog: DDLog = DDLog.sharedInstance) { - _DDLogMessage(message, level: level, flag: .info, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog) -} - -public func DDLogWarn(_ message: @autoclosure () -> String, level: DDLogLevel = defaultDebugLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: Any? = nil, asynchronous async: Bool = true, ddlog: DDLog = DDLog.sharedInstance) { - _DDLogMessage(message, level: level, flag: .warning, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog) -} - -public func DDLogVerbose(_ message: @autoclosure () -> String, level: DDLogLevel = defaultDebugLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: Any? = nil, asynchronous async: Bool = true, ddlog: DDLog = DDLog.sharedInstance) { - _DDLogMessage(message, level: level, flag: .verbose, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog) -} - -public func DDLogError(_ message: @autoclosure () -> String, level: DDLogLevel = defaultDebugLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: Any? = nil, asynchronous async: Bool = false, ddlog: DDLog = DDLog.sharedInstance) { - _DDLogMessage(message, level: level, flag: .error, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog) -} - -/// Returns a String of the current filename, without full path or extension. -/// -/// Analogous to the C preprocessor macro `THIS_FILE`. -public func CurrentFileName(_ fileName: StaticString = #file) -> String { - var str = String(describing: fileName) - if let idx = str.range(of: "/", options: .backwards)?.upperBound { - str = String(str[idx...]) - } - if let idx = str.range(of: ".", options: .backwards)?.lowerBound { - str = String(str[.. -#include -#include -#include - -static BOOL _cancel = YES; -static DDLogLevel _captureLevel = DDLogLevelVerbose; - -#ifdef __IPHONE_8_0 - #define DDASL_IOS_PIVOT_VERSION __IPHONE_8_0 -#endif -#ifdef __MAC_10_10 - #define DDASL_OSX_PIVOT_VERSION __MAC_10_10 -#endif - -@implementation DDASLLogCapture - -static aslmsg (*dd_asl_next)(aslresponse obj); -static void (*dd_asl_release)(aslresponse obj); - -+ (void)initialize -{ - #if (defined(DDASL_IOS_PIVOT_VERSION) && __IPHONE_OS_VERSION_MAX_ALLOWED >= DDASL_IOS_PIVOT_VERSION) || (defined(DDASL_OSX_PIVOT_VERSION) && __MAC_OS_X_VERSION_MAX_ALLOWED >= DDASL_OSX_PIVOT_VERSION) - #if __IPHONE_OS_VERSION_MIN_REQUIRED < DDASL_IOS_PIVOT_VERSION || __MAC_OS_X_VERSION_MIN_REQUIRED < DDASL_OSX_PIVOT_VERSION - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wdeprecated-declarations" - // Building on falsely advertised SDK, targeting deprecated API - dd_asl_next = &aslresponse_next; - dd_asl_release = &aslresponse_free; - #pragma GCC diagnostic pop - #else - // Building on lastest, correct SDK, targeting latest API - dd_asl_next = &asl_next; - dd_asl_release = &asl_release; - #endif - #else - // Building on old SDKs, targeting deprecated API - dd_asl_next = &aslresponse_next; - dd_asl_release = &aslresponse_free; - #endif -} - -+ (void)start { - // Ignore subsequent calls - if (!_cancel) { - return; - } - - _cancel = NO; - - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void) { - [self captureAslLogs]; - }); -} - -+ (void)stop { - _cancel = YES; -} - -+ (DDLogLevel)captureLevel { - return _captureLevel; -} - -+ (void)setCaptureLevel:(DDLogLevel)level { - _captureLevel = level; -} - -#pragma mark - Private methods - -+ (void)configureAslQuery:(aslmsg)query { - const char param[] = "7"; // ASL_LEVEL_DEBUG, which is everything. We'll rely on regular DDlog log level to filter - - asl_set_query(query, ASL_KEY_LEVEL, param, ASL_QUERY_OP_LESS_EQUAL | ASL_QUERY_OP_NUMERIC); - - // Don't retrieve logs from our own DDASLLogger - asl_set_query(query, kDDASLKeyDDLog, kDDASLDDLogValue, ASL_QUERY_OP_NOT_EQUAL); - -#if !TARGET_OS_IPHONE || TARGET_SIMULATOR - int processId = [[NSProcessInfo processInfo] processIdentifier]; - char pid[16]; - sprintf(pid, "%d", processId); - asl_set_query(query, ASL_KEY_PID, pid, ASL_QUERY_OP_EQUAL | ASL_QUERY_OP_NUMERIC); -#endif -} - -+ (void)aslMessageReceived:(aslmsg)msg { - const char* messageCString = asl_get( msg, ASL_KEY_MSG ); - if ( messageCString == NULL ) - return; - - int flag; - BOOL async; - - const char* levelCString = asl_get(msg, ASL_KEY_LEVEL); - switch (levelCString? atoi(levelCString) : 0) { - // By default all NSLog's with a ASL_LEVEL_WARNING level - case ASL_LEVEL_EMERG : - case ASL_LEVEL_ALERT : - case ASL_LEVEL_CRIT : flag = DDLogFlagError; async = NO; break; - case ASL_LEVEL_ERR : flag = DDLogFlagWarning; async = YES; break; - case ASL_LEVEL_WARNING : flag = DDLogFlagInfo; async = YES; break; - case ASL_LEVEL_NOTICE : flag = DDLogFlagDebug; async = YES; break; - case ASL_LEVEL_INFO : - case ASL_LEVEL_DEBUG : - default : flag = DDLogFlagVerbose; async = YES; break; - } - - if (!(_captureLevel & flag)) { - return; - } - - // NSString * sender = [NSString stringWithCString:asl_get(msg, ASL_KEY_SENDER) encoding:NSUTF8StringEncoding]; - NSString *message = @(messageCString); - - const char* secondsCString = asl_get( msg, ASL_KEY_TIME ); - const char* nanoCString = asl_get( msg, ASL_KEY_TIME_NSEC ); - NSTimeInterval seconds = secondsCString ? strtod(secondsCString, NULL) : [NSDate timeIntervalSinceReferenceDate] - NSTimeIntervalSince1970; - double nanoSeconds = nanoCString? strtod(nanoCString, NULL) : 0; - NSTimeInterval totalSeconds = seconds + (nanoSeconds / 1e9); - - NSDate *timeStamp = [NSDate dateWithTimeIntervalSince1970:totalSeconds]; - - DDLogMessage *logMessage = [[DDLogMessage alloc]initWithMessage:message - level:_captureLevel - flag:flag - context:0 - file:@"DDASLLogCapture" - function:0 - line:0 - tag:nil - options:0 - timestamp:timeStamp]; - - [DDLog log:async message:logMessage]; -} - -+ (void)captureAslLogs { - @autoreleasepool - { - /* - We use ASL_KEY_MSG_ID to see each message once, but there's no - obvious way to get the "next" ID. To bootstrap the process, we'll - search by timestamp until we've seen a message. - */ - - struct timeval timeval = { - .tv_sec = 0 - }; - gettimeofday(&timeval, NULL); - unsigned long long startTime = timeval.tv_sec; - __block unsigned long long lastSeenID = 0; - - /* - syslogd posts kNotifyASLDBUpdate (com.apple.system.logger.message) - through the notify API when it saves messages to the ASL database. - There is some coalescing - currently it is sent at most twice per - second - but there is no documented guarantee about this. In any - case, there may be multiple messages per notification. - - Notify notifications don't carry any payload, so we need to search - for the messages. - */ - int notifyToken = 0; // Can be used to unregister with notify_cancel(). - notify_register_dispatch(kNotifyASLDBUpdate, ¬ifyToken, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^(int token) - { - // At least one message has been posted; build a search query. - @autoreleasepool - { - aslmsg query = asl_new(ASL_TYPE_QUERY); - char stringValue[64]; - - if (lastSeenID > 0) { - snprintf(stringValue, sizeof stringValue, "%llu", lastSeenID); - asl_set_query(query, ASL_KEY_MSG_ID, stringValue, ASL_QUERY_OP_GREATER | ASL_QUERY_OP_NUMERIC); - } else { - snprintf(stringValue, sizeof stringValue, "%llu", startTime); - asl_set_query(query, ASL_KEY_TIME, stringValue, ASL_QUERY_OP_GREATER_EQUAL | ASL_QUERY_OP_NUMERIC); - } - - [self configureAslQuery:query]; - - // Iterate over new messages. - aslmsg msg; - aslresponse response = asl_search(NULL, query); - - while ((msg = dd_asl_next(response))) - { - [self aslMessageReceived:msg]; - - // Keep track of which messages we've seen. - lastSeenID = atoll(asl_get(msg, ASL_KEY_MSG_ID)); - } - dd_asl_release(response); - asl_free(query); - - if (_cancel) { - notify_cancel(token); - return; - } - - } - }); - } -} - -@end diff --git a/Pods/CocoaLumberjack/Classes/DDAssertMacros.h b/Pods/CocoaLumberjack/Classes/DDAssertMacros.h deleted file mode 100644 index 7678a9c14..000000000 --- a/Pods/CocoaLumberjack/Classes/DDAssertMacros.h +++ /dev/null @@ -1,26 +0,0 @@ -// Software License Agreement (BSD License) -// -// Copyright (c) 2010-2016, Deusty, LLC -// All rights reserved. -// -// Redistribution and use of this software in source and binary forms, -// with or without modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Neither the name of Deusty nor the names of its contributors may be used -// to endorse or promote products derived from this software without specific -// prior written permission of Deusty, LLC. - -/** - * NSAsset replacement that will output a log message even when assertions are disabled. - **/ -#define DDAssert(condition, frmt, ...) \ - if (!(condition)) { \ - NSString *description = [NSString stringWithFormat:frmt, ## __VA_ARGS__]; \ - DDLogError(@"%@", description); \ - NSAssert(NO, description); \ - } -#define DDAssertCondition(condition) DDAssert(condition, @"Condition not satisfied: %s", #condition) - diff --git a/Pods/CocoaLumberjack/Classes/DDFileLogger.h b/Pods/CocoaLumberjack/Classes/DDFileLogger.h deleted file mode 100644 index 66b27aaf1..000000000 --- a/Pods/CocoaLumberjack/Classes/DDFileLogger.h +++ /dev/null @@ -1,512 +0,0 @@ -// Software License Agreement (BSD License) -// -// Copyright (c) 2010-2016, Deusty, LLC -// All rights reserved. -// -// Redistribution and use of this software in source and binary forms, -// with or without modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Neither the name of Deusty nor the names of its contributors may be used -// to endorse or promote products derived from this software without specific -// prior written permission of Deusty, LLC. - -// Disable legacy macros -#ifndef DD_LEGACY_MACROS - #define DD_LEGACY_MACROS 0 -#endif - -#import "DDLog.h" - -@class DDLogFileInfo; - -/** - * This class provides a logger to write log statements to a file. - **/ - - -// Default configuration and safety/sanity values. -// -// maximumFileSize -> kDDDefaultLogMaxFileSize -// rollingFrequency -> kDDDefaultLogRollingFrequency -// maximumNumberOfLogFiles -> kDDDefaultLogMaxNumLogFiles -// logFilesDiskQuota -> kDDDefaultLogFilesDiskQuota -// -// You should carefully consider the proper configuration values for your application. - -extern unsigned long long const kDDDefaultLogMaxFileSize; -extern NSTimeInterval const kDDDefaultLogRollingFrequency; -extern NSUInteger const kDDDefaultLogMaxNumLogFiles; -extern unsigned long long const kDDDefaultLogFilesDiskQuota; - - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -#pragma mark - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/** - * The LogFileManager protocol is designed to allow you to control all aspects of your log files. - * - * The primary purpose of this is to allow you to do something with the log files after they have been rolled. - * Perhaps you want to compress them to save disk space. - * Perhaps you want to upload them to an FTP server. - * Perhaps you want to run some analytics on the file. - * - * A default LogFileManager is, of course, provided. - * The default LogFileManager simply deletes old log files according to the maximumNumberOfLogFiles property. - * - * This protocol provides various methods to fetch the list of log files. - * - * There are two variants: sorted and unsorted. - * If sorting is not necessary, the unsorted variant is obviously faster. - * The sorted variant will return an array sorted by when the log files were created, - * with the most recently created log file at index 0, and the oldest log file at the end of the array. - * - * You can fetch only the log file paths (full path including name), log file names (name only), - * or an array of `DDLogFileInfo` objects. - * The `DDLogFileInfo` class is documented below, and provides a handy wrapper that - * gives you easy access to various file attributes such as the creation date or the file size. - */ -@protocol DDLogFileManager -@required - -// Public properties - -/** - * The maximum number of archived log files to keep on disk. - * For example, if this property is set to 3, - * then the LogFileManager will only keep 3 archived log files (plus the current active log file) on disk. - * Once the active log file is rolled/archived, then the oldest of the existing 3 rolled/archived log files is deleted. - * - * You may optionally disable this option by setting it to zero. - **/ -@property (readwrite, assign, atomic) NSUInteger maximumNumberOfLogFiles; - -/** - * The maximum space that logs can take. On rolling logfile all old logfiles that exceed logFilesDiskQuota will - * be deleted. - * - * You may optionally disable this option by setting it to zero. - **/ -@property (readwrite, assign, atomic) unsigned long long logFilesDiskQuota; - -// Public methods - -/** - * Returns the logs directory (path) - */ -@property (nonatomic, readonly, copy) NSString *logsDirectory; - -/** - * Returns an array of `NSString` objects, - * each of which is the filePath to an existing log file on disk. - **/ -@property (nonatomic, readonly, strong) NSArray *unsortedLogFilePaths; - -/** - * Returns an array of `NSString` objects, - * each of which is the fileName of an existing log file on disk. - **/ -@property (nonatomic, readonly, strong) NSArray *unsortedLogFileNames; - -/** - * Returns an array of `DDLogFileInfo` objects, - * each representing an existing log file on disk, - * and containing important information about the log file such as it's modification date and size. - **/ -@property (nonatomic, readonly, strong) NSArray *unsortedLogFileInfos; - -/** - * Just like the `unsortedLogFilePaths` method, but sorts the array. - * The items in the array are sorted by creation date. - * The first item in the array will be the most recently created log file. - **/ -@property (nonatomic, readonly, strong) NSArray *sortedLogFilePaths; - -/** - * Just like the `unsortedLogFileNames` method, but sorts the array. - * The items in the array are sorted by creation date. - * The first item in the array will be the most recently created log file. - **/ -@property (nonatomic, readonly, strong) NSArray *sortedLogFileNames; - -/** - * Just like the `unsortedLogFileInfos` method, but sorts the array. - * The items in the array are sorted by creation date. - * The first item in the array will be the most recently created log file. - **/ -@property (nonatomic, readonly, strong) NSArray *sortedLogFileInfos; - -// Private methods (only to be used by DDFileLogger) - -/** - * Generates a new unique log file path, and creates the corresponding log file. - **/ -- (NSString *)createNewLogFile; - -@optional - -// Notifications from DDFileLogger - -/** - * Called when a log file was archieved - */ -- (void)didArchiveLogFile:(NSString *)logFilePath NS_SWIFT_NAME(didArchiveLogFile(atPath:)); - -/** - * Called when the roll action was executed and the log was archieved - */ -- (void)didRollAndArchiveLogFile:(NSString *)logFilePath NS_SWIFT_NAME(didRollAndArchiveLogFile(atPath:)); - -@end - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -#pragma mark - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/** - * Default log file manager. - * - * All log files are placed inside the logsDirectory. - * If a specific logsDirectory isn't specified, the default directory is used. - * On Mac, this is in `~/Library/Logs/`. - * On iPhone, this is in `~/Library/Caches/Logs`. - * - * Log files are named `"

    - +

    +

    CocoaLumberjack =============== -[![Build Status](https://travis-ci.org/CocoaLumberjack/CocoaLumberjack.svg?branch=master)](https://travis-ci.org/CocoaLumberjack/CocoaLumberjack) -[![Pod Version](http://img.shields.io/cocoapods/v/CocoaLumberjack.svg?style=flat)](http://cocoadocs.org/docsets/CocoaLumberjack/) +[![Version](https://img.shields.io/github/release/CocoaLumberjack/CocoaLumberjack.svg?display_name=tag&style=flat)](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/latest) +[![License](https://img.shields.io/github/license/CocoaLumberjack/CocoaLumberjack.svg?style=flat)](https://opensource.org/licenses/BSD-3-Clause) +[![Pod Platform](https://img.shields.io/cocoapods/p/CocoaLumberjack.svg?style=flat)](https://cocoadocs.org/docsets/CocoaLumberjack/) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) -[![Pod Platform](http://img.shields.io/cocoapods/p/CocoaLumberjack.svg?style=flat)](http://cocoadocs.org/docsets/CocoaLumberjack/) -[![Pod License](http://img.shields.io/cocoapods/l/CocoaLumberjack.svg?style=flat)](http://opensource.org/licenses/BSD-3-Clause) -[![Reference Status](https://www.versioneye.com/objective-c/cocoalumberjack/reference_badge.svg?style=flat)](https://www.versioneye.com/objective-c/cocoalumberjack/references) +![Unit Tests](https://github.com/CocoaLumberjack/CocoaLumberjack/workflows/Unit%20Tests/badge.svg) [![codecov](https://codecov.io/gh/CocoaLumberjack/CocoaLumberjack/branch/master/graph/badge.svg)](https://codecov.io/gh/CocoaLumberjack/CocoaLumberjack) +[![codebeat badge](https://codebeat.co/badges/840b714a-c8f3-4936-ada4-363473cd4e6b)](https://codebeat.co/projects/github-com-cocoalumberjack-cocoalumberjack-master) -**CocoaLumberjack** is a fast & simple, yet powerful & flexible logging framework for Mac and iOS. -### How to get started -- install via [CocoaPods](http://cocoapods.org) +**CocoaLumberjack** is a fast & simple, yet powerful & flexible logging framework for macOS, iOS, tvOS and watchOS. + +## How to get started + +First, install CocoaLumberjack via [CocoaPods](https://cocoapods.org), [Carthage](https://github.com/Carthage/Carthage), [Swift Package Manager](https://swift.org/package-manager/) or manually. +Then use `DDOSLogger` for iOS 10 and later, or `DDTTYLogger` and `DDASLLogger` for earlier versions to begin logging messages. + +### CocoaPods -##### Swift version via CocoaPods ```ruby -platform :ios, '8.0' +platform :ios, '11.0' -# You need to set target when you use CocoaPods 1.0.0 or later. -target 'SampleTarget' do +target 'SampleTarget' do use_frameworks! pod 'CocoaLumberjack/Swift' end ``` -Note: `Swift` is a subspec which will include all the Obj-C code plus the Swift one, so this is sufficient. +Note: `Swift` is a subspec which will include all the Obj-C code plus the Swift one, so this is sufficient. For more details about how to use Swift with Lumberjack, see [this conversation](https://github.com/CocoaLumberjack/CocoaLumberjack/issues/405). -##### Swift Usage +For Objective-C use the following: +```ruby +platform :ios, '11.0' + +target 'SampleTarget' do + pod 'CocoaLumberjack' +end +``` + +### Carthage + +Carthage is a lightweight dependency manager for Swift and Objective-C. It leverages CocoaTouch modules and is less invasive than CocoaPods. + +To install with Carthage, follow the instruction on [Carthage](https://github.com/Carthage/Carthage) + +Cartfile +``` +github "CocoaLumberjack/CocoaLumberjack" +``` + + +### Swift Package Manager + +As of CocoaLumberjack 3.6.0, you can use the Swift Package Manager as integration method. +If you want to use the Swift Package Manager as integration method, either use Xcode to add the package dependency or add the following dependency to your Package.swift: -If you installed using CocoaPods or manually: ```swift -import CocoaLumberjack +.package(url: "https://github.com/CocoaLumberjack/CocoaLumberjack.git", from: "3.8.0"), ``` +Note that you may need to add both products, `CocoaLumberjack` and `CocoaLumberjackSwift` to your target since SPM sometimes fails to detect that `CocoaLumerjackSwift` depends on `CocoaLumberjack`. + +### Install manually + +If you want to install CocoaLumberjack manually, read the [manual installation](Documentation/GettingStarted.md#manual-installation) guide for more information. + +### Swift Usage + +Usually, you can simply `import CocoaLumberjackSwift`. If you installed CocoaLumberjack using CocoaPods, you need to use `import CocoaLumberjack` instead. + ```swift -DDLog.add(DDTTYLogger.sharedInstance) // TTY = Xcode console -DDLog.add(DDASLLogger.sharedInstance) // ASL = Apple System Logs +DDLog.add(DDOSLogger.sharedInstance) // Uses os_log let fileLogger: DDFileLogger = DDFileLogger() // File Logger -fileLogger.rollingFrequency = TimeInterval(60*60*24) // 24 hours +fileLogger.rollingFrequency = 60 * 60 * 24 // 24 hours fileLogger.logFileManager.maximumNumberOfLogFiles = 7 DDLog.add(fileLogger) ... -DDLogVerbose("Verbose"); -DDLogDebug("Debug"); -DDLogInfo("Info"); -DDLogWarn("Warn"); -DDLogError("Error"); +DDLogVerbose("Verbose") +DDLogDebug("Debug") +DDLogInfo("Info") +DDLogWarn("Warn") +DDLogError("Error") ``` -##### Obj-C version via CocoaPods - -```ruby -platform :ios, '7.0' -pod 'CocoaLumberjack' -``` - -##### Obj-C usage -If you're using Lumberjack as a framework, you can `@import CocoaLumberjack`. +### Obj-C usage +If you're using Lumberjack as a framework, you can `@import CocoaLumberjack;`. Otherwise, `#import ` ```objc -[DDLog addLogger:[DDTTYLogger sharedInstance]]; // TTY = Xcode console -[DDLog addLogger:[DDASLLogger sharedInstance]]; // ASL = Apple System Logs +[DDLog addLogger:[DDOSLogger sharedInstance]]; // Uses os_log DDFileLogger *fileLogger = [[DDFileLogger alloc] init]; // File Logger fileLogger.rollingFrequency = 60 * 60 * 24; // 24 hour rolling @@ -84,59 +111,77 @@ DDLogInfo(@"Info"); DDLogWarn(@"Warn"); DDLogError(@"Error"); ``` +### Objective-C ARC Semantic Issue -##### Installation with Carthage (iOS 8+) +When integrating Lumberjack into an existing Objective-C it is possible to run into `Multiple methods named 'tag' found with mismatched result, parameter type or attributes` build error. -[Carthage](https://github.com/Carthage/Carthage) is a lightweight dependency manager for Swift and Objective-C. It leverages CocoaTouch modules and is less invasive than CocoaPods. +Add `#define DD_LEGACY_MESSAGE_TAG 0` before importing CocoaLumberjack or add `#define DD_LEGACY_MESSAGE_TAG 0` or add `-DDD_LEGACY_MESSAGE_TAG=0` to *Other C Flags*/*OTHER_CFLAGS* in your Xcode project. -To install with Carthage, follow the instruction on [Carthage](https://github.com/Carthage/Carthage) +## [swift-log](https://github.com/apple/swift-log) backend -Cartfile -``` -github "CocoaLumberjack/CocoaLumberjack" +CocoaLumberjack also ships with a backend implementation for [swift-log](https://github.com/apple/swift-log). +Simply add CocoaLumberjack as dependency to your SPM target (see above) and also add the `CocoaLumberjackSwiftLogBackend` product as dependency to your target. + +You can then use `DDLogHandler` as backend for swift-log, which will forward all messages to CocoaLumberjack's `DDLog`. You will still configure the loggers and log formatters you want via `DDLog`, but writing log messages will be done using `Logger` from swift-log. + +In your own log formatters, you can make use of the `swiftLogInfo` property on `DDLogMessage` to retrieve the details of a message that is logged via swift-log. + +To use swift-log with CocoaLumberjack, take a look the following code snippet to see how to get started. + +```swift +import CocoaLumberjack +import CocoaLumberjackSwiftLogBackend +import Logging + +// In your application's entry point (e.g. AppDelegate): +DDLog.add(DDOSLogger.sharedInstance) // Configure loggers +LoggingSystem.bootstrapWithCocoaLumberjack() // Use CocoaLumberjack as swift-log backend ``` -- or [install manually](Documentation/GettingStarted.md#manual-installation) + +## More information + - read the [Getting started](Documentation/GettingStarted.md) guide, check out the [FAQ](Documentation/FAQ.md) section or the other [docs](Documentation/) - if you find issues or want to suggest improvements, create an issue or a pull request -- for all kinds of questions involving CocoaLumberjack, use the [Google group](http://groups.google.com/group/cocoalumberjack) or StackOverflow (use [#lumberjack](http://stackoverflow.com/questions/tagged/lumberjack)). +- for all kinds of questions involving CocoaLumberjack, use the [Google group](https://groups.google.com/group/cocoalumberjack) or StackOverflow (use [#lumberjack](https://stackoverflow.com/questions/tagged/lumberjack)). -### CocoaLumberjack 3 -#### Migrating to 3.x +## CocoaLumberjack 3 + +### Migrating to 3.x * To be determined -### Features +## Features -#### Lumberjack is Fast & Simple, yet Powerful & Flexible. +### Lumberjack is Fast & Simple, yet Powerful & Flexible. It is similar in concept to other popular logging frameworks such as log4j, yet is designed specifically for Objective-C, and takes advantage of features such as multi-threading, grand central dispatch (if available), lockless atomic operations, and the dynamic nature of the Objective-C runtime. -#### Lumberjack is Fast +### Lumberjack is Fast In most cases it is an order of magnitude faster than NSLog. -#### Lumberjack is Simple +### Lumberjack is Simple It takes as little as a single line of code to configure lumberjack when your application launches. Then simply replace your NSLog statements with DDLog statements and that's about it. (And the DDLog macros have the exact same format and syntax as NSLog, so it's super easy.) -#### Lumberjack is Powerful: +### Lumberjack is Powerful: One log statement can be sent to multiple loggers, meaning you can log to a file and the console simultaneously. Want more? Create your own loggers (it's easy) and send your log statements over the network. Or to a database or distributed file system. The sky is the limit. -#### Lumberjack is Flexible: +### Lumberjack is Flexible: Configure your logging however you want. Change log levels per file (perfect for debugging). Change log levels per logger (verbose console, but concise log file). Change log levels per xcode configuration (verbose debug, but concise release). Have your log statements compiled out of the release build. Customize the number of log levels for your application. Add your own fine-grained logging. Dynamically change log levels during runtime. Choose how & when you want your log files to be rolled. Upload your log files to a central server. Compress archived log files to save disk space... -### This framework is for you if: +## This framework is for you if: - You're looking for a way to track down that impossible-to-reproduce bug that keeps popping up in the field. - You're frustrated with the super short console log on the iPhone. - You're looking to take your application to the next level in terms of support and stability. - You're looking for an enterprise level logging solution for your application (Mac or iPhone). -### Documentation +## Documentation - **[Get started using Lumberjack](Documentation/GettingStarted.md)**
    - [Different log levels for Debug and Release builds](Documentation/XcodeTricks.md)
    @@ -149,16 +194,21 @@ Configure your logging however you want. Change log levels per file (perfect for - [AppCode support](Documentation/AppCode-support.md) - **[Full Lumberjack documentation](Documentation/)**
    -### Requirements +## Requirements The current version of Lumberjack requires: -- Xcode 9 or later -- Swift 4.0 or later -- iOS 6 or later -- OS X 10.8 or later -- WatchOS 2 or later -- TVOS 9 or later - -#### Backwards compability +- Xcode 14.1 or later +- Swift 5.5 or later +- macOS 10.13 or later +- iOS 11 or later +- tvOS 11 or later +- watchOS 4 or later + +### Backwards compatibility +- for iOS/tvOS up to 10, watchOS up to 3, macOS up to 10.12, Xcode up to 13 and Swift up to 5.4, use the 3.7.4 version +- for Xcode 11 and Swift up to 5.2, use the 3.6.2 version +- for Xcode 10 and Swift 4.2, use the 3.5.2 version +- for iOS 8, use the 3.6.1 version +- for iOS 6, iOS 7, OS X 10.8, OS X 10.9 and Xcode 9, use the 3.4.2 version - for iOS 5 and OS X 10.7, use the 3.3 version - for Xcode 8 and Swift 3, use the 3.2 version - for Xcode 7.3 and Swift 2.3, use the 2.4.0 version @@ -168,29 +218,84 @@ The current version of Lumberjack requires: - for Xcode 6 or earlier, use the 2.0.x version - for OS X < 10.7 support, use the 1.6.0 version -### Communication +## Communication -- If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/lumberjack). (Tag 'lumberjack') -- If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/lumberjack). +- If you **need help**, use [Stack Overflow](https://stackoverflow.com/questions/tagged/lumberjack). (Tag 'lumberjack') +- If you'd like to **ask a general question**, use [Stack Overflow](https://stackoverflow.com/questions/tagged/lumberjack). - If you **found a bug**, open an issue. - If you **have a feature request**, open an issue. - If you **want to contribute**, submit a pull request. -### Author +## Data Collection Practices + +Per [App privacy details on the App Store](https://developer.apple.com/app-store/app-privacy-details/), Apple is requesting app developers to provide info about their data collection, us SDK maintainers must provide them with the same data. + +### Data collection by the framework + +**By default, CocoaLumberjack does NOT collect any data on its own.** + +[See our Data Collection Practices list.](https://cocoalumberjack.github.io/DataCollection/index.html) + +### Indirect data collection through the framework + +CocoaLumberjack is a logging framework which makes it easy to send those logs to different platforms. + +This is why collecting data might happen quite easily, if app developers include any sensitive data into their log messages. + +**Important note: app developers are fully responsible for any sensitive data collected through our logging system!** + +In consequence, you must comply to the Apple's privacy details policy (mentioned above) and document the ways in which user data is being collected. +Since the number of scenarios where data might be indirectly collected through CocoaLumberjack is quite large, it's up to you, as app developers, to properly review your app's code and identify those cases. +What we can do to help is raise awareness about potential data collection through our framework. + +Private data includes but isn't limited to: + +- user info (name, email, address, ...) +- location info +- contacts +- identifiers (user id, device id, ...) +- app usage data +- performance data +- health and fitness info +- financial info +- sensitive info +- user content +- history (browsing, search, ...) +- purchases +- diagnostics +- ... + +_Example_: `DDLogInfo("User: \(myUser)")` will add the `myUser` info to the logs, so if those are forwarded to a 3rd party or sent via email, that may qualify as data collection. + +## Author + - [Robbie Hanson](https://github.com/robbiehanson) -- Love the project? Wanna buy me a coffee? (or a beer :D) [![donation](http://www.paypal.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UZRA26JPJB3DA) +- Love the project? Wanna buy me a coffee? (or a beer :D) [![donation](https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UZRA26JPJB3DA) -### Collaborators +## Collaborators - [Ernesto Rivera](https://github.com/rivera-ernesto) - [Dmitry Vorobyov](https://github.com/dvor) - [Bogdan Poplauschi](https://github.com/bpoplauschi) - [C.W. Betts](https://github.com/MaddTheSane) - -### License -- CocoaLumberjack is available under the BSD license. See the [LICENSE file](https://github.com/CocoaLumberjack/CocoaLumberjack/blob/master/LICENSE.txt). - -### Architecture - -

    - +- [Koichi Yokota (sushichop)](https://github.com/sushichop) +- [Nick Brook](https://github.com/nrbrook) +- [Florian Friedrich](https://github.com/ffried) +- [Stephan Diederich](https://github.com/diederich) +- [Kent Sutherland](https://github.com/ksuther) +- [Dmitry Lobanov](https://github.com/lolgear) +- [Hakon Hanesand](https://github.com/hhanesand) + +## License +- CocoaLumberjack is available under the BSD 3 license. See the [LICENSE file](LICENSE). + +## Extensions +- [Birch-Lumberjack](https://github.com/gruffins/birch-lumberjack) A remote logger for CocoaLumberjack +- [BugfenderSDK-CocoaLumberjack](https://github.com/bugfender/BugfenderSDK-CocoaLumberjack) A Bugfender logger for CocoaLumberjack +- [LogIO-CocoaLumberjack](https://github.com/s4nchez/LogIO-CocoaLumberjack) A log.io logger for CocoaLumberjack +- [XCDLumberjackNSLogger](https://github.com/0xced/XCDLumberjackNSLogger) CocoaLumberjack logger which sends logs to NSLogger + +## Architecture + +

    +

    diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/CLI/CLIColor.m b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/CLI/CLIColor.m new file mode 100644 index 000000000..08c63301d --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/CLI/CLIColor.m @@ -0,0 +1,57 @@ +// Software License Agreement (BSD License) +// +// Copyright (c) 2010-2024, Deusty, LLC +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, +// with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Neither the name of Deusty nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission of Deusty, LLC. + +#import + +#if TARGET_OS_OSX + +#import + +@interface CLIColor () { + CGFloat _red, _green, _blue, _alpha; +} + +@end + + +@implementation CLIColor + ++ (instancetype)colorWithCalibratedRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha { + __auto_type color = [CLIColor new]; + color->_red = red; + color->_green = green; + color->_blue = blue; + color->_alpha = alpha; + return color; +} + +- (void)getRed:(CGFloat *)red green:(CGFloat *)green blue:(CGFloat *)blue alpha:(CGFloat *)alpha { + if (red) { + *red = _red; + } + if (green) { + *green = _green; + } + if (blue) { + *blue = _blue; + } + if (alpha) { + *alpha = _alpha; + } +} + +@end + +#endif diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDASLLogCapture.m b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDASLLogCapture.m new file mode 100644 index 000000000..db7254dc0 --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDASLLogCapture.m @@ -0,0 +1,205 @@ +// Software License Agreement (BSD License) +// +// Copyright (c) 2010-2024, Deusty, LLC +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, +// with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Neither the name of Deusty nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission of Deusty, LLC. + +#import + +#if !TARGET_OS_WATCH + +#include +#include +#include +#include + +#import + +// Disable legacy macros +#ifndef DD_LEGACY_MACROS + #define DD_LEGACY_MACROS 0 +#endif + +static __auto_type _cancel = YES; +static __auto_type _captureLevel = DDLogLevelVerbose; + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-implementations" +@implementation DDASLLogCapture +#pragma clang diagnostic pop + ++ (void)start { + // Ignore subsequent calls + if (!_cancel) { + return; + } + + _cancel = NO; + + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void) { + [self captureAslLogs]; + }); +} + ++ (void)stop { + _cancel = YES; +} + ++ (DDLogLevel)captureLevel { + return _captureLevel; +} + ++ (void)setCaptureLevel:(DDLogLevel)level { + _captureLevel = level; +} + +#pragma mark - Private methods + ++ (void)configureAslQuery:(aslmsg)query { + const char param[] = "7"; // ASL_LEVEL_DEBUG, which is everything. We'll rely on regular DDlog log level to filter + + asl_set_query(query, ASL_KEY_LEVEL, param, ASL_QUERY_OP_LESS_EQUAL | ASL_QUERY_OP_NUMERIC); + + // Don't retrieve logs from our own DDASLLogger + asl_set_query(query, kDDASLKeyDDLog, kDDASLDDLogValue, ASL_QUERY_OP_NOT_EQUAL); + +#if !TARGET_OS_IPHONE || (defined(TARGET_SIMULATOR) && TARGET_SIMULATOR) + __auto_type processId = [[NSProcessInfo processInfo] processIdentifier]; + char pid[16]; + snprintf(pid, sizeof(pid), "%d", processId); + asl_set_query(query, ASL_KEY_PID, pid, ASL_QUERY_OP_EQUAL | ASL_QUERY_OP_NUMERIC); +#endif +} + ++ (void)aslMessageReceived:(aslmsg)msg { + __auto_type messageCString = asl_get(msg, ASL_KEY_MSG); + if (messageCString == NULL) + return; + + DDLogFlag flag; + BOOL async; + + __auto_type levelCString = asl_get(msg, ASL_KEY_LEVEL); + switch (levelCString? atoi(levelCString) : 0) { + // By default all NSLog's with a ASL_LEVEL_WARNING level + case ASL_LEVEL_EMERG : + case ASL_LEVEL_ALERT : + case ASL_LEVEL_CRIT : flag = DDLogFlagError; async = NO; break; + case ASL_LEVEL_ERR : flag = DDLogFlagWarning; async = YES; break; + case ASL_LEVEL_WARNING : flag = DDLogFlagInfo; async = YES; break; + case ASL_LEVEL_NOTICE : flag = DDLogFlagDebug; async = YES; break; + case ASL_LEVEL_INFO : + case ASL_LEVEL_DEBUG : + default : flag = DDLogFlagVerbose; async = YES; break; + } + + if (!(_captureLevel & flag)) { + return; + } + + // NSString * sender = [NSString stringWithCString:asl_get(msg, ASL_KEY_SENDER) encoding:NSUTF8StringEncoding]; + NSString *message = @(messageCString); + + __auto_type secondsCString = asl_get(msg, ASL_KEY_TIME); + __auto_type nanoCString = asl_get(msg, ASL_KEY_TIME_NSEC); + __auto_type seconds = secondsCString ? strtod(secondsCString, NULL) : [NSDate timeIntervalSinceReferenceDate] - NSTimeIntervalSince1970; + __auto_type nanoSeconds = nanoCString? strtod(nanoCString, NULL) : 0; + __auto_type totalSeconds = seconds + (nanoSeconds / 1e9); + + __auto_type timeStamp = [NSDate dateWithTimeIntervalSince1970:totalSeconds]; + + __auto_type logMessage = [[DDLogMessage alloc] initWithMessage:message + level:_captureLevel + flag:flag + context:0 + file:@"DDASLLogCapture" + function:nil + line:0 + tag:nil + options:DDLogMessageDontCopyMessage + timestamp:timeStamp]; + + [DDLog log:async message:logMessage]; +} + ++ (void)captureAslLogs { + @autoreleasepool + { + /* + We use ASL_KEY_MSG_ID to see each message once, but there's no + obvious way to get the "next" ID. To bootstrap the process, we'll + search by timestamp until we've seen a message. + */ + + struct timeval timeval = { + .tv_sec = 0 + }; + gettimeofday(&timeval, NULL); + __auto_type startTime = (unsigned long long)timeval.tv_sec; + __block unsigned long long lastSeenID = 0; + + /* + syslogd posts kNotifyASLDBUpdate (com.apple.system.logger.message) + through the notify API when it saves messages to the ASL database. + There is some coalescing - currently it is sent at most twice per + second - but there is no documented guarantee about this. In any + case, there may be multiple messages per notification. + + Notify notifications don't carry any payload, so we need to search + for the messages. + */ + int notifyToken = 0; // Can be used to unregister with notify_cancel(). + notify_register_dispatch(kNotifyASLDBUpdate, ¬ifyToken, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^(int token) + { + // At least one message has been posted; build a search query. + @autoreleasepool + { + __auto_type query = asl_new(ASL_TYPE_QUERY); + char stringValue[64]; + + if (lastSeenID > 0) { + snprintf(stringValue, sizeof stringValue, "%llu", lastSeenID); + asl_set_query(query, ASL_KEY_MSG_ID, stringValue, ASL_QUERY_OP_GREATER | ASL_QUERY_OP_NUMERIC); + } else { + snprintf(stringValue, sizeof stringValue, "%llu", startTime); + asl_set_query(query, ASL_KEY_TIME, stringValue, ASL_QUERY_OP_GREATER_EQUAL | ASL_QUERY_OP_NUMERIC); + } + + [self configureAslQuery:query]; + + // Iterate over new messages. + aslmsg msg; + __auto_type response = asl_search(NULL, query); + + while ((msg = asl_next(response))) + { + [self aslMessageReceived:msg]; + + // Keep track of which messages we've seen. + lastSeenID = (unsigned long long)atoll(asl_get(msg, ASL_KEY_MSG_ID)); + } + asl_release(response); + asl_free(query); + + if (_cancel) { + notify_cancel(token); + return; + } + + } + }); + } +} + +@end + +#endif diff --git a/Pods/CocoaLumberjack/Classes/DDASLLogger.m b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDASLLogger.m similarity index 81% rename from Pods/CocoaLumberjack/Classes/DDASLLogger.m rename to Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDASLLogger.m index 61c11727e..e9b8c6a3a 100644 --- a/Pods/CocoaLumberjack/Classes/DDASLLogger.m +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDASLLogger.m @@ -1,6 +1,6 @@ // Software License Agreement (BSD License) // -// Copyright (c) 2010-2016, Deusty, LLC +// Copyright (c) 2010-2024, Deusty, LLC // All rights reserved. // // Redistribution and use of this software in source and binary forms, @@ -13,18 +13,25 @@ // to endorse or promote products derived from this software without specific // prior written permission of Deusty, LLC. -#import "DDASLLogger.h" -#import +#import + +#if !TARGET_OS_WATCH #if !__has_feature(objc_arc) #error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). #endif -const char* const kDDASLKeyDDLog = "DDLog"; +#import + +#import +const char* const kDDASLKeyDDLog = "DDLog"; const char* const kDDASLDDLogValue = "1"; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" static DDASLLogger *sharedInstance; +#pragma clang diagnostic pop @interface DDASLLogger () { aslclient _client; @@ -33,7 +40,10 @@ @interface DDASLLogger () { @end +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-implementations" @implementation DDASLLogger +#pragma clang diagnostic pop + (instancetype)sharedInstance { static dispatch_once_t DDASLLoggerOnceToken; @@ -60,16 +70,20 @@ - (instancetype)init { return self; } +- (DDLoggerName)loggerName { + return DDLoggerNameASL; +} + - (void)logMessage:(DDLogMessage *)logMessage { // Skip captured log messages if ([logMessage->_fileName isEqualToString:@"DDASLLogCapture"]) { return; } - NSString * message = _logFormatter ? [_logFormatter formatLogMessage:logMessage] : logMessage->_message; + __auto_type message = _logFormatter ? [_logFormatter formatLogMessage:logMessage] : logMessage->_message; if (message) { - const char *msg = [message UTF8String]; + __auto_type msg = [message UTF8String]; size_t aslLogLevel; switch (logMessage->_flag) { @@ -86,11 +100,11 @@ - (void)logMessage:(DDLogMessage *)logMessage { static char const *const level_strings[] = { "0", "1", "2", "3", "4", "5", "6", "7" }; // NSLog uses the current euid to set the ASL_KEY_READ_UID. - uid_t const readUID = geteuid(); + const __auto_type readUID = geteuid(); char readUIDString[16]; #ifndef NS_BLOCK_ASSERTIONS - size_t l = snprintf(readUIDString, sizeof(readUIDString), "%d", readUID); + __auto_type l = (size_t)snprintf(readUIDString, sizeof(readUIDString), "%d", readUID); #else snprintf(readUIDString, sizeof(readUIDString), "%d", readUID); #endif @@ -100,7 +114,7 @@ - (void)logMessage:(DDLogMessage *)logMessage { NSAssert(aslLogLevel < (sizeof(level_strings) / sizeof(level_strings[0])), @"Unhandled ASL log level."); - aslmsg m = asl_new(ASL_TYPE_MSG); + __auto_type m = asl_new(ASL_TYPE_MSG); if (m != NULL) { if (asl_set(m, ASL_KEY_LEVEL, level_strings[aslLogLevel]) == 0 && asl_set(m, ASL_KEY_MSG, msg) == 0 && @@ -114,8 +128,6 @@ - (void)logMessage:(DDLogMessage *)logMessage { } } -- (NSString *)loggerName { - return @"cocoa.lumberjack.aslLogger"; -} - @end + +#endif diff --git a/Pods/CocoaLumberjack/Classes/DDAbstractDatabaseLogger.m b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDAbstractDatabaseLogger.m similarity index 77% rename from Pods/CocoaLumberjack/Classes/DDAbstractDatabaseLogger.m rename to Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDAbstractDatabaseLogger.m index af37bdbe2..232846aac 100644 --- a/Pods/CocoaLumberjack/Classes/DDAbstractDatabaseLogger.m +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDAbstractDatabaseLogger.m @@ -1,6 +1,6 @@ // Software License Agreement (BSD License) // -// Copyright (c) 2010-2016, Deusty, LLC +// Copyright (c) 2010-2024, Deusty, LLC // All rights reserved. // // Redistribution and use of this software in source and binary forms, @@ -13,18 +13,20 @@ // to endorse or promote products derived from this software without specific // prior written permission of Deusty, LLC. -#import "DDAbstractDatabaseLogger.h" -#import - - #if !__has_feature(objc_arc) #error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). #endif +#import + @interface DDAbstractDatabaseLogger () - (void)destroySaveTimer; +- (void)updateAndResumeSaveTimer; +- (void)createSuspendedSaveTimer; - (void)destroyDeleteTimer; +- (void)updateDeleteTimer; +- (void)createAndStartDeleteTimer; @end @@ -52,7 +54,7 @@ - (void)dealloc { #pragma mark Override Me //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- (BOOL)db_log:(DDLogMessage *)logMessage { +- (BOOL)db_log:(__unused DDLogMessage *)logMessage { // Override me and add your implementation. // // Return YES if an item was added to the buffer. @@ -89,9 +91,9 @@ - (void)performSaveAndSuspendSaveTimer { _unsavedCount = 0; _unsavedTime = 0; - if (_saveTimer && !_saveTimerSuspended) { + if (_saveTimer != NULL && _saveTimerSuspended == 0) { dispatch_suspend(_saveTimer); - _saveTimerSuspended = YES; + _saveTimerSuspended = 1; } } @@ -108,32 +110,37 @@ - (void)performDelete { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (void)destroySaveTimer { - if (_saveTimer) { + if (_saveTimer != NULL) { dispatch_source_cancel(_saveTimer); - if (_saveTimerSuspended) { - // Must resume a timer before releasing it (or it will crash) + // Must activate a timer before releasing it (or it will crash) + if (_saveTimerSuspended < 0) { + dispatch_activate(_saveTimer); + } else if (_saveTimerSuspended > 0) { dispatch_resume(_saveTimer); - _saveTimerSuspended = NO; } - #if !OS_OBJECT_USE_OBJC +#if !OS_OBJECT_USE_OBJC dispatch_release(_saveTimer); - #endif +#endif _saveTimer = NULL; + _saveTimerSuspended = 0; } } - (void)updateAndResumeSaveTimer { - if ((_saveTimer != NULL) && (_saveInterval > 0.0) && (_unsavedTime > 0.0)) { - uint64_t interval = (uint64_t)(_saveInterval * (NSTimeInterval) NSEC_PER_SEC); - dispatch_time_t startTime = dispatch_time(_unsavedTime, interval); + if ((_saveTimer != NULL) && (_saveInterval > 0.0) && (_unsavedTime > 0)) { + __auto_type interval = (uint64_t)(_saveInterval * (NSTimeInterval) NSEC_PER_SEC); + __auto_type startTime = dispatch_time(_unsavedTime, (int64_t)interval); dispatch_source_set_timer(_saveTimer, startTime, interval, 1ull * NSEC_PER_SEC); - if (_saveTimerSuspended) { + if (_saveTimerSuspended < 0) { + dispatch_activate(_saveTimer); + _saveTimerSuspended = 0; + } else if (_saveTimerSuspended > 0) { dispatch_resume(_saveTimer); - _saveTimerSuspended = NO; + _saveTimerSuspended = 0; } } } @@ -143,26 +150,26 @@ - (void)createSuspendedSaveTimer { _saveTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, self.loggerQueue); dispatch_source_set_event_handler(_saveTimer, ^{ @autoreleasepool { - [self performSaveAndSuspendSaveTimer]; - } }); + [self performSaveAndSuspendSaveTimer]; + } }); - _saveTimerSuspended = YES; + _saveTimerSuspended = -1; } } - (void)destroyDeleteTimer { - if (_deleteTimer) { + if (_deleteTimer != NULL) { dispatch_source_cancel(_deleteTimer); - #if !OS_OBJECT_USE_OBJC +#if !OS_OBJECT_USE_OBJC dispatch_release(_deleteTimer); - #endif +#endif _deleteTimer = NULL; } } - (void)updateDeleteTimer { if ((_deleteTimer != NULL) && (_deleteInterval > 0.0) && (_maxAge > 0.0)) { - uint64_t interval = (uint64_t)(_deleteInterval * (NSTimeInterval) NSEC_PER_SEC); + __auto_type interval = (int64_t)(_deleteInterval * (NSTimeInterval) NSEC_PER_SEC); dispatch_time_t startTime; if (_lastDeleteTime > 0) { @@ -171,7 +178,7 @@ - (void)updateDeleteTimer { startTime = dispatch_time(DISPATCH_TIME_NOW, interval); } - dispatch_source_set_timer(_deleteTimer, startTime, interval, 1ull * NSEC_PER_SEC); + dispatch_source_set_timer(_deleteTimer, startTime, (uint64_t)interval, 1ull * NSEC_PER_SEC); } } @@ -181,14 +188,14 @@ - (void)createAndStartDeleteTimer { if (_deleteTimer != NULL) { dispatch_source_set_event_handler(_deleteTimer, ^{ @autoreleasepool { - [self performDelete]; - } }); + [self performDelete]; + } }); [self updateDeleteTimer]; - if (_deleteTimer != NULL) { - dispatch_resume(_deleteTimer); - } + // We are sure that -updateDeleteTimer did call dispatch_source_set_timer() + // since it has the same guards on _deleteInterval and _maxAge + dispatch_activate(_deleteTimer); } } } @@ -208,16 +215,12 @@ - (NSUInteger)saveThreshold { // This is the intended result. Fix it by accessing the ivar directly. // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster. - NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure"); - NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax."); - - dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue]; + DDAbstractLoggerAssertLockedPropertyAccess(); __block NSUInteger result; - - dispatch_sync(globalLoggingQueue, ^{ + dispatch_sync(DDLog.loggingQueue, ^{ dispatch_sync(self.loggerQueue, ^{ - result = _saveThreshold; + result = self->_saveThreshold; }); }); @@ -227,15 +230,15 @@ - (NSUInteger)saveThreshold { - (void)setSaveThreshold:(NSUInteger)threshold { dispatch_block_t block = ^{ @autoreleasepool { - if (_saveThreshold != threshold) { - _saveThreshold = threshold; + if (self->_saveThreshold != threshold) { + self->_saveThreshold = threshold; // Since the saveThreshold has changed, // we check to see if the current unsavedCount has surpassed the new threshold. // // If it has, we immediately save the log. - if ((_unsavedCount >= _saveThreshold) && (_saveThreshold > 0)) { + if ((self->_unsavedCount >= self->_saveThreshold) && (self->_saveThreshold > 0)) { [self performSaveAndSuspendSaveTimer]; } } @@ -248,10 +251,8 @@ - (void)setSaveThreshold:(NSUInteger)threshold { if ([self isOnInternalLoggerQueue]) { block(); } else { - dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue]; - NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure"); - - dispatch_async(globalLoggingQueue, ^{ + DDAbstractLoggerAssertNotOnGlobalLoggingQueue(); + dispatch_async(DDLog.loggingQueue, ^{ dispatch_async(self.loggerQueue, block); }); } @@ -268,16 +269,12 @@ - (NSTimeInterval)saveInterval { // This is the intended result. Fix it by accessing the ivar directly. // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster. - NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure"); - NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax."); - - dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue]; + DDAbstractLoggerAssertLockedPropertyAccess(); __block NSTimeInterval result; - - dispatch_sync(globalLoggingQueue, ^{ + dispatch_sync(DDLog.loggingQueue, ^{ dispatch_sync(self.loggerQueue, ^{ - result = _saveInterval; + result = self->_saveInterval; }); }); @@ -285,13 +282,13 @@ - (NSTimeInterval)saveInterval { } - (void)setSaveInterval:(NSTimeInterval)interval { - dispatch_block_t block = ^{ + __auto_type block = ^{ @autoreleasepool { // C99 recommended floating point comparison macro // Read: isLessThanOrGreaterThan(floatA, floatB) - if (/* saveInterval != interval */ islessgreater(_saveInterval, interval)) { - _saveInterval = interval; + if (/* saveInterval != interval */ islessgreater(self->_saveInterval, interval)) { + self->_saveInterval = interval; // There are several cases we need to handle here. // @@ -306,8 +303,8 @@ - (void)setSaveInterval:(NSTimeInterval)interval { // 4. If the saveInterval decreased, then we need to reset the timer so that it fires at an earlier date. // (Plus we might need to do an immediate save.) - if (_saveInterval > 0.0) { - if (_saveTimer == NULL) { + if (self->_saveInterval > 0.0) { + if (self->_saveTimer == NULL) { // Handles #2 // // Since the saveTimer uses the unsavedTime to calculate it's first fireDate, @@ -324,7 +321,7 @@ - (void)setSaveInterval:(NSTimeInterval)interval { [self updateAndResumeSaveTimer]; } - } else if (_saveTimer) { + } else if (self->_saveTimer) { // Handles #1 [self destroySaveTimer]; @@ -339,10 +336,8 @@ - (void)setSaveInterval:(NSTimeInterval)interval { if ([self isOnInternalLoggerQueue]) { block(); } else { - dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue]; - NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure"); - - dispatch_async(globalLoggingQueue, ^{ + DDAbstractLoggerAssertNotOnGlobalLoggingQueue(); + dispatch_async(DDLog.loggingQueue, ^{ dispatch_async(self.loggerQueue, block); }); } @@ -359,16 +354,13 @@ - (NSTimeInterval)maxAge { // This is the intended result. Fix it by accessing the ivar directly. // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster. - NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure"); - NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax."); - - dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue]; + DDAbstractLoggerAssertLockedPropertyAccess(); __block NSTimeInterval result; - dispatch_sync(globalLoggingQueue, ^{ + dispatch_sync(DDLog.loggingQueue, ^{ dispatch_sync(self.loggerQueue, ^{ - result = _maxAge; + result = self->_maxAge; }); }); @@ -376,16 +368,16 @@ - (NSTimeInterval)maxAge { } - (void)setMaxAge:(NSTimeInterval)interval { - dispatch_block_t block = ^{ + __auto_type block = ^{ @autoreleasepool { // C99 recommended floating point comparison macro // Read: isLessThanOrGreaterThan(floatA, floatB) - if (/* maxAge != interval */ islessgreater(_maxAge, interval)) { - NSTimeInterval oldMaxAge = _maxAge; - NSTimeInterval newMaxAge = interval; + if (/* maxAge != interval */ islessgreater(self->_maxAge, interval)) { + __auto_type oldMaxAge = self->_maxAge; + __auto_type newMaxAge = interval; - _maxAge = interval; + self->_maxAge = interval; // There are several cases we need to handle here. // @@ -401,7 +393,7 @@ - (void)setMaxAge:(NSTimeInterval)interval { // 4. If the maxAge was decreased, // then we should do an immediate delete. - BOOL shouldDeleteNow = NO; + __auto_type shouldDeleteNow = NO; if (oldMaxAge > 0.0) { if (newMaxAge <= 0.0) { @@ -420,7 +412,7 @@ - (void)setMaxAge:(NSTimeInterval)interval { if (shouldDeleteNow) { [self performDelete]; - if (_deleteTimer) { + if (self->_deleteTimer) { [self updateDeleteTimer]; } else { [self createAndStartDeleteTimer]; @@ -436,10 +428,8 @@ - (void)setMaxAge:(NSTimeInterval)interval { if ([self isOnInternalLoggerQueue]) { block(); } else { - dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue]; - NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure"); - - dispatch_async(globalLoggingQueue, ^{ + DDAbstractLoggerAssertNotOnGlobalLoggingQueue(); + dispatch_async(DDLog.loggingQueue, ^{ dispatch_async(self.loggerQueue, block); }); } @@ -456,16 +446,13 @@ - (NSTimeInterval)deleteInterval { // This is the intended result. Fix it by accessing the ivar directly. // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster. - NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure"); - NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax."); - - dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue]; + DDAbstractLoggerAssertLockedPropertyAccess(); __block NSTimeInterval result; - dispatch_sync(globalLoggingQueue, ^{ + dispatch_sync(DDLog.loggingQueue, ^{ dispatch_sync(self.loggerQueue, ^{ - result = _deleteInterval; + result = self->_deleteInterval; }); }); @@ -473,13 +460,13 @@ - (NSTimeInterval)deleteInterval { } - (void)setDeleteInterval:(NSTimeInterval)interval { - dispatch_block_t block = ^{ + __auto_type block = ^{ @autoreleasepool { // C99 recommended floating point comparison macro // Read: isLessThanOrGreaterThan(floatA, floatB) - if (/* deleteInterval != interval */ islessgreater(_deleteInterval, interval)) { - _deleteInterval = interval; + if (/* deleteInterval != interval */ islessgreater(self->_deleteInterval, interval)) { + self->_deleteInterval = interval; // There are several cases we need to handle here. // @@ -494,8 +481,8 @@ - (void)setDeleteInterval:(NSTimeInterval)interval { // 4. If the deleteInterval decreased, then we need to reset the timer so that it fires at an earlier date. // (Plus we might need to do an immediate delete.) - if (_deleteInterval > 0.0) { - if (_deleteTimer == NULL) { + if (self->_deleteInterval > 0.0) { + if (self->_deleteTimer == NULL) { // Handles #2 // // Since the deleteTimer uses the lastDeleteTime to calculate it's first fireDate, @@ -511,7 +498,7 @@ - (void)setDeleteInterval:(NSTimeInterval)interval { [self updateDeleteTimer]; } - } else if (_deleteTimer) { + } else if (self->_deleteTimer) { // Handles #1 [self destroyDeleteTimer]; @@ -526,10 +513,9 @@ - (void)setDeleteInterval:(NSTimeInterval)interval { if ([self isOnInternalLoggerQueue]) { block(); } else { - dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue]; - NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure"); + DDAbstractLoggerAssertNotOnGlobalLoggingQueue(); - dispatch_async(globalLoggingQueue, ^{ + dispatch_async(DDLog.loggingQueue, ^{ dispatch_async(self.loggerQueue, block); }); } @@ -546,16 +532,13 @@ - (BOOL)deleteOnEverySave { // This is the intended result. Fix it by accessing the ivar directly. // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster. - NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure"); - NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax."); - - dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue]; + DDAbstractLoggerAssertLockedPropertyAccess(); __block BOOL result; - dispatch_sync(globalLoggingQueue, ^{ + dispatch_sync(DDLog.loggingQueue, ^{ dispatch_sync(self.loggerQueue, ^{ - result = _deleteOnEverySave; + result = self->_deleteOnEverySave; }); }); @@ -563,8 +546,8 @@ - (BOOL)deleteOnEverySave { } - (void)setDeleteOnEverySave:(BOOL)flag { - dispatch_block_t block = ^{ - _deleteOnEverySave = flag; + __auto_type block = ^{ + self->_deleteOnEverySave = flag; }; // The design of the setter logic below is taken from the DDAbstractLogger implementation. @@ -573,10 +556,8 @@ - (void)setDeleteOnEverySave:(BOOL)flag { if ([self isOnInternalLoggerQueue]) { block(); } else { - dispatch_queue_t globalLoggingQueue = [DDLog loggingQueue]; - NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure"); - - dispatch_async(globalLoggingQueue, ^{ + DDAbstractLoggerAssertNotOnGlobalLoggingQueue(); + dispatch_async(DDLog.loggingQueue, ^{ dispatch_async(self.loggerQueue, block); }); } @@ -587,7 +568,7 @@ - (void)setDeleteOnEverySave:(BOOL)flag { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (void)savePendingLogEntries { - dispatch_block_t block = ^{ + __auto_type block = ^{ @autoreleasepool { [self performSaveAndSuspendSaveTimer]; } @@ -601,7 +582,7 @@ - (void)savePendingLogEntries { } - (void)deleteOldLogEntries { - dispatch_block_t block = ^{ + __auto_type block = ^{ @autoreleasepool { [self performDelete]; } @@ -620,24 +601,20 @@ - (void)deleteOldLogEntries { - (void)didAddLogger { // If you override me be sure to invoke [super didAddLogger]; - [self createSuspendedSaveTimer]; - [self createAndStartDeleteTimer]; } - (void)willRemoveLogger { // If you override me be sure to invoke [super willRemoveLogger]; - [self performSaveAndSuspendSaveTimer]; - [self destroySaveTimer]; [self destroyDeleteTimer]; } - (void)logMessage:(DDLogMessage *)logMessage { if ([self db_log:logMessage]) { - BOOL firstUnsavedEntry = (++_unsavedCount == 1); + __auto_type firstUnsavedEntry = (++_unsavedCount == 1); if ((_unsavedCount >= _saveThreshold) && (_saveThreshold > 0)) { [self performSaveAndSuspendSaveTimer]; @@ -653,7 +630,6 @@ - (void)flush { // // It is called automatically when the application quits, // or if the developer invokes DDLog's flushLog method prior to crashing or something. - [self performSaveAndSuspendSaveTimer]; } diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDFileLogger+Internal.h b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDFileLogger+Internal.h new file mode 100644 index 000000000..0ca060946 --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDFileLogger+Internal.h @@ -0,0 +1,31 @@ +// Software License Agreement (BSD License) +// +// Copyright (c) 2010-2024, Deusty, LLC +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, +// with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Neither the name of Deusty nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission of Deusty, LLC. + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface DDFileLogger (Internal) + +- (void)logData:(NSData *)data; + +// Will assert if used outside logger's queue. +- (void)lt_logData:(NSData *)data; + +- (nullable NSData *)lt_dataForMessage:(DDLogMessage *)message; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDFileLogger.m b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDFileLogger.m new file mode 100644 index 000000000..5caee8cac --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDFileLogger.m @@ -0,0 +1,1865 @@ +// Software License Agreement (BSD License) +// +// Copyright (c) 2010-2024, Deusty, LLC +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, +// with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Neither the name of Deusty nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission of Deusty, LLC. + +#if !__has_feature(objc_arc) +#error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). +#endif + +#import +#import +#import +#import + +#import "DDFileLogger+Internal.h" + +// We probably shouldn't be using DDLog() statements within the DDLog implementation. +// But we still want to leave our log statements for any future debugging, +// and to allow other developers to trace the implementation (which is a great learning tool). +// +// So we use primitive logging macros around NSLog. +// We maintain the NS prefix on the macros to be explicit about the fact that we're using NSLog. + +#ifndef DD_NSLOG_LEVEL + #define DD_NSLOG_LEVEL 2 +#endif + +#define NSLogError(frmt, ...) do{ if(DD_NSLOG_LEVEL >= 1) NSLog((frmt), ##__VA_ARGS__); } while(0) +#define NSLogWarn(frmt, ...) do{ if(DD_NSLOG_LEVEL >= 2) NSLog((frmt), ##__VA_ARGS__); } while(0) +#define NSLogInfo(frmt, ...) do{ if(DD_NSLOG_LEVEL >= 3) NSLog((frmt), ##__VA_ARGS__); } while(0) +#define NSLogDebug(frmt, ...) do{ if(DD_NSLOG_LEVEL >= 4) NSLog((frmt), ##__VA_ARGS__); } while(0) +#define NSLogVerbose(frmt, ...) do{ if(DD_NSLOG_LEVEL >= 5) NSLog((frmt), ##__VA_ARGS__); } while(0) + + +#if TARGET_OS_IPHONE +BOOL doesAppRunInBackground(void); +#endif + +unsigned long long const kDDDefaultLogMaxFileSize = 1024 * 1024; // 1 MB +NSTimeInterval const kDDDefaultLogRollingFrequency = 60 * 60 * 24; // 24 Hours +NSUInteger const kDDDefaultLogMaxNumLogFiles = 5; // 5 Files +unsigned long long const kDDDefaultLogFilesDiskQuota = 20 * 1024 * 1024; // 20 MB + +NSTimeInterval const kDDRollingLeeway = 1.0; // 1s + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +@implementation DDFileLogPlainTextMessageSerializer + +- (instancetype)init { + return [super init]; +} + +- (NSData *)dataForString:(NSString *)string originatingFromMessage:(DDLogMessage *)message { + return [string dataUsingEncoding:NSUTF8StringEncoding] ?: [NSData data]; +} + +@end + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +@interface DDLogFileManagerDefault () { + NSDateFormatter *_fileDateFormatter; + NSUInteger _maximumNumberOfLogFiles; + unsigned long long _logFilesDiskQuota; + NSString *_logsDirectory; + BOOL _wasAddedToLogger; +#if TARGET_OS_IPHONE + NSFileProtectionType _defaultFileProtectionLevel; +#endif +} + +@end + +@implementation DDLogFileManagerDefault + +@synthesize maximumNumberOfLogFiles = _maximumNumberOfLogFiles; +@synthesize logFilesDiskQuota = _logFilesDiskQuota; +@synthesize logMessageSerializer = _logMessageSerializer; + +- (instancetype)initWithLogsDirectory:(nullable NSString *)aLogsDirectory { + if ((self = [super init])) { + _maximumNumberOfLogFiles = kDDDefaultLogMaxNumLogFiles; + _logFilesDiskQuota = kDDDefaultLogFilesDiskQuota; + _wasAddedToLogger = NO; + + _fileDateFormatter = [[NSDateFormatter alloc] init]; + [_fileDateFormatter setLocale:[NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]]; + [_fileDateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]]; + [_fileDateFormatter setDateFormat: @"yyyy'-'MM'-'dd'--'HH'-'mm'-'ss'-'SSS'"]; + + if (aLogsDirectory.length > 0) { + _logsDirectory = [aLogsDirectory copy]; + } else { + _logsDirectory = [[self defaultLogsDirectory] copy]; + } + + _logMessageSerializer = [[DDFileLogPlainTextMessageSerializer alloc] init]; + + NSLogVerbose(@"DDFileLogManagerDefault: logsDirectory:\n%@", [self logsDirectory]); + NSLogVerbose(@"DDFileLogManagerDefault: sortedLogFileNames:\n%@", [self sortedLogFileNames]); + } + + return self; +} + +#if TARGET_OS_IPHONE +- (instancetype)initWithLogsDirectory:(NSString *)logsDirectory + defaultFileProtectionLevel:(NSFileProtectionType)fileProtectionLevel { + + if ((self = [self initWithLogsDirectory:logsDirectory])) { + if ([fileProtectionLevel isEqualToString:NSFileProtectionNone] || + [fileProtectionLevel isEqualToString:NSFileProtectionComplete] || + [fileProtectionLevel isEqualToString:NSFileProtectionCompleteUnlessOpen] || + [fileProtectionLevel isEqualToString:NSFileProtectionCompleteUntilFirstUserAuthentication]) { + _defaultFileProtectionLevel = fileProtectionLevel; + } + } + + return self; +} +#endif + +- (instancetype)init { + return [self initWithLogsDirectory:nil]; +} + +- (void)didAddToFileLogger:(DDFileLogger *)fileLogger { + _wasAddedToLogger = YES; +} + +- (void)deleteOldFilesForConfigurationChange { + if (!_wasAddedToLogger) return; + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + @autoreleasepool { + // See method header for queue reasoning. + [self deleteOldLogFilesWithError:nil]; + } + }); +} + +- (void)setLogFilesDiskQuota:(unsigned long long)logFilesDiskQuota { + if (_logFilesDiskQuota != logFilesDiskQuota) { + _logFilesDiskQuota = logFilesDiskQuota; + NSLogInfo(@"DDFileLogManagerDefault: Responding to configuration change: logFilesDiskQuota"); + [self deleteOldFilesForConfigurationChange]; + } +} + +- (void)setMaximumNumberOfLogFiles:(NSUInteger)maximumNumberOfLogFiles { + if (_maximumNumberOfLogFiles != maximumNumberOfLogFiles) { + _maximumNumberOfLogFiles = maximumNumberOfLogFiles; + NSLogInfo(@"DDFileLogManagerDefault: Responding to configuration change: maximumNumberOfLogFiles"); + [self deleteOldFilesForConfigurationChange]; + } +} + +#if TARGET_OS_IPHONE +- (NSFileProtectionType)logFileProtection { + if (_defaultFileProtectionLevel.length > 0) { + return _defaultFileProtectionLevel; + } else if (doesAppRunInBackground()) { + return NSFileProtectionCompleteUntilFirstUserAuthentication; + } else { + return NSFileProtectionCompleteUnlessOpen; + } +} +#endif + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark File Deleting +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * Deletes archived log files that exceed the maximumNumberOfLogFiles or logFilesDiskQuota configuration values. + * Method may take a while to execute since we're performing IO. It's not critical that this is synchronized with + * log output, since the files we're deleting are all archived and not in use, therefore this method is called on a + * background queue. + **/ +- (BOOL)deleteOldLogFilesWithError:(NSError *__autoreleasing _Nullable *)error { + NSLogVerbose(@"DDLogFileManagerDefault: %@", NSStringFromSelector(_cmd)); + + if (error) *error = nil; + + __auto_type sortedLogFileInfos = [self sortedLogFileInfos]; + NSUInteger firstIndexToDelete = NSNotFound; + + const unsigned long long diskQuota = self.logFilesDiskQuota; + const NSUInteger maxNumLogFiles = self.maximumNumberOfLogFiles; + + if (diskQuota) { + unsigned long long used = 0; + + for (NSUInteger i = 0; i < sortedLogFileInfos.count; i++) { + DDLogFileInfo *info = sortedLogFileInfos[i]; + used += info.fileSize; + + if (used > diskQuota) { + firstIndexToDelete = i; + break; + } + } + } + + if (maxNumLogFiles) { + if (firstIndexToDelete == NSNotFound) { + firstIndexToDelete = maxNumLogFiles; + } else { + firstIndexToDelete = MIN(firstIndexToDelete, maxNumLogFiles); + } + } + + if (firstIndexToDelete == 0) { + // Do we consider the first file? + // We are only supposed to be deleting archived files. + // In most cases, the first file is likely the log file that is currently being written to. + // So in most cases, we do not want to consider this file for deletion. + + if (sortedLogFileInfos.count > 0) { + if (!sortedLogFileInfos[0].isArchived) { + // Don't delete active file. + firstIndexToDelete++; + } + } + } + + if (firstIndexToDelete != NSNotFound) { + // removing all log files starting with firstIndexToDelete + for (NSUInteger i = firstIndexToDelete; i < sortedLogFileInfos.count; i++) { + __auto_type logFileInfo = sortedLogFileInfos[i]; + + __autoreleasing NSError *deletionError = nil; + __auto_type success = [[NSFileManager defaultManager] removeItemAtPath:logFileInfo.filePath error:&deletionError]; + if (success) { + NSLogInfo(@"DDLogFileManagerDefault: Deleting file: %@", logFileInfo.fileName); + } else { + NSLogError(@"DDLogFileManagerDefault: Error deleting file %@", deletionError); + if (error) { + *error = deletionError; + return NO; // If we were given an error, stop after the first failure! + } + } + } + } + + return YES; +} + +- (BOOL)cleanupLogFilesWithError:(NSError *__autoreleasing _Nullable *)error { + return [self deleteOldLogFilesWithError:error]; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Log Files +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * Returns the path to the default logs directory. + * If the logs directory doesn't exist, this method automatically creates it. + **/ +- (NSString *)defaultLogsDirectory { +#if TARGET_OS_IPHONE + __auto_type paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); + __auto_type baseDir = paths.firstObject; + __auto_type logsDirectory = [baseDir stringByAppendingPathComponent:@"Logs"]; +#else + __auto_type appName = [[NSProcessInfo processInfo] processName]; + __auto_type paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); + __auto_type basePath = ([paths count] > 0) ? paths[0] : NSTemporaryDirectory(); + __auto_type logsDirectory = [[basePath stringByAppendingPathComponent:@"Logs"] stringByAppendingPathComponent:appName]; +#endif + + return logsDirectory; +} + +- (NSString *)logsDirectory { + // We could do this check once, during initialization, and not bother again. + // But this way the code continues to work if the directory gets deleted while the code is running. + + NSAssert(_logsDirectory.length > 0, @"Directory must be set."); + + __autoreleasing NSError *error = nil; + __auto_type success = [[NSFileManager defaultManager] createDirectoryAtPath:_logsDirectory + withIntermediateDirectories:YES + attributes:nil + error:&error]; + if (!success) { + NSLogError(@"DDFileLogManagerDefault: Error creating logsDirectory: %@", error); + } + + return _logsDirectory; +} + +- (BOOL)isLogFile:(NSString *)fileName { + __auto_type appName = [self applicationName]; + + // We need to add a space to the name as otherwise we could match applications that have the name prefix. + return [fileName hasPrefix:[appName stringByAppendingString:@" "]] && [fileName hasSuffix:@".log"]; +} + +// if you change formatter, then change sortedLogFileInfos method also accordingly +- (NSDateFormatter *)logFileDateFormatter { + return _fileDateFormatter; +} + +- (NSArray *)unsortedLogFilePaths { + __auto_type logsDirectory = [self logsDirectory]; + + __autoreleasing NSError *error = nil; + __auto_type fileNames = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:logsDirectory error:&error]; + if (!fileNames && error) { + NSLogError(@"DDFileLogManagerDefault: Error listing log file directory: %@", error); + return [[NSArray alloc] init]; + } + + __auto_type unsortedLogFilePaths = [NSMutableArray arrayWithCapacity:[fileNames count]]; + + for (NSString *fileName in fileNames) { + // Filter out any files that aren't log files. (Just for extra safety) +#if TARGET_IPHONE_SIMULATOR + // This is only used on the iPhone simulator for backward compatibility reason. + // + // In case of iPhone simulator there can be 'archived' extension. isLogFile: + // method knows nothing about it. Thus removing it for this method. + __auto_type theFileName = [fileName stringByReplacingOccurrencesOfString:@".archived" + withString:@""]; + + if ([self isLogFile:theFileName]) +#else + if ([self isLogFile:fileName]) +#endif + { + __auto_type filePath = [logsDirectory stringByAppendingPathComponent:fileName]; + [unsortedLogFilePaths addObject:filePath]; + } + } + + return unsortedLogFilePaths; +} + +- (NSArray *)unsortedLogFileNames { + __auto_type unsortedLogFilePaths = [self unsortedLogFilePaths]; + __auto_type unsortedLogFileNames = [NSMutableArray arrayWithCapacity:[unsortedLogFilePaths count]]; + + for (NSString *filePath in unsortedLogFilePaths) { + [unsortedLogFileNames addObject:[filePath lastPathComponent]]; + } + + return unsortedLogFileNames; +} + +- (NSArray *)unsortedLogFileInfos { + __auto_type unsortedLogFilePaths = [self unsortedLogFilePaths]; + __auto_type unsortedLogFileInfos = [NSMutableArray arrayWithCapacity:[unsortedLogFilePaths count]]; + + for (NSString *filePath in unsortedLogFilePaths) { + __auto_type logFileInfo = [[DDLogFileInfo alloc] initWithFilePath:filePath]; + [unsortedLogFileInfos addObject:logFileInfo]; + } + + return unsortedLogFileInfos; +} + +- (NSArray *)sortedLogFilePaths { + __auto_type sortedLogFileInfos = [self sortedLogFileInfos]; + __auto_type sortedLogFilePaths = [NSMutableArray arrayWithCapacity:[sortedLogFileInfos count]]; + + for (DDLogFileInfo *logFileInfo in sortedLogFileInfos) { + [sortedLogFilePaths addObject:[logFileInfo filePath]]; + } + + return sortedLogFilePaths; +} + +- (NSArray *)sortedLogFileNames { + __auto_type sortedLogFileInfos = [self sortedLogFileInfos]; + __auto_type sortedLogFileNames = [NSMutableArray arrayWithCapacity:[sortedLogFileInfos count]]; + + for (DDLogFileInfo *logFileInfo in sortedLogFileInfos) { + [sortedLogFileNames addObject:[logFileInfo fileName]]; + } + + return sortedLogFileNames; +} + +- (NSArray *)sortedLogFileInfos { + return [[self unsortedLogFileInfos] sortedArrayUsingComparator:^NSComparisonResult(DDLogFileInfo *obj1, + DDLogFileInfo *obj2) { + NSDate *date1 = [NSDate date]; + NSDate *date2 = [NSDate date]; + + __auto_type arrayComponent = [[obj1 fileName] componentsSeparatedByString:@" "]; + if (arrayComponent.count > 0) { + NSString *stringDate = arrayComponent.lastObject; + stringDate = [stringDate stringByReplacingOccurrencesOfString:@".log" withString:@""]; +#if TARGET_IPHONE_SIMULATOR + // This is only used on the iPhone simulator for backward compatibility reason. + stringDate = [stringDate stringByReplacingOccurrencesOfString:@".archived" withString:@""]; +#endif + date1 = [[self logFileDateFormatter] dateFromString:stringDate] ?: [obj1 creationDate]; + } + + arrayComponent = [[obj2 fileName] componentsSeparatedByString:@" "]; + if (arrayComponent.count > 0) { + NSString *stringDate = arrayComponent.lastObject; + stringDate = [stringDate stringByReplacingOccurrencesOfString:@".log" withString:@""]; +#if TARGET_IPHONE_SIMULATOR + // This is only used on the iPhone simulator for backward compatibility reason. + stringDate = [stringDate stringByReplacingOccurrencesOfString:@".archived" withString:@""]; +#endif + date2 = [[self logFileDateFormatter] dateFromString:stringDate] ?: [obj2 creationDate]; + } + + return [date2 compare:date1 ?: [NSDate date]]; + }]; + +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Creation +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// If you change newLogFileName, then change `isLogFile:` method also accordingly. +- (NSString *)newLogFileName { + __auto_type appName = [self applicationName]; + __auto_type dateFormatter = [self logFileDateFormatter]; + __auto_type formattedDate = [dateFormatter stringFromDate:[NSDate date]]; + + return [NSString stringWithFormat:@"%@ %@.log", appName, formattedDate]; +} + +- (nullable NSString *)logFileHeader { + return nil; +} + +- (NSData *)logFileHeaderData { + NSString *fileHeaderStr = [self logFileHeader]; + + if (fileHeaderStr.length == 0) { + return nil; + } + + if (![fileHeaderStr hasSuffix:@"\n"]) { + fileHeaderStr = [fileHeaderStr stringByAppendingString:@"\n"]; + } + + return [_logMessageSerializer dataForString:fileHeaderStr originatingFromMessage:nil]; +} + +- (NSString *)createNewLogFileWithError:(NSError *__autoreleasing _Nullable *)error { + static NSUInteger MAX_ALLOWED_ERROR = 5; + + __auto_type fileName = [self newLogFileName]; + __auto_type logsDirectory = [self logsDirectory]; + __auto_type fileHeader = [self logFileHeaderData] ?: [NSData data]; + + NSString *baseName = nil; + NSString *extension; + NSUInteger attempt = 1; + NSUInteger criticalErrors = 0; + NSError *lastCriticalError; + + if (error) *error = nil; + do { + if (criticalErrors >= MAX_ALLOWED_ERROR) { + NSLogError(@"DDLogFileManagerDefault: Bailing file creation, encountered %ld errors.", + (unsigned long)criticalErrors); + if (error) *error = lastCriticalError; + return nil; + } + + NSString *actualFileName; + if (attempt > 1) { + if (baseName == nil) { + baseName = [fileName stringByDeletingPathExtension]; + extension = [fileName pathExtension]; + } + + actualFileName = [baseName stringByAppendingFormat:@" %lu", (unsigned long)attempt]; + if (extension.length) { + actualFileName = [actualFileName stringByAppendingPathExtension:extension]; + } + } else { + actualFileName = fileName; + } + + __auto_type filePath = [logsDirectory stringByAppendingPathComponent:actualFileName]; + + __autoreleasing NSError *currentError = nil; + __auto_type success = [fileHeader writeToFile:filePath options:NSDataWritingAtomic error:¤tError]; + +#if TARGET_OS_IPHONE && !TARGET_OS_MACCATALYST + if (success) { + // When creating log file on iOS we're setting NSFileProtectionKey attribute to NSFileProtectionCompleteUnlessOpen. + // + // But in case if app is able to launch from background we need to have an ability to open log file any time we + // want (even if device is locked). Thats why that attribute have to be changed to + // NSFileProtectionCompleteUntilFirstUserAuthentication. + NSDictionary *attributes = @{NSFileProtectionKey: [self logFileProtection]}; + success = [[NSFileManager defaultManager] setAttributes:attributes + ofItemAtPath:filePath + error:¤tError]; + } +#endif + + if (success) { + NSLogVerbose(@"DDLogFileManagerDefault: Created new log file: %@", actualFileName); + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + // Since we just created a new log file, we may need to delete some old log files + // Note that we don't on errors here! The new log file was created, so this method technically succeeded! + [self deleteOldLogFilesWithError:nil]; + }); + return filePath; + } else if (currentError.code == NSFileWriteFileExistsError) { + attempt++; + } else { + NSLogError(@"DDLogFileManagerDefault: Critical error while creating log file: %@", currentError); + criticalErrors++; + lastCriticalError = currentError; + } + } while (YES); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Utility +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +- (NSString *)applicationName { + static NSString *_appName; + static dispatch_once_t onceToken; + + dispatch_once(&onceToken, ^{ + _appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"]; + + if (_appName.length == 0) { + _appName = [[NSProcessInfo processInfo] processName]; + } + + if (_appName.length == 0) { + _appName = @""; + } + }); + + return _appName; +} + +@end + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +@interface DDLogFileFormatterDefault () { + NSDateFormatter *_dateFormatter; +} + +@end + +@implementation DDLogFileFormatterDefault + +- (instancetype)init { + return [self initWithDateFormatter:nil]; +} + +- (instancetype)initWithDateFormatter:(nullable NSDateFormatter *)aDateFormatter { + if ((self = [super init])) { + if (aDateFormatter) { + _dateFormatter = aDateFormatter; + } else { + _dateFormatter = [[NSDateFormatter alloc] init]; + [_dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4]; // 10.4+ style + [_dateFormatter setLocale:[NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]]; + [_dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]]; + [_dateFormatter setDateFormat:@"yyyy/MM/dd HH:mm:ss:SSS"]; + } + } + + return self; +} + +- (NSString *)formatLogMessage:(DDLogMessage *)logMessage { + __auto_type dateAndTime = [_dateFormatter stringFromDate:logMessage->_timestamp]; + // Note: There are two spaces between the date and the message. + return [NSString stringWithFormat:@"%@ %@", dateAndTime, logMessage->_message]; +} + +@end + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +@interface DDFileLogger () { + id _logFileManager; + + DDLogFileInfo *_currentLogFileInfo; + NSFileHandle *_currentLogFileHandle; + + dispatch_source_t _currentLogFileVnode; + + NSTimeInterval _rollingFrequency; + dispatch_source_t _rollingTimer; + + unsigned long long _maximumFileSize; + + dispatch_queue_t _completionQueue; +} + +@end + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wincomplete-implementation" +@implementation DDFileLogger +#pragma clang diagnostic pop + +- (instancetype)init { + return [self initWithLogFileManager:[[DDLogFileManagerDefault alloc] init] + completionQueue:nil]; +} + +- (instancetype)initWithLogFileManager:(id)logFileManager { + return [self initWithLogFileManager:logFileManager completionQueue:nil]; +} + +- (instancetype)initWithLogFileManager:(id )aLogFileManager + completionQueue:(nullable dispatch_queue_t)dispatchQueue { + if ((self = [super init])) { + _completionQueue = dispatchQueue ?: dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); + + _maximumFileSize = kDDDefaultLogMaxFileSize; + _rollingFrequency = kDDDefaultLogRollingFrequency; + _automaticallyAppendNewlineForCustomFormatters = YES; + + _logFileManager = aLogFileManager; + _logFormatter = [DDLogFileFormatterDefault new]; + + if ([_logFileManager respondsToSelector:@selector(didAddToFileLogger:)]) { + [_logFileManager didAddToFileLogger:self]; + } + } + + return self; +} + +- (void)lt_cleanup { + DDAbstractLoggerAssertOnInternalLoggerQueue(); + + if (_currentLogFileHandle != nil) { + if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)) { + __autoreleasing NSError *error = nil; + __auto_type success = [_currentLogFileHandle synchronizeAndReturnError:&error]; + if (!success) { + NSLogError(@"DDFileLogger: Failed to synchronize file: %@", error); + } + success = [_currentLogFileHandle closeAndReturnError:&error]; + if (!success) { + NSLogError(@"DDFileLogger: Failed to close file: %@", error); + } + } else { + @try { + [_currentLogFileHandle synchronizeFile]; + } + @catch (NSException *exception) { + NSLogError(@"DDFileLogger: Failed to synchronize file: %@", exception); + } + [_currentLogFileHandle closeFile]; + } + _currentLogFileHandle = nil; + } + + if (_currentLogFileVnode) { + dispatch_source_cancel(_currentLogFileVnode); + _currentLogFileVnode = NULL; + } + + if (_rollingTimer) { + dispatch_source_cancel(_rollingTimer); + _rollingTimer = NULL; + } +} + +- (void)dealloc { + if (self.isOnInternalLoggerQueue) { + [self lt_cleanup]; + } else { + dispatch_sync(self.loggerQueue, ^{ + [self lt_cleanup]; + }); + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Properties +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +- (unsigned long long)maximumFileSize { + __block unsigned long long result; + + __auto_type block = ^{ + result = self->_maximumFileSize; + }; + + // The design of this method is taken from the DDAbstractLogger implementation. + // For extensive documentation please refer to the DDAbstractLogger implementation. + + // Note: The internal implementation MUST access the maximumFileSize variable directly, + // This method is designed explicitly for external access. + // + // Using "self." syntax to go through this method will cause immediate deadlock. + // This is the intended result. Fix it by accessing the ivar directly. + // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster. + + DDAbstractLoggerAssertLockedPropertyAccess(); + + dispatch_sync(DDLog.loggingQueue, ^{ + dispatch_sync(self.loggerQueue, block); + }); + + return result; +} + +- (void)setMaximumFileSize:(unsigned long long)newMaximumFileSize { + __auto_type block = ^{ + @autoreleasepool { + self->_maximumFileSize = newMaximumFileSize; + if (self->_currentLogFileHandle != nil) { + [self lt_maybeRollLogFileDueToSize]; + } + } + }; + + // The design of this method is taken from the DDAbstractLogger implementation. + // For extensive documentation please refer to the DDAbstractLogger implementation. + + // Note: The internal implementation MUST access the maximumFileSize variable directly, + // This method is designed explicitly for external access. + // + // Using "self." syntax to go through this method will cause immediate deadlock. + // This is the intended result. Fix it by accessing the ivar directly. + // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster. + + DDAbstractLoggerAssertLockedPropertyAccess(); + + dispatch_async(DDLog.loggingQueue, ^{ + dispatch_async(self.loggerQueue, block); + }); +} + +- (NSTimeInterval)rollingFrequency { + __block NSTimeInterval result; + + __auto_type block = ^{ + result = self->_rollingFrequency; + }; + + // The design of this method is taken from the DDAbstractLogger implementation. + // For extensive documentation please refer to the DDAbstractLogger implementation. + + // Note: The internal implementation should access the rollingFrequency variable directly, + // This method is designed explicitly for external access. + // + // Using "self." syntax to go through this method will cause immediate deadlock. + // This is the intended result. Fix it by accessing the ivar directly. + // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster. + + DDAbstractLoggerAssertLockedPropertyAccess(); + + dispatch_sync(DDLog.loggingQueue, ^{ + dispatch_sync(self.loggerQueue, block); + }); + + return result; +} + +- (void)setRollingFrequency:(NSTimeInterval)newRollingFrequency { + __auto_type block = ^{ + @autoreleasepool { + self->_rollingFrequency = newRollingFrequency; + if (self->_currentLogFileHandle != nil) { + [self lt_maybeRollLogFileDueToAge]; + } + } + }; + + // The design of this method is taken from the DDAbstractLogger implementation. + // For extensive documentation please refer to the DDAbstractLogger implementation. + + // Note: The internal implementation should access the rollingFrequency variable directly, + // This method is designed explicitly for external access. + // + // Using "self." syntax to go through this method will cause immediate deadlock. + // This is the intended result. Fix it by accessing the ivar directly. + // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster. + + DDAbstractLoggerAssertLockedPropertyAccess(); + + dispatch_async(DDLog.loggingQueue, ^{ + dispatch_async(self.loggerQueue, block); + }); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark File Rolling +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +- (void)lt_scheduleTimerToRollLogFileDueToAge { + DDAbstractLoggerAssertOnInternalLoggerQueue(); + + if (_rollingTimer) { + dispatch_source_cancel(_rollingTimer); + _rollingTimer = NULL; + } + + if (_currentLogFileInfo == nil || _rollingFrequency <= 0.0) { + return; + } + + __auto_type logFileCreationDate = [_currentLogFileInfo creationDate]; + __auto_type frequency = MIN(_rollingFrequency, DBL_MAX - [logFileCreationDate timeIntervalSinceReferenceDate]); + __auto_type logFileRollingDate = [logFileCreationDate dateByAddingTimeInterval:frequency]; + + NSLogVerbose(@"DDFileLogger: scheduleTimerToRollLogFileDueToAge"); + NSLogVerbose(@"DDFileLogger: logFileCreationDate : %@", logFileCreationDate); + NSLogVerbose(@"DDFileLogger: actual rollingFrequency: %f", frequency); + NSLogVerbose(@"DDFileLogger: logFileRollingDate : %@", logFileRollingDate); + + _rollingTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, _loggerQueue); + + __weak __auto_type weakSelf = self; + dispatch_source_set_event_handler(_rollingTimer, ^{ @autoreleasepool { + [weakSelf lt_maybeRollLogFileDueToAge]; + } }); + +#if !OS_OBJECT_USE_OBJC + dispatch_source_t theRollingTimer = _rollingTimer; + dispatch_source_set_cancel_handler(_rollingTimer, ^{ + dispatch_release(theRollingTimer); + }); +#endif + + static NSTimeInterval const kDDMaxTimerDelay = LLONG_MAX / NSEC_PER_SEC; + __auto_type delay = (int64_t)(MIN([logFileRollingDate timeIntervalSinceNow], kDDMaxTimerDelay) * (NSTimeInterval)NSEC_PER_SEC); + __auto_type fireTime = dispatch_walltime(NULL, delay); // `NULL` uses `gettimeofday` internally + + dispatch_source_set_timer(_rollingTimer, fireTime, DISPATCH_TIME_FOREVER, (uint64_t)kDDRollingLeeway * NSEC_PER_SEC); + dispatch_activate(_rollingTimer); +} + +- (void)rollLogFile { + [self rollLogFileWithCompletionBlock:nil]; +} + +- (void)rollLogFileWithCompletionBlock:(nullable void (^)(void))completionBlock { + // This method is public. + // We need to execute the rolling on our logging thread/queue. + + __auto_type block = ^{ + @autoreleasepool { + [self lt_rollLogFileNow]; + + if (completionBlock) { + dispatch_async(self->_completionQueue, ^{ + completionBlock(); + }); + } + } + }; + + // The design of this method is taken from the DDAbstractLogger implementation. + // For extensive documentation please refer to the DDAbstractLogger implementation. + + if ([self isOnInternalLoggerQueue]) { + block(); + } else { + DDAbstractLoggerAssertNotOnGlobalLoggingQueue(); + dispatch_async(DDLog.loggingQueue, ^{ + dispatch_async(self.loggerQueue, block); + }); + } +} + +- (void)lt_rollLogFileNow { + DDAbstractLoggerAssertOnInternalLoggerQueue(); + NSLogVerbose(@"DDFileLogger: %@", NSStringFromSelector(_cmd)); + + if (_currentLogFileHandle == nil) { + return; + } + + if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)) { + __autoreleasing NSError *error = nil; + __auto_type success = [_currentLogFileHandle synchronizeAndReturnError:&error]; + if (!success) { + NSLogError(@"DDFileLogger: Failed to synchronize file: %@", error); + } + success = [_currentLogFileHandle closeAndReturnError:&error]; + if (!success) { + NSLogError(@"DDFileLogger: Failed to close file: %@", error); + } + } else { + @try { + [_currentLogFileHandle synchronizeFile]; + } + @catch (NSException *exception) { + NSLogError(@"DDFileLogger: Failed to synchronize file: %@", exception); + } + [_currentLogFileHandle closeFile]; + } + _currentLogFileHandle = nil; + + _currentLogFileInfo.isArchived = YES; + + const __auto_type logFileManagerRespondsToNewArchiveSelector = [_logFileManager respondsToSelector:@selector(didArchiveLogFile:wasRolled:)]; + const __auto_type logFileManagerRespondsToSelector = (logFileManagerRespondsToNewArchiveSelector + || [_logFileManager respondsToSelector:@selector(didRollAndArchiveLogFile:)]); + NSString *archivedFilePath = (logFileManagerRespondsToSelector) ? [_currentLogFileInfo.filePath copy] : nil; + _currentLogFileInfo = nil; + + if (logFileManagerRespondsToSelector) { + dispatch_block_t block; + if (logFileManagerRespondsToNewArchiveSelector) { + block = ^{ + [self->_logFileManager didArchiveLogFile:archivedFilePath wasRolled:YES]; + }; + } else { + block = ^{ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + [self->_logFileManager didRollAndArchiveLogFile:archivedFilePath]; +#pragma clang diagnostic pop + }; + } + dispatch_async(_completionQueue, block); + } + + if (_currentLogFileVnode) { + dispatch_source_cancel(_currentLogFileVnode); + _currentLogFileVnode = nil; + } + + if (_rollingTimer) { + dispatch_source_cancel(_rollingTimer); + _rollingTimer = nil; + } +} + +- (void)lt_maybeRollLogFileDueToAge { + DDAbstractLoggerAssertOnInternalLoggerQueue(); + + if (_rollingFrequency > 0.0 && (_currentLogFileInfo.age + kDDRollingLeeway) >= _rollingFrequency) { + NSLogVerbose(@"DDFileLogger: Rolling log file due to age..."); + [self lt_rollLogFileNow]; + } else { + [self lt_scheduleTimerToRollLogFileDueToAge]; + } +} + +- (void)lt_maybeRollLogFileDueToSize { + DDAbstractLoggerAssertOnInternalLoggerQueue(); + + // This method is called from logMessage. + // Keep it FAST. + + // Note: Use direct access to maximumFileSize variable. + // We specifically wrote our own getter/setter method to allow us to do this (for performance reasons). + + if (_currentLogFileHandle != nil && _maximumFileSize > 0) { + unsigned long long fileSize; + if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)) { + __autoreleasing NSError *error = nil; + __auto_type success = [_currentLogFileHandle getOffset:&fileSize error:&error]; + if (!success) { + NSLogError(@"DDFileLogger: Failed to get offset: %@", error); + return; + } + } else { + fileSize = [_currentLogFileHandle offsetInFile]; + } + + if (fileSize >= _maximumFileSize) { + NSLogVerbose(@"DDFileLogger: Rolling log file due to size (%qu)...", fileSize); + + [self lt_rollLogFileNow]; + } + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark File Logging +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +- (BOOL)lt_shouldLogFileBeArchived:(DDLogFileInfo *)mostRecentLogFileInfo { + DDAbstractLoggerAssertOnInternalLoggerQueue(); + + if ([self shouldArchiveRecentLogFileInfo:mostRecentLogFileInfo]) { + return YES; + } else if (_maximumFileSize > 0 && mostRecentLogFileInfo.fileSize >= _maximumFileSize) { + return YES; + } else if (_rollingFrequency > 0.0 && mostRecentLogFileInfo.age >= _rollingFrequency) { + return YES; + } + +#if TARGET_OS_IPHONE + // When creating log file on iOS we're setting NSFileProtectionKey attribute to NSFileProtectionCompleteUnlessOpen. + // + // But in case if app is able to launch from background we need to have an ability to open log file any time we + // want (even if device is locked). Thats why that attribute have to be changed to + // NSFileProtectionCompleteUntilFirstUserAuthentication. + // + // If previous log was created when app wasn't running in background, but now it is - we archive it and create + // a new one. + // + // If user has overwritten to NSFileProtectionNone there is no need to create a new one. + if (doesAppRunInBackground()) { + NSFileProtectionType key = mostRecentLogFileInfo.fileAttributes[NSFileProtectionKey]; + __auto_type isUntilFirstAuth = [key isEqualToString:NSFileProtectionCompleteUntilFirstUserAuthentication]; + __auto_type isNone = [key isEqualToString:NSFileProtectionNone]; + + if (key != nil && !isUntilFirstAuth && !isNone) { + return YES; + } + } +#endif + + return NO; +} + +/** + * Returns the log file that should be used. + * If there is an existing log file that is suitable, within the + * constraints of maximumFileSize and rollingFrequency, then it is returned. + * + * Otherwise a new file is created and returned. + **/ +- (DDLogFileInfo *)currentLogFileInfo { + // The design of this method is taken from the DDAbstractLogger implementation. + // For extensive documentation please refer to the DDAbstractLogger implementation. + // Do not access this method on any Lumberjack queue, will deadlock. + + DDAbstractLoggerAssertLockedPropertyAccess(); + + __block DDLogFileInfo *info = nil; + __auto_type block = ^{ + info = [self lt_currentLogFileInfo]; + }; + + dispatch_sync(DDLog.loggingQueue, ^{ + dispatch_sync(self->_loggerQueue, block); + }); + + return info; +} + +- (DDLogFileInfo *)lt_currentLogFileInfo { + DDAbstractLoggerAssertOnInternalLoggerQueue(); + + // Get the current log file info ivar (might be nil). + __auto_type newCurrentLogFile = _currentLogFileInfo; + + // Check if we're resuming and if so, get the first of the sorted log file infos. + __auto_type isResuming = newCurrentLogFile == nil; + if (isResuming) { + NSArray *sortedLogFileInfos = [_logFileManager sortedLogFileInfos]; + newCurrentLogFile = sortedLogFileInfos.firstObject; + } + + // Check if the file we've found is still valid. Otherwise create a new one. + if (newCurrentLogFile != nil && [self lt_shouldUseLogFile:newCurrentLogFile isResuming:isResuming]) { + if (isResuming) { + NSLogVerbose(@"DDFileLogger: Resuming logging with file %@", newCurrentLogFile.fileName); + } + _currentLogFileInfo = newCurrentLogFile; + } else { + NSString *currentLogFilePath; + if ([_logFileManager respondsToSelector:@selector(createNewLogFileWithError:)]) { + __autoreleasing NSError *error; // Don't initialize error to nil since it will be done in -createNewLogFileWithError: + currentLogFilePath = [_logFileManager createNewLogFileWithError:&error]; + if (!currentLogFilePath) { + NSLogError(@"DDFileLogger: Failed to create new log file: %@", error); + } + } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + NSAssert([_logFileManager respondsToSelector:@selector(createNewLogFile)], + @"Invalid log file manager! Responds neither to `-createNewLogFileWithError:` nor `-createNewLogFile`!"); + currentLogFilePath = [_logFileManager createNewLogFile]; +#pragma clang diagnostic pop + if (!currentLogFilePath) { + NSLogError(@"DDFileLogger: Failed to create new log file"); + } + } + // Use static factory method here, since it checks for nil (and is unavailable to Swift). + _currentLogFileInfo = [DDLogFileInfo logFileWithPath:currentLogFilePath]; + } + + return _currentLogFileInfo; +} + +- (BOOL)lt_shouldUseLogFile:(nonnull DDLogFileInfo *)logFileInfo isResuming:(BOOL)isResuming { + NSParameterAssert(logFileInfo); + DDAbstractLoggerAssertOnInternalLoggerQueue(); + + // Check if the log file is archived. We must not use archived log files. + if (logFileInfo.isArchived) { + return NO; + } + + // Don't follow symlink + if (logFileInfo.isSymlink) { + return NO; + } + + // If we're resuming, we need to check if the log file is allowed for reuse or needs to be archived. + if (isResuming && (_doNotReuseLogFiles || [self lt_shouldLogFileBeArchived:logFileInfo])) { + logFileInfo.isArchived = YES; + + const __auto_type logFileManagerRespondsToNewArchiveSelector = [_logFileManager respondsToSelector:@selector(didArchiveLogFile:wasRolled:)]; + if (logFileManagerRespondsToNewArchiveSelector || [_logFileManager respondsToSelector:@selector(didArchiveLogFile:)]) { + NSString *archivedFilePath = [logFileInfo.filePath copy]; + dispatch_block_t block; + if (logFileManagerRespondsToNewArchiveSelector) { + block = ^{ + [self->_logFileManager didArchiveLogFile:archivedFilePath wasRolled:NO]; + }; + } else { + block = ^{ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + [self->_logFileManager didArchiveLogFile:archivedFilePath]; +#pragma clang diagnostic pop + }; + } + dispatch_async(_completionQueue, block); + } + + return NO; + } + + // All checks have passed. It's valid. + return YES; +} + +- (void)lt_monitorCurrentLogFileForExternalChanges { + DDAbstractLoggerAssertOnInternalLoggerQueue(); + NSAssert(_currentLogFileHandle, @"Can not monitor without handle."); + + // This seems to work around crashes when an active source is replaced / released. + // See https://github.com/CocoaLumberjack/CocoaLumberjack/issues/1341 + // And https://stackoverflow.com/questions/36296528/what-does-this-dispatch-xref-dispose-error-mean + if (_currentLogFileVnode) { + dispatch_source_cancel(_currentLogFileVnode); + } + + _currentLogFileVnode = dispatch_source_create(DISPATCH_SOURCE_TYPE_VNODE, + (uintptr_t)[_currentLogFileHandle fileDescriptor], + DISPATCH_VNODE_DELETE | DISPATCH_VNODE_RENAME | DISPATCH_VNODE_REVOKE, + _loggerQueue); + + __weak __auto_type weakSelf = self; + dispatch_source_set_event_handler(_currentLogFileVnode, ^{ @autoreleasepool { + NSLogInfo(@"DDFileLogger: Current logfile was moved. Rolling it and creating a new one"); + [weakSelf lt_rollLogFileNow]; + } }); + +#if !OS_OBJECT_USE_OBJC + dispatch_source_t vnode = _currentLogFileVnode; + dispatch_source_set_cancel_handler(_currentLogFileVnode, ^{ + dispatch_release(vnode); + }); +#endif + + dispatch_activate(_currentLogFileVnode); +} + +- (NSFileHandle *)lt_currentLogFileHandle { + DDAbstractLoggerAssertOnInternalLoggerQueue(); + + if (_currentLogFileHandle == nil) { + __auto_type logFilePath = [[self lt_currentLogFileInfo] filePath]; + _currentLogFileHandle = [NSFileHandle fileHandleForWritingAtPath:logFilePath]; + if (_currentLogFileHandle != nil) { + if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)) { + __autoreleasing NSError *error = nil; + __auto_type success = [_currentLogFileHandle seekToEndReturningOffset:nil error:&error]; + if (!success) { + NSLogError(@"DDFileLogger: Failed to seek to end of file: %@", error); + } + } else { + [_currentLogFileHandle seekToEndOfFile]; + } + + [self lt_scheduleTimerToRollLogFileDueToAge]; + [self lt_monitorCurrentLogFileForExternalChanges]; + } + } + + return _currentLogFileHandle; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark DDLogger Protocol +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static int exception_count = 0; + +- (void)logMessage:(DDLogMessage *)logMessage { + // Don't need to check for isOnInternalLoggerQueue, -lt_dataForMessage: will do it for us. + NSData *data = [self lt_dataForMessage:logMessage]; + if (data.length == 0) { + return; + } + + [self lt_logData:data]; +} + +- (void)willLogMessage:(DDLogFileInfo *)logFileInfo {} + +- (void)didLogMessage:(DDLogFileInfo *)logFileInfo { + [self lt_maybeRollLogFileDueToSize]; +} + +- (BOOL)shouldArchiveRecentLogFileInfo:(__unused DDLogFileInfo *)recentLogFileInfo { + return NO; +} + +- (void)willRemoveLogger { + [self lt_rollLogFileNow]; +} + +- (void)flush { + // This method is public. + // We need to execute the rolling on our logging thread/queue. + + dispatch_block_t block = ^{ + @autoreleasepool { + [self lt_flush]; + } + }; + + // The design of this method is taken from the DDAbstractLogger implementation. + // For extensive documentation please refer to the DDAbstractLogger implementation. + + if ([self isOnInternalLoggerQueue]) { + block(); + } else { + DDAbstractLoggerAssertNotOnGlobalLoggingQueue(); + dispatch_sync(DDLog.loggingQueue, ^{ + dispatch_sync(self.loggerQueue, block); + }); + } +} + +- (void)lt_flush { + DDAbstractLoggerAssertOnInternalLoggerQueue(); + + if (_currentLogFileHandle != nil) { + if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)) { + __autoreleasing NSError *error = nil; + __auto_type success = [_currentLogFileHandle synchronizeAndReturnError:&error]; + if (!success) { + NSLogError(@"DDFileLogger: Failed to synchronize file: %@", error); + } + } else { + @try { + [_currentLogFileHandle synchronizeFile]; + } @catch (NSException *exception) { + NSLogError(@"DDFileLogger: Failed to synchronize file: %@", exception); + } + } + } +} + +- (DDLoggerName)loggerName { + return DDLoggerNameFile; +} + +@end + +@implementation DDFileLogger (Internal) + +- (void)logData:(NSData *)data { + // This method is public. + // We need to execute the rolling on our logging thread/queue. + + __auto_type block = ^{ + @autoreleasepool { + [self lt_logData:data]; + } + }; + + // The design of this method is taken from the DDAbstractLogger implementation. + // For extensive documentation please refer to the DDAbstractLogger implementation. + + if ([self isOnInternalLoggerQueue]) { + block(); + } else { + DDAbstractLoggerAssertNotOnGlobalLoggingQueue(); + dispatch_sync(DDLog.loggingQueue, ^{ + dispatch_sync(self.loggerQueue, block); + }); + } +} + +- (void)lt_deprecationCatchAll {} + +- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector { + if (aSelector == @selector(willLogMessage) || aSelector == @selector(didLogMessage)) { + // Ignore calls to deprecated methods. + return [self methodSignatureForSelector:@selector(lt_deprecationCatchAll)]; + } + + return [super methodSignatureForSelector:aSelector]; +} + +- (void)forwardInvocation:(NSInvocation *)anInvocation { + if (anInvocation.selector != @selector(lt_deprecationCatchAll)) { + [super forwardInvocation:anInvocation]; + } +} + +- (void)lt_logData:(NSData *)data { + static __auto_type implementsDeprecatedWillLog = NO; + static __auto_type implementsDeprecatedDidLog = NO; + + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + implementsDeprecatedWillLog = [self respondsToSelector:@selector(willLogMessage)]; + implementsDeprecatedDidLog = [self respondsToSelector:@selector(didLogMessage)]; + }); + + DDAbstractLoggerAssertOnInternalLoggerQueue(); + + if (data.length == 0) { + return; + } + + @try { + // Make sure that _currentLogFileInfo is initialised before being used. + __auto_type handle = [self lt_currentLogFileHandle]; + + if (implementsDeprecatedWillLog) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + [self willLogMessage]; +#pragma clang diagnostic pop + } else { + [self willLogMessage:_currentLogFileInfo]; + } + + // use an advisory lock to coordinate write with other processes + __auto_type fd = [handle fileDescriptor]; + while(flock(fd, LOCK_EX) != 0) { + NSLogError(@"DDFileLogger: Could not lock logfile, retrying in 1ms: %s (%d)", strerror(errno), errno); + usleep(1000); + } + if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)) { + __autoreleasing NSError *error = nil; + __auto_type success = [handle seekToEndReturningOffset:nil error:&error]; + if (!success) { + NSLogError(@"DDFileLogger: Failed to seek to end of file: %@", error); + } + success = [handle writeData:data error:&error]; + if (!success) { + NSLogError(@"DDFileLogger: Failed to write data: %@", error); + } + } else { + [handle seekToEndOfFile]; + [handle writeData:data]; + } + flock(fd, LOCK_UN); + + if (implementsDeprecatedDidLog) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + [self didLogMessage]; +#pragma clang diagnostic pop + } else { + [self didLogMessage:_currentLogFileInfo]; + } + + } + @catch (NSException *exception) { + exception_count++; + + if (exception_count <= 10) { + NSLogError(@"DDFileLogger.logMessage: %@", exception); + + if (exception_count == 10) { + NSLogError(@"DDFileLogger.logMessage: Too many exceptions -- will not log any more of them."); + } + } + } +} + +- (id )lt_logFileSerializer { + if ([_logFileManager respondsToSelector:@selector(logMessageSerializer)]) { + return _logFileManager.logMessageSerializer; + } else { + return [[DDFileLogPlainTextMessageSerializer alloc] init]; + } +} + +- (NSData *)lt_dataForMessage:(DDLogMessage *)logMessage { + DDAbstractLoggerAssertOnInternalLoggerQueue(); + + __auto_type messageString = logMessage->_message; + __auto_type isFormatted = NO; + + if (_logFormatter != nil) { + messageString = [_logFormatter formatLogMessage:logMessage]; + isFormatted = messageString != logMessage->_message; + } + + if (messageString.length == 0) { + return nil; + } + + __auto_type shouldFormat = !isFormatted || _automaticallyAppendNewlineForCustomFormatters; + if (shouldFormat && ![messageString hasSuffix:@"\n"]) { + messageString = [messageString stringByAppendingString:@"\n"]; + } + + return [[self lt_logFileSerializer] dataForString:messageString originatingFromMessage:logMessage]; +} + +@end + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static NSString * const kDDXAttrArchivedName = @"lumberjack.log.archived"; + +@interface DDLogFileInfo () { + __strong NSString *_filePath; + __strong NSString *_fileName; + + __strong NSDictionary *_fileAttributes; + + __strong NSDate *_creationDate; + __strong NSDate *_modificationDate; + + unsigned long long _fileSize; +} + +#if TARGET_IPHONE_SIMULATOR +// Old implementation of extended attributes on the simulator. +- (BOOL)_hasExtensionAttributeWithName:(NSString *)attrName; +- (void)_removeExtensionAttributeWithName:(NSString *)attrName; +#endif + +@end + + +@implementation DDLogFileInfo + +@synthesize filePath; + +@dynamic fileName; +@dynamic fileAttributes; +@dynamic creationDate; +@dynamic modificationDate; +@dynamic fileSize; +@dynamic age; + +@dynamic isArchived; + +#pragma mark Lifecycle + ++ (instancetype)logFileWithPath:(NSString *)aFilePath { + if (!aFilePath) return nil; + return [[self alloc] initWithFilePath:aFilePath]; +} + +- (instancetype)initWithFilePath:(NSString *)aFilePath { + NSParameterAssert(aFilePath); + if ((self = [super init])) { + filePath = [aFilePath copy]; + } + + return self; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Standard Info +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +- (NSDictionary *)fileAttributes { + if (_fileAttributes == nil && filePath != nil) { + __autoreleasing NSError *error = nil; + _fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:&error]; + if (!_fileAttributes) { + NSLogError(@"DDLogFileInfo: Failed to read file attributes: %@", error); + } + } + + return _fileAttributes ?: @{}; +} + +- (NSString *)fileName { + if (_fileName == nil) { + _fileName = [filePath lastPathComponent]; + } + + return _fileName; +} + +- (NSDate *)modificationDate { + if (_modificationDate == nil) { + _modificationDate = self.fileAttributes[NSFileModificationDate]; + } + + return _modificationDate; +} + +- (NSDate *)creationDate { + if (_creationDate == nil) { + _creationDate = self.fileAttributes[NSFileCreationDate]; + } + + return _creationDate; +} + +- (unsigned long long)fileSize { + if (_fileSize == 0) { + _fileSize = [self.fileAttributes[NSFileSize] unsignedLongLongValue]; + } + + return _fileSize; +} + +- (NSTimeInterval)age { + return -[[self creationDate] timeIntervalSinceNow]; +} + +- (BOOL)isSymlink { + return self.fileAttributes[NSFileType] == NSFileTypeSymbolicLink; +} + +- (NSString *)description { + return [@{ @"filePath": self.filePath ? : @"", + @"fileName": self.fileName ? : @"", + @"fileAttributes": self.fileAttributes ? : @"", + @"creationDate": self.creationDate ? : @"", + @"modificationDate": self.modificationDate ? : @"", + @"fileSize": @(self.fileSize), + @"age": @(self.age), + @"isArchived": @(self.isArchived) } description]; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Archiving +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +- (BOOL)isArchived { + return [self hasExtendedAttributeWithName:kDDXAttrArchivedName]; +} + +- (void)setIsArchived:(BOOL)flag { + if (flag) { + [self addExtendedAttributeWithName:kDDXAttrArchivedName]; + } else { + [self removeExtendedAttributeWithName:kDDXAttrArchivedName]; + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Changes +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +- (void)reset { + _fileName = nil; + _fileAttributes = nil; + _creationDate = nil; + _modificationDate = nil; +} + +- (void)renameFile:(NSString *)newFileName { + // This method is only used on the iPhone simulator, where normal extended attributes are broken. + // See full explanation in the header file. + + if (![newFileName isEqualToString:[self fileName]]) { + __auto_type fileManager = [NSFileManager defaultManager]; + __auto_type fileDir = [filePath stringByDeletingLastPathComponent]; + __auto_type newFilePath = [fileDir stringByAppendingPathComponent:newFileName]; + + // We only want to assert when we're not using the simulator, as we're "archiving" a log file with this method in the sim + // (in which case the file might not exist anymore and neither does it parent folder). +#if defined(DEBUG) && (!defined(TARGET_IPHONE_SIMULATOR) || !TARGET_IPHONE_SIMULATOR) + __auto_type directory = NO; + [fileManager fileExistsAtPath:fileDir isDirectory:&directory]; + NSAssert(directory, @"Containing directory must exist."); +#endif + + __autoreleasing NSError *error = nil; + __auto_type success = [fileManager removeItemAtPath:newFilePath error:&error]; + if (!success && error.code != NSFileNoSuchFileError) { + NSLogError(@"DDLogFileInfo: Error deleting archive (%@): %@", self.fileName, error); + } + + success = [fileManager moveItemAtPath:filePath toPath:newFilePath error:&error]; + + // When a log file is deleted, moved or renamed on the simulator, we attempt to rename it as a + // result of "archiving" it, but since the file doesn't exist anymore, needless error logs are printed + // We therefore ignore this error, and assert that the directory we are copying into exists (which + // is the only other case where this error code can come up). +#if TARGET_IPHONE_SIMULATOR + if (!success && error.code != NSFileNoSuchFileError) +#else + if (!success) +#endif + { + NSLogError(@"DDLogFileInfo: Error renaming file (%@): %@", self.fileName, error); + } + + filePath = newFilePath; + [self reset]; + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Attribute Management +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +#if TARGET_IPHONE_SIMULATOR + +// Old implementation of extended attributes on the simulator. + +// Extended attributes were not working properly on the simulator +// due to misuse of setxattr() function. +// Now that this is fixed in the new implementation, we want to keep +// backward compatibility with previous simulator installations. + +static NSString * const kDDExtensionSeparator = @"."; + +static NSString *_xattrToExtensionName(NSString *attrName) { + static NSDictionary* _xattrToExtensionNameMap; + static dispatch_once_t _token; + dispatch_once(&_token, ^{ + _xattrToExtensionNameMap = @{ kDDXAttrArchivedName: @"archived" }; + }); + return [_xattrToExtensionNameMap objectForKey:attrName]; +} + +- (BOOL)_hasExtensionAttributeWithName:(NSString *)attrName { + // This method is only used on the iPhone simulator for backward compatibility reason. + + // Split the file name into components. File name may have various format, but generally + // structure is same: + // + // . and .archived. + // or + // and .archived + // + // So we want to search for the attrName in the components (ignoring the first array index). + + __auto_type components = [[self fileName] componentsSeparatedByString:kDDExtensionSeparator]; + + // Watch out for file names without an extension + + for (NSUInteger i = 1; i < components.count; i++) { + if ([attrName isEqualToString:components[i]]) { + return YES; + } + } + + return NO; +} + +- (void)_removeExtensionAttributeWithName:(NSString *)attrName { + // This method is only used on the iPhone simulator for backward compatibility reason. + + if ([attrName length] == 0) { + return; + } + + // Example: + // attrName = "archived" + // + // "mylog.archived.txt" -> "mylog.txt" + // "mylog.archived" -> "mylog" + + __auto_type components = [[self fileName] componentsSeparatedByString:kDDExtensionSeparator]; + + __auto_type count = [components count]; + + __auto_type estimatedNewLength = [[self fileName] length]; + __auto_type newFileName = [NSMutableString stringWithCapacity:estimatedNewLength]; + + if (count > 0) { + [newFileName appendString:components[0]]; + } + + __auto_type found = NO; + + NSUInteger i; + + for (i = 1; i < count; i++) { + __auto_type attr = components[i]; + + if ([attrName isEqualToString:attr]) { + found = YES; + } else { + [newFileName appendString:kDDExtensionSeparator]; + [newFileName appendString:attr]; + } + } + + if (found) { + [self renameFile:newFileName]; + } +} + +#endif /* if TARGET_IPHONE_SIMULATOR */ + +- (BOOL)hasExtendedAttributeWithName:(NSString *)attrName { + __auto_type path = [filePath fileSystemRepresentation]; + __auto_type name = [attrName UTF8String]; + __auto_type hasExtendedAttribute = NO; + char buffer[1]; + + __auto_type result = getxattr(path, name, buffer, 1, 0, 0); + + // Fast path + if (result > 0 && buffer[0] == '\1') { + hasExtendedAttribute = YES; + } + // Maintain backward compatibility, but fix it for future checks + else if (result >= 0) { + hasExtendedAttribute = YES; + + [self addExtendedAttributeWithName:attrName]; + } +#if TARGET_IPHONE_SIMULATOR + else if ([self _hasExtensionAttributeWithName:_xattrToExtensionName(attrName)]) { + hasExtendedAttribute = YES; + + [self addExtendedAttributeWithName:attrName]; + } +#endif + + return hasExtendedAttribute; +} + +- (void)addExtendedAttributeWithName:(NSString *)attrName { + __auto_type path = [filePath fileSystemRepresentation]; + __auto_type name = [attrName UTF8String]; + + __auto_type result = setxattr(path, name, "\1", 1, 0, 0); + + if (result < 0) { + if (errno != ENOENT) { + NSLogError(@"DDLogFileInfo: setxattr(%@, %@): error = %@", + attrName, + filePath, + @(strerror(errno))); + } else { + NSLogDebug(@"DDLogFileInfo: File does not exist in setxattr(%@, %@): error = %@", + attrName, + filePath, + @(strerror(errno))); + } + } +#if TARGET_IPHONE_SIMULATOR + else { + [self _removeExtensionAttributeWithName:_xattrToExtensionName(attrName)]; + } +#endif +} + +- (void)removeExtendedAttributeWithName:(NSString *)attrName { + __auto_type path = [filePath fileSystemRepresentation]; + __auto_type name = [attrName UTF8String]; + + __auto_type result = removexattr(path, name, 0); + + if (result < 0 && errno != ENOATTR) { + NSLogError(@"DDLogFileInfo: removexattr(%@, %@): error = %@", + attrName, + self.fileName, + @(strerror(errno))); + } + +#if TARGET_IPHONE_SIMULATOR + [self _removeExtensionAttributeWithName:_xattrToExtensionName(attrName)]; +#endif +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Comparisons +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +- (BOOL)isEqual:(id)object { + if ([object isKindOfClass:[self class]]) { + __auto_type another = (DDLogFileInfo *)object; + + return [filePath isEqualToString:[another filePath]]; + } + + return NO; +} + +- (NSUInteger)hash { + return [filePath hash]; +} + +- (NSComparisonResult)reverseCompareDatesUs:(NSDate *_Nullable)us them:(NSDate *_Nullable)them { + if (us != nil && them != nil) { + return [them compare:(NSDate * _Nonnull)us]; + } else if (us == nil && them == nil) { + return NSOrderedSame; + } + return them == nil ? NSOrderedAscending : NSOrderedDescending; +} + +- (NSComparisonResult)reverseCompareByCreationDate:(DDLogFileInfo *)another { + return [self reverseCompareDatesUs:[self creationDate] them:[another creationDate]]; +} + +- (NSComparisonResult)reverseCompareByModificationDate:(DDLogFileInfo *)another { + return [self reverseCompareDatesUs:[self modificationDate] them:[another modificationDate]]; +} + +@end + +#if TARGET_OS_IPHONE +/** + * When creating log file on iOS we're setting NSFileProtectionKey attribute to NSFileProtectionCompleteUnlessOpen. + * + * But in case if app is able to launch from background we need to have an ability to open log file any time we + * want (even if device is locked). Thats why that attribute have to be changed to + * NSFileProtectionCompleteUntilFirstUserAuthentication. + */ +BOOL doesAppRunInBackground(void) { + if ([[[NSBundle mainBundle] executablePath] containsString:@".appex/"]) { + return YES; + } + + __auto_type answer = NO; + NSArray *backgroundModes = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIBackgroundModes"]; + for (NSString *mode in backgroundModes) { + if (mode.length > 0) { + answer = YES; + break; + } + } + + return answer; +} +#endif diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDLog.m b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDLog.m new file mode 100644 index 000000000..6c0977203 --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDLog.m @@ -0,0 +1,1321 @@ +// Software License Agreement (BSD License) +// +// Copyright (c) 2010-2024, Deusty, LLC +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, +// with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Neither the name of Deusty nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission of Deusty, LLC. + +#if !__has_feature(objc_arc) +#error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). +#endif + +#import +#import +#import + +#if TARGET_OS_IOS + #import + #import +#elif !defined(DD_CLI) && __has_include() + #import +#endif + +// Disable legacy macros +#ifndef DD_LEGACY_MACROS + #define DD_LEGACY_MACROS 0 +#endif + +#import + +// We probably shouldn't be using DDLog() statements within the DDLog implementation. +// But we still want to leave our log statements for any future debugging, +// and to allow other developers to trace the implementation (which is a great learning tool). +// +// So we use a primitive logging macro around NSLog. +// We maintain the NS prefix on the macros to be explicit about the fact that we're using NSLog. + +#ifndef DD_DEBUG + #define DD_DEBUG 0 +#endif + +#define NSLogDebug(frmt, ...) do{ if(DD_DEBUG) NSLog((frmt), ##__VA_ARGS__); } while(0) + +#define DDLogAssertOnGlobalLoggingQueue() \ +NSAssert(dispatch_get_specific(GlobalLoggingQueueIdentityKey), @"This method must be called on the logging thread/queue!") +#define DDLogAssertNotOnGlobalLoggingQueue() \ +NSAssert(!dispatch_get_specific(GlobalLoggingQueueIdentityKey), @"This method must not be called on the logging thread/queue!") + +// The "global logging queue" refers to [DDLog loggingQueue]. +// It is the queue that all log statements go through. +// +// The logging queue sets a flag via dispatch_queue_set_specific using this key. +// We can check for this key via dispatch_get_specific() to see if we're on the "global logging queue". + +static void *const GlobalLoggingQueueIdentityKey = (void *)&GlobalLoggingQueueIdentityKey; + +@interface DDLoggerNode : NSObject +{ + // Direct accessors to be used only for performance + @public + id _logger; + DDLogLevel _level; + dispatch_queue_t _loggerQueue; +} + +@property (nonatomic, readonly) id logger; +@property (nonatomic, readonly) DDLogLevel level; +@property (nonatomic, readonly) dispatch_queue_t loggerQueue; + ++ (instancetype)nodeWithLogger:(id )logger + loggerQueue:(dispatch_queue_t)loggerQueue + level:(DDLogLevel)level; + +@end + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +@interface DDLog () + +// An array used to manage all the individual loggers. +// The array is only modified on the loggingQueue/loggingThread. +@property (nonatomic, strong) NSMutableArray *_loggers; + +@end + +@implementation DDLog + +// All logging statements are added to the same queue to ensure FIFO operation. +static dispatch_queue_t _loggingQueue; + +// Individual loggers are executed concurrently per log statement. +// Each logger has it's own associated queue, and a dispatch group is used for synchronization. +static dispatch_group_t _loggingGroup; + +// Minor optimization for uniprocessor machines +static NSUInteger _numProcessors; + +/** + * Returns the singleton `DDLog`. + * The instance is used by `DDLog` class methods. + * + * @return The singleton `DDLog`. + */ ++ (instancetype)sharedInstance { + static DDLog *sharedInstance = nil; + + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + sharedInstance = [[self alloc] init]; + }); + + return sharedInstance; +} + +/** + * The runtime sends initialize to each class in a program exactly one time just before the class, + * or any class that inherits from it, is sent its first message from within the program. (Thus the + * method may never be invoked if the class is not used.) The runtime sends the initialize message to + * classes in a thread-safe manner. Superclasses receive this message before their subclasses. + * + * This method may also be called directly, hence the safety mechanism. + **/ ++ (void)initialize { + static dispatch_once_t DDLogOnceToken; + + dispatch_once(&DDLogOnceToken, ^{ + NSLogDebug(@"DDLog: Using grand central dispatch"); + + _loggingQueue = dispatch_queue_create("cocoa.lumberjack", NULL); + _loggingGroup = dispatch_group_create(); + + void *nonNullValue = GlobalLoggingQueueIdentityKey; // Whatever, just not null + dispatch_queue_set_specific(_loggingQueue, GlobalLoggingQueueIdentityKey, nonNullValue, NULL); + + // Figure out how many processors are available. + // This may be used later for an optimization on uniprocessor machines. + + _numProcessors = MAX([NSProcessInfo processInfo].processorCount, (NSUInteger) 1); + + NSLogDebug(@"DDLog: numProcessors = %@", @(_numProcessors)); + }); +} + +/** + * The `DDLog` initializer. + * Static variables are set only once. + * + * @return An initialized `DDLog` instance. + */ +- (instancetype)init { + self = [super init]; + + if (self) { + self._loggers = [[NSMutableArray alloc] initWithCapacity:4]; + +#if TARGET_OS_IOS + __auto_type notificationName = UIApplicationWillTerminateNotification; +#else + NSString *notificationName = nil; + + // On Command Line Tool apps AppKit may not be available +#if !defined(DD_CLI) && __has_include() + if (NSApp) { + notificationName = NSApplicationWillTerminateNotification; + } +#endif + + if (!notificationName) { + // If there is no NSApp -> we are running Command Line Tool app. + // In this case terminate notification wouldn't be fired, so we use workaround. + __weak __auto_type weakSelf = self; + atexit_b (^{ + [weakSelf applicationWillTerminate:nil]; + }); + } + +#endif /* if TARGET_OS_IOS */ + + if (notificationName) { + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(applicationWillTerminate:) + name:notificationName + object:nil]; + } + } + + return self; +} + +/** + * Provides access to the logging queue. + **/ ++ (dispatch_queue_t)loggingQueue { + return _loggingQueue; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Notifications +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +- (void)applicationWillTerminate:(NSNotification * __attribute__((unused)))notification { + [self flushLog]; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Logger Management +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ++ (void)addLogger:(id )logger { + [self.sharedInstance addLogger:logger]; +} + +- (void)addLogger:(id )logger { + [self addLogger:logger withLevel:DDLogLevelAll]; // DDLogLevelAll has all bits set +} + ++ (void)addLogger:(id )logger withLevel:(DDLogLevel)level { + [self.sharedInstance addLogger:logger withLevel:level]; +} + +- (void)addLogger:(id )logger withLevel:(DDLogLevel)level { + if (!logger) { + return; + } + + dispatch_async(_loggingQueue, ^{ @autoreleasepool { + [self lt_addLogger:logger level:level]; + } }); +} + ++ (void)removeLogger:(id )logger { + [self.sharedInstance removeLogger:logger]; +} + +- (void)removeLogger:(id )logger { + if (!logger) { + return; + } + + dispatch_async(_loggingQueue, ^{ @autoreleasepool { + [self lt_removeLogger:logger]; + } }); +} + ++ (void)removeAllLoggers { + [self.sharedInstance removeAllLoggers]; +} + +- (void)removeAllLoggers { + dispatch_async(_loggingQueue, ^{ @autoreleasepool { + [self lt_removeAllLoggers]; + } }); +} + ++ (NSArray> *)allLoggers { + return [self.sharedInstance allLoggers]; +} + +- (NSArray> *)allLoggers { + __block NSArray *theLoggers; + + dispatch_sync(_loggingQueue, ^{ @autoreleasepool { + theLoggers = [self lt_allLoggers]; + } }); + + return theLoggers; +} + ++ (NSArray *)allLoggersWithLevel { + return [self.sharedInstance allLoggersWithLevel]; +} + +- (NSArray *)allLoggersWithLevel { + __block NSArray *theLoggersWithLevel; + + dispatch_sync(_loggingQueue, ^{ @autoreleasepool { + theLoggersWithLevel = [self lt_allLoggersWithLevel]; + } }); + + return theLoggersWithLevel; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - Master Logging +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +- (void)queueLogMessage:(DDLogMessage *)logMessage asynchronously:(BOOL)asyncFlag { + // We have a tricky situation here... + // + // In the common case, when the queueSize is below the maximumQueueSize, + // we want to simply enqueue the logMessage. And we want to do this as fast as possible, + // which means we don't want to block and we don't want to use any locks. + // + // However, if the queueSize gets too big, we want to block. + // But we have very strict requirements as to when we block, and how long we block. + // + // The following example should help illustrate our requirements: + // + // Imagine that the maximum queue size is configured to be 5, + // and that there are already 5 log messages queued. + // Let us call these 5 queued log messages A, B, C, D, and E. (A is next to be executed) + // + // Now if our thread issues a log statement (let us call the log message F), + // it should block before the message is added to the queue. + // Furthermore, it should be unblocked immediately after A has been unqueued. + // + // The requirements are strict in this manner so that we block only as long as necessary, + // and so that blocked threads are unblocked in the order in which they were blocked. + // + // Returning to our previous example, let us assume that log messages A through E are still queued. + // Our aforementioned thread is blocked attempting to queue log message F. + // Now assume we have another separate thread that attempts to issue log message G. + // It should block until log messages A and B have been unqueued. + + __auto_type logBlock = ^{ + // We're now sure we won't overflow the queue. + // It is time to queue our log message. + @autoreleasepool { + [self lt_log:logMessage]; + } + }; + + if (asyncFlag) { + dispatch_async(_loggingQueue, logBlock); + } else if (dispatch_get_specific(GlobalLoggingQueueIdentityKey)) { + // We've logged an error message while on the logging queue... + logBlock(); + } else { + dispatch_sync(_loggingQueue, logBlock); + } +} + ++ (void)log:(BOOL)asynchronous + level:(DDLogLevel)level + flag:(DDLogFlag)flag + context:(NSInteger)context + file:(const char *)file + function:(const char *)function + line:(NSUInteger)line + tag:(id)tag + format:(NSString *)format, ... { + va_list args; + + if (format) { + va_start(args, format); + + [self log:asynchronous + level:level + flag:flag + context:context + file:file + function:function + line:line + tag:tag + format:format + args:args]; + + va_end(args); + } +} + +- (void)log:(BOOL)asynchronous + level:(DDLogLevel)level + flag:(DDLogFlag)flag + context:(NSInteger)context + file:(const char *)file + function:(const char *)function + line:(NSUInteger)line + tag:(id)tag + format:(NSString *)format, ... { + va_list args; + + if (format) { + va_start(args, format); + + [self log:asynchronous + level:level + flag:flag + context:context + file:file + function:function + line:line + tag:tag + format:format + args:args]; + + va_end(args); + } +} + ++ (void)log:(BOOL)asynchronous + level:(DDLogLevel)level + flag:(DDLogFlag)flag + context:(NSInteger)context + file:(const char *)file + function:(const char *)function + line:(NSUInteger)line + tag:(id)tag + format:(NSString *)format + args:(va_list)args { + [self.sharedInstance log:asynchronous level:level flag:flag context:context file:file function:function line:line tag:tag format:format args:args]; +} + +- (void)log:(BOOL)asynchronous + level:(DDLogLevel)level + flag:(DDLogFlag)flag + context:(NSInteger)context + file:(const char *)file + function:(const char *)function + line:(NSUInteger)line + tag:(id)tag + format:(NSString *)format + args:(va_list)args { + if (format) { + // Null checks are handled by -initWithMessage: +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnullable-to-nonnull-conversion" + __auto_type logMessage = [[DDLogMessage alloc] initWithFormat:format + args:args + level:level + flag:flag + context:context + file:@(file) + function:@(function) + line:line + tag:tag + options:(DDLogMessageOptions)0 + timestamp:nil]; +#pragma clang diagnostic pop + + [self queueLogMessage:logMessage asynchronously:asynchronous]; + } +} + ++ (void)log:(BOOL)asynchronous message:(DDLogMessage *)logMessage { + [self.sharedInstance log:asynchronous message:logMessage]; +} + +- (void)log:(BOOL)asynchronous message:(DDLogMessage *)logMessage { + [self queueLogMessage:logMessage asynchronously:asynchronous]; +} + ++ (void)flushLog { + [self.sharedInstance flushLog]; +} + +- (void)flushLog { + DDLogAssertNotOnGlobalLoggingQueue(); + dispatch_sync(_loggingQueue, ^{ + @autoreleasepool { + [self lt_flush]; + } + }); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Registered Dynamic Logging +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ++ (BOOL)isRegisteredClass:(Class)class { + __auto_type getterSel = @selector(ddLogLevel); + __auto_type setterSel = @selector(ddSetLogLevel:); + + // Issue #6 (GoogleCode) - Crashes on iOS 4.2.1 and iPhone 4 + // Crash caused by class_getClassMethod(2). + // "It's a bug with UIAccessibilitySafeCategory__NSObject so it didn't pop up until + // users had VoiceOver enabled [...]. I was able to work around it by searching the + // result of class_copyMethodList() instead of calling class_getClassMethod()" + // + // Issue #24 (GitHub) - Crashing in in ARC+Simulator + // The method +[DDLog isRegisteredClass] will crash a project when using it with ARC + Simulator. + // For running in the Simulator, it needs to execute the non-iOS code. Unless we're running on iOS 17+. + +#if TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR + if (@available(iOS 17, tvOS 17, *)) { +#endif + __auto_type result = NO; + unsigned int methodCount, i; + __auto_type methodList = class_copyMethodList(object_getClass(class), &methodCount); + + if (methodList != NULL) { + __auto_type getterFound = NO; + __auto_type setterFound = NO; + + for (i = 0; i < methodCount; ++i) { + __auto_type currentSel = method_getName(methodList[i]); + + if (currentSel == getterSel) { + getterFound = YES; + } else if (currentSel == setterSel) { + setterFound = YES; + } + + if (getterFound && setterFound) { + result = YES; + break; + } + } + + free(methodList); + } + + return result; +#if TARGET_OS_SIMULATOR + } else { +#endif /* TARGET_OS_SIMULATOR */ +#endif /* TARGET_OS_IPHONE */ +#if !TARGET_OS_IPHONE || TARGET_OS_SIMULATOR + __auto_type getter = class_getClassMethod(class, getterSel); + __auto_type setter = class_getClassMethod(class, setterSel); + return (getter != NULL) && (setter != NULL); +#endif /* !TARGET_OS_IPHONE || TARGET_OS_SIMULATOR */ +#if TARGET_OS_IPHONE && TARGET_OS_SIMULATOR + } +#endif /* TARGET_OS_IPHONE && TARGET_OS_SIMULATOR */ +} + ++ (NSArray *)registeredClasses { + // We're going to get the list of all registered classes. + // The Objective-C runtime library automatically registers all the classes defined in your source code. + // + // To do this we use the following method (documented in the Objective-C Runtime Reference): + // + // int objc_getClassList(Class *buffer, int bufferLen) + // + // We can pass (NULL, 0) to obtain the total number of + // registered class definitions without actually retrieving any class definitions. + // This allows us to allocate the minimum amount of memory needed for the application. + + NSUInteger numClasses = 0; + Class *classes = NULL; + + while (numClasses == 0) { + numClasses = (NSUInteger)MAX(objc_getClassList(NULL, 0), 0); + + // numClasses now tells us how many classes we have (but it might change) + // So we can allocate our buffer, and get pointers to all the class definitions. + __auto_type bufferSize = numClasses; + classes = numClasses ? (Class *)calloc(bufferSize, sizeof(Class)) : NULL; + if (classes == NULL) { + return @[]; // no memory or classes? + } + + numClasses = (NSUInteger)MAX(objc_getClassList(classes, (int)bufferSize),0); + if (numClasses > bufferSize || numClasses == 0) { + // apparently more classes added between calls (or a problem); try again + free(classes); + classes = NULL; + numClasses = 0; + } + } + + // We can now loop through the classes, and test each one to see if it is a DDLogging class. + __auto_type result = [NSMutableArray arrayWithCapacity:numClasses]; + for (NSUInteger i = 0; i < numClasses; i++) { + // Cannot use `__auto_type` here, since this will lead to crashes when deallocating! + Class class = classes[i]; + + if ([self isRegisteredClass:class]) { + [result addObject:class]; + } + } + + free(classes); + + return result; +} + ++ (NSArray *)registeredClassNames { + __auto_type registeredClasses = [self registeredClasses]; + __auto_type result = [NSMutableArray arrayWithCapacity:[registeredClasses count]]; + + for (Class class in registeredClasses) { + [result addObject:NSStringFromClass(class)]; + } + return result; +} + ++ (DDLogLevel)levelForClass:(Class)aClass { + if ([self isRegisteredClass:aClass]) { + return [aClass ddLogLevel]; + } + return (DDLogLevel)-1; +} + ++ (DDLogLevel)levelForClassWithName:(NSString *)aClassName { + Class clazz = NSClassFromString(aClassName); + if (clazz == nil) return (DDLogLevel)-1; + return [self levelForClass:clazz]; +} + ++ (void)setLevel:(DDLogLevel)level forClass:(Class)aClass { + if ([self isRegisteredClass:aClass]) { + [aClass ddSetLogLevel:level]; + } +} + ++ (void)setLevel:(DDLogLevel)level forClassWithName:(NSString *)aClassName { + Class clazz = NSClassFromString(aClassName); + if (clazz == nil) return; + [self setLevel:level forClass:clazz]; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Logging Thread +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +- (void)lt_addLogger:(id )logger level:(DDLogLevel)level { + // Add to loggers array. + // Need to create loggerQueue if loggerNode doesn't provide one. + + for (DDLoggerNode *node in self._loggers) { + if (node->_logger == logger && node->_level == level) { + // Exactly same logger already added, exit + return; + } + } + + DDLogAssertOnGlobalLoggingQueue(); + + dispatch_queue_t loggerQueue = NULL; + if ([logger respondsToSelector:@selector(loggerQueue)]) { + // Logger may be providing its own queue + loggerQueue = logger.loggerQueue; + } + + if (loggerQueue == nil) { + // Automatically create queue for the logger. + // Use the logger name as the queue name if possible. + const char *loggerQueueName = NULL; + + if ([logger respondsToSelector:@selector(loggerName)]) { + loggerQueueName = logger.loggerName.UTF8String; + } + + loggerQueue = dispatch_queue_create(loggerQueueName, NULL); + } + + __auto_type loggerNode = [DDLoggerNode nodeWithLogger:logger loggerQueue:loggerQueue level:level]; + [self._loggers addObject:loggerNode]; + + if ([logger respondsToSelector:@selector(didAddLoggerInQueue:)]) { + dispatch_async(loggerNode->_loggerQueue, ^{ @autoreleasepool { + [logger didAddLoggerInQueue:loggerNode->_loggerQueue]; + } }); + } else if ([logger respondsToSelector:@selector(didAddLogger)]) { + dispatch_async(loggerNode->_loggerQueue, ^{ @autoreleasepool { + [logger didAddLogger]; + } }); + } +} + +- (void)lt_removeLogger:(id )logger { + // Find associated loggerNode in list of added loggers + + DDLogAssertOnGlobalLoggingQueue(); + + DDLoggerNode *loggerNode = nil; + + for (DDLoggerNode *node in self._loggers) { + if (node->_logger == logger) { + loggerNode = node; + break; + } + } + + if (loggerNode == nil) { + NSLogDebug(@"DDLog: Request to remove logger which wasn't added"); + return; + } + + // Notify logger + if ([logger respondsToSelector:@selector(willRemoveLogger)]) { + dispatch_async(loggerNode->_loggerQueue, ^{ @autoreleasepool { + [logger willRemoveLogger]; + } }); + } + + // Remove from loggers array + [self._loggers removeObject:loggerNode]; +} + +- (void)lt_removeAllLoggers { + DDLogAssertOnGlobalLoggingQueue(); + + // Notify all loggers + for (DDLoggerNode *loggerNode in self._loggers) { + if ([loggerNode->_logger respondsToSelector:@selector(willRemoveLogger)]) { + dispatch_async(loggerNode->_loggerQueue, ^{ @autoreleasepool { + [loggerNode->_logger willRemoveLogger]; + } }); + } + } + + // Remove all loggers from array + [self._loggers removeAllObjects]; +} + +- (NSArray *)lt_allLoggers { + DDLogAssertOnGlobalLoggingQueue(); + + __auto_type loggerNodes = self._loggers; + __auto_type theLoggers = [NSMutableArray arrayWithCapacity:loggerNodes.count]; + + for (DDLoggerNode *loggerNode in loggerNodes) { + [theLoggers addObject:loggerNode->_logger]; + } + + return [theLoggers copy]; +} + +- (NSArray *)lt_allLoggersWithLevel { + DDLogAssertOnGlobalLoggingQueue(); + + + __auto_type loggerNodes = self._loggers; + __auto_type theLoggersWithLevel = [NSMutableArray arrayWithCapacity:loggerNodes.count]; + + for (DDLoggerNode *loggerNode in loggerNodes) { + [theLoggersWithLevel addObject:[DDLoggerInformation informationWithLogger:loggerNode->_logger + andLevel:loggerNode->_level]]; + } + + return [theLoggersWithLevel copy]; +} + +- (void)lt_log:(DDLogMessage *)logMessage { + DDLogAssertOnGlobalLoggingQueue(); + + // Execute the given log message on each of our loggers. + + if (_numProcessors > 1) { + // Execute each logger concurrently, each within its own queue. + // All blocks are added to same group. + // After each block has been queued, wait on group. + // + // The waiting ensures that a slow logger doesn't end up with a large queue of pending log messages. + // This would defeat the purpose of the efforts we made earlier to restrict the max queue size. + + for (DDLoggerNode *loggerNode in self._loggers) { + // skip the loggers that shouldn't write this message based on the log level + + if (!(logMessage->_flag & loggerNode->_level)) { + continue; + } + + dispatch_group_async(_loggingGroup, loggerNode->_loggerQueue, ^{ @autoreleasepool { + [loggerNode->_logger logMessage:logMessage]; + } }); + } + + dispatch_group_wait(_loggingGroup, DISPATCH_TIME_FOREVER); + } else { + // Execute each logger serially, each within its own queue. + + for (DDLoggerNode *loggerNode in self._loggers) { + // skip the loggers that shouldn't write this message based on the log level + + if (!(logMessage->_flag & loggerNode->_level)) { + continue; + } + +#if DD_DEBUG + // we must assure that we aren not on loggerNode->_loggerQueue. + if (loggerNode->_loggerQueue == NULL) { + // tell that we can't dispatch logger node on queue that is NULL. + NSLogDebug(@"DDLog: current node has loggerQueue == NULL"); + } + else { + dispatch_async(loggerNode->_loggerQueue, ^{ + if (dispatch_get_specific(GlobalLoggingQueueIdentityKey)) { + // tell that we somehow on logging queue? + NSLogDebug(@"DDLog: current node has loggerQueue == globalLoggingQueue"); + } + }); + } +#endif + // next, we must check that node is OK. + dispatch_sync(loggerNode->_loggerQueue, ^{ @autoreleasepool { + [loggerNode->_logger logMessage:logMessage]; + } }); + } + } +} + +- (void)lt_flush { + // All log statements issued before the flush method was invoked have now been executed. + // + // Now we need to propagate the flush request to any loggers that implement the flush method. + // This is designed for loggers that buffer IO. + + DDLogAssertOnGlobalLoggingQueue(); + + for (DDLoggerNode *loggerNode in self._loggers) { + if ([loggerNode->_logger respondsToSelector:@selector(flush)]) { + dispatch_group_async(_loggingGroup, loggerNode->_loggerQueue, ^{ @autoreleasepool { + [loggerNode->_logger flush]; + } }); + } + } + + dispatch_group_wait(_loggingGroup, DISPATCH_TIME_FOREVER); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Utilities +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +NSString * __nullable DDExtractFileNameWithoutExtension(const char *filePath, BOOL copy) { + if (filePath == NULL) { + return nil; + } + + char *lastSlash = NULL; + char *lastDot = NULL; + + __auto_type p = (char *)filePath; + while (*p != '\0') { + if (*p == '/') { + lastSlash = p; + } else if (*p == '.') { + lastDot = p; + } + + p++; + } + + char *subStr; + NSUInteger subLen; + + if (lastSlash) { + if (lastDot) { + // lastSlash -> lastDot + subStr = lastSlash + 1; + subLen = (NSUInteger)(lastDot - subStr); + } else { + // lastSlash -> endOfString + subStr = lastSlash + 1; + subLen = (NSUInteger)(p - subStr); + } + } else { + if (lastDot) { + // startOfString -> lastDot + subStr = (char *)filePath; + subLen = (NSUInteger)(lastDot - subStr); + } else { + // startOfString -> endOfString + subStr = (char *)filePath; + subLen = (NSUInteger)(p - subStr); + } + } + + if (copy) { + return [[NSString alloc] initWithBytes:subStr + length:subLen + encoding:NSUTF8StringEncoding]; + } else { + // We can take advantage of the fact that __FILE__ is a string literal. + // Specifically, we don't need to waste time copying the string. + // We can just tell NSString to point to a range within the string literal. + + return [[NSString alloc] initWithBytesNoCopy:subStr + length:subLen + encoding:NSUTF8StringEncoding + freeWhenDone:NO]; + } +} + +@end + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +@implementation DDLoggerNode + +- (instancetype)initWithLogger:(id )logger loggerQueue:(dispatch_queue_t)loggerQueue level:(DDLogLevel)level { + if ((self = [super init])) { + _logger = logger; + + if (loggerQueue) { + _loggerQueue = loggerQueue; +#if !OS_OBJECT_USE_OBJC + dispatch_retain(loggerQueue); +#endif + } + + _level = level; + } + return self; +} + ++ (instancetype)nodeWithLogger:(id )logger loggerQueue:(dispatch_queue_t)loggerQueue level:(DDLogLevel)level { + return [[self alloc] initWithLogger:logger loggerQueue:loggerQueue level:level]; +} + +- (void)dealloc { +#if !OS_OBJECT_USE_OBJC + if (_loggerQueue) { + dispatch_release(_loggerQueue); + } +#endif +} + +@end + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +@implementation DDLogMessage + +- (instancetype)init { + self = [super init]; + return self; +} + +- (instancetype)initWithFormat:(NSString *)messageFormat + formatted:(NSString *)message + level:(DDLogLevel)level + flag:(DDLogFlag)flag + context:(NSInteger)context + file:(NSString *)file + function:(NSString *)function + line:(NSUInteger)line + tag:(id)tag + options:(DDLogMessageOptions)options + timestamp:(NSDate *)timestamp { + NSParameterAssert(messageFormat); + NSParameterAssert(message); + NSParameterAssert(file); + + if ((self = [super init])) { + __auto_type copyMessage = (options & DDLogMessageDontCopyMessage) == 0; + _messageFormat = copyMessage ? [messageFormat copy] : messageFormat; + _message = copyMessage ? [message copy] : message; + _level = level; + _flag = flag; + _context = context; + + __auto_type copyFile = (options & DDLogMessageCopyFile) != 0; + _file = copyFile ? [file copy] : file; + + __auto_type copyFunction = (options & DDLogMessageCopyFunction) != 0; + _function = copyFunction ? [function copy] : function; + + _line = line; + _representedObject = tag; +#if DD_LEGACY_MESSAGE_TAG +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + _tag = tag; +#pragma clang diagnostic pop +#endif + _options = options; + _timestamp = timestamp ?: [NSDate date]; + + __uint64_t tid; + if (pthread_threadid_np(NULL, &tid) == 0) { + _threadID = [[NSString alloc] initWithFormat:@"%llu", tid]; + } else { + _threadID = @"N/A"; + } + _threadName = NSThread.currentThread.name; + + // Get the file name without extension + _fileName = [_file lastPathComponent]; + __auto_type dotLocation = [_fileName rangeOfString:@"." options:NSBackwardsSearch].location; + if (dotLocation != NSNotFound) { + _fileName = [_fileName substringToIndex:dotLocation]; + } + + // Try to get the current queue's label + _queueLabel = @(dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL)); + _qos = (NSUInteger) qos_class_self(); + } + return self; +} + +- (instancetype)initWithFormat:(NSString *)messageFormat + args:(va_list)messageArgs + level:(DDLogLevel)level + flag:(DDLogFlag)flag + context:(NSInteger)context + file:(NSString *)file + function:(NSString *)function + line:(NSUInteger)line + tag:(id)tag + options:(DDLogMessageOptions)options + timestamp:(NSDate *)timestamp { + __auto_type copyMessage = (options & DDLogMessageDontCopyMessage) == 0; + NSString *format = copyMessage ? [messageFormat copy] : messageFormat; + self = [self initWithFormat:format + formatted:[[NSString alloc] initWithFormat:format arguments:messageArgs] + level:level + flag:flag + context:context + file:file + function:function + line:line + tag:tag + options:options | DDLogMessageDontCopyMessage // we already did the copying if needed. + timestamp:timestamp]; + return self; +} + +- (instancetype)initWithMessage:(NSString *)message + level:(DDLogLevel)level + flag:(DDLogFlag)flag + context:(NSInteger)context + file:(NSString *)file + function:(NSString *)function + line:(NSUInteger)line + tag:(id)tag + options:(DDLogMessageOptions)options + timestamp:(NSDate *)timestamp { + self = [self initWithFormat:message + formatted:message + level:level + flag:flag + context:context + file:file + function:function + line:line + tag:tag + options:options + timestamp:timestamp]; + return self; +} + +NS_INLINE BOOL _nullable_strings_equal(NSString* _Nullable lhs, NSString* _Nullable rhs) +{ + if (lhs == nil) { + if (rhs == nil) { + return YES; + } + } else if (rhs != nil && [lhs isEqualToString:(NSString* _Nonnull)rhs]) { + return YES; + } + return NO; +} + +- (BOOL)isEqual:(id)other { + // Subclasses of NSObject should not call [super isEqual:] here. + // See https://stackoverflow.com/questions/36593038/confused-about-the-default-isequal-and-hash-implements + if (other == self) { + return YES; + } else if (!other || ![other isKindOfClass:[DDLogMessage class]]) { + return NO; + } else { + __auto_type otherMsg = (DDLogMessage *)other; + return [otherMsg->_message isEqualToString:_message] + && [otherMsg->_messageFormat isEqualToString:_messageFormat] + && otherMsg->_level == _level + && otherMsg->_flag == _flag + && otherMsg->_context == _context + && [otherMsg->_file isEqualToString:_file] + && _nullable_strings_equal(otherMsg->_function, _function) + && otherMsg->_line == _line + && (([otherMsg->_representedObject respondsToSelector:@selector(isEqual:)] && [otherMsg->_representedObject isEqual:_representedObject]) || otherMsg->_representedObject == _representedObject) + && [otherMsg->_timestamp isEqualToDate:_timestamp] + && [otherMsg->_threadID isEqualToString:_threadID] // If the thread ID is the same, the name will likely be the same as well. + && [otherMsg->_queueLabel isEqualToString:_queueLabel] + && otherMsg->_qos == _qos; + } +} + +- (NSUInteger)hash { + // Subclasses of NSObject should not call [super hash] here. + // See https://stackoverflow.com/questions/36593038/confused-about-the-default-isequal-and-hash-implements + return _message.hash + ^ _messageFormat.hash + ^ _level + ^ _flag + ^ _context + ^ _file.hash + ^ _function.hash + ^ _line + ^ ([_representedObject respondsToSelector:@selector(hash)] ? [_representedObject hash] : (NSUInteger)_representedObject) + ^ _timestamp.hash + ^ _threadID.hash + ^ _queueLabel.hash + ^ _qos; +} + +- (id)copyWithZone:(NSZone * __attribute__((unused)))zone { + DDLogMessage *newMessage = [DDLogMessage new]; + + newMessage->_messageFormat = _messageFormat; + newMessage->_message = _message; + newMessage->_level = _level; + newMessage->_flag = _flag; + newMessage->_context = _context; + newMessage->_file = _file; + newMessage->_fileName = _fileName; + newMessage->_function = _function; + newMessage->_line = _line; + newMessage->_representedObject = _representedObject; +#if DD_LEGACY_MESSAGE_TAG +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + newMessage->_tag = _tag; +#pragma clang diagnostic pop +#endif + newMessage->_options = _options; + newMessage->_timestamp = _timestamp; + newMessage->_threadID = _threadID; + newMessage->_threadName = _threadName; + newMessage->_queueLabel = _queueLabel; + newMessage->_qos = _qos; + + return newMessage; +} + +// ensure compatibility even when built with DD_LEGACY_MESSAGE_TAG to 0. +- (id)tag { + return _representedObject; +} + +@end + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +@implementation DDAbstractLogger + +- (instancetype)init { + if ((self = [super init])) { + const char *loggerQueueName = NULL; + + if ([self respondsToSelector:@selector(loggerName)]) { + loggerQueueName = self.loggerName.UTF8String; + } + + _loggerQueue = dispatch_queue_create(loggerQueueName, NULL); + + // We're going to use dispatch_queue_set_specific() to "mark" our loggerQueue. + // Later we can use dispatch_get_specific() to determine if we're executing on our loggerQueue. + // The documentation states: + // + // > Keys are only compared as pointers and are never dereferenced. + // > Thus, you can use a pointer to a static variable for a specific subsystem or + // > any other value that allows you to identify the value uniquely. + // > Specifying a pointer to a string constant is not recommended. + // + // So we're going to use the very convenient key of "self", + // which also works when multiple logger classes extend this class, as each will have a different "self" key. + // + // This is used primarily for thread-safety assertions (via the isOnInternalLoggerQueue method below). + + __auto_type key = (__bridge void *)self; + __auto_type nonNullValue = (__bridge void *)self; + + dispatch_queue_set_specific(_loggerQueue, key, nonNullValue, NULL); + } + + return self; +} + +- (void)dealloc { +#if !OS_OBJECT_USE_OBJC + if (_loggerQueue) { + dispatch_release(_loggerQueue); + } +#endif +} + +- (void)logMessage:(DDLogMessage * __attribute__((unused)))logMessage { + // Override me +} + +- (id )logFormatter { + // This method must be thread safe and intuitive. + // Therefore if somebody executes the following code: + // + // [logger setLogFormatter:myFormatter]; + // formatter = [logger logFormatter]; + // + // They would expect formatter to equal myFormatter. + // This functionality must be ensured by the getter and setter method. + // + // The thread safety must not come at a cost to the performance of the logMessage method. + // This method is likely called sporadically, while the logMessage method is called repeatedly. + // This means, the implementation of this method: + // - Must NOT require the logMessage method to acquire a lock. + // - Must NOT require the logMessage method to access an atomic property (also a lock of sorts). + // + // Thread safety is ensured by executing access to the formatter variable on the loggerQueue. + // This is the same queue that the logMessage method operates on. + // + // Note: The last time I benchmarked the performance of direct access vs atomic property access, + // direct access was over twice as fast on the desktop and over 6 times as fast on the iPhone. + // + // Furthermore, consider the following code: + // + // DDLogVerbose(@"log msg 1"); + // DDLogVerbose(@"log msg 2"); + // [logger setFormatter:myFormatter]; + // DDLogVerbose(@"log msg 3"); + // + // Our intuitive requirement means that the new formatter will only apply to the 3rd log message. + // This must remain true even when using asynchronous logging. + // We must keep in mind the various queue's that are in play here: + // + // loggerQueue : Our own private internal queue that the logMessage method runs on. + // Operations are added to this queue from the global loggingQueue. + // + // globalLoggingQueue : The queue that all log messages go through before they arrive in our loggerQueue. + // + // All log statements go through the serial globalLoggingQueue before they arrive at our loggerQueue. + // Thus this method also goes through the serial globalLoggingQueue to ensure intuitive operation. + + // IMPORTANT NOTE: + // + // Methods within the DDLogger implementation MUST access the formatter ivar directly. + // This method is designed explicitly for external access. + // + // Using "self." syntax to go through this method will cause immediate deadlock. + // This is the intended result. Fix it by accessing the ivar directly. + // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster. + + DDAbstractLoggerAssertLockedPropertyAccess(); + + __block id result; + dispatch_sync(DDLog.loggingQueue, ^{ + dispatch_sync(self->_loggerQueue, ^{ + result = self->_logFormatter; + }); + }); + + return result; +} + +- (void)setLogFormatter:(id )logFormatter { + // The design of this method is documented extensively in the logFormatter message (above in code). + + DDAbstractLoggerAssertLockedPropertyAccess(); + + __auto_type block = ^{ + @autoreleasepool { + if (self->_logFormatter != logFormatter) { + if ([self->_logFormatter respondsToSelector:@selector(willRemoveFromLogger:)]) { + [self->_logFormatter willRemoveFromLogger:self]; + } + + self->_logFormatter = logFormatter; + + if ([self->_logFormatter respondsToSelector:@selector(didAddToLogger:inQueue:)]) { + [self->_logFormatter didAddToLogger:self inQueue:self->_loggerQueue]; + } else if ([self->_logFormatter respondsToSelector:@selector(didAddToLogger:)]) { + [self->_logFormatter didAddToLogger:self]; + } + } + } + }; + + dispatch_async(DDLog.loggingQueue, ^{ + dispatch_async(self->_loggerQueue, block); + }); +} + +- (dispatch_queue_t)loggerQueue { + return _loggerQueue; +} + +- (NSString *)loggerName { + return NSStringFromClass([self class]); +} + +- (BOOL)isOnGlobalLoggingQueue { + return (dispatch_get_specific(GlobalLoggingQueueIdentityKey) != NULL); +} + +- (BOOL)isOnInternalLoggerQueue { + return dispatch_get_specific((__bridge void *)self) != NULL; +} + +@end + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +@interface DDLoggerInformation() +{ + // Direct accessors to be used only for performance + @public + id _logger; + DDLogLevel _level; +} + +@end + +@implementation DDLoggerInformation + +- (instancetype)initWithLogger:(id )logger andLevel:(DDLogLevel)level { + if ((self = [super init])) { + _logger = logger; + _level = level; + } + return self; +} + ++ (instancetype)informationWithLogger:(id )logger andLevel:(DDLogLevel)level { + return [[self alloc] initWithLogger:logger andLevel:level]; +} + +@end diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDLoggerNames.m b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDLoggerNames.m new file mode 100644 index 000000000..ffe6e3313 --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDLoggerNames.m @@ -0,0 +1,21 @@ +// Software License Agreement (BSD License) +// +// Copyright (c) 2010-2024, Deusty, LLC +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, +// with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Neither the name of Deusty nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission of Deusty, LLC. + +#import + +DDLoggerName const DDLoggerNameASL = @"cocoa.lumberjack.aslLogger"; +DDLoggerName const DDLoggerNameTTY = @"cocoa.lumberjack.ttyLogger"; +DDLoggerName const DDLoggerNameOS = @"cocoa.lumberjack.osLogger"; +DDLoggerName const DDLoggerNameFile = @"cocoa.lumberjack.fileLogger"; diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDOSLogger.m b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDOSLogger.m new file mode 100644 index 000000000..3ee583c6a --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDOSLogger.m @@ -0,0 +1,158 @@ +// Software License Agreement (BSD License) +// +// Copyright (c) 2010-2024, Deusty, LLC +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, +// with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Neither the name of Deusty nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission of Deusty, LLC. + +#import +#import + +#import + +@implementation DDOSLogLevelMapperDefault + +- (instancetype)init { + self = [super init]; + return self; +} + +- (os_log_type_t)osLogTypeForLogFlag:(DDLogFlag)logFlag { + switch (logFlag) { + case DDLogFlagError: + case DDLogFlagWarning: + return OS_LOG_TYPE_ERROR; + case DDLogFlagInfo: + return OS_LOG_TYPE_INFO; + case DDLogFlagDebug: + case DDLogFlagVerbose: + return OS_LOG_TYPE_DEBUG; + default: + return OS_LOG_TYPE_DEFAULT; + } +} + +@end + +#if TARGET_OS_SIMULATOR +@implementation DDOSLogLevelMapperSimulatorConsoleAppWorkaround + +- (os_log_type_t)osLogTypeForLogFlag:(DDLogFlag)logFlag { + __auto_type defaultMapping = [super osLogTypeForLogFlag:logFlag]; + return (defaultMapping == OS_LOG_TYPE_DEBUG) ? OS_LOG_TYPE_DEFAULT : defaultMapping; +} + +@end +#endif + +@interface DDOSLogger () + +@property (nonatomic, copy, readonly, nullable) NSString *subsystem; +@property (nonatomic, copy, readonly, nullable) NSString *category; +@property (nonatomic, strong, readonly, nonnull) os_log_t logger; + +@end + +@implementation DDOSLogger + +@synthesize subsystem = _subsystem; +@synthesize category = _category; +@synthesize logLevelMapper = _logLevelMapper; +@synthesize logger = _logger; + +#pragma mark - Shared Instance + +API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) +static DDOSLogger *sharedInstance; + ++ (instancetype)sharedInstance { + static dispatch_once_t DDOSLoggerOnceToken; + + dispatch_once(&DDOSLoggerOnceToken, ^{ + sharedInstance = [[[self class] alloc] init]; + }); + + return sharedInstance; +} + +#pragma mark - Initialization +- (instancetype)initWithSubsystem:(NSString *)subsystem category:(NSString *)category { + NSAssert((subsystem == nil) == (category == nil), + @"Either both subsystem and category or neither should be nil."); + if (self = [super init]) { + _subsystem = [subsystem copy]; + _category = [category copy]; + _logLevelMapper = [[DDOSLogLevelMapperDefault alloc] init]; + } + return self; +} + +- (instancetype)init { + return [self initWithSubsystem:nil category:nil]; +} + +- (instancetype)initWithSubsystem:(NSString *)subsystem + category:(NSString *)category + logLevelMapper:(id)logLevelMapper { + if (self = [self initWithSubsystem:subsystem category:category]) { + NSParameterAssert(logLevelMapper); + _logLevelMapper = logLevelMapper; + } + return self; +} + +- (instancetype)initWithLogLevelMapper:(id)logLevelMapper { + return [self initWithSubsystem:nil category:nil logLevelMapper:logLevelMapper]; +} + +#pragma mark - Mapper +- (id)logLevelMapper { + if (_logLevelMapper == nil) { + _logLevelMapper = [[DDOSLogLevelMapperDefault alloc] init]; + } + return _logLevelMapper; +} + +#pragma mark - os_log +- (os_log_t)logger { + if (_logger == nil) { + if (self.subsystem == nil || self.category == nil) { + _logger = OS_LOG_DEFAULT; + } else { + _logger = os_log_create(self.subsystem.UTF8String, self.category.UTF8String); + } + } + return _logger; +} + +#pragma mark - DDLogger +- (DDLoggerName)loggerName { + return DDLoggerNameOS; +} + +- (void)logMessage:(DDLogMessage *)logMessage { +#if !TARGET_OS_WATCH // See DDASLLogCapture.m -> Was never supported on watchOS. + // Skip captured log messages. + if ([logMessage->_fileName isEqualToString:@"DDASLLogCapture"]) { + return; + } +#endif + + if (@available(iOS 10.0, macOS 10.12, tvOS 10.0, watchOS 3.0, *)) { + __auto_type message = _logFormatter ? [_logFormatter formatLogMessage:logMessage] : logMessage->_message; + if (message != nil) { + __auto_type logType = [self.logLevelMapper osLogTypeForLogFlag:logMessage->_flag]; + os_log_with_type(self.logger, logType, "%{public}s", message.UTF8String); + } + } +} + +@end diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDTTYLogger.m b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDTTYLogger.m new file mode 100644 index 000000000..20d08b715 --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/DDTTYLogger.m @@ -0,0 +1,1446 @@ +// Software License Agreement (BSD License) +// +// Copyright (c) 2010-2024, Deusty, LLC +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, +// with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Neither the name of Deusty nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission of Deusty, LLC. + +#if !__has_feature(objc_arc) +#error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). +#endif + +#import + +#import + +// We probably shouldn't be using DDLog() statements within the DDLog implementation. +// But we still want to leave our log statements for any future debugging, +// and to allow other developers to trace the implementation (which is a great learning tool). +// +// So we use primitive logging macros around NSLog. +// We maintain the NS prefix on the macros to be explicit about the fact that we're using NSLog. + +#ifndef DD_NSLOG_LEVEL + #define DD_NSLOG_LEVEL 2 +#endif + +#define NSLogError(frmt, ...) do{ if(DD_NSLOG_LEVEL >= 1) NSLog((frmt), ##__VA_ARGS__); } while(0) +#define NSLogWarn(frmt, ...) do{ if(DD_NSLOG_LEVEL >= 2) NSLog((frmt), ##__VA_ARGS__); } while(0) +#define NSLogInfo(frmt, ...) do{ if(DD_NSLOG_LEVEL >= 3) NSLog((frmt), ##__VA_ARGS__); } while(0) +#define NSLogDebug(frmt, ...) do{ if(DD_NSLOG_LEVEL >= 4) NSLog((frmt), ##__VA_ARGS__); } while(0) +#define NSLogVerbose(frmt, ...) do{ if(DD_NSLOG_LEVEL >= 5) NSLog((frmt), ##__VA_ARGS__); } while(0) + +// Xcode does NOT natively support colors in the Xcode debugging console. +// You'll need to install the XcodeColors plugin to see colors in the Xcode console. +// https://github.com/robbiehanson/XcodeColors +// +// The following is documentation from the XcodeColors project: +// +// +// How to apply color formatting to your log statements: +// +// To set the foreground color: +// Insert the ESCAPE_SEQ into your string, followed by "fg124,12,255;" where r=124, g=12, b=255. +// +// To set the background color: +// Insert the ESCAPE_SEQ into your string, followed by "bg12,24,36;" where r=12, g=24, b=36. +// +// To reset the foreground color (to default value): +// Insert the ESCAPE_SEQ into your string, followed by "fg;" +// +// To reset the background color (to default value): +// Insert the ESCAPE_SEQ into your string, followed by "bg;" +// +// To reset the foreground and background color (to default values) in one operation: +// Insert the ESCAPE_SEQ into your string, followed by ";" + +#define XCODE_COLORS_ESCAPE_SEQ "\033[" + +#define XCODE_COLORS_RESET_FG XCODE_COLORS_ESCAPE_SEQ "fg;" // Clear any foreground color +#define XCODE_COLORS_RESET_BG XCODE_COLORS_ESCAPE_SEQ "bg;" // Clear any background color +#define XCODE_COLORS_RESET XCODE_COLORS_ESCAPE_SEQ ";" // Clear any foreground or background color + +// If running in a shell, not all RGB colors will be supported. +// In this case we automatically map to the closest available color. +// In order to provide this mapping, we have a hard-coded set of the standard RGB values available in the shell. +// However, not every shell is the same, and Apple likes to think different even when it comes to shell colors. +// +// Map to standard Terminal.app colors (1), or +// map to standard xterm colors (0). + +#define MAP_TO_TERMINAL_APP_COLORS 1 + +typedef struct { + uint8_t r; + uint8_t g; + uint8_t b; +} DDRGBColor; + +@interface DDTTYLoggerColorProfile : NSObject { +@public + DDLogFlag mask; + NSInteger context; + + DDRGBColor fg; + DDRGBColor bg; + + NSUInteger fgCodeIndex; + NSString *fgCodeRaw; + + NSUInteger bgCodeIndex; + NSString *bgCodeRaw; + + char fgCode[24]; + size_t fgCodeLen; + + char bgCode[24]; + size_t bgCodeLen; + + char resetCode[8]; + size_t resetCodeLen; +} + +- (nullable instancetype)initWithForegroundColor:(nullable DDColor *)fgColor backgroundColor:(nullable DDColor *)bgColor flag:(DDLogFlag)mask context:(NSInteger)ctxt; + +@end + +@interface DDTTYLogger () { + NSString *_appName; + char *_app; + size_t _appLen; + + NSString *_processID; + char *_pid; + size_t _pidLen; + + BOOL _colorsEnabled; + NSMutableArray *_colorProfilesArray; + NSMutableDictionary *_colorProfilesDict; +} + +@end + +#pragma mark - + +@implementation DDTTYLogger + +static BOOL isaColorTTY; +static BOOL isaColor256TTY; +static BOOL isaXcodeColorTTY; + +static NSArray *codesFg = nil; +static NSArray *codesBg = nil; +static NSArray *colors = nil; + +static DDTTYLogger *sharedInstance; + +/** + * Initializes the colors array, as well as the `codesFg` and `codesBg` arrays, for 16 color mode. + * + * This method is used when the application is running from within a shell that only supports 16 color mode. + * This method is not invoked if the application is running within Xcode, or via normal UI app launch. + **/ ++ (void)initializeColors16 { + if (codesFg || codesBg || colors) { + return; + } + + __auto_type mColors = [NSMutableArray arrayWithCapacity:16]; + + // In a standard shell only 16 colors are supported. + // + // More information about ansi escape codes can be found online. + // http://en.wikipedia.org/wiki/ANSI_escape_code + codesFg = @[ + @"30m", // normal - black + @"31m", // normal - red + @"32m", // normal - green + @"33m", // normal - yellow + @"34m", // normal - blue + @"35m", // normal - magenta + @"36m", // normal - cyan + @"37m", // normal - gray + @"1;30m", // bright - darkgray + @"1;31m", // bright - red + @"1;32m", // bright - green + @"1;33m", // bright - yellow + @"1;34m", // bright - blue + @"1;35m", // bright - magenta + @"1;36m", // bright - cyan + @"1;37m", // bright - white + ]; + + codesBg = @[ + @"40m", // normal - black + @"41m", // normal - red + @"42m", // normal - green + @"43m", // normal - yellow + @"44m", // normal - blue + @"45m", // normal - magenta + @"46m", // normal - cyan + @"47m", // normal - gray + @"1;40m", // bright - darkgray + @"1;41m", // bright - red + @"1;42m", // bright - green + @"1;43m", // bright - yellow + @"1;44m", // bright - blue + @"1;45m", // bright - magenta + @"1;46m", // bright - cyan + @"1;47m", // bright - white + ]; + +#if MAP_TO_TERMINAL_APP_COLORS + + // Standard Terminal.app colors: + // + // These are the default colors used by Apple's Terminal.app. + const DDRGBColor rgbColors[] = { + { 0, 0, 0}, // normal - black + {194, 54, 33}, // normal - red + { 37, 188, 36}, // normal - green + {173, 173, 39}, // normal - yellow + { 73, 46, 225}, // normal - blue + {211, 56, 211}, // normal - magenta + { 51, 187, 200}, // normal - cyan + {203, 204, 205}, // normal - gray + {129, 131, 131}, // bright - darkgray + {252, 57, 31}, // bright - red + { 49, 231, 34}, // bright - green + {234, 236, 35}, // bright - yellow + { 88, 51, 255}, // bright - blue + {249, 53, 248}, // bright - magenta + { 20, 240, 240}, // bright - cyan + {233, 235, 235}, // bright - white + }; + +#else /* if MAP_TO_TERMINAL_APP_COLORS */ + + // Standard xterm colors: + // + // These are the default colors used by most xterm shells. + const DDRGBColor rgbColors[] = { + { 0, 0, 0}, // normal - black + {205, 0, 0}, // normal - red + { 0, 205, 0}, // normal - green + {205, 205, 0}, // normal - yellow + { 0, 0, 238}, // normal - blue + {205, 0, 205}, // normal - magenta + { 0, 205, 205}, // normal - cyan + {229, 229, 229}, // normal - gray + {127, 127, 127}, // bright - darkgray + {255, 0, 0}, // bright - red + { 0, 255, 0}, // bright - green + {255, 255, 0}, // bright - yellow + { 92, 92, 255}, // bright - blue + {255, 0, 255}, // bright - magenta + { 0, 255, 255}, // bright - cyan + {255, 255, 255}, // bright - white + }; +#endif /* if MAP_TO_TERMINAL_APP_COLORS */ + + for (size_t i = 0; i < sizeof(rgbColors) / sizeof(rgbColors[0]); ++i) { + [mColors addObject:DDMakeColor(rgbColors[i].r, rgbColors[i].g, rgbColors[i].b)]; + } + colors = [mColors copy]; + + NSAssert([codesFg count] == [codesBg count], @"Invalid colors/codes array(s)"); + NSAssert([codesFg count] == [colors count], @"Invalid colors/codes array(s)"); +} + +/** + * Initializes the colors array, as well as the `codesFg` and `codesBg` arrays, for 256 color mode. + * + * This method is used when the application is running from within a shell that supports 256 color mode. + * This method is not invoked if the application is running within Xcode, or via normal UI app launch. + **/ ++ (void)initializeColors256 { + if (codesFg || codesBg || colors) { + return; + } + + __auto_type mCodesFg = [NSMutableArray arrayWithCapacity:(256 - 16)]; + __auto_type mCodesBg = [NSMutableArray arrayWithCapacity:(256 - 16)]; + __auto_type mColors = [NSMutableArray arrayWithCapacity:(256 - 16)]; + +#if MAP_TO_TERMINAL_APP_COLORS + + // Standard Terminal.app colors: + // + // These are the colors the Terminal.app uses in xterm-256color mode. + // In this mode, the terminal supports 256 different colors, specified by 256 color codes. + // + // The first 16 color codes map to the original 16 color codes supported by the earlier xterm-color mode. + // These are actually configurable, and thus we ignore them for the purposes of mapping, + // as we can't rely on them being constant. They are largely duplicated anyway. + // + // The next 216 color codes are designed to run the spectrum, with several shades of every color. + // While the color codes are standardized, the actual RGB values for each color code is not. + // Apple's Terminal.app uses different RGB values from that of a standard xterm. + // Apple's choices in colors are designed to be a little nicer on the eyes. + // + // The last 24 color codes represent a grayscale. + // + // Unfortunately, unlike the standard xterm color chart, + // Apple's RGB values cannot be calculated using a simple formula (at least not that I know of). + // Also, I don't know of any ways to programmatically query the shell for the RGB values. + // So this big giant color chart had to be made by hand. + // + // More information about ansi escape codes can be found online. + // http://en.wikipedia.org/wiki/ANSI_escape_code + + // Colors + const DDRGBColor rgbColors[] = { + { 47, 49, 49}, + { 60, 42, 144}, + { 66, 44, 183}, + { 73, 46, 222}, + { 81, 50, 253}, + { 88, 51, 255}, + + { 42, 128, 37}, + { 42, 127, 128}, + { 44, 126, 169}, + { 56, 125, 209}, + { 59, 124, 245}, + { 66, 123, 255}, + + { 51, 163, 41}, + { 39, 162, 121}, + { 42, 161, 162}, + { 53, 160, 202}, + { 45, 159, 240}, + { 58, 158, 255}, + + { 31, 196, 37}, + { 48, 196, 115}, + { 39, 195, 155}, + { 49, 195, 195}, + { 32, 194, 235}, + { 53, 193, 255}, + + { 50, 229, 35}, + { 40, 229, 109}, + { 27, 229, 149}, + { 49, 228, 189}, + { 33, 228, 228}, + { 53, 227, 255}, + + { 27, 254, 30}, + { 30, 254, 103}, + { 45, 254, 143}, + { 38, 253, 182}, + { 38, 253, 222}, + { 42, 253, 252}, + + {140, 48, 40}, + {136, 51, 136}, + {135, 52, 177}, + {134, 52, 217}, + {135, 56, 248}, + {134, 53, 255}, + + {125, 125, 38}, + {124, 125, 125}, + {122, 124, 166}, + {123, 124, 207}, + {123, 122, 247}, + {124, 121, 255}, + + {119, 160, 35}, + {117, 160, 120}, + {117, 160, 160}, + {115, 159, 201}, + {116, 158, 240}, + {117, 157, 255}, + + {113, 195, 39}, + {110, 194, 114}, + {111, 194, 154}, + {108, 194, 194}, + {109, 193, 234}, + {108, 192, 255}, + + {105, 228, 30}, + {103, 228, 109}, + {105, 228, 148}, + {100, 227, 188}, + { 99, 227, 227}, + { 99, 226, 253}, + + { 92, 253, 34}, + { 96, 253, 103}, + { 97, 253, 142}, + { 88, 253, 182}, + { 93, 253, 221}, + { 88, 254, 251}, + + {177, 53, 34}, + {174, 54, 131}, + {172, 55, 172}, + {171, 57, 213}, + {170, 55, 249}, + {170, 57, 255}, + + {165, 123, 37}, + {163, 123, 123}, + {162, 123, 164}, + {161, 122, 205}, + {161, 121, 241}, + {161, 121, 255}, + + {158, 159, 33}, + {157, 158, 118}, + {157, 158, 159}, + {155, 157, 199}, + {155, 157, 239}, + {154, 156, 255}, + + {152, 193, 40}, + {151, 193, 113}, + {150, 193, 153}, + {150, 192, 193}, + {148, 192, 232}, + {149, 191, 253}, + + {146, 227, 28}, + {144, 227, 108}, + {144, 227, 147}, + {144, 227, 187}, + {142, 226, 227}, + {142, 225, 252}, + + {138, 253, 36}, + {137, 253, 102}, + {136, 253, 141}, + {138, 254, 181}, + {135, 255, 220}, + {133, 255, 250}, + + {214, 57, 30}, + {211, 59, 126}, + {209, 57, 168}, + {208, 55, 208}, + {207, 58, 247}, + {206, 61, 255}, + + {204, 121, 32}, + {202, 121, 121}, + {201, 121, 161}, + {200, 120, 202}, + {200, 120, 241}, + {198, 119, 255}, + + {198, 157, 37}, + {196, 157, 116}, + {195, 156, 157}, + {195, 156, 197}, + {194, 155, 236}, + {193, 155, 255}, + + {191, 192, 36}, + {190, 191, 112}, + {189, 191, 152}, + {189, 191, 191}, + {188, 190, 230}, + {187, 190, 253}, + + {185, 226, 28}, + {184, 226, 106}, + {183, 225, 146}, + {183, 225, 186}, + {182, 225, 225}, + {181, 224, 252}, + + {178, 255, 35}, + {178, 255, 101}, + {177, 254, 141}, + {176, 254, 180}, + {176, 254, 220}, + {175, 253, 249}, + + {247, 56, 30}, + {245, 57, 122}, + {243, 59, 163}, + {244, 60, 204}, + {242, 59, 241}, + {240, 55, 255}, + + {241, 119, 36}, + {240, 120, 118}, + {238, 119, 158}, + {237, 119, 199}, + {237, 118, 238}, + {236, 118, 255}, + + {235, 154, 36}, + {235, 154, 114}, + {234, 154, 154}, + {232, 154, 194}, + {232, 153, 234}, + {232, 153, 255}, + + {230, 190, 30}, + {229, 189, 110}, + {228, 189, 150}, + {227, 189, 190}, + {227, 189, 229}, + {226, 188, 255}, + + {224, 224, 35}, + {223, 224, 105}, + {222, 224, 144}, + {222, 223, 184}, + {222, 223, 224}, + {220, 223, 253}, + + {217, 253, 28}, + {217, 253, 99}, + {216, 252, 139}, + {216, 252, 179}, + {215, 252, 218}, + {215, 251, 250}, + + {255, 61, 30}, + {255, 60, 118}, + {255, 58, 159}, + {255, 56, 199}, + {255, 55, 238}, + {255, 59, 255}, + + {255, 117, 29}, + {255, 117, 115}, + {255, 117, 155}, + {255, 117, 195}, + {255, 116, 235}, + {254, 116, 255}, + + {255, 152, 27}, + {255, 152, 111}, + {254, 152, 152}, + {255, 152, 192}, + {254, 151, 231}, + {253, 151, 253}, + + {255, 187, 33}, + {253, 187, 107}, + {252, 187, 148}, + {253, 187, 187}, + {254, 187, 227}, + {252, 186, 252}, + + {252, 222, 34}, + {251, 222, 103}, + {251, 222, 143}, + {250, 222, 182}, + {251, 221, 222}, + {252, 221, 252}, + + {251, 252, 15}, + {251, 252, 97}, + {249, 252, 137}, + {247, 252, 177}, + {247, 253, 217}, + {254, 255, 255}, + + // Grayscale + + { 52, 53, 53}, + { 57, 58, 59}, + { 66, 67, 67}, + { 75, 76, 76}, + { 83, 85, 85}, + { 92, 93, 94}, + + {101, 102, 102}, + {109, 111, 111}, + {118, 119, 119}, + {126, 127, 128}, + {134, 136, 136}, + {143, 144, 145}, + + {151, 152, 153}, + {159, 161, 161}, + {167, 169, 169}, + {176, 177, 177}, + {184, 185, 186}, + {192, 193, 194}, + + {200, 201, 202}, + {208, 209, 210}, + {216, 218, 218}, + {224, 226, 226}, + {232, 234, 234}, + {240, 242, 242}, + }; + + for (size_t i = 0; i < sizeof(rgbColors) / sizeof(rgbColors[0]); ++i) { + [mColors addObject:DDMakeColor(rgbColors[i].r, rgbColors[i].g, rgbColors[i].b)]; + } + + // Color codes + int index = 16; + while (index < 256) { + [mCodesFg addObject:[NSString stringWithFormat:@"38;5;%dm", index]]; + [mCodesBg addObject:[NSString stringWithFormat:@"48;5;%dm", index]]; + + index++; + } + +#else /* if MAP_TO_TERMINAL_APP_COLORS */ + + // Standard xterm colors: + // + // These are the colors xterm shells use in xterm-256color mode. + // In this mode, the shell supports 256 different colors, specified by 256 color codes. + // + // The first 16 color codes map to the original 16 color codes supported by the earlier xterm-color mode. + // These are generally configurable, and thus we ignore them for the purposes of mapping, + // as we can't rely on them being constant. They are largely duplicated anyway. + // + // The next 216 color codes are designed to run the spectrum, with several shades of every color. + // The last 24 color codes represent a grayscale. + // + // While the color codes are standardized, the actual RGB values for each color code is not. + // However most standard xterms follow a well known color chart, + // which can easily be calculated using the simple formula below. + // + // More information about ansi escape codes can be found online. + // http://en.wikipedia.org/wiki/ANSI_escape_code + + int index = 16; + + int r; // red + int g; // green + int b; // blue + + int ri; // r increment + int gi; // g increment + int bi; // b increment + + // Calculate xterm colors (using standard algorithm) + + int r = 0; + int g = 0; + int b = 0; + + for (ri = 0; ri < 6; ri++) { + r = (ri == 0) ? 0 : 95 + (40 * (ri - 1)); + + for (gi = 0; gi < 6; gi++) { + g = (gi == 0) ? 0 : 95 + (40 * (gi - 1)); + + for (bi = 0; bi < 6; bi++) { + b = (bi == 0) ? 0 : 95 + (40 * (bi - 1)); + + [mCodesFg addObject:[NSString stringWithFormat:@"38;5;%dm", index]]; + [mCodesBg addObject:[NSString stringWithFormat:@"48;5;%dm", index]]; + [mColors addObject:DDMakeColor(r, g, b)]; + + index++; + } + } + } + + // Calculate xterm grayscale (using standard algorithm) + + r = 8; + g = 8; + b = 8; + + while (index < 256) { + [mCodesFg addObject:[NSString stringWithFormat:@"38;5;%dm", index]]; + [mCodesBg addObject:[NSString stringWithFormat:@"48;5;%dm", index]]; + [mColor s addObject:DDMakeColor(r, g, b)]; + + r += 10; + g += 10; + b += 10; + + index++; + } + +#endif /* if MAP_TO_TERMINAL_APP_COLORS */ + + codesFg = [mCodesFg copy]; + codesBg = [mCodesBg copy]; + colors = [mColors copy]; + + NSAssert([codesFg count] == [codesBg count], @"Invalid colors/codes array(s)"); + NSAssert([codesFg count] == [colors count], @"Invalid colors/codes array(s)"); +} + ++ (void)getRed:(CGFloat *)rPtr green:(CGFloat *)gPtr blue:(CGFloat *)bPtr fromColor:(DDColor *)color { +#if TARGET_OS_IPHONE + + // iOS + __auto_type done = NO; + + if ([color respondsToSelector:@selector(getRed:green:blue:alpha:)]) { + done = [color getRed:rPtr green:gPtr blue:bPtr alpha:NULL]; + } + + if (!done) { + // The method getRed:green:blue:alpha: was only available starting iOS 5. + // So in iOS 4 and earlier, we have to jump through hoops. + + __auto_type rgbColorSpace = CGColorSpaceCreateDeviceRGB(); + + unsigned char pixel[4]; + __auto_type context = CGBitmapContextCreate(&pixel, 1, 1, 8, 4, rgbColorSpace, (CGBitmapInfo)(kCGBitmapAlphaInfoMask & kCGImageAlphaNoneSkipLast)); + + CGContextSetFillColorWithColor(context, [color CGColor]); + CGContextFillRect(context, CGRectMake(0, 0, 1, 1)); + + if (rPtr) { + *rPtr = pixel[0] / 255.0; + } + if (gPtr) { + *gPtr = pixel[1] / 255.0; + } + if (bPtr) { + *bPtr = pixel[2] / 255.0; + } + + CGContextRelease(context); + CGColorSpaceRelease(rgbColorSpace); + } + +#elif defined(DD_CLI) || !__has_include() + + // OS X without AppKit + [color getRed:rPtr green:gPtr blue:bPtr alpha:NULL]; + +#else /* if TARGET_OS_IPHONE */ + + // OS X with AppKit + NSColor *safeColor; + if (@available(macOS 10.14,*)) { + safeColor = [color colorUsingColorSpace:NSColorSpace.deviceRGBColorSpace]; + } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + safeColor = [color colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; +#pragma clang diagnostic pop + } + + [safeColor getRed:rPtr green:gPtr blue:bPtr alpha:NULL]; + +#endif /* if TARGET_OS_IPHONE */ +} + +/** + * Maps the given color to the closest available color supported by the shell. + * The shell may support 256 colors, or only 16. + * + * This method loops through the known supported color set, and calculates the closest color. + * The array index of that color, within the colors array, is then returned. + * This array index may also be used as the index within the `codesFg` and `codesBg` arrays. + **/ ++ (NSUInteger)codeIndexForColor:(DDColor *)inColor { + CGFloat inR, inG, inB; + + [self getRed:&inR green:&inG blue:&inB fromColor:inColor]; + + NSUInteger bestIndex = 0; + CGFloat lowestDistance = 100.0; + + NSUInteger i = 0; + + for (DDColor *color in colors) { + // Calculate Euclidean distance (lower value means closer to given color) + + CGFloat r, g, b; + [self getRed:&r green:&g blue:&b fromColor:color]; + +#if CGFLOAT_IS_DOUBLE + __auto_type distance = sqrt(pow(r - inR, 2.0) + pow(g - inG, 2.0) + pow(b - inB, 2.0)); +#else + __auto_type distance = sqrtf(powf(r - inR, 2.0f) + powf(g - inG, 2.0f) + powf(b - inB, 2.0f)); +#endif + + NSLogVerbose(@"DDTTYLogger: %3lu : %.3f,%.3f,%.3f & %.3f,%.3f,%.3f = %.6f", + (unsigned long)i, (double)inR, (double)inG, (double)inB, (double)r, (double)g, (double)b, (double)distance); + + if (distance < lowestDistance) { + bestIndex = i; + lowestDistance = distance; + + NSLogVerbose(@"DDTTYLogger: New best index = %lu", (unsigned long)bestIndex); + } + + i++; + } + + return bestIndex; +} + ++ (instancetype)sharedInstance { + static dispatch_once_t DDTTYLoggerOnceToken; + + dispatch_once(&DDTTYLoggerOnceToken, ^{ + // Xcode does NOT natively support colors in the Xcode debugging console. + // You'll need to install the XcodeColors plugin to see colors in the Xcode console. + // + // PS - Please read the header file before diving into the source code. + + __auto_type xcodeColors = getenv("XcodeColors"); + __auto_type term = getenv("TERM"); + + if (xcodeColors && (strcmp(xcodeColors, "YES") == 0)) { + isaXcodeColorTTY = YES; + } else if (term) { + if (strcasestr(term, "color") != NULL) { + isaColorTTY = YES; + isaColor256TTY = (strcasestr(term, "256") != NULL); + + if (isaColor256TTY) { + [self initializeColors256]; + } else { + [self initializeColors16]; + } + } + } + + NSLogInfo(@"DDTTYLogger: isaColorTTY = %@", (isaColorTTY ? @"YES" : @"NO")); + NSLogInfo(@"DDTTYLogger: isaColor256TTY: %@", (isaColor256TTY ? @"YES" : @"NO")); + NSLogInfo(@"DDTTYLogger: isaXcodeColorTTY: %@", (isaXcodeColorTTY ? @"YES" : @"NO")); + + sharedInstance = [[self alloc] init]; + }); + + return sharedInstance; +} + +- (instancetype)init { + if (sharedInstance != nil) { + return nil; + } + +#if !defined(DD_CLI) || __has_include() + if (@available(iOS 10.0, macOS 10.12, tvOS 10.0, watchOS 3.0, *)) { + NSLogWarn(@"CocoaLumberjack: Warning: Usage of DDTTYLogger detected when DDOSLogger is available and can be used! Please consider migrating to DDOSLogger."); + } +#endif + + if ((self = [super init])) { + // Initialize 'app' variable (char *) + _appName = [[NSProcessInfo processInfo] processName]; + _appLen = [_appName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; + + if (_appLen == 0) { + _appName = @""; + _appLen = [_appName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; + } + + _app = (char *)calloc(_appLen + 1, sizeof(char)); + if (_app == NULL) { + return nil; + } + + BOOL processedAppName = [_appName getCString:_app maxLength:(_appLen + 1) encoding:NSUTF8StringEncoding]; + if (!processedAppName) { + free(_app); + return nil; + } + + // Initialize 'pid' variable (char *) + + _processID = [NSString stringWithFormat:@"%i", (int)getpid()]; + + _pidLen = [_processID lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; + _pid = (char *)calloc(_pidLen + 1, sizeof(char)); + + if (_pid == NULL) { + free(_app); + return nil; + } + + BOOL processedID = [_processID getCString:_pid maxLength:(_pidLen + 1) encoding:NSUTF8StringEncoding]; + if (!processedID) { + free(_app); + free(_pid); + return nil; + } + + // Initialize color stuff + + _colorsEnabled = NO; + _colorProfilesArray = [[NSMutableArray alloc] initWithCapacity:8]; + _colorProfilesDict = [[NSMutableDictionary alloc] initWithCapacity:8]; + + _automaticallyAppendNewlineForCustomFormatters = YES; + } + + return self; +} + +- (DDLoggerName)loggerName { + return DDLoggerNameTTY; +} + +- (void)loadDefaultColorProfiles { + [self setForegroundColor:DDMakeColor(214, 57, 30) backgroundColor:nil forFlag:DDLogFlagError]; + [self setForegroundColor:DDMakeColor(204, 121, 32) backgroundColor:nil forFlag:DDLogFlagWarning]; +} + +- (BOOL)colorsEnabled { + // The design of this method is taken from the DDAbstractLogger implementation. + // For extensive documentation please refer to the DDAbstractLogger implementation. + + // Note: The internal implementation MUST access the colorsEnabled variable directly, + // This method is designed explicitly for external access. + // + // Using "self." syntax to go through this method will cause immediate deadlock. + // This is the intended result. Fix it by accessing the ivar directly. + // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster. + + DDAbstractLoggerAssertLockedPropertyAccess(); + __block BOOL result; + dispatch_sync(DDLog.loggingQueue, ^{ + dispatch_sync(self.loggerQueue, ^{ + result = self->_colorsEnabled; + }); + }); + + return result; +} + +- (void)setColorsEnabled:(BOOL)newColorsEnabled { + __auto_type block = ^{ + @autoreleasepool { + self->_colorsEnabled = newColorsEnabled; + + if ([self->_colorProfilesArray count] == 0) { + [self loadDefaultColorProfiles]; + } + } + }; + + // The design of this method is taken from the DDAbstractLogger implementation. + // For extensive documentation please refer to the DDAbstractLogger implementation. + + // Note: The internal implementation MUST access the colorsEnabled variable directly, + // This method is designed explicitly for external access. + // + // Using "self." syntax to go through this method will cause immediate deadlock. + // This is the intended result. Fix it by accessing the ivar directly. + // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster. + + DDAbstractLoggerAssertLockedPropertyAccess(); + dispatch_async(DDLog.loggingQueue, ^{ + dispatch_async(self.loggerQueue, block); + }); +} + +- (void)setForegroundColor:(DDColor *)txtColor backgroundColor:(DDColor *)bgColor forFlag:(DDLogFlag)mask { + [self setForegroundColor:txtColor backgroundColor:bgColor forFlag:mask context:LOG_CONTEXT_ALL]; +} + +- (void)setForegroundColor:(DDColor *)txtColor backgroundColor:(DDColor *)bgColor forFlag:(DDLogFlag)mask context:(NSInteger)ctxt { + dispatch_block_t block = ^{ + @autoreleasepool { + DDTTYLoggerColorProfile *newColorProfile = [[DDTTYLoggerColorProfile alloc] initWithForegroundColor:txtColor + backgroundColor:bgColor + flag:mask + context:ctxt]; + if (!newColorProfile) return; + + NSLogInfo(@"DDTTYLogger: newColorProfile: %@", newColorProfile); + + NSUInteger i = 0; + + for (DDTTYLoggerColorProfile *colorProfile in self->_colorProfilesArray) { + if ((colorProfile->mask == mask) && (colorProfile->context == ctxt)) { + break; + } + + i++; + } + + if (i < [self->_colorProfilesArray count]) { + self->_colorProfilesArray[i] = newColorProfile; + } else { + [self->_colorProfilesArray addObject:newColorProfile]; + } + } + }; + + // The design of the setter logic below is taken from the DDAbstractLogger implementation. + // For documentation please refer to the DDAbstractLogger implementation. + + if ([self isOnInternalLoggerQueue]) { + block(); + } else { + DDAbstractLoggerAssertNotOnGlobalLoggingQueue(); + dispatch_async(DDLog.loggingQueue, ^{ + dispatch_async(self.loggerQueue, block); + }); + } +} + +- (void)setForegroundColor:(DDColor *)txtColor backgroundColor:(DDColor *)bgColor forTag:(id )tag { + NSAssert([(id )tag conformsToProtocol: @protocol(NSCopying)], @"Invalid tag"); + + __auto_type block = ^{ + @autoreleasepool { + __auto_type newColorProfile = [[DDTTYLoggerColorProfile alloc] initWithForegroundColor:txtColor + backgroundColor:bgColor + flag:(DDLogFlag)0 + context:0]; + + NSLogInfo(@"DDTTYLogger: newColorProfile: %@", newColorProfile); + + self->_colorProfilesDict[tag] = newColorProfile; + } + }; + + // The design of the setter logic below is taken from the DDAbstractLogger implementation. + // For documentation please refer to the DDAbstractLogger implementation. + + if ([self isOnInternalLoggerQueue]) { + block(); + } else { + DDAbstractLoggerAssertNotOnGlobalLoggingQueue(); + dispatch_async(DDLog.loggingQueue, ^{ + dispatch_async(self.loggerQueue, block); + }); + } +} + +- (void)clearColorsForFlag:(DDLogFlag)mask { + [self clearColorsForFlag:mask context:0]; +} + +- (void)clearColorsForFlag:(DDLogFlag)mask context:(NSInteger)context { + __auto_type block = ^{ + @autoreleasepool { + NSUInteger i = 0; + + for (DDTTYLoggerColorProfile *colorProfile in self->_colorProfilesArray) { + if ((colorProfile->mask == mask) && (colorProfile->context == context)) { + break; + } + + i++; + } + + if (i < [self->_colorProfilesArray count]) { + [self->_colorProfilesArray removeObjectAtIndex:i]; + } + } + }; + + // The design of the setter logic below is taken from the DDAbstractLogger implementation. + // For documentation please refer to the DDAbstractLogger implementation. + + if ([self isOnInternalLoggerQueue]) { + block(); + } else { + DDAbstractLoggerAssertNotOnGlobalLoggingQueue(); + dispatch_async(DDLog.loggingQueue, ^{ + dispatch_async(self.loggerQueue, block); + }); + } +} + +- (void)clearColorsForTag:(id )tag { + NSAssert([(id ) tag conformsToProtocol: @protocol(NSCopying)], @"Invalid tag"); + + __auto_type block = ^{ + @autoreleasepool { + [self->_colorProfilesDict removeObjectForKey:tag]; + } + }; + + // The design of the setter logic below is taken from the DDAbstractLogger implementation. + // For documentation please refer to the DDAbstractLogger implementation. + + if ([self isOnInternalLoggerQueue]) { + block(); + } else { + DDAbstractLoggerAssertNotOnGlobalLoggingQueue(); + dispatch_async(DDLog.loggingQueue, ^{ + dispatch_async(self.loggerQueue, block); + }); + } +} + +- (void)clearColorsForAllFlags { + __auto_type block = ^{ + @autoreleasepool { + [self->_colorProfilesArray removeAllObjects]; + } + }; + + // The design of the setter logic below is taken from the DDAbstractLogger implementation. + // For documentation please refer to the DDAbstractLogger implementation. + + if ([self isOnInternalLoggerQueue]) { + block(); + } else { + DDAbstractLoggerAssertNotOnGlobalLoggingQueue(); + dispatch_async(DDLog.loggingQueue, ^{ + dispatch_async(self.loggerQueue, block); + }); + } +} + +- (void)clearColorsForAllTags { + __auto_type block = ^{ + @autoreleasepool { + [self->_colorProfilesDict removeAllObjects]; + } + }; + + // The design of the setter logic below is taken from the DDAbstractLogger implementation. + // For documentation please refer to the DDAbstractLogger implementation. + + if ([self isOnInternalLoggerQueue]) { + block(); + } else { + DDAbstractLoggerAssertNotOnGlobalLoggingQueue(); + dispatch_async(DDLog.loggingQueue, ^{ + dispatch_async(self.loggerQueue, block); + }); + } +} + +- (void)clearAllColors { + __auto_type block = ^{ + @autoreleasepool { + [self->_colorProfilesArray removeAllObjects]; + [self->_colorProfilesDict removeAllObjects]; + } + }; + + // The design of the setter logic below is taken from the DDAbstractLogger implementation. + // For documentation please refer to the DDAbstractLogger implementation. + + if ([self isOnInternalLoggerQueue]) { + block(); + } else { + DDAbstractLoggerAssertNotOnGlobalLoggingQueue(); + dispatch_async(DDLog.loggingQueue, ^{ + dispatch_async(self.loggerQueue, block); + }); + } +} + +- (void)logMessage:(DDLogMessage *)logMessage { + __auto_type logMsg = logMessage->_message; + __auto_type isFormatted = NO; + + if (_logFormatter) { + logMsg = [_logFormatter formatLogMessage:logMessage]; + isFormatted = logMsg != logMessage->_message; + } + + if (logMsg) { + // Search for a color profile associated with the log message + + DDTTYLoggerColorProfile *colorProfile = nil; + + if (_colorsEnabled) { + if (logMessage->_representedObject) { + colorProfile = _colorProfilesDict[logMessage->_representedObject]; + } + + if (colorProfile == nil) { + for (DDTTYLoggerColorProfile *cp in _colorProfilesArray) { + if (logMessage->_flag & cp->mask) { + // Color profile set for this context? + if (logMessage->_context == cp->context) { + colorProfile = cp; + + // Stop searching + break; + } + + // Check if LOG_CONTEXT_ALL was specified as a default color for this flag + if (cp->context == LOG_CONTEXT_ALL) { + colorProfile = cp; + + // We don't break to keep searching for more specific color profiles for the context + } + } + } + } + } + + // Convert log message to C string. + // + // We use the stack instead of the heap for speed if possible. + // But we're extra cautious to avoid a stack overflow. + + __auto_type msgLen = [logMsg lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; + const __auto_type useStack = msgLen < (1024 * 4); + + char *msg; + if (useStack) { + msg = (char *)alloca(msgLen + 1); + } else { + msg = (char *)calloc(msgLen + 1, sizeof(char)); + } + if (msg == NULL) { + return; + } + + BOOL logMsgEnc = [logMsg getCString:msg maxLength:(msgLen + 1) encoding:NSUTF8StringEncoding]; + if (!logMsgEnc) { + if (!useStack) { + free(msg); + } + return; + } + + // Write the log message to STDERR + + if (isFormatted) { + // The log message has already been formatted. + const size_t maxIovecLen = 5; + size_t iovecLen = _automaticallyAppendNewlineForCustomFormatters ? 5 : 4; + struct iovec v[maxIovecLen] = { 0 }; + + if (colorProfile) { + v[0].iov_base = colorProfile->fgCode; + v[0].iov_len = colorProfile->fgCodeLen; + + v[1].iov_base = colorProfile->bgCode; + v[1].iov_len = colorProfile->bgCodeLen; + + v[maxIovecLen - 1].iov_base = colorProfile->resetCode; + v[maxIovecLen - 1].iov_len = colorProfile->resetCodeLen; + } + + v[2].iov_base = msg; + v[2].iov_len = (msgLen > SIZE_MAX - 1) ? SIZE_MAX - 1 : msgLen; + + if (_automaticallyAppendNewlineForCustomFormatters && (v[2].iov_len == 0 || msg[v[2].iov_len - 1] != '\n')) { + v[3].iov_base = "\n"; + v[3].iov_len = 1; + iovecLen = 5; + } + + writev(STDERR_FILENO, v, (int)iovecLen); + } else { + // The log message is unformatted, so apply standard NSLog style formatting. + + int len; + char ts[24] = ""; + size_t tsLen = 0; + + // Calculate timestamp. + // The technique below is faster than using NSDateFormatter. + if (logMessage->_timestamp) { + __auto_type epoch = [logMessage->_timestamp timeIntervalSince1970]; + double integral; + __auto_type fract = modf(epoch, &integral); + struct tm tm; + __auto_type time = (time_t)integral; + (void)localtime_r(&time, &tm); + __auto_type milliseconds = (long)(fract * 1000.0); + + len = snprintf(ts, 24, "%04d-%02d-%02d %02d:%02d:%02d:%03ld", // yyyy-MM-dd HH:mm:ss:SSS + tm.tm_year + 1900, + tm.tm_mon + 1, + tm.tm_mday, + tm.tm_hour, + tm.tm_min, + tm.tm_sec, milliseconds); + + tsLen = (NSUInteger)MAX(MIN(24 - 1, len), 0); + } + + // Calculate thread ID + // + // How many characters do we need for the thread id? + // logMessage->machThreadID is of type mach_port_t, which is an unsigned int. + // + // 1 hex char = 4 bits + // 8 hex chars for 32 bit, plus ending '\0' = 9 + + char tid[9]; + len = snprintf(tid, 9, "%s", [logMessage->_threadID cStringUsingEncoding:NSUTF8StringEncoding]); + + __auto_type tidLen = (NSUInteger)MAX(MIN(9 - 1, len), 0); + + // Here is our format: "%s %s[%i:%s] %s", timestamp, appName, processID, threadID, logMsg + + struct iovec v[13]; + + if (colorProfile) { + v[0].iov_base = colorProfile->fgCode; + v[0].iov_len = colorProfile->fgCodeLen; + + v[1].iov_base = colorProfile->bgCode; + v[1].iov_len = colorProfile->bgCodeLen; + + v[12].iov_base = colorProfile->resetCode; + v[12].iov_len = colorProfile->resetCodeLen; + } else { + v[0].iov_base = ""; + v[0].iov_len = 0; + + v[1].iov_base = ""; + v[1].iov_len = 0; + + v[12].iov_base = ""; + v[12].iov_len = 0; + } + + v[2].iov_base = ts; + v[2].iov_len = tsLen; + + v[3].iov_base = " "; + v[3].iov_len = 1; + + v[4].iov_base = _app; + v[4].iov_len = _appLen; + + v[5].iov_base = "["; + v[5].iov_len = 1; + + v[6].iov_base = _pid; + v[6].iov_len = _pidLen; + + v[7].iov_base = ":"; + v[7].iov_len = 1; + + v[8].iov_base = tid; + v[8].iov_len = MIN((size_t)8, tidLen); // snprintf doesn't return what you might think + + v[9].iov_base = "] "; + v[9].iov_len = 2; + + v[10].iov_base = (char *)msg; + v[10].iov_len = msgLen; + + v[11].iov_base = "\n"; + v[11].iov_len = (msg[msgLen] == '\n') ? 0 : 1; + + writev(STDERR_FILENO, v, 13); + } + + if (!useStack) { + free(msg); + } + } +} + +@end + +#pragma mark - + +@implementation DDTTYLoggerColorProfile + +- (instancetype)initWithForegroundColor:(DDColor *)fgColor backgroundColor:(DDColor *)bgColor flag:(DDLogFlag)aMask context:(NSInteger)ctxt { + if ((self = [super init])) { + mask = aMask; + context = ctxt; + + CGFloat r, g, b; + + if (fgColor) { + [DDTTYLogger getRed:&r green:&g blue:&b fromColor:fgColor]; + + fg.r = (uint8_t)(r * (CGFloat)255.0); + fg.g = (uint8_t)(g * (CGFloat)255.0); + fg.b = (uint8_t)(b * (CGFloat)255.0); + } + + if (bgColor) { + [DDTTYLogger getRed:&r green:&g blue:&b fromColor:bgColor]; + + bg.r = (uint8_t)(r * (CGFloat)255.0); + bg.g = (uint8_t)(g * (CGFloat)255.0); + bg.b = (uint8_t)(b * (CGFloat)255.0); + } + + if (fgColor && isaColorTTY) { + // Map foreground color to closest available shell color + + fgCodeIndex = [DDTTYLogger codeIndexForColor:fgColor]; + fgCodeRaw = codesFg[fgCodeIndex]; + + const __auto_type escapeSeq = @"\033["; + + __auto_type len1 = [escapeSeq lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; + __auto_type len2 = [fgCodeRaw lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; + + BOOL escapeSeqEnc = [escapeSeq getCString:(fgCode) maxLength:(len1 + 1) encoding:NSUTF8StringEncoding]; + BOOL fgCodeRawEsc = [fgCodeRaw getCString:(fgCode + len1) maxLength:(len2 + 1) encoding:NSUTF8StringEncoding]; + + if (!escapeSeqEnc || !fgCodeRawEsc) { + return nil; + } + + fgCodeLen = len1 + len2; + } else if (fgColor && isaXcodeColorTTY) { + // Convert foreground color to color code sequence + const char *escapeSeq = XCODE_COLORS_ESCAPE_SEQ; + __auto_type result = snprintf(fgCode, 24, "%sfg%u,%u,%u;", escapeSeq, fg.r, fg.g, fg.b); + fgCodeLen = (NSUInteger)MAX(MIN(result, (24 - 1)), 0); + } else { + // No foreground color or no color support + fgCode[0] = '\0'; + fgCodeLen = 0; + } + + if (bgColor && isaColorTTY) { + // Map background color to closest available shell color + + bgCodeIndex = [DDTTYLogger codeIndexForColor:bgColor]; + bgCodeRaw = codesBg[bgCodeIndex]; + + const __auto_type escapeSeq = @"\033["; + + __auto_type len1 = [escapeSeq lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; + __auto_type len2 = [bgCodeRaw lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; + + BOOL escapeSeqEnc = [escapeSeq getCString:(bgCode) maxLength:(len1 + 1) encoding:NSUTF8StringEncoding]; + BOOL bgCodeRawEsc = [bgCodeRaw getCString:(bgCode + len1) maxLength:(len2 + 1) encoding:NSUTF8StringEncoding]; + + if (!escapeSeqEnc || !bgCodeRawEsc) { + return nil; + } + + bgCodeLen = len1 + len2; + } else if (bgColor && isaXcodeColorTTY) { + // Convert background color to color code sequence + const char *escapeSeq = XCODE_COLORS_ESCAPE_SEQ; + __auto_type result = snprintf(bgCode, 24, "%sbg%u,%u,%u;", escapeSeq, bg.r, bg.g, bg.b); + bgCodeLen = (NSUInteger)MAX(MIN(result, (24 - 1)), 0); + } else { + // No background color or no color support + bgCode[0] = '\0'; + bgCodeLen = 0; + } + + if (isaColorTTY) { + resetCodeLen = (NSUInteger)MAX(snprintf(resetCode, 8, "\033[0m"), 0); + } else if (isaXcodeColorTTY) { + resetCodeLen = (NSUInteger)MAX(snprintf(resetCode, 8, XCODE_COLORS_RESET), 0); + } else { + resetCode[0] = '\0'; + resetCodeLen = 0; + } + } + + return self; +} + +- (NSString *)description { + return [NSString stringWithFormat: + @"", + self, (int)mask, (long)context, fg.r, fg.g, fg.b, bg.r, bg.g, bg.b, fgCodeRaw, bgCodeRaw]; +} + +@end diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/Extensions/DDContextFilterLogFormatter+Deprecated.m b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/Extensions/DDContextFilterLogFormatter+Deprecated.m new file mode 100644 index 000000000..c05db19f3 --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/Extensions/DDContextFilterLogFormatter+Deprecated.m @@ -0,0 +1,57 @@ +// Software License Agreement (BSD License) +// +// Copyright (c) 2010-2024, Deusty, LLC +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, +// with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Neither the name of Deusty nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission of Deusty, LLC. + +#import + +@implementation DDContextAllowlistFilterLogFormatter (Deprecated) + +- (void)addToWhitelist:(NSInteger)loggingContext { + [self addToAllowlist:loggingContext]; +} + +- (void)removeFromWhitelist:(NSInteger)loggingContext { + [self removeFromAllowlist:loggingContext]; +} + +- (NSArray *)whitelist { + return [self allowlist]; +} + +- (BOOL)isOnWhitelist:(NSInteger)loggingContext { + return [self isOnAllowlist:loggingContext]; +} + +@end + + +@implementation DDContextDenylistFilterLogFormatter (Deprecated) + +- (void)addToBlacklist:(NSInteger)loggingContext { + [self addToDenylist:loggingContext]; +} + +- (void)removeFromBlacklist:(NSInteger)loggingContext { + [self removeFromDenylist:loggingContext]; +} + +- (NSArray *)blacklist { + return [self denylist]; +} + +- (BOOL)isOnBlacklist:(NSInteger)loggingContext { + return [self isOnDenylist:loggingContext]; +} + +@end diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/Extensions/DDContextFilterLogFormatter.m b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/Extensions/DDContextFilterLogFormatter.m new file mode 100755 index 000000000..271cd4b9a --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/Extensions/DDContextFilterLogFormatter.m @@ -0,0 +1,185 @@ +// Software License Agreement (BSD License) +// +// Copyright (c) 2010-2024, Deusty, LLC +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, +// with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Neither the name of Deusty nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission of Deusty, LLC. + +#if !__has_feature(objc_arc) +#error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). +#endif + +#import + +#import + +@interface DDLoggingContextSet : NSObject + +@property (readonly, copy, nonnull) NSArray *currentSet; + +- (void)addToSet:(NSInteger)loggingContext; +- (void)removeFromSet:(NSInteger)loggingContext; + +- (BOOL)isInSet:(NSInteger)loggingContext; + +@end + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +@interface DDContextAllowlistFilterLogFormatter () { + DDLoggingContextSet *_contextSet; +} +@end + +@implementation DDContextAllowlistFilterLogFormatter + +- (instancetype)init { + if ((self = [super init])) { + _contextSet = [[DDLoggingContextSet alloc] init]; + } + return self; +} + +- (void)addToAllowlist:(NSInteger)loggingContext { + [_contextSet addToSet:loggingContext]; +} + +- (void)removeFromAllowlist:(NSInteger)loggingContext { + [_contextSet removeFromSet:loggingContext]; +} + +- (NSArray *)allowlist { + return [_contextSet currentSet]; +} + +- (BOOL)isOnAllowlist:(NSInteger)loggingContext { + return [_contextSet isInSet:loggingContext]; +} + +- (NSString *)formatLogMessage:(DDLogMessage *)logMessage { + if ([self isOnAllowlist:logMessage->_context]) { + return logMessage->_message; + } else { + return nil; + } +} + +@end + + +@interface DDContextDenylistFilterLogFormatter () { + DDLoggingContextSet *_contextSet; +} +@end + +@implementation DDContextDenylistFilterLogFormatter + +- (instancetype)init { + if ((self = [super init])) { + _contextSet = [[DDLoggingContextSet alloc] init]; + } + return self; +} + +- (void)addToDenylist:(NSInteger)loggingContext { + [_contextSet addToSet:loggingContext]; +} + +- (void)removeFromDenylist:(NSInteger)loggingContext { + [_contextSet removeFromSet:loggingContext]; +} + +- (NSArray *)denylist { + return [_contextSet currentSet]; +} + +- (BOOL)isOnDenylist:(NSInteger)loggingContext { + return [_contextSet isInSet:loggingContext]; +} + +- (NSString *)formatLogMessage:(DDLogMessage *)logMessage { + if ([self isOnDenylist:logMessage->_context]) { + return nil; + } else { + return logMessage->_message; + } +} + +@end + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +@interface DDLoggingContextSet () { + pthread_mutex_t _mutex; + NSMutableSet *_set; +} +@end + +@implementation DDLoggingContextSet + +- (instancetype)init { + if ((self = [super init])) { + _set = [[NSMutableSet alloc] init]; + pthread_mutex_init(&_mutex, NULL); + } + + return self; +} + +- (void)dealloc { + pthread_mutex_destroy(&_mutex); +} + +- (void)addToSet:(NSInteger)loggingContext { + pthread_mutex_lock(&_mutex); + { + [_set addObject:@(loggingContext)]; + } + pthread_mutex_unlock(&_mutex); +} + +- (void)removeFromSet:(NSInteger)loggingContext { + pthread_mutex_lock(&_mutex); + { + [_set removeObject:@(loggingContext)]; + } + pthread_mutex_unlock(&_mutex); +} + +- (NSArray *)currentSet { + NSArray *result = nil; + + pthread_mutex_lock(&_mutex); + { + result = [_set allObjects]; + } + pthread_mutex_unlock(&_mutex); + + return result; +} + +- (BOOL)isInSet:(NSInteger)loggingContext { + __auto_type result = NO; + + pthread_mutex_lock(&_mutex); + { + result = [_set containsObject:@(loggingContext)]; + } + pthread_mutex_unlock(&_mutex); + + return result; +} + +@end diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/Extensions/DDDispatchQueueLogFormatter.m b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/Extensions/DDDispatchQueueLogFormatter.m new file mode 100755 index 000000000..d34885519 --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/Extensions/DDDispatchQueueLogFormatter.m @@ -0,0 +1,240 @@ +// Software License Agreement (BSD License) +// +// Copyright (c) 2010-2024, Deusty, LLC +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, +// with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Neither the name of Deusty nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission of Deusty, LLC. + +#if !__has_feature(objc_arc) +#error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). +#endif + +#import +#import +#import + +#import + +DDQualityOfServiceName const DDQualityOfServiceUserInteractive = @"UI"; +DDQualityOfServiceName const DDQualityOfServiceUserInitiated = @"IN"; +DDQualityOfServiceName const DDQualityOfServiceDefault = @"DF"; +DDQualityOfServiceName const DDQualityOfServiceUtility = @"UT"; +DDQualityOfServiceName const DDQualityOfServiceBackground = @"BG"; +DDQualityOfServiceName const DDQualityOfServiceUnspecified = @"UN"; + +static DDQualityOfServiceName _qos_name(NSUInteger qos) { + switch ((qos_class_t) qos) { + case QOS_CLASS_USER_INTERACTIVE: return DDQualityOfServiceUserInteractive; + case QOS_CLASS_USER_INITIATED: return DDQualityOfServiceUserInitiated; + case QOS_CLASS_DEFAULT: return DDQualityOfServiceDefault; + case QOS_CLASS_UTILITY: return DDQualityOfServiceUtility; + case QOS_CLASS_BACKGROUND: return DDQualityOfServiceBackground; + default: return DDQualityOfServiceUnspecified; + } +} + +#pragma mark - DDDispatchQueueLogFormatter + +@interface DDDispatchQueueLogFormatter () { + NSDateFormatter *_dateFormatter; // Use [self stringFromDate] + + pthread_mutex_t _mutex; + + NSUInteger _minQueueLength; // _prefix == Only access via atomic property + NSUInteger _maxQueueLength; // _prefix == Only access via atomic property + NSMutableDictionary *_replacements; // _prefix == Only access from within spinlock +} +@end + + +@implementation DDDispatchQueueLogFormatter + +- (instancetype)init { + if ((self = [super init])) { + _dateFormatter = [self createDateFormatter]; + + pthread_mutex_init(&_mutex, NULL); + _replacements = [[NSMutableDictionary alloc] init]; + + // Set default replacements: + _replacements[@"com.apple.main-thread"] = @"main"; + } + + return self; +} + +- (instancetype)initWithMode:(DDDispatchQueueLogFormatterMode)mode { + return [self init]; +} + +- (void)dealloc { + pthread_mutex_destroy(&_mutex); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark Configuration +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +@synthesize minQueueLength = _minQueueLength; +@synthesize maxQueueLength = _maxQueueLength; + +- (NSString *)replacementStringForQueueLabel:(NSString *)longLabel { + NSString *result = nil; + + pthread_mutex_lock(&_mutex); + { + result = _replacements[longLabel]; + } + pthread_mutex_unlock(&_mutex); + + return result; +} + +- (void)setReplacementString:(NSString *)shortLabel forQueueLabel:(NSString *)longLabel { + pthread_mutex_lock(&_mutex); + { + if (shortLabel) { + _replacements[longLabel] = shortLabel; + } else { + [_replacements removeObjectForKey:longLabel]; + } + } + pthread_mutex_unlock(&_mutex); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark DDLogFormatter +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +- (NSDateFormatter *)createDateFormatter { + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + [self configureDateFormatter:formatter]; + return formatter; +} + +- (void)configureDateFormatter:(NSDateFormatter *)dateFormatter { + [dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4]; + [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss:SSS"]; + [dateFormatter setLocale:[NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]]; + [dateFormatter setCalendar:[[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]]; +} + +- (NSString *)stringFromDate:(NSDate *)date { + return [_dateFormatter stringFromDate:date]; +} + +- (NSString *)queueThreadLabelForLogMessage:(DDLogMessage *)logMessage { + // As per the DDLogFormatter contract, this method is always invoked on the same thread/dispatch_queue + + __auto_type useQueueLabel = NO; + if (logMessage->_queueLabel) { + useQueueLabel = YES; + + // If you manually create a thread, it's dispatch_queue will have one of the thread names below. + // Since all such threads have the same name, we'd prefer to use the threadName or the machThreadID. + const NSArray *names = @[ + @"com.apple.root.low-priority", + @"com.apple.root.default-priority", + @"com.apple.root.high-priority", + @"com.apple.root.low-overcommit-priority", + @"com.apple.root.default-overcommit-priority", + @"com.apple.root.high-overcommit-priority", + @"com.apple.root.default-qos.overcommit", + ]; + for (NSString *name in names) { + if ([logMessage->_queueLabel isEqualToString:name]) { + useQueueLabel = NO; + break; + } + } + } + + // Get the name of the queue, thread, or machID (whichever we are to use). + NSString *queueThreadLabel; + if (useQueueLabel || [logMessage->_threadName length] > 0) { + __auto_type fullLabel = useQueueLabel ? logMessage->_queueLabel : logMessage->_threadName; + + NSString *abrvLabel; + pthread_mutex_lock(&_mutex); + { + abrvLabel = _replacements[fullLabel]; + } + pthread_mutex_unlock(&_mutex); + + queueThreadLabel = abrvLabel ?: fullLabel; + } else { + queueThreadLabel = logMessage->_threadID; + } + + // Now use the thread label in the output + // labelLength > maxQueueLength : truncate + // labelLength < minQueueLength : padding + // : exact + __auto_type minQueueLength = self.minQueueLength; + __auto_type maxQueueLength = self.maxQueueLength; + __auto_type labelLength = [queueThreadLabel length]; + if (maxQueueLength > 0 && labelLength > maxQueueLength) { + // Truncate + return [queueThreadLabel substringToIndex:maxQueueLength]; + } else if (labelLength < minQueueLength) { + // Padding + return [queueThreadLabel stringByPaddingToLength:minQueueLength + withString:@" " + startingAtIndex:0]; + } else { + // Exact + return queueThreadLabel; + } +} + +- (NSString *)formatLogMessage:(DDLogMessage *)logMessage { + __auto_type timestamp = [self stringFromDate:logMessage->_timestamp]; + __auto_type queueThreadLabel = [self queueThreadLabelForLogMessage:logMessage]; + + return [NSString stringWithFormat:@"%@ [%@ (QOS:%@)] %@", timestamp, queueThreadLabel, _qos_name(logMessage->_qos), logMessage->_message]; +} + +@end + +#pragma mark - DDAtomicCounter + +@interface DDAtomicCounter() { + atomic_int_fast32_t _value; +} +@end + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-implementations" +@implementation DDAtomicCounter +#pragma clang diagnostic pop + +- (instancetype)initWithDefaultValue:(int32_t)defaultValue { + if ((self = [super init])) { + atomic_init(&_value, defaultValue); + } + return self; +} + +- (int32_t)value { + return atomic_load_explicit(&_value, memory_order_relaxed); +} + +- (int32_t)increment { + int32_t old = atomic_fetch_add_explicit(&_value, 1, memory_order_relaxed); + return (old + 1); +} + +- (int32_t)decrement { + int32_t old = atomic_fetch_sub_explicit(&_value, 1, memory_order_relaxed); + return (old - 1); +} + +@end diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/Extensions/DDFileLogger+Buffering.m b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/Extensions/DDFileLogger+Buffering.m new file mode 100644 index 000000000..a620a3ed3 --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/Extensions/DDFileLogger+Buffering.m @@ -0,0 +1,202 @@ +// Software License Agreement (BSD License) +// +// Copyright (c) 2010-2024, Deusty, LLC +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, +// with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Neither the name of Deusty nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission of Deusty, LLC. + +#import + +#import +#import "../DDFileLogger+Internal.h" + +static const NSUInteger kDDDefaultBufferSize = 4096; // 4 kB, block f_bsize on iphone7 +static const NSUInteger kDDMaxBufferSize = 1048576; // ~1 mB, f_iosize on iphone7 + +// Reads attributes from base file system to determine buffer size. +// see statfs in sys/mount.h for descriptions of f_iosize and f_bsize. +// f_bsize == "default", and f_iosize == "max" +static inline NSUInteger p_DDGetDefaultBufferSizeBytesMax(const BOOL max) { + struct statfs *mountedFileSystems = NULL; + __auto_type count = getmntinfo(&mountedFileSystems, 0); + + for (int i = 0; i < count; i++) { + __auto_type mounted = mountedFileSystems[i]; + __auto_type name = mounted.f_mntonname; + + // We can use 2 as max here, since any length > 1 will fail the if-statement. + if (strnlen(name, 2) == 1 && *name == '/') { + return max ? (NSUInteger)mounted.f_iosize : (NSUInteger)mounted.f_bsize; + } + } + + return max ? kDDMaxBufferSize : kDDDefaultBufferSize; +} + +static NSUInteger DDGetMaxBufferSizeBytes(void) { + static NSUInteger maxBufferSize = 0; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + maxBufferSize = p_DDGetDefaultBufferSizeBytesMax(YES); + }); + return maxBufferSize; +} + +static NSUInteger DDGetDefaultBufferSizeBytes(void) { + static NSUInteger defaultBufferSize = 0; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + defaultBufferSize = p_DDGetDefaultBufferSizeBytesMax(NO); + }); + return defaultBufferSize; +} + +@interface DDBufferedProxy : NSProxy + +@property (nonatomic) DDFileLogger *fileLogger; +@property (nonatomic) NSOutputStream *buffer; + +@property (nonatomic) NSUInteger maxBufferSizeBytes; +@property (nonatomic) NSUInteger currentBufferSizeBytes; + +@end + +@implementation DDBufferedProxy + +- (instancetype)initWithFileLogger:(DDFileLogger *)fileLogger { + _fileLogger = fileLogger; + _maxBufferSizeBytes = DDGetDefaultBufferSizeBytes(); + [self flushBuffer]; + + return self; +} + +- (void)dealloc { + __auto_type block = ^{ + [self lt_sendBufferedDataToFileLogger]; + self.fileLogger = nil; + }; + + if ([self->_fileLogger isOnInternalLoggerQueue]) { + block(); + } else { + dispatch_sync(self->_fileLogger.loggerQueue, block); + } +} + +#pragma mark - Buffering + +- (void)flushBuffer { + [_buffer close]; + _buffer = [NSOutputStream outputStreamToMemory]; + [_buffer open]; + _currentBufferSizeBytes = 0; +} + +- (void)lt_sendBufferedDataToFileLogger { + NSData *data = [_buffer propertyForKey:NSStreamDataWrittenToMemoryStreamKey]; + [_fileLogger lt_logData:data]; + [self flushBuffer]; +} + +#pragma mark - Logging + +- (void)logMessage:(DDLogMessage *)logMessage { + // Don't need to check for isOnInternalLoggerQueue, -lt_dataForMessage: will do it for us. + __auto_type data = [_fileLogger lt_dataForMessage:logMessage]; + + if (data.length == 0) { + return; + } + + [data enumerateByteRangesUsingBlock:^(const void * __nonnull bytes, NSRange byteRange, BOOL * __nonnull __unused stop) { + __auto_type bytesLength = byteRange.length; +#ifdef NS_BLOCK_ASSERTIONS + __unused +#endif + __auto_type written = [_buffer write:bytes maxLength:bytesLength]; + NSAssert(written > 0 && (NSUInteger)written == bytesLength, @"Failed to write to memory buffer."); + + _currentBufferSizeBytes += bytesLength; + + if (_currentBufferSizeBytes >= _maxBufferSizeBytes) { + [self lt_sendBufferedDataToFileLogger]; + } + }]; +} + +- (void)flush { + // This method is public. + // We need to execute the rolling on our logging thread/queue. + + __auto_type block = ^{ + @autoreleasepool { + [self lt_sendBufferedDataToFileLogger]; + [self.fileLogger flush]; + } + }; + + // The design of this method is taken from the DDAbstractLogger implementation. + // For extensive documentation please refer to the DDAbstractLogger implementation. + + if ([self.fileLogger isOnInternalLoggerQueue]) { + block(); + } else { + NSAssert(![self.fileLogger isOnGlobalLoggingQueue], @"Core architecture requirement failure"); + dispatch_sync(DDLog.loggingQueue, ^{ + dispatch_sync(self.fileLogger.loggerQueue, block); + }); + } +} + +#pragma mark - Properties + +- (void)setMaxBufferSizeBytes:(NSUInteger)newBufferSizeBytes { + _maxBufferSizeBytes = MIN(newBufferSizeBytes, DDGetMaxBufferSizeBytes()); +} + +#pragma mark - Wrapping + +- (DDFileLogger *)wrapWithBuffer { + return (DDFileLogger *)self; +} + +- (DDFileLogger *)unwrapFromBuffer { + return (DDFileLogger *)self.fileLogger; +} + +#pragma mark - NSProxy + +- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel { + return [self.fileLogger methodSignatureForSelector:sel]; +} + +- (BOOL)respondsToSelector:(SEL)aSelector { + return [self.fileLogger respondsToSelector:aSelector]; +} + +- (void)forwardInvocation:(NSInvocation *)invocation { + [invocation invokeWithTarget:self.fileLogger]; +} + +@end + +@implementation DDFileLogger (Buffering) + +- (instancetype)wrapWithBuffer { + return (DDFileLogger *)[[DDBufferedProxy alloc] initWithFileLogger:self]; +} + +- (instancetype)unwrapFromBuffer { + return self; +} + +@end diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/Extensions/DDMultiFormatter.m b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/Extensions/DDMultiFormatter.m new file mode 100644 index 000000000..078265231 --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/Extensions/DDMultiFormatter.m @@ -0,0 +1,110 @@ +// Software License Agreement (BSD License) +// +// Copyright (c) 2010-2024, Deusty, LLC +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, +// with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Neither the name of Deusty nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission of Deusty, LLC. + +#if !__has_feature(objc_arc) +#error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). +#endif + +#import + +@interface DDMultiFormatter () { + dispatch_queue_t _queue; + NSMutableArray *_formatters; +} + +- (DDLogMessage *)logMessageForLine:(NSString *)line originalMessage:(DDLogMessage *)message; + +@end + + +@implementation DDMultiFormatter + +- (instancetype)init { + self = [super init]; + + if (self) { + _queue = dispatch_queue_create("cocoa.lumberjack.multiformatter", DISPATCH_QUEUE_CONCURRENT); + _formatters = [NSMutableArray new]; + } + + return self; +} + +#pragma mark Processing + +- (NSString *)formatLogMessage:(DDLogMessage *)logMessage { + __block __auto_type line = logMessage->_message; + + dispatch_sync(_queue, ^{ + for (id formatter in self->_formatters) { + __auto_type message = [self logMessageForLine:line originalMessage:logMessage]; + line = [formatter formatLogMessage:message]; + + if (!line) { + break; + } + } + }); + + return line; +} + +- (DDLogMessage *)logMessageForLine:(NSString *)line originalMessage:(DDLogMessage *)message { + DDLogMessage *newMessage = [message copy]; + newMessage->_message = line; + return newMessage; +} + +#pragma mark Formatters + +- (NSArray *)formatters { + __block NSArray *formatters; + + dispatch_sync(_queue, ^{ + formatters = [self->_formatters copy]; + }); + + return formatters; +} + +- (void)addFormatter:(id)formatter { + dispatch_barrier_async(_queue, ^{ + [self->_formatters addObject:formatter]; + }); +} + +- (void)removeFormatter:(id)formatter { + dispatch_barrier_async(_queue, ^{ + [self->_formatters removeObject:formatter]; + }); +} + +- (void)removeAllFormatters { + dispatch_barrier_async(_queue, ^{ + [self->_formatters removeAllObjects]; + }); +} + +- (BOOL)isFormattingWithFormatter:(id)formatter { + __block BOOL hasFormatter; + + dispatch_sync(_queue, ^{ + hasFormatter = [self->_formatters containsObject:formatter]; + }); + + return hasFormatter; +} + +@end diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/PrivacyInfo.xcprivacy b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/PrivacyInfo.xcprivacy new file mode 100644 index 000000000..ec783fe6a --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/PrivacyInfo.xcprivacy @@ -0,0 +1,30 @@ + + + + + NSPrivacyTracking + + NSPrivacyCollectedDataTypes + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + C617.1 + 0A2A.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryDiskSpace + NSPrivacyAccessedAPITypeReasons + + E174.1 + + + + + diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/Supporting Files/CocoaLumberjack.h b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/Supporting Files/CocoaLumberjack.h new file mode 100644 index 000000000..91b240880 --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/Supporting Files/CocoaLumberjack.h @@ -0,0 +1,104 @@ +// Software License Agreement (BSD License) +// +// Copyright (c) 2010-2024, Deusty, LLC +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, +// with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Neither the name of Deusty nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission of Deusty, LLC. + +/** + * Welcome to CocoaLumberjack! + * + * The project page has a wealth of documentation if you have any questions. + * https://github.com/CocoaLumberjack/CocoaLumberjack + * + * If you're new to the project you may wish to read "Getting Started" at: + * Documentation/GettingStarted.md + * + * Otherwise, here is a quick refresher. + * There are three steps to using the macros: + * + * Step 1: + * Import the header in your implementation or prefix file: + * + * #import + * + * Step 2: + * Define your logging level in your implementation file: + * + * // Log levels: off, error, warn, info, verbose + * static const DDLogLevel ddLogLevel = DDLogLevelVerbose; + * + * Step 2 [3rd party frameworks]: + * + * Define your LOG_LEVEL_DEF to a different variable/function than ddLogLevel: + * + * // #undef LOG_LEVEL_DEF // Undefine first only if needed + * #define LOG_LEVEL_DEF myLibLogLevel + * + * Define your logging level in your implementation file: + * + * // Log levels: off, error, warn, info, verbose + * static const DDLogLevel myLibLogLevel = DDLogLevelVerbose; + * + * Step 3: + * Replace your NSLog statements with DDLog statements according to the severity of the message. + * + * NSLog(@"Fatal error, no dohickey found!"); -> DDLogError(@"Fatal error, no dohickey found!"); + * + * DDLog works exactly the same as NSLog. + * This means you can pass it multiple variables just like NSLog. + **/ + +#import + +//! Project version number for CocoaLumberjack. +FOUNDATION_EXPORT double CocoaLumberjackVersionNumber; + +//! Project version string for CocoaLumberjack. +FOUNDATION_EXPORT const unsigned char CocoaLumberjackVersionString[]; + +// Disable legacy macros +#ifndef DD_LEGACY_MACROS + #define DD_LEGACY_MACROS 0 +#endif + +// Core +#import + +// Main macros +#import +#import + +// Capture ASL +#import + +// Loggers +#import + +#import +#import +#import +#import + +// Extensions +#import +#import +#import +#import +#import + +// CLI +#import + +// etc +#import +#import +#import diff --git a/Pods/CocoaLumberjack/Classes/DDLegacyMacros.h b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/Supporting Files/DDLegacyMacros.h similarity index 95% rename from Pods/CocoaLumberjack/Classes/DDLegacyMacros.h rename to Pods/CocoaLumberjack/Sources/CocoaLumberjack/Supporting Files/DDLegacyMacros.h index 46100c135..5289f33bb 100644 --- a/Pods/CocoaLumberjack/Classes/DDLegacyMacros.h +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/Supporting Files/DDLegacyMacros.h @@ -1,6 +1,6 @@ // Software License Agreement (BSD License) // -// Copyright (c) 2010-2016, Deusty, LLC +// Copyright (c) 2010-2024, Deusty, LLC // All rights reserved. // // Redistribution and use of this software in source and binary forms, @@ -61,7 +61,7 @@ Disable legacy macros by importing CocoaLumberjack.h or DDLogMacros.h instead of format : (frmt), ## __VA_ARGS__] #define LOG_MAYBE(async, lvl, flg, ctx, fnct, frmt, ...) \ - do { if(lvl & flg) LOG_MACRO(async, lvl, flg, ctx, nil, fnct, frmt, ##__VA_ARGS__); } while(0) + do { if((lvl & flg) != 0) LOG_MACRO(async, lvl, flg, ctx, nil, fnct, frmt, ##__VA_ARGS__); } while(0) #define LOG_OBJC_MAYBE(async, lvl, flg, ctx, frmt, ...) \ LOG_MAYBE(async, lvl, flg, ctx, __PRETTY_FUNCTION__, frmt, ## __VA_ARGS__) diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/CLIColor.h b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/CLIColor.h new file mode 100644 index 000000000..d702e9c85 --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/CLIColor.h @@ -0,0 +1,54 @@ +// Software License Agreement (BSD License) +// +// Copyright (c) 2010-2024, Deusty, LLC +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, +// with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Neither the name of Deusty nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission of Deusty, LLC. + +#import + +#if TARGET_OS_OSX + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + * This class represents an NSColor replacement for CLI projects that don't link with AppKit + **/ +@interface CLIColor : NSObject + +/** + * Convenience method for creating a `CLIColor` instance from RGBA params + * + * @param red red channel, between 0 and 1 + * @param green green channel, between 0 and 1 + * @param blue blue channel, between 0 and 1 + * @param alpha alpha channel, between 0 and 1 + */ ++ (instancetype)colorWithCalibratedRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; + +/** + * Get the RGBA components from a `CLIColor` + * + * @param red red channel, between 0 and 1 + * @param green green channel, between 0 and 1 + * @param blue blue channel, between 0 and 1 + * @param alpha alpha channel, between 0 and 1 + */ +- (void)getRed:(nullable CGFloat *)red green:(nullable CGFloat *)green blue:(nullable CGFloat *)blue alpha:(nullable CGFloat *)alpha NS_SWIFT_NAME(get(red:green:blue:alpha:)); + +@end + +NS_ASSUME_NONNULL_END + +#endif diff --git a/Pods/CocoaLumberjack/Classes/DDASLLogCapture.h b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDASLLogCapture.h similarity index 80% rename from Pods/CocoaLumberjack/Classes/DDASLLogCapture.h rename to Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDASLLogCapture.h index 64d837039..90226a6d0 100644 --- a/Pods/CocoaLumberjack/Classes/DDASLLogCapture.h +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDASLLogCapture.h @@ -1,6 +1,6 @@ // Software License Agreement (BSD License) // -// Copyright (c) 2010-2016, Deusty, LLC +// Copyright (c) 2010-2024, Deusty, LLC // All rights reserved. // // Redistribution and use of this software in source and binary forms, @@ -13,13 +13,16 @@ // to endorse or promote products derived from this software without specific // prior written permission of Deusty, LLC. -#import "DDASLLogger.h" +#import @protocol DDLogger; +NS_ASSUME_NONNULL_BEGIN + /** * This class provides the ability to capture the ASL (Apple System Logs) */ +API_DEPRECATED("Use DDOSLogger instead", macosx(10.4,10.12), ios(2.0,10.0), watchos(2.0,3.0), tvos(9.0,10.0)) @interface DDASLLogCapture : NSObject /** @@ -39,3 +42,5 @@ @property (class) DDLogLevel captureLevel; @end + +NS_ASSUME_NONNULL_END diff --git a/Pods/CocoaLumberjack/Classes/DDASLLogger.h b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDASLLogger.h similarity index 84% rename from Pods/CocoaLumberjack/Classes/DDASLLogger.h rename to Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDASLLogger.h index 046636df0..8951a8f92 100644 --- a/Pods/CocoaLumberjack/Classes/DDASLLogger.h +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDASLLogger.h @@ -1,6 +1,6 @@ // Software License Agreement (BSD License) // -// Copyright (c) 2010-2016, Deusty, LLC +// Copyright (c) 2010-2024, Deusty, LLC // All rights reserved. // // Redistribution and use of this software in source and binary forms, @@ -20,7 +20,9 @@ #define DD_LEGACY_MACROS 0 #endif -#import "DDLog.h" +#import + +NS_ASSUME_NONNULL_BEGIN // Custom key set on messages sent to ASL extern const char* const kDDASLKeyDDLog; @@ -41,6 +43,7 @@ extern const char* const kDDASLDDLogValue; * However, if you instead choose to use file logging (for faster performance), * you may choose to use a file logger and a tty logger. **/ +API_DEPRECATED("Use DDOSLogger instead", macosx(10.4,10.12), ios(2.0,10.0), watchos(2.0,3.0), tvos(9.0,10.0)) @interface DDASLLogger : DDAbstractLogger /** @@ -48,7 +51,7 @@ extern const char* const kDDASLDDLogValue; * * @return the shared instance */ -@property (class, readonly, strong) DDASLLogger *sharedInstance; +@property (nonatomic, class, readonly, strong) DDASLLogger *sharedInstance; // Inherited from DDAbstractLogger @@ -56,3 +59,5 @@ extern const char* const kDDASLDDLogValue; // - (void)setLogFormatter:(id )formatter; @end + +NS_ASSUME_NONNULL_END diff --git a/Pods/CocoaLumberjack/Classes/DDAbstractDatabaseLogger.h b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDAbstractDatabaseLogger.h similarity index 96% rename from Pods/CocoaLumberjack/Classes/DDAbstractDatabaseLogger.h rename to Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDAbstractDatabaseLogger.h index 208bb223a..e7d0b8cc1 100644 --- a/Pods/CocoaLumberjack/Classes/DDAbstractDatabaseLogger.h +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDAbstractDatabaseLogger.h @@ -1,6 +1,6 @@ // Software License Agreement (BSD License) // -// Copyright (c) 2010-2016, Deusty, LLC +// Copyright (c) 2010-2024, Deusty, LLC // All rights reserved. // // Redistribution and use of this software in source and binary forms, @@ -18,7 +18,9 @@ #define DD_LEGACY_MACROS 0 #endif -#import "DDLog.h" +#import + +NS_ASSUME_NONNULL_BEGIN /** * This class provides an abstract implementation of a database logger. @@ -36,7 +38,7 @@ NSTimeInterval _deleteInterval; BOOL _deleteOnEverySave; - BOOL _saveTimerSuspended; + NSInteger _saveTimerSuspended; NSUInteger _unsavedCount; dispatch_time_t _unsavedTime; dispatch_source_t _saveTimer; @@ -121,3 +123,5 @@ - (void)deleteOldLogEntries; @end + +NS_ASSUME_NONNULL_END diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDAssertMacros.h b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDAssertMacros.h new file mode 100644 index 000000000..de8d8f121 --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDAssertMacros.h @@ -0,0 +1,30 @@ +// Software License Agreement (BSD License) +// +// Copyright (c) 2010-2024, Deusty, LLC +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, +// with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Neither the name of Deusty nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission of Deusty, LLC. + +/** + * NSAssert replacement that will output a log message even when assertions are disabled. + **/ +#define DDAssert(condition, frmt, ...) \ + if (!(condition)) { \ + NSString *description = [NSString stringWithFormat:frmt, ## __VA_ARGS__]; \ + DDLogError(@"%@", description); \ + NSAssert(NO, @"%@", description); \ + } +#define DDAssertCondition(condition) DDAssert(condition, @"Condition not satisfied: %@", @(#condition)) + +/** + * Analog to `DDAssertionFailure` from DDAssert.swift for use in Objective C + */ +#define DDAssertionFailure(frmt, ...) DDAssert(NO, frmt, ##__VA_ARGS__) diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDContextFilterLogFormatter+Deprecated.h b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDContextFilterLogFormatter+Deprecated.h new file mode 100644 index 000000000..3ffc0402c --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDContextFilterLogFormatter+Deprecated.h @@ -0,0 +1,119 @@ +// Software License Agreement (BSD License) +// +// Copyright (c) 2010-2024, Deusty, LLC +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, +// with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Neither the name of Deusty nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission of Deusty, LLC. + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + * This class provides a log formatter that filters log statements from a logging context not on the whitelist. + * @deprecated Use DDContextAllowlistFilterLogFormatter instead. + * + * A log formatter can be added to any logger to format and/or filter its output. + * You can learn more about log formatters here: + * Documentation/CustomFormatters.md + * + * You can learn more about logging context's here: + * Documentation/CustomContext.md + * + * But here's a quick overview / refresher: + * + * Every log statement has a logging context. + * These come from the underlying logging macros defined in DDLog.h. + * The default logging context is zero. + * You can define multiple logging context's for use in your application. + * For example, logically separate parts of your app each have a different logging context. + * Also 3rd party frameworks that make use of Lumberjack generally use their own dedicated logging context. + **/ +__attribute__((deprecated("Use DDContextAllowlistFilterLogFormatter instead"))) +typedef DDContextAllowlistFilterLogFormatter DDContextWhitelistFilterLogFormatter; + +@interface DDContextAllowlistFilterLogFormatter (Deprecated) + +/** + * Add a context to the whitelist + * @deprecated Use -addToAllowlist: instead. + * + * @param loggingContext the context + */ +- (void)addToWhitelist:(NSInteger)loggingContext __attribute__((deprecated("Use -addToAllowlist: instead"))); + +/** + * Remove context from whitelist + * @deprecated Use -removeFromAllowlist: instead. + * + * @param loggingContext the context + */ +- (void)removeFromWhitelist:(NSInteger)loggingContext __attribute__((deprecated("Use -removeFromAllowlist: instead"))); + +/** + * Return the whitelist + * @deprecated Use allowlist instead. + */ +@property (nonatomic, readonly, copy) NSArray *whitelist __attribute__((deprecated("Use allowlist instead"))); + +/** + * Check if a context is on the whitelist + * @deprecated Use -isOnAllowlist: instead. + * + * @param loggingContext the context + */ +- (BOOL)isOnWhitelist:(NSInteger)loggingContext __attribute__((deprecated("Use -isOnAllowlist: instead"))); + +@end + + +/** + * This class provides a log formatter that filters log statements from a logging context on the blacklist. + * @deprecated Use DDContextDenylistFilterLogFormatter instead. + **/ +__attribute__((deprecated("Use DDContextDenylistFilterLogFormatter instead"))) +typedef DDContextDenylistFilterLogFormatter DDContextBlacklistFilterLogFormatter; + +@interface DDContextDenylistFilterLogFormatter (Deprecated) + +/** + * Add a context to the blacklist + * @deprecated Use -addToDenylist: instead. + * + * @param loggingContext the context + */ +- (void)addToBlacklist:(NSInteger)loggingContext __attribute__((deprecated("Use -addToDenylist: instead"))); + +/** + * Remove context from blacklist + * @deprecated Use -removeFromDenylist: instead. + * + * @param loggingContext the context + */ +- (void)removeFromBlacklist:(NSInteger)loggingContext __attribute__((deprecated("Use -removeFromDenylist: instead"))); + +/** + * Return the blacklist + * @deprecated Use denylist instead. + */ +@property (readonly, copy) NSArray *blacklist __attribute__((deprecated("Use denylist instead"))); + +/** + * Check if a context is on the blacklist + * @deprecated Use -isOnDenylist: instead. + * + * @param loggingContext the context + */ +- (BOOL)isOnBlacklist:(NSInteger)loggingContext __attribute__((deprecated("Use -isOnDenylist: instead"))); + +@end + +NS_ASSUME_NONNULL_END diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDContextFilterLogFormatter.h b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDContextFilterLogFormatter.h new file mode 100644 index 000000000..c83a689aa --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDContextFilterLogFormatter.h @@ -0,0 +1,117 @@ +// Software License Agreement (BSD License) +// +// Copyright (c) 2010-2024, Deusty, LLC +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, +// with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Neither the name of Deusty nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission of Deusty, LLC. + +#import + +// Disable legacy macros +#ifndef DD_LEGACY_MACROS + #define DD_LEGACY_MACROS 0 +#endif + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + * This class provides a log formatter that filters log statements from a logging context not on the allowlist. + * + * A log formatter can be added to any logger to format and/or filter its output. + * You can learn more about log formatters here: + * Documentation/CustomFormatters.md + * + * You can learn more about logging context's here: + * Documentation/CustomContext.md + * + * But here's a quick overview / refresher: + * + * Every log statement has a logging context. + * These come from the underlying logging macros defined in DDLog.h. + * The default logging context is zero. + * You can define multiple logging context's for use in your application. + * For example, logically separate parts of your app each have a different logging context. + * Also 3rd party frameworks that make use of Lumberjack generally use their own dedicated logging context. + **/ +@interface DDContextAllowlistFilterLogFormatter : NSObject + +/** + * Designated default initializer + */ +- (instancetype)init NS_DESIGNATED_INITIALIZER; + +/** + * Add a context to the allowlist + * + * @param loggingContext the context + */ +- (void)addToAllowlist:(NSInteger)loggingContext; + +/** + * Remove context from allowlist + * + * @param loggingContext the context + */ +- (void)removeFromAllowlist:(NSInteger)loggingContext; + +/** + * Return the allowlist + */ +@property (nonatomic, readonly, copy) NSArray *allowlist; + +/** + * Check if a context is on the allowlist + * + * @param loggingContext the context + */ +- (BOOL)isOnAllowlist:(NSInteger)loggingContext; + +@end + + +/** + * This class provides a log formatter that filters log statements from a logging context on the denylist. + **/ +@interface DDContextDenylistFilterLogFormatter : NSObject + +- (instancetype)init NS_DESIGNATED_INITIALIZER; + +/** + * Add a context to the denylist + * + * @param loggingContext the context + */ +- (void)addToDenylist:(NSInteger)loggingContext; + +/** + * Remove context from denylist + * + * @param loggingContext the context + */ +- (void)removeFromDenylist:(NSInteger)loggingContext; + +/** + * Return the denylist + */ +@property (readonly, copy) NSArray *denylist; + +/** + * Check if a context is on the denylist + * + * @param loggingContext the context + */ +- (BOOL)isOnDenylist:(NSInteger)loggingContext; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDDispatchQueueLogFormatter.h b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDDispatchQueueLogFormatter.h new file mode 100644 index 000000000..90d32d4dd --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDDispatchQueueLogFormatter.h @@ -0,0 +1,223 @@ +// Software License Agreement (BSD License) +// +// Copyright (c) 2010-2024, Deusty, LLC +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, +// with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Neither the name of Deusty nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission of Deusty, LLC. + +#import + +// Disable legacy macros +#ifndef DD_LEGACY_MACROS + #define DD_LEGACY_MACROS 0 +#endif + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + * Log formatter mode + */ +__attribute__((deprecated("DDDispatchQueueLogFormatter is always shareable"))) +typedef NS_ENUM(NSUInteger, DDDispatchQueueLogFormatterMode){ + /** + * This is the default option, means the formatter can be reused between multiple loggers and therefore is thread-safe. + * There is, of course, a performance cost for the thread-safety + */ + DDDispatchQueueLogFormatterModeShareble = 0, + /** + * If the formatter will only be used by a single logger, then the thread-safety can be removed + * @note: there is an assert checking if the formatter is added to multiple loggers and the mode is non-shareble + */ + DDDispatchQueueLogFormatterModeNonShareble, +}; + +/** + * Quality of Service names. + * + * Since macOS 10.10 and iOS 8.0, pthreads, dispatch queues and NSOperations express their + * scheduling priority by using an abstract classification called Quality of Service (QOS). + * + * This formatter will add a representation of this QOS in the log message by using those + * string constants. + * For example: + * + * `2011-10-17 20:21:45.435 AppName[19928:5207 (QOS:DF)] Your log message here` + * + * Where QOS is one of: + * `- UI = User Interactive` + * `- IN = User Initiated` + * `- DF = Default` + * `- UT = Utility` + * `- BG = Background` + * `- UN = Unspecified` + * + * Note: QOS will be absent in the log messages if running on OS versions that don't support it. + **/ +typedef NSString * DDQualityOfServiceName NS_STRING_ENUM; + +FOUNDATION_EXPORT DDQualityOfServiceName const DDQualityOfServiceUserInteractive NS_SWIFT_NAME(DDQualityOfServiceName.userInteractive) API_AVAILABLE(macos(10.10), ios(8.0)); +FOUNDATION_EXPORT DDQualityOfServiceName const DDQualityOfServiceUserInitiated NS_SWIFT_NAME(DDQualityOfServiceName.userInitiated) API_AVAILABLE(macos(10.10), ios(8.0)); +FOUNDATION_EXPORT DDQualityOfServiceName const DDQualityOfServiceDefault NS_SWIFT_NAME(DDQualityOfServiceName.default) API_AVAILABLE(macos(10.10), ios(8.0)); +FOUNDATION_EXPORT DDQualityOfServiceName const DDQualityOfServiceUtility NS_SWIFT_NAME(DDQualityOfServiceName.utility) API_AVAILABLE(macos(10.10), ios(8.0)); +FOUNDATION_EXPORT DDQualityOfServiceName const DDQualityOfServiceBackground NS_SWIFT_NAME(DDQualityOfServiceName.background) API_AVAILABLE(macos(10.10), ios(8.0)); +FOUNDATION_EXPORT DDQualityOfServiceName const DDQualityOfServiceUnspecified NS_SWIFT_NAME(DDQualityOfServiceName.unspecified) API_AVAILABLE(macos(10.10), ios(8.0)); + +/** + * This class provides a log formatter that prints the dispatch_queue label instead of the mach_thread_id. + * + * A log formatter can be added to any logger to format and/or filter its output. + * You can learn more about log formatters here: + * Documentation/CustomFormatters.md + * + * A typical `NSLog` (or `DDTTYLogger`) prints detailed info as `[:]`. + * For example: + * + * `2011-10-17 20:21:45.435 AppName[19928:5207] Your log message here` + * + * Where: + * `- 19928 = process id` + * `- 5207 = thread id (mach_thread_id printed in hex)` + * + * When using grand central dispatch (GCD), this information is less useful. + * This is because a single serial dispatch queue may be run on any thread from an internally managed thread pool. + * For example: + * + * `2011-10-17 20:32:31.111 AppName[19954:4d07] Message from my_serial_dispatch_queue` + * `2011-10-17 20:32:31.112 AppName[19954:5207] Message from my_serial_dispatch_queue` + * `2011-10-17 20:32:31.113 AppName[19954:2c55] Message from my_serial_dispatch_queue` + * + * This formatter allows you to replace the standard `[box:info]` with the dispatch_queue name. + * For example: + * + * `2011-10-17 20:32:31.111 AppName[img-scaling] Message from my_serial_dispatch_queue` + * `2011-10-17 20:32:31.112 AppName[img-scaling] Message from my_serial_dispatch_queue` + * `2011-10-17 20:32:31.113 AppName[img-scaling] Message from my_serial_dispatch_queue` + * + * If the dispatch_queue doesn't have a set name, then it falls back to the thread name. + * If the current thread doesn't have a set name, then it falls back to the mach_thread_id in hex (like normal). + * + * Note: If manually creating your own background threads (via `NSThread/alloc/init` or `NSThread/detachNeThread`), + * you can use `[[NSThread currentThread] setName:(NSString *)]`. + **/ +@interface DDDispatchQueueLogFormatter : NSObject + +/** + * Standard init method. + * Configure using properties as desired. + **/ +- (instancetype)init NS_DESIGNATED_INITIALIZER; + +/** + * Initializer with ability to set the queue mode + * + * @param mode choose between DDDispatchQueueLogFormatterModeShareble and DDDispatchQueueLogFormatterModeNonShareble, depending if the formatter is shared between several loggers or not + */ +- (instancetype)initWithMode:(DDDispatchQueueLogFormatterMode)mode __attribute__((deprecated("DDDispatchQueueLogFormatter is always shareable"))); + +/** + * The minQueueLength restricts the minimum size of the [detail box]. + * If the minQueueLength is set to 0, there is no restriction. + * + * For example, say a dispatch_queue has a label of "diskIO": + * + * If the minQueueLength is 0: [diskIO] + * If the minQueueLength is 4: [diskIO] + * If the minQueueLength is 5: [diskIO] + * If the minQueueLength is 6: [diskIO] + * If the minQueueLength is 7: [diskIO ] + * If the minQueueLength is 8: [diskIO ] + * + * The default minQueueLength is 0 (no minimum, so [detail box] won't be padded). + * + * If you want every [detail box] to have the exact same width, + * set both minQueueLength and maxQueueLength to the same value. + **/ +@property (assign, atomic) NSUInteger minQueueLength; + +/** + * The maxQueueLength restricts the number of characters that will be inside the [detail box]. + * If the maxQueueLength is 0, there is no restriction. + * + * For example, say a dispatch_queue has a label of "diskIO": + * + * If the maxQueueLength is 0: [diskIO] + * If the maxQueueLength is 4: [disk] + * If the maxQueueLength is 5: [diskI] + * If the maxQueueLength is 6: [diskIO] + * If the maxQueueLength is 7: [diskIO] + * If the maxQueueLength is 8: [diskIO] + * + * The default maxQueueLength is 0 (no maximum, so [detail box] won't be truncated). + * + * If you want every [detail box] to have the exact same width, + * set both minQueueLength and maxQueueLength to the same value. + **/ +@property (assign, atomic) NSUInteger maxQueueLength; + +/** + * Sometimes queue labels have long names like "com.apple.main-queue", + * but you'd prefer something shorter like simply "main". + * + * This method allows you to set such preferred replacements. + * The above example is set by default. + * + * To remove/undo a previous replacement, invoke this method with nil for the 'shortLabel' parameter. + **/ +- (nullable NSString *)replacementStringForQueueLabel:(NSString *)longLabel; + +/** + * See the `replacementStringForQueueLabel:` description + */ +- (void)setReplacementString:(nullable NSString *)shortLabel forQueueLabel:(NSString *)longLabel; + +@end + +/** + * Category on `DDDispatchQueueLogFormatter` to make method declarations easier to extend/modify + **/ +@interface DDDispatchQueueLogFormatter (OverridableMethods) + +/** + * Date formatter default configuration + */ +- (void)configureDateFormatter:(NSDateFormatter *)dateFormatter; + +/** + * Formatter method to transfrom from date to string + */ +- (NSString *)stringFromDate:(NSDate *)date; + +/** + * Method to compute the queue thread label + */ +- (NSString *)queueThreadLabelForLogMessage:(DDLogMessage *)logMessage; + +@end + +#pragma mark - DDAtomicCountable + +__attribute__((deprecated("DDAtomicCountable is useless since DDDispatchQueueLogFormatter is always shareable now"))) +@protocol DDAtomicCountable + +- (instancetype)initWithDefaultValue:(int32_t)defaultValue; +- (int32_t)increment; +- (int32_t)decrement; +- (int32_t)value; + +@end + +__attribute__((deprecated("DDAtomicCountable is deprecated"))) +@interface DDAtomicCounter: NSObject +@end + +NS_ASSUME_NONNULL_END diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDFileLogger+Buffering.h b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDFileLogger+Buffering.h new file mode 100644 index 000000000..cbb90f082 --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDFileLogger+Buffering.h @@ -0,0 +1,27 @@ +// Software License Agreement (BSD License) +// +// Copyright (c) 2010-2024, Deusty, LLC +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, +// with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Neither the name of Deusty nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission of Deusty, LLC. + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface DDFileLogger (Buffering) + +- (instancetype)wrapWithBuffer; +- (instancetype)unwrapFromBuffer; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDFileLogger.h b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDFileLogger.h new file mode 100644 index 000000000..ffd39365c --- /dev/null +++ b/Pods/CocoaLumberjack/Sources/CocoaLumberjack/include/CocoaLumberjack/DDFileLogger.h @@ -0,0 +1,571 @@ +// Software License Agreement (BSD License) +// +// Copyright (c) 2010-2024, Deusty, LLC +// All rights reserved. +// +// Redistribution and use of this software in source and binary forms, +// with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Neither the name of Deusty nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission of Deusty, LLC. + +// Disable legacy macros +#ifndef DD_LEGACY_MACROS + #define DD_LEGACY_MACROS 0 +#endif + +#import + +@class DDLogFileInfo; + +NS_ASSUME_NONNULL_BEGIN + +/** + * This class provides a logger to write log statements to a file. + **/ + + +// Default configuration and safety/sanity values. +// +// maximumFileSize -> kDDDefaultLogMaxFileSize +// rollingFrequency -> kDDDefaultLogRollingFrequency +// maximumNumberOfLogFiles -> kDDDefaultLogMaxNumLogFiles +// logFilesDiskQuota -> kDDDefaultLogFilesDiskQuota +// +// You should carefully consider the proper configuration values for your application. + +extern unsigned long long const kDDDefaultLogMaxFileSize; +extern NSTimeInterval const kDDDefaultLogRollingFrequency; +extern NSUInteger const kDDDefaultLogMaxNumLogFiles; +extern unsigned long long const kDDDefaultLogFilesDiskQuota; + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + +/// The serializer is responsible for turning a log message into binary for writing into a file. +/// It allows storing log messages in a non-text format. +/// The serialier should not be used for filtering or formatting messages! +/// Also, it must be fast! +@protocol DDFileLogMessageSerializer +@required + +/// Returns the binary representation of the message. +/// - Parameter message: The formatted log message to serialize. +// + +/// Returns the binary representation of the message. +/// - Parameters: +/// - string: The string to serialize. Usually, this is the formatted message, but it can also be e.g. a log file header. +/// - message: The message which represents the `string`. This is null, if `string` is e.g. a log file header. +/// - Note: The `message` parameter should not be used for formatting! It should simply be used to extract the necessary metadata for serializing. +- (NSData *)dataForString:(NSString *)string + originatingFromMessage:(nullable DDLogMessage *)message NS_SWIFT_NAME(dataForString(_:originatingFrom:)); + +@end + +/// The (default) plain text message serializer. +@interface DDFileLogPlainTextMessageSerializer : NSObject + +- (instancetype)init; + +@end + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +@class DDFileLogger; +/** + * The LogFileManager protocol is designed to allow you to control all aspects of your log files. + * + * The primary purpose of this is to allow you to do something with the log files after they have been rolled. + * Perhaps you want to compress them to save disk space. + * Perhaps you want to upload them to an FTP server. + * Perhaps you want to run some analytics on the file. + * + * A default LogFileManager is, of course, provided. + * The default LogFileManager simply deletes old log files according to the maximumNumberOfLogFiles property. + * + * This protocol provides various methods to fetch the list of log files. + * + * There are two variants: sorted and unsorted. + * If sorting is not necessary, the unsorted variant is obviously faster. + * The sorted variant will return an array sorted by when the log files were created, + * with the most recently created log file at index 0, and the oldest log file at the end of the array. + * + * You can fetch only the log file paths (full path including name), log file names (name only), + * or an array of `DDLogFileInfo` objects. + * The `DDLogFileInfo` class is documented below, and provides a handy wrapper that + * gives you easy access to various file attributes such as the creation date or the file size. + */ +@protocol DDLogFileManager +@required + +// Public properties + +/** + * The maximum number of archived log files to keep on disk. + * For example, if this property is set to 3, + * then the LogFileManager will only keep 3 archived log files (plus the current active log file) on disk. + * Once the active log file is rolled/archived, then the oldest of the existing 3 rolled/archived log files is deleted. + * + * You may optionally disable this option by setting it to zero. + **/ +@property (readwrite, assign, atomic) NSUInteger maximumNumberOfLogFiles; + +/** + * The maximum space that logs can take. On rolling logfile all old log files that exceed logFilesDiskQuota will + * be deleted. + * + * You may optionally disable this option by setting it to zero. + **/ +@property (readwrite, assign, atomic) unsigned long long logFilesDiskQuota; + +// Public methods + +/** + * Returns the logs directory (path) + */ +@property (nonatomic, readonly, copy) NSString *logsDirectory; + +/** + * Returns an array of `NSString` objects, + * each of which is the filePath to an existing log file on disk. + **/ +@property (nonatomic, readonly, strong) NSArray *unsortedLogFilePaths; + +/** + * Returns an array of `NSString` objects, + * each of which is the fileName of an existing log file on disk. + **/ +@property (nonatomic, readonly, strong) NSArray *unsortedLogFileNames; + +/** + * Returns an array of `DDLogFileInfo` objects, + * each representing an existing log file on disk, + * and containing important information about the log file such as it's modification date and size. + **/ +@property (nonatomic, readonly, strong) NSArray *unsortedLogFileInfos; + +/** + * Just like the `unsortedLogFilePaths` method, but sorts the array. + * The items in the array are sorted by creation date. + * The first item in the array will be the most recently created log file. + **/ +@property (nonatomic, readonly, strong) NSArray *sortedLogFilePaths; + +/** + * Just like the `unsortedLogFileNames` method, but sorts the array. + * The items in the array are sorted by creation date. + * The first item in the array will be the most recently created log file. + **/ +@property (nonatomic, readonly, strong) NSArray *sortedLogFileNames; + +/** + * Just like the `unsortedLogFileInfos` method, but sorts the array. + * The items in the array are sorted by creation date. + * The first item in the array will be the most recently created log file. + **/ +@property (nonatomic, readonly, strong) NSArray *sortedLogFileInfos; + +// Private methods (only to be used by DDFileLogger) + +/** + * Generates a new unique log file path, and creates the corresponding log file. + * This method is executed directly on the file logger's internal queue. + * The file has to exist by the time the method returns. + **/ +- (nullable NSString *)createNewLogFileWithError:(NSError **)error; + +@optional + +/// The log message serializer. +@property (nonatomic, readonly, strong) id logMessageSerializer; + +/// Manually perform a cleanup of the log files managed by this manager. +/// This can be called from any queue! +- (BOOL)cleanupLogFilesWithError:(NSError **)error; + +// MARK: Private methods (only to be used by DDFileLogger) + +// MARK: Notifications from DDFileLogger +/// Called when the log file manager was added to a file logger. +/// This should be used to make the manager "active" - like starting internal timers etc. +/// Executed on global queue with default priority. +/// - Parameter fileLogger: The file logger this manager was added to. +/// - Important: The manager **must not** keep a strong reference to `fileLogger` or a retain cycle will be created! +- (void)didAddToFileLogger:(DDFileLogger *)fileLogger; + +/// Called when a log file was archived. Executed on global queue with default priority. +/// @param logFilePath The path to the log file that was archived. +/// @param wasRolled Whether or not the archiving happend after rolling the log file. +- (void)didArchiveLogFile:(NSString *)logFilePath wasRolled:(BOOL)wasRolled NS_SWIFT_NAME(didArchiveLogFile(atPath:wasRolled:)); + +// MARK: Deprecated APIs +/// Creates a new log file ignoring any errors. Deprecated in favor of `-createNewLogFileWithError:`. +/// Will only be called if `-createNewLogFileWithError:` is not implemented. +- (nullable NSString *)createNewLogFile __attribute__((deprecated("Use -createNewLogFileWithError:"))) NS_SWIFT_UNAVAILABLE("Use -createNewLogFileWithError:"); + +/// Called when a log file was archived. Executed on global queue with default priority. +- (void)didArchiveLogFile:(NSString *)logFilePath NS_SWIFT_NAME(didArchiveLogFile(atPath:)) __attribute__((deprecated("Use -didArchiveLogFile:wasRolled:"))); + +/// Called when the roll action was executed and the log was archived. Executed on global queue with default priority. +- (void)didRollAndArchiveLogFile:(NSString *)logFilePath NS_SWIFT_NAME(didRollAndArchiveLogFile(atPath:)) __attribute__((deprecated("Use -didArchiveLogFile:wasRolled:"))); + +@end + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * Default log file manager. + * + * All log files are placed inside the logsDirectory. + * If a specific logsDirectory isn't specified, the default directory is used. + * On Mac, this is in `~/Library/Logs/`. + * On iPhone, this is in `~/Library/Caches/Logs`. + * + * Log files are named `"