@greenpandastudios/aug-cli 0.19.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -6
- package/THIRD_PARTY_NOTICES.md +4 -0
- package/bin/aug.mjs +12 -2
- package/docs/about.md +27 -0
- package/docs/api/crypto.md +103 -69
- package/docs/api/io.md +35 -33
- package/docs/api/json.md +3 -3
- package/docs/api/memory.md +23 -19
- package/docs/api/time.md +10 -9
- package/docs/api/web.md +33 -38
- package/docs/assets/benchmarks/execution.svg +774 -637
- package/docs/assets/benchmarks/http.svg +278 -249
- package/docs/assets/benchmarks/improvements.svg +66 -66
- package/docs/assets/benchmarks/kernels-mobile.svg +1 -0
- package/docs/assets/benchmarks/kernels.svg +1 -0
- package/docs/assets/benchmarks/memory.svg +153 -153
- package/docs/benchmark-results.json +227089 -90363
- package/docs/compatibility.md +8 -8
- package/docs/contributing-benchmarks.md +68 -0
- package/docs/dev-containers.md +88 -0
- package/docs/dgx-consumers.json +122 -0
- package/docs/dgx-gyms.json +784 -0
- package/docs/dgx-kernels.json +1170 -0
- package/docs/dgx-performance.json +227849 -0
- package/docs/dgx-spark.md +64 -0
- package/docs/diagnostics.md +15 -5
- package/docs/docker.md +173 -12
- package/docs/editor.md +35 -0
- package/docs/example-projects.json +238 -24
- package/docs/examples/approved-design/counters.md +34 -126
- package/docs/examples/approved-design/dependencies/august/0.21.0/io/contracts.md +178 -0
- package/docs/examples/approved-design/domain/app.md +13 -77
- package/docs/examples/approved-design/domain/export.md +5 -19
- package/docs/examples/approved-design/domain/models.md +4 -23
- package/docs/examples/approved-design/domain/numbers.md +24 -114
- package/docs/examples/approved-design/index.md +16 -7
- package/docs/examples/approved-design/main.md +19 -96
- package/docs/examples/benchmark/index.md +6 -5
- package/docs/examples/benchmark/main.md +7 -35
- package/docs/examples/calls-benchmark/index.md +36 -0
- package/docs/examples/calls-benchmark/main.md +78 -0
- package/docs/examples/calls-benchmark/operations.md +60 -0
- package/docs/examples/cli-args/index.md +6 -5
- package/docs/examples/cli-args/main.md +6 -31
- package/docs/examples/collections/index.md +6 -5
- package/docs/examples/collections/main.md +7 -35
- package/docs/examples/collections-benchmark/index.md +6 -5
- package/docs/examples/collections-benchmark/main.md +7 -35
- package/docs/examples/cpu-benchmark/index.md +6 -5
- package/docs/examples/cpu-benchmark/main.md +5 -24
- package/docs/examples/developer-workflow/calculator.md +39 -186
- package/docs/examples/developer-workflow/dependencies/august/0.21.0/io/contracts.md +178 -0
- package/docs/examples/developer-workflow/index.md +16 -7
- package/docs/examples/developer-workflow/logging/console.md +10 -56
- package/docs/examples/developer-workflow/logging/export.md +4 -14
- package/docs/examples/developer-workflow/logging/logger.md +7 -43
- package/docs/examples/developer-workflow/main.md +17 -69
- package/docs/examples/drop/index.md +6 -5
- package/docs/examples/drop/main.md +7 -27
- package/docs/examples/drop/resource.md +7 -30
- package/docs/examples/errors/errors.md +7 -27
- package/docs/examples/errors/index.md +6 -5
- package/docs/examples/errors/main.md +7 -28
- package/docs/examples/errors-benchmark/index.md +36 -0
- package/docs/examples/errors-benchmark/main.md +92 -0
- package/docs/examples/errors-benchmark/operations.md +65 -0
- package/docs/examples/ffi/index.md +6 -5
- package/docs/examples/ffi/main.md +6 -20
- package/docs/examples/ffi/native.md +8 -34
- package/docs/examples/float-benchmark/index.md +35 -0
- package/docs/examples/float-benchmark/main.md +75 -0
- package/docs/examples/generic-di/dependencies/august/0.21.0/io/contracts.md +178 -0
- package/docs/examples/generic-di/index.md +6 -5
- package/docs/examples/generic-di/main.md +9 -39
- package/docs/examples/generic-di/types.md +23 -92
- package/docs/examples/generics/index.md +6 -5
- package/docs/examples/generics/main.md +10 -47
- package/docs/examples/generics/types.md +25 -100
- package/docs/examples/hello/app/export.md +4 -12
- package/docs/examples/hello/app/greeter.md +13 -91
- package/docs/examples/hello/dependencies/august/0.21.0/io/contracts.md +178 -0
- package/docs/examples/hello/index.md +17 -6
- package/docs/examples/hello/logging/console.md +10 -54
- package/docs/examples/hello/logging/export.md +4 -14
- package/docs/examples/hello/logging/logger.md +7 -45
- package/docs/examples/hello/main.md +9 -39
- package/docs/examples/http-benchmark/index.md +6 -5
- package/docs/examples/http-benchmark/main.md +6 -20
- package/docs/examples/http-benchmark/routes.md +9 -31
- package/docs/examples/index.md +63 -29
- package/docs/examples/interceptors/app.md +20 -139
- package/docs/examples/interceptors/dependencies/august/0.21.0/io/contracts.md +178 -0
- package/docs/examples/interceptors/index.md +6 -5
- package/docs/examples/interceptors/interceptors.md +24 -148
- package/docs/examples/interceptors/logging.md +13 -76
- package/docs/examples/interceptors/main.md +10 -65
- package/docs/examples/json-benchmark/data.md +4 -20
- package/docs/examples/json-benchmark/dependencies/packages/@git/url_2d3c37c690c0fa115be1/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/contracts.md +67 -0
- package/docs/examples/json-benchmark/index.md +7 -5
- package/docs/examples/json-benchmark/main-yaml.md +20 -0
- package/docs/examples/json-benchmark/main.md +10 -49
- package/docs/examples/list-benchmark/index.md +35 -0
- package/docs/examples/list-benchmark/main.md +78 -0
- package/docs/examples/map-churn-benchmark/index.md +35 -0
- package/docs/examples/map-churn-benchmark/main.md +106 -0
- package/docs/examples/native-blake3/dependencies/packages/@greenpandastudios/aug-blake3/0.1.3/api.md +104 -0
- package/docs/examples/native-blake3/dependencies/packages/@greenpandastudios/aug-blake3/0.1.3/contracts.md +54 -0
- package/docs/examples/native-blake3/dependencies/packages/@greenpandastudios/aug-blake3/0.1.3/native.abi-json.md +48 -0
- package/docs/examples/native-blake3/hashing.md +93 -0
- package/docs/examples/native-blake3/index.md +38 -0
- package/docs/examples/native-blake3/main.md +73 -0
- package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/api.md +406 -0
- package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/bindings.md +51 -0
- package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/contracts.md +63 -0
- package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/native.abi-json.md +161 -0
- package/docs/examples/native-pytorch/index.md +38 -0
- package/docs/examples/native-pytorch/main.md +73 -0
- package/docs/examples/native-pytorch/tensors.md +123 -0
- package/docs/examples/native-sqlite/database.md +116 -0
- package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/api.md +284 -0
- package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/bindings.md +51 -0
- package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/contracts.md +75 -0
- package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/native.abi-json.md +119 -0
- package/docs/examples/native-sqlite/index.md +38 -0
- package/docs/examples/native-sqlite/main.md +73 -0
- package/docs/examples/native-zlib/compression.md +99 -0
- package/docs/examples/native-zlib/dependencies/packages/@greenpandastudios/aug-zlib/0.1.3/api.md +153 -0
- package/docs/examples/native-zlib/dependencies/packages/@greenpandastudios/aug-zlib/0.1.3/contracts.md +54 -0
- package/docs/examples/native-zlib/dependencies/packages/@greenpandastudios/aug-zlib/0.1.3/native.abi-json.md +76 -0
- package/docs/examples/native-zlib/index.md +38 -0
- package/docs/examples/native-zlib/main.md +78 -0
- package/docs/examples/new-syntax/console.md +10 -52
- package/docs/examples/new-syntax/dependencies/august/0.21.0/io/contracts.md +178 -0
- package/docs/examples/new-syntax/greeter.md +13 -71
- package/docs/examples/new-syntax/index.md +6 -5
- package/docs/examples/new-syntax/logger.md +7 -43
- package/docs/examples/new-syntax/main.md +10 -53
- package/docs/examples/new-syntax/math.md +6 -24
- package/docs/examples/oidc-login/client/contracts.md +10 -61
- package/docs/examples/oidc-login/client/endpoints.md +32 -154
- package/docs/examples/oidc-login/client/export.md +5 -23
- package/docs/examples/oidc-login/client/login.md +234 -344
- package/docs/examples/oidc-login/client/logout.md +38 -143
- package/docs/examples/oidc-login/client/protocol.md +183 -304
- package/docs/examples/oidc-login/client/session.md +41 -149
- package/docs/examples/oidc-login/client/views.md +13 -58
- package/docs/examples/oidc-login/common/export.md +6 -26
- package/docs/examples/oidc-login/common/headers.md +42 -72
- package/docs/examples/oidc-login/common/keys.md +40 -164
- package/docs/examples/oidc-login/common/settings.md +24 -40
- package/docs/examples/oidc-login/common/views.md +7 -28
- package/docs/examples/oidc-login/dependencies/packages/@git/url_0eb7c89453c87681ed15/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/store.md +205 -0
- package/docs/examples/oidc-login/dependencies/packages/@git/url_2d3c37c690c0fa115be1/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/contracts.md +67 -0
- package/docs/examples/oidc-login/dependencies/packages/@git/url_897efafd565158fc4908/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/contracts.md +267 -0
- package/docs/examples/oidc-login/dependencies/packages/@git/url_9ef654c66d34ab8f5527/0.0.0-git.b14a0f9aa41f1ce58bd51133bcdc424033e40d40/contracts.md +415 -0
- package/docs/examples/oidc-login/dependencies/packages/@git/url_9ef654c66d34ab8f5527/0.0.0-git.b14a0f9aa41f1ce58bd51133bcdc424033e40d40/jose.md +271 -0
- package/docs/examples/oidc-login/dependencies/packages/@git/url_c092cd151499c4e1d8a1/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/contracts.md +89 -0
- package/docs/examples/oidc-login/index.md +8 -7
- package/docs/examples/oidc-login/main-yaml.md +7 -0
- package/docs/examples/oidc-login/main.md +26 -153
- package/docs/examples/oidc-login/provider/authorization.md +232 -275
- package/docs/examples/oidc-login/provider/contracts.md +24 -146
- package/docs/examples/oidc-login/provider/credentials.md +24 -57
- package/docs/examples/oidc-login/provider/discovery.md +48 -122
- package/docs/examples/oidc-login/provider/export.md +11 -37
- package/docs/examples/oidc-login/provider/token.md +159 -237
- package/docs/examples/oidc-login/provider/userinfo.md +47 -102
- package/docs/examples/oidc-login/provider/views.md +13 -53
- package/docs/examples/ownership/counter.md +17 -63
- package/docs/examples/ownership/index.md +6 -5
- package/docs/examples/ownership/main.md +7 -30
- package/docs/examples/ownership-transfer/dependencies/august/0.21.0/io/contracts.md +178 -0
- package/docs/examples/ownership-transfer/index.md +6 -5
- package/docs/examples/ownership-transfer/main.md +10 -52
- package/docs/examples/ownership-transfer/resource.md +15 -67
- package/docs/examples/packages-app/dependencies/packages/@example/aug-math/0.1.0/arithmetic.md +12 -50
- package/docs/examples/packages-app/index.md +7 -6
- package/docs/examples/packages-app/main.md +7 -25
- package/docs/examples/packages-math/aug-package-json.md +1 -1
- package/docs/examples/packages-math/index.md +7 -6
- package/docs/examples/packages-math/src/arithmetic.md +12 -50
- package/docs/examples/packages-math/src/export.md +4 -12
- package/docs/examples/records-benchmark/data.md +55 -0
- package/docs/examples/records-benchmark/index.md +36 -0
- package/docs/examples/records-benchmark/main.md +85 -0
- package/docs/examples/startup-benchmark/index.md +6 -5
- package/docs/examples/startup-benchmark/main.md +5 -17
- package/docs/examples/strings-benchmark/index.md +35 -0
- package/docs/examples/strings-benchmark/main.md +76 -0
- package/docs/examples/tasks-benchmark/index.md +36 -0
- package/docs/examples/tasks-benchmark/main.md +89 -0
- package/docs/examples/tasks-benchmark/operations.md +58 -0
- package/docs/examples/visibility/counter.md +19 -67
- package/docs/examples/visibility/index.md +6 -5
- package/docs/examples/visibility/main.md +7 -31
- package/docs/examples/weather-api/forecasts.md +168 -0
- package/docs/examples/weather-api/index.md +42 -0
- package/docs/examples/weather-api/main-yaml.md +21 -0
- package/docs/examples/weather-api/main.md +65 -0
- package/docs/examples.json +10 -0
- package/docs/getting-started.md +105 -2
- package/docs/grammar.md +7 -5
- package/docs/guides/change-a-module.md +64 -0
- package/docs/guides/index.md +27 -0
- package/docs/gym-results.json +784 -0
- package/docs/implementation-map.md +6 -0
- package/docs/index.md +51 -29
- package/docs/kernel-results.json +1170 -0
- package/docs/language-conformance.md +7 -1
- package/docs/language-constructs.md +30 -22
- package/docs/language-design-audit.md +1 -1
- package/docs/learn/data-and-errors.md +77 -0
- package/docs/learn/index.md +30 -0
- package/docs/learn/modules-and-dependencies.md +73 -0
- package/docs/learn/state-and-tests.md +71 -0
- package/docs/learn/values-and-functions.md +62 -0
- package/docs/lesson-failures.json +8 -0
- package/docs/maintaining-docs.md +16 -4
- package/docs/native-implementation.md +276 -0
- package/docs/native-interop-llvm-plan.md +342 -0
- package/docs/native-package-examples.md +684 -0
- package/docs/native-packages.md +179 -0
- package/docs/packages.md +72 -126
- package/docs/performance.md +61 -68
- package/docs/production-readiness.md +16 -5
- package/docs/public/downloads/approved-design.zip +0 -0
- package/docs/public/downloads/benchmark.zip +0 -0
- package/docs/public/downloads/calls-benchmark.zip +0 -0
- package/docs/public/downloads/cli-args.zip +0 -0
- package/docs/public/downloads/collections-benchmark.zip +0 -0
- package/docs/public/downloads/collections.zip +0 -0
- package/docs/public/downloads/cpu-benchmark.zip +0 -0
- package/docs/public/downloads/developer-workflow.zip +0 -0
- package/docs/public/downloads/drop.zip +0 -0
- package/docs/public/downloads/errors-benchmark.zip +0 -0
- package/docs/public/downloads/errors.zip +0 -0
- package/docs/public/downloads/ffi.zip +0 -0
- package/docs/public/downloads/float-benchmark.zip +0 -0
- package/docs/public/downloads/generic-di.zip +0 -0
- package/docs/public/downloads/generics.zip +0 -0
- package/docs/public/downloads/hello.zip +0 -0
- package/docs/public/downloads/http-benchmark.zip +0 -0
- package/docs/public/downloads/interceptors.zip +0 -0
- package/docs/public/downloads/json-benchmark.zip +0 -0
- package/docs/public/downloads/list-benchmark.zip +0 -0
- package/docs/public/downloads/map-churn-benchmark.zip +0 -0
- package/docs/public/downloads/native-blake3.zip +0 -0
- package/docs/public/downloads/native-pytorch.zip +0 -0
- package/docs/public/downloads/native-sqlite.zip +0 -0
- package/docs/public/downloads/native-zlib.zip +0 -0
- package/docs/public/downloads/new-syntax.zip +0 -0
- package/docs/public/downloads/oidc-login.zip +0 -0
- package/docs/public/downloads/ownership-transfer.zip +0 -0
- package/docs/public/downloads/ownership.zip +0 -0
- package/docs/public/downloads/packages-app.zip +0 -0
- package/docs/public/downloads/packages-math.zip +0 -0
- package/docs/public/downloads/records-benchmark.zip +0 -0
- package/docs/public/downloads/startup-benchmark.zip +0 -0
- package/docs/public/downloads/strings-benchmark.zip +0 -0
- package/docs/public/downloads/tasks-benchmark.zip +0 -0
- package/docs/public/downloads/visibility.zip +0 -0
- package/docs/public/downloads/weather-api.zip +0 -0
- package/docs/qualification-results.md +66 -0
- package/docs/reference.md +47 -17
- package/docs/releasing.md +105 -16
- package/docs/research/code-to-natural-language.md +108 -0
- package/docs/research/ecosystem-workflow.md +41 -0
- package/docs/research/libtorch-native-qualification.md +115 -0
- package/docs/research/native-interop-llvm.md +197 -0
- package/docs/research/qualification-methods.md +15 -0
- package/docs/research/wiki-editorial-design.md +71 -0
- package/docs/roadmap.md +2 -1
- package/docs/safety-gyms.md +41 -0
- package/docs/specifications.md +27 -11
- package/docs/testing.md +19 -5
- package/docs/tooling.md +36 -22
- package/docs/weather-api.md +65 -0
- package/docs/web-library-gaps.md +1 -1
- package/docs/web.md +54 -18
- package/docs/writing-docs.md +49 -0
- package/examples/{hello/.aug-spec/august/0.19.0 → approved-design/.aug-spec/august/0.21.0}/io/contracts.aug +4 -3
- package/examples/approved-design/.aug-spec/august/0.21.0/io/contracts.aug.md +82 -0
- package/examples/approved-design/.aug-spec/manifest.json +3 -3
- package/examples/approved-design/counters.aug +5 -4
- package/examples/approved-design/counters.aug.md +25 -132
- package/examples/approved-design/domain/app.aug +2 -1
- package/examples/approved-design/domain/app.aug.md +10 -80
- package/examples/approved-design/domain/export.aug +1 -0
- package/examples/approved-design/domain/export.aug.md +4 -20
- package/examples/approved-design/domain/models.aug +1 -0
- package/examples/approved-design/domain/models.aug.md +3 -25
- package/examples/approved-design/domain/numbers.aug +3 -2
- package/examples/approved-design/domain/numbers.aug.md +19 -116
- package/examples/approved-design/main.aug +1 -0
- package/examples/approved-design/main.aug.md +12 -95
- package/examples/benchmark/.aug-spec/manifest.json +1 -1
- package/examples/benchmark/main.aug +1 -0
- package/examples/benchmark/main.aug.md +6 -36
- package/examples/cli-args/.aug-spec/manifest.json +1 -1
- package/examples/cli-args/main.aug +1 -0
- package/examples/cli-args/main.aug.md +5 -32
- package/examples/collections/.aug-spec/manifest.json +1 -1
- package/examples/collections/main.aug +1 -0
- package/examples/collections/main.aug.md +6 -36
- package/examples/{generic-di/.aug-spec/august/0.19.0 → developer-workflow/.aug-spec/august/0.21.0}/io/contracts.aug +4 -3
- package/examples/developer-workflow/.aug-spec/august/0.21.0/io/contracts.aug.md +82 -0
- package/examples/developer-workflow/.aug-spec/manifest.json +3 -3
- package/examples/developer-workflow/calculator.aug +3 -2
- package/examples/developer-workflow/calculator.aug.md +28 -189
- package/examples/developer-workflow/logging/console.aug +2 -1
- package/examples/developer-workflow/logging/console.aug.md +7 -57
- package/examples/developer-workflow/logging/export.aug +1 -0
- package/examples/developer-workflow/logging/export.aug.md +3 -15
- package/examples/developer-workflow/logging/logger.aug +1 -0
- package/examples/developer-workflow/logging/logger.aug.md +6 -46
- package/examples/developer-workflow/main.aug +1 -0
- package/examples/developer-workflow/main.aug.md +10 -68
- package/examples/drop/.aug-spec/manifest.json +1 -1
- package/examples/drop/main.aug +1 -0
- package/examples/drop/main.aug.md +6 -28
- package/examples/drop/resource.aug +1 -0
- package/examples/drop/resource.aug.md +6 -34
- package/examples/errors/.aug-spec/manifest.json +1 -1
- package/examples/errors/errors.aug +2 -1
- package/examples/errors/errors.aug.md +4 -27
- package/examples/errors/main.aug +1 -0
- package/examples/errors/main.aug.md +6 -29
- package/examples/ffi/.aug-spec/manifest.json +1 -1
- package/examples/ffi/main.aug +1 -0
- package/examples/ffi/main.aug.md +5 -21
- package/examples/ffi/native.aug +2 -1
- package/examples/ffi/native.aug.md +5 -35
- package/examples/{approved-design/.aug-spec/august/0.19.0 → generic-di/.aug-spec/august/0.21.0}/io/contracts.aug +4 -3
- package/examples/generic-di/.aug-spec/august/0.21.0/io/contracts.aug.md +82 -0
- package/examples/generic-di/.aug-spec/manifest.json +3 -3
- package/examples/generic-di/main.aug +1 -0
- package/examples/generic-di/main.aug.md +8 -40
- package/examples/generic-di/types.aug +3 -2
- package/examples/generic-di/types.aug.md +18 -97
- package/examples/generics/.aug-spec/manifest.json +1 -1
- package/examples/generics/main.aug +1 -0
- package/examples/generics/main.aug.md +9 -48
- package/examples/generics/types.aug +4 -3
- package/examples/generics/types.aug.md +18 -104
- package/examples/{developer-workflow/.aug-spec/august/0.19.0 → hello/.aug-spec/august/0.21.0}/io/contracts.aug +4 -3
- package/examples/hello/.aug-spec/august/0.21.0/io/contracts.aug.md +82 -0
- package/examples/hello/.aug-spec/manifest.json +3 -3
- package/examples/hello/app/export.aug +1 -0
- package/examples/hello/app/export.aug.md +3 -13
- package/examples/hello/app/greeter.aug +2 -1
- package/examples/hello/app/greeter.aug.md +10 -94
- package/examples/hello/logging/console.aug +2 -1
- package/examples/hello/logging/console.aug.md +7 -55
- package/examples/hello/logging/export.aug +1 -0
- package/examples/hello/logging/export.aug.md +3 -15
- package/examples/hello/logging/logger.aug +1 -0
- package/examples/hello/logging/logger.aug.md +6 -48
- package/examples/hello/main.aug +1 -0
- package/examples/hello/main.aug.md +8 -40
- package/examples/interceptors/.aug-spec/august/0.21.0/io/contracts.aug +37 -0
- package/examples/interceptors/.aug-spec/august/0.21.0/io/contracts.aug.md +82 -0
- package/examples/interceptors/.aug-spec/manifest.json +3 -3
- package/examples/interceptors/app.aug +3 -2
- package/examples/interceptors/app.aug.md +15 -141
- package/examples/interceptors/interceptors.aug +3 -2
- package/examples/interceptors/interceptors.aug.md +19 -152
- package/examples/interceptors/logging.aug +2 -1
- package/examples/interceptors/logging.aug.md +10 -79
- package/examples/interceptors/main.aug +1 -0
- package/examples/interceptors/main.aug.md +9 -66
- package/examples/native-blake3/.aug-spec/manifest.json +16 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.1/native.abi.json +29 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/api.aug +14 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/api.aug.md +34 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/contracts.aug +4 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/contracts.aug.md +8 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/native.abi.json +29 -0
- package/examples/native-blake3/AGENTS.md +5 -0
- package/examples/native-blake3/aug.lock.json +253 -0
- package/examples/native-blake3/hashing.aug +11 -0
- package/examples/native-blake3/hashing.aug.md +25 -0
- package/examples/native-blake3/main.aug +8 -0
- package/examples/native-blake3/main.aug.md +13 -0
- package/examples/native-pytorch/.aug-spec/manifest.json +18 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.1/native.abi.json +142 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.3/native.abi.json +142 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/api.aug +101 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/api.aug.md +160 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/bindings.aug +3 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/bindings.aug.md +8 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/contracts.aug +6 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/contracts.aug.md +13 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/native.abi.json +142 -0
- package/examples/native-pytorch/AGENTS.md +5 -0
- package/examples/native-pytorch/aug.lock.json +309 -0
- package/examples/native-pytorch/main.aug +8 -0
- package/examples/native-pytorch/main.aug.md +13 -0
- package/examples/native-pytorch/tensors.aug +23 -0
- package/examples/native-pytorch/tensors.aug.md +35 -0
- package/examples/native-sqlite/.aug-spec/manifest.json +18 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.2/native.abi.json +100 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/api.aug +48 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/api.aug.md +91 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/bindings.aug +3 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/bindings.aug.md +8 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/contracts.aug +8 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/contracts.aug.md +22 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/native.abi.json +100 -0
- package/examples/native-sqlite/AGENTS.md +5 -0
- package/examples/native-sqlite/aug.lock.json +236 -0
- package/examples/native-sqlite/database.aug +15 -0
- package/examples/native-sqlite/database.aug.md +27 -0
- package/examples/native-sqlite/main.aug +8 -0
- package/examples/native-sqlite/main.aug.md +13 -0
- package/examples/native-zlib/.aug-spec/manifest.json +16 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.1/native.abi.json +57 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/api.aug +29 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/api.aug.md +54 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/contracts.aug +4 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/contracts.aug.md +8 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/native.abi.json +57 -0
- package/examples/native-zlib/AGENTS.md +5 -0
- package/examples/native-zlib/aug.lock.json +236 -0
- package/examples/native-zlib/compression.aug +15 -0
- package/examples/native-zlib/compression.aug.md +27 -0
- package/examples/native-zlib/main.aug +10 -0
- package/examples/native-zlib/main.aug.md +13 -0
- package/examples/new-syntax/.aug-spec/august/0.21.0/io/contracts.aug +37 -0
- package/examples/new-syntax/.aug-spec/august/0.21.0/io/contracts.aug.md +82 -0
- package/examples/new-syntax/.aug-spec/manifest.json +3 -3
- package/examples/new-syntax/console.aug +2 -1
- package/examples/new-syntax/console.aug.md +7 -53
- package/examples/new-syntax/greeter.aug +2 -1
- package/examples/new-syntax/greeter.aug.md +10 -74
- package/examples/new-syntax/logger.aug +1 -0
- package/examples/new-syntax/logger.aug.md +6 -46
- package/examples/new-syntax/main.aug +1 -0
- package/examples/new-syntax/main.aug.md +9 -54
- package/examples/new-syntax/math.aug +2 -1
- package/examples/new-syntax/math.aug.md +3 -24
- package/examples/oidc-login/.aug-spec/manifest.json +13 -13
- package/examples/oidc-login/.aug-spec/packages/@git/url_0eb7c89453c87681ed15/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/store.aug.md +71 -0
- package/examples/oidc-login/.aug-spec/packages/@git/url_2d3c37c690c0fa115be1/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/contracts.aug.md +17 -0
- package/examples/oidc-login/.aug-spec/packages/@git/url_897efafd565158fc4908/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/contracts.aug.md +125 -0
- package/examples/oidc-login/.aug-spec/{august/0.19.0/crypto → packages/@git/url_9ef654c66d34ab8f5527/0.0.0-git.b14a0f9aa41f1ce58bd51133bcdc424033e40d40}/contracts.aug +12 -11
- package/examples/oidc-login/.aug-spec/packages/@git/url_9ef654c66d34ab8f5527/0.0.0-git.b14a0f9aa41f1ce58bd51133bcdc424033e40d40/contracts.aug.md +244 -0
- package/examples/oidc-login/.aug-spec/{august/0.19.0/crypto → packages/@git/url_9ef654c66d34ab8f5527/0.0.0-git.b14a0f9aa41f1ce58bd51133bcdc424033e40d40}/jose.aug +6 -5
- package/examples/oidc-login/.aug-spec/packages/@git/url_9ef654c66d34ab8f5527/0.0.0-git.b14a0f9aa41f1ce58bd51133bcdc424033e40d40/jose.aug.md +71 -0
- package/examples/oidc-login/.aug-spec/packages/@git/url_c092cd151499c4e1d8a1/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/contracts.aug.md +30 -0
- package/examples/oidc-login/aug.lock.json +100 -0
- package/examples/oidc-login/client/contracts.aug +1 -0
- package/examples/oidc-login/client/contracts.aug.md +9 -66
- package/examples/oidc-login/client/endpoints.aug +6 -5
- package/examples/oidc-login/client/endpoints.aug.md +13 -145
- package/examples/oidc-login/client/export.aug +1 -0
- package/examples/oidc-login/client/export.aug.md +4 -24
- package/examples/oidc-login/client/login.aug +7 -6
- package/examples/oidc-login/client/login.aug.md +25 -303
- package/examples/oidc-login/client/logout.aug +5 -4
- package/examples/oidc-login/client/logout.aug.md +13 -135
- package/examples/oidc-login/client/protocol.aug +7 -6
- package/examples/oidc-login/client/protocol.aug.md +36 -283
- package/examples/oidc-login/client/session.aug +5 -4
- package/examples/oidc-login/client/session.aug.md +12 -139
- package/examples/oidc-login/client/views.aug +3 -2
- package/examples/oidc-login/client/views.aug.md +8 -57
- package/examples/oidc-login/common/export.aug +1 -0
- package/examples/oidc-login/common/export.aug.md +5 -27
- package/examples/oidc-login/common/headers.aug +4 -3
- package/examples/oidc-login/common/headers.aug.md +9 -67
- package/examples/oidc-login/common/keys.aug +6 -5
- package/examples/oidc-login/common/keys.aug.md +29 -165
- package/examples/oidc-login/common/settings.aug +2 -1
- package/examples/oidc-login/common/settings.aug.md +5 -39
- package/examples/oidc-login/common/views.aug +2 -1
- package/examples/oidc-login/common/views.aug.md +4 -28
- package/examples/oidc-login/main.aug +6 -16
- package/examples/oidc-login/main.aug.md +17 -146
- package/examples/oidc-login/main.yaml +7 -0
- package/examples/oidc-login/provider/authorization.aug +7 -6
- package/examples/oidc-login/provider/authorization.aug.md +23 -238
- package/examples/oidc-login/provider/contracts.aug +1 -0
- package/examples/oidc-login/provider/contracts.aug.md +23 -158
- package/examples/oidc-login/provider/credentials.aug +3 -2
- package/examples/oidc-login/provider/credentials.aug.md +9 -53
- package/examples/oidc-login/provider/discovery.aug +4 -3
- package/examples/oidc-login/provider/discovery.aug.md +11 -118
- package/examples/oidc-login/provider/export.aug +1 -0
- package/examples/oidc-login/provider/export.aug.md +6 -34
- package/examples/oidc-login/provider/token.aug +6 -5
- package/examples/oidc-login/provider/token.aug.md +16 -204
- package/examples/oidc-login/provider/userinfo.aug +4 -3
- package/examples/oidc-login/provider/userinfo.aug.md +10 -92
- package/examples/oidc-login/provider/views.aug +3 -2
- package/examples/oidc-login/provider/views.aug.md +8 -52
- package/examples/ownership/.aug-spec/manifest.json +1 -1
- package/examples/ownership/counter.aug +3 -2
- package/examples/ownership/counter.aug.md +12 -66
- package/examples/ownership/main.aug +1 -0
- package/examples/ownership/main.aug.md +6 -31
- package/examples/ownership-transfer/.aug-spec/august/0.21.0/io/contracts.aug +37 -0
- package/examples/ownership-transfer/.aug-spec/august/0.21.0/io/contracts.aug.md +82 -0
- package/examples/ownership-transfer/.aug-spec/manifest.json +3 -3
- package/examples/ownership-transfer/main.aug +1 -0
- package/examples/ownership-transfer/main.aug.md +9 -53
- package/examples/ownership-transfer/resource.aug +2 -1
- package/examples/ownership-transfer/resource.aug.md +12 -71
- package/examples/packages/app/.aug-spec/manifest.json +1 -1
- package/examples/packages/app/.aug-spec/packages/@example/aug-math/0.1.0/arithmetic.aug +2 -1
- package/examples/packages/app/.aug-spec/packages/@example/aug-math/0.1.0/arithmetic.aug.md +9 -51
- package/examples/packages/app/main.aug +1 -0
- package/examples/packages/app/main.aug.md +6 -26
- package/examples/packages/math/.aug-spec/manifest.json +1 -1
- package/examples/packages/math/aug-package.json +1 -1
- package/examples/packages/math/src/arithmetic.aug +2 -1
- package/examples/packages/math/src/arithmetic.aug.md +9 -51
- package/examples/packages/math/src/export.aug +1 -0
- package/examples/packages/math/src/export.aug.md +3 -13
- package/examples/visibility/.aug-spec/manifest.json +1 -1
- package/examples/visibility/counter.aug +4 -3
- package/examples/visibility/counter.aug.md +12 -68
- package/examples/visibility/main.aug +1 -0
- package/examples/visibility/main.aug.md +6 -32
- package/examples/weather-api/.aug-spec/manifest.json +8 -0
- package/examples/weather-api/AGENTS.md +17 -0
- package/examples/weather-api/README.md +19 -0
- package/examples/weather-api/forecasts.aug +47 -0
- package/examples/weather-api/forecasts.aug.md +32 -0
- package/examples/weather-api/main.aug +4 -0
- package/examples/weather-api/main.aug.md +15 -0
- package/examples/weather-api/main.yaml +5 -0
- package/examples/weather-api/weather.http +5 -0
- package/native/compiler-packs.json +43 -0
- package/package.json +4 -4
- package/runtime/aug_http.c +48 -21
- package/runtime/aug_http_ir.c +30 -0
- package/runtime/aug_http_ir.h +18 -0
- package/runtime/aug_ir.c +209 -0
- package/runtime/aug_ir.h +89 -0
- package/runtime/aug_json.c +6 -1
- package/runtime/aug_runtime.c +82 -16
- package/runtime/aug_runtime.h +16 -2
- package/runtime/aug_tasks.c +38 -7
- package/runtime/aug_values.c +12 -6
- package/scripts/bootstrap-native.mjs +184 -106
- package/scripts/native-setup.mjs +98 -0
- package/scripts/native-toolchain.mjs +28 -0
- package/src/ast.js +1 -1
- package/src/builtins.js +1 -1
- package/src/checker.js +369 -100
- package/src/cli.js +198 -26
- package/src/codegen.js +32 -7
- package/src/compiler-packs.js +66 -0
- package/src/config.js +3 -3
- package/src/contracts.js +10 -0
- package/src/editor.js +86 -22
- package/src/fixes.js +90 -2
- package/src/formatter.js +23 -10
- package/src/git-http.js +137 -0
- package/src/git-packages.js +118 -0
- package/src/help.js +33 -24
- package/src/http-contracts.js +14 -0
- package/src/http-policies.js +5 -5
- package/src/ir-types.js +5 -0
- package/src/ir-verify.js +277 -0
- package/src/ir.js +962 -0
- package/src/libraries.js +1 -1
- package/src/llvm-debug.js +101 -0
- package/src/llvm-native.js +152 -0
- package/src/llvm-platform.js +20 -0
- package/src/llvm.js +781 -0
- package/src/lsp.js +14 -5
- package/src/native-artifacts.js +207 -0
- package/src/native-bindings.js +189 -0
- package/src/native-contracts.js +295 -0
- package/src/native-declarations.js +68 -0
- package/src/native-facts.js +63 -0
- package/src/native.js +19 -13
- package/src/navigation.js +4 -2
- package/src/openapi.js +5 -4
- package/src/package-locking.js +88 -0
- package/src/package-manager.js +267 -68
- package/src/parser.js +32 -6
- package/src/policies.js +3 -3
- package/src/project-init.js +78 -4
- package/src/project.js +11 -9
- package/src/runtime-abi.js +23 -0
- package/src/runtime-adapters.js +18 -0
- package/src/schemas.js +24 -17
- package/src/semantic.js +54 -5
- package/src/snippets.js +60 -0
- package/src/spec-hints.js +56 -0
- package/src/spec-tree.js +241 -0
- package/src/spec.js +669 -305
- package/docs/examples/approved-design/dependencies/august/0.19.0/io/contracts.md +0 -395
- package/docs/examples/developer-workflow/dependencies/august/0.19.0/io/contracts.md +0 -395
- package/docs/examples/generic-di/dependencies/august/0.19.0/io/contracts.md +0 -395
- package/docs/examples/hello/dependencies/august/0.19.0/io/contracts.md +0 -395
- package/docs/examples/interceptors/dependencies/august/0.19.0/io/contracts.md +0 -395
- package/docs/examples/json-benchmark/dependencies/august/0.19.0/json/contracts.md +0 -103
- package/docs/examples/new-syntax/dependencies/august/0.19.0/io/contracts.md +0 -395
- package/docs/examples/oidc-login/dependencies/august/0.19.0/crypto/contracts.md +0 -925
- package/docs/examples/oidc-login/dependencies/august/0.19.0/crypto/jose.md +0 -434
- package/docs/examples/oidc-login/dependencies/august/0.19.0/json/contracts.md +0 -103
- package/docs/examples/oidc-login/dependencies/august/0.19.0/memory/store.md +0 -374
- package/docs/examples/oidc-login/dependencies/august/0.19.0/time/contracts.md +0 -150
- package/docs/examples/oidc-login/dependencies/august/0.19.0/web/contracts.md +0 -532
- package/docs/examples/ownership-transfer/dependencies/august/0.19.0/io/contracts.md +0 -395
- package/examples/approved-design/.aug-spec/august/0.19.0/io/contracts.aug.md +0 -316
- package/examples/developer-workflow/.aug-spec/august/0.19.0/io/contracts.aug.md +0 -316
- package/examples/generic-di/.aug-spec/august/0.19.0/io/contracts.aug.md +0 -316
- package/examples/hello/.aug-spec/august/0.19.0/io/contracts.aug.md +0 -316
- package/examples/interceptors/.aug-spec/august/0.19.0/io/contracts.aug +0 -36
- package/examples/interceptors/.aug-spec/august/0.19.0/io/contracts.aug.md +0 -316
- package/examples/new-syntax/.aug-spec/august/0.19.0/io/contracts.aug +0 -36
- package/examples/new-syntax/.aug-spec/august/0.19.0/io/contracts.aug.md +0 -316
- package/examples/oidc-login/.aug-spec/august/0.19.0/crypto/contracts.aug.md +0 -791
- package/examples/oidc-login/.aug-spec/august/0.19.0/crypto/jose.aug.md +0 -266
- package/examples/oidc-login/.aug-spec/august/0.19.0/json/contracts.aug.md +0 -55
- package/examples/oidc-login/.aug-spec/august/0.19.0/memory/store.aug.md +0 -250
- package/examples/oidc-login/.aug-spec/august/0.19.0/time/contracts.aug.md +0 -96
- package/examples/oidc-login/.aug-spec/august/0.19.0/web/contracts.aug.md +0 -420
- package/examples/ownership-transfer/.aug-spec/august/0.19.0/io/contracts.aug +0 -36
- package/examples/ownership-transfer/.aug-spec/august/0.19.0/io/contracts.aug.md +0 -316
- /package/examples/oidc-login/.aug-spec/{august/0.19.0/memory → packages/@git/url_0eb7c89453c87681ed15/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301}/store.aug +0 -0
- /package/examples/oidc-login/.aug-spec/{august/0.19.0/json → packages/@git/url_2d3c37c690c0fa115be1/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301}/contracts.aug +0 -0
- /package/examples/oidc-login/.aug-spec/{august/0.19.0/web → packages/@git/url_897efafd565158fc4908/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301}/contracts.aug +0 -0
- /package/examples/oidc-login/.aug-spec/{august/0.19.0/time → packages/@git/url_c092cd151499c4e1d8a1/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301}/contracts.aug +0 -0
package/runtime/aug_ir.h
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#ifndef AUG_IR_H
|
|
2
|
+
#define AUG_IR_H
|
|
3
|
+
#include "aug_runtime.h"
|
|
4
|
+
|
|
5
|
+
/* Compiler-private pointer-call ABI. This is not the public native package ABI.
|
|
6
|
+
All target packs record these layouts; LLVM validates that record before use. */
|
|
7
|
+
enum AugIrOperation {
|
|
8
|
+
AUG_IR_PRINT=1, AUG_IR_BINARY, AUG_IR_UNARY, AUG_IR_FIELD, AUG_IR_SET_FIELD,
|
|
9
|
+
AUG_IR_LIST, AUG_IR_TUPLE, AUG_IR_SET, AUG_IR_MAP, AUG_IR_MAP_SET,
|
|
10
|
+
AUG_IR_LIST_LENGTH, AUG_IR_LIST_GET, AUG_IR_LIST_AT, AUG_IR_LIST_APPEND,
|
|
11
|
+
AUG_IR_TUPLE_LENGTH, AUG_IR_TUPLE_GET, AUG_IR_SET_LENGTH, AUG_IR_SET_ADD,
|
|
12
|
+
AUG_IR_SET_CONTAINS, AUG_IR_MAP_LENGTH, AUG_IR_MAP_GET, AUG_IR_MAP_TAKE,
|
|
13
|
+
AUG_IR_MAP_CONTAINS, AUG_IR_STRING_LENGTH, AUG_IR_STRING_BYTES,
|
|
14
|
+
AUG_IR_STRING_SPLIT, AUG_IR_STRING_STARTS_WITH, AUG_IR_STRING_IS_TOKEN,
|
|
15
|
+
AUG_IR_BYTES_LENGTH, AUG_IR_BYTES_TEXT, AUG_IR_BYTES_BASE64URL,
|
|
16
|
+
AUG_IR_BASE64URL_DECODE, AUG_IR_C_INT, AUG_IR_READ_FILE, AUG_IR_WRITE_FILE,
|
|
17
|
+
AUG_IR_ARGUMENTS, AUG_IR_FREEZE, AUG_IR_ITER, AUG_IR_MAP_ITER, AUG_IR_IS_TYPE,
|
|
18
|
+
AUG_IR_SHARED, AUG_IR_SHARED_LOCK, AUG_IR_JSON_WRAP, AUG_IR_JSON_PARSE,
|
|
19
|
+
AUG_IR_JSON_STRINGIFY, AUG_IR_JSON_GET, AUG_IR_JSON_REQUIRE, AUG_IR_JSON_STRING,
|
|
20
|
+
AUG_IR_JSON_INTEGER, AUG_IR_JSON_BOOLEAN, AUG_IR_JSON_ITEMS, AUG_IR_TIME_NOW, AUG_IR_EXIT, AUG_IR_TEST_CASE
|
|
21
|
+
};
|
|
22
|
+
void aug_ir_operation(AugValue *out, int operation, AugValue *args, int count, const char *text, int64_t number);
|
|
23
|
+
/* Specialized services keep managed inputs in the caller's rooted cells. */
|
|
24
|
+
void aug_ir_print(const AugValue *value);
|
|
25
|
+
void aug_ir_binary(AugValue *out,const char *operation,const AugValue *left,const AugValue *right);
|
|
26
|
+
void aug_ir_unary(AugValue *out,const char *operation,const AugValue *value);
|
|
27
|
+
void aug_ir_list_new(AugValue *out,AugValue *items,int count);
|
|
28
|
+
void aug_ir_tuple_new(AugValue *out,AugValue *items,int count);
|
|
29
|
+
void aug_ir_set_new(AugValue *out,AugValue *items,int count);
|
|
30
|
+
void aug_ir_map(AugValue *out);
|
|
31
|
+
void aug_ir_iter(AugValue *out,const AugValue *value);
|
|
32
|
+
void aug_ir_map_iter(AugValue *out,const AugValue *value);
|
|
33
|
+
void aug_ir_list_append(const AugValue *list,const AugValue *value);
|
|
34
|
+
int64_t aug_ir_tuple_length(const AugValue *tuple);
|
|
35
|
+
void aug_ir_tuple_get(AugValue *out,const AugValue *tuple,const AugValue *index);
|
|
36
|
+
int64_t aug_ir_string_length(const AugValue *value);
|
|
37
|
+
void aug_ir_string_bytes(AugValue *out,const AugValue *value);
|
|
38
|
+
void aug_ir_string_split(AugValue *out,const AugValue *value,const AugValue *separator);
|
|
39
|
+
void aug_ir_map_set(const AugValue *map,const AugValue *key,const AugValue *value);
|
|
40
|
+
void aug_ir_set_add(const AugValue *set,const AugValue *value);
|
|
41
|
+
uint8_t aug_ir_set_contains(const AugValue *set,const AugValue *value);
|
|
42
|
+
uint8_t aug_ir_map_contains(const AugValue *map,const AugValue *key);
|
|
43
|
+
int64_t aug_ir_list_length(const AugValue *list);
|
|
44
|
+
int64_t aug_ir_set_length(const AugValue *set);
|
|
45
|
+
int64_t aug_ir_map_length(const AugValue *map);
|
|
46
|
+
void aug_ir_list_get(AugValue *out,const AugValue *list,const AugValue *index);
|
|
47
|
+
void aug_ir_list_at(AugValue *out,const AugValue *list,const AugValue *index);
|
|
48
|
+
void aug_ir_map_get(AugValue *out,const AugValue *map,const AugValue *key);
|
|
49
|
+
void aug_ir_map_take(AugValue *out,const AugValue *map,const AugValue *key);
|
|
50
|
+
void aug_ir_json_decode(AugValue *out, const AugValue *value, const AugSchema *schema);
|
|
51
|
+
void aug_ir_string(AugValue *out, const void *text, uint64_t count);
|
|
52
|
+
void aug_ir_assert(const AugValue *condition, const char *expression, const char *file, int line);
|
|
53
|
+
void aug_ir_drop(AugValue *value);
|
|
54
|
+
void aug_ir_failed_result(AugValue *value);
|
|
55
|
+
void aug_ir_constructor_result(AugValue *value, const AugValue *result);
|
|
56
|
+
void aug_ir_throw(const AugValue *value);
|
|
57
|
+
void aug_ir_take_error(AugValue *out);
|
|
58
|
+
void aug_ir_save_error_state(AugValue *error,AugValue *cancelled);
|
|
59
|
+
void aug_ir_restore_error_state(const AugValue *error,const AugValue *cancelled);
|
|
60
|
+
void aug_ir_task_wait(AugValue *out, AugValue *tasks, int count);
|
|
61
|
+
bool aug_ir_has_error(void);
|
|
62
|
+
bool aug_ir_cancelled(void);
|
|
63
|
+
/* 0 = running, 1 = cancelled, 2 = checked error; cancellation wins. */
|
|
64
|
+
uint8_t aug_ir_state(void);
|
|
65
|
+
bool aug_ir_is_null(const AugValue *value);
|
|
66
|
+
bool aug_ir_truthy(const AugValue *value);
|
|
67
|
+
int64_t aug_ir_integer(const AugValue *value);
|
|
68
|
+
double aug_ir_float(const AugValue *value);
|
|
69
|
+
void aug_ir_frame_enter(AugFrame *frame, AugValue *values, uint64_t count);
|
|
70
|
+
void aug_ir_method(AugValue *out, const AugValue *self, const char *name, AugValue *args, int count);
|
|
71
|
+
void aug_ir_object(AugValue *out, const char *type, uint64_t fields, const unsigned char *owned,
|
|
72
|
+
const AugMethodEntry *methods, uint64_t method_count, const char *const *names, bool record);
|
|
73
|
+
void aug_ir_binding_get(AugValue *out, uint64_t index);
|
|
74
|
+
void aug_ir_binding_set(uint64_t index, const AugValue *value);
|
|
75
|
+
int aug_ir_exit_status(bool test);
|
|
76
|
+
void *aug_ir_resource_pointer(const AugValue *value, const char *type);
|
|
77
|
+
void aug_ir_resource(AugValue *out, void *pointer, const char *type, void (*release)(void *));
|
|
78
|
+
void aug_ir_resource_move(AugValue *value);
|
|
79
|
+
void aug_ir_contract_error(AugValue *out);
|
|
80
|
+
void aug_ir_native_error(AugValue *out, AugPointerMethod factory, int32_t code, const void *text, uint64_t length);
|
|
81
|
+
bool aug_ir_data(const AugValue *value, const void **data, uint64_t *count);
|
|
82
|
+
bool aug_ir_floats(const AugValue *value, double **data, uint64_t *count);
|
|
83
|
+
bool aug_ir_strings(const AugValue *value, const void ***data, uint64_t **lengths, uint64_t *count);
|
|
84
|
+
void aug_ir_free(void *memory);
|
|
85
|
+
void aug_ir_copy_bytes(AugValue *out, const void *bytes, uint64_t count);
|
|
86
|
+
void aug_ir_copy_utf8(AugValue *out, const void *text, uint64_t count);
|
|
87
|
+
void aug_ir_copy_bool(AugValue *out, uint8_t value);
|
|
88
|
+
void aug_ir_copy_floats(AugValue *out, const double *values, uint64_t count);
|
|
89
|
+
#endif
|
package/runtime/aug_json.c
CHANGED
|
@@ -116,6 +116,11 @@ AugValue aug_json_items(AugValue value) {
|
|
|
116
116
|
for (size_t i = 0; i < value.as.object->field_count; i++) aug_list_append(roots[1], aug_json_wrap(value.as.object->fields[i]));
|
|
117
117
|
AugValue result = roots[1]; aug_frame_leave(&frame); return result;
|
|
118
118
|
}
|
|
119
|
+
AugValue aug_schema_make(const AugSchema *schema, AugValue *fields, int count) {
|
|
120
|
+
if(schema->pointer_make){AugValue result=aug_null();schema->pointer_make(&result,NULL,fields,count);return result;}
|
|
121
|
+
if(schema->make)return schema->make(fields,count);
|
|
122
|
+
return invalid();
|
|
123
|
+
}
|
|
119
124
|
static AugValue decode(AugValue value, const AugSchema *schema, size_t depth) {
|
|
120
125
|
if (depth > 64) return invalid();
|
|
121
126
|
if (value.tag == AUG_NULL && schema->nullable) return value;
|
|
@@ -152,7 +157,7 @@ static AugValue decode(AugValue value, const AugSchema *schema, size_t depth) {
|
|
|
152
157
|
}
|
|
153
158
|
AugValue result = aug_null();
|
|
154
159
|
if (!aug_has_error) {
|
|
155
|
-
if (schema->kind == AUG_SCHEMA_RECORD) result = schema
|
|
160
|
+
if (schema->kind == AUG_SCHEMA_RECORD) result = aug_schema_make(schema,items,(int)count);
|
|
156
161
|
else if (schema->kind == AUG_SCHEMA_TUPLE) result = aug_tuple_new(items, count);
|
|
157
162
|
else if (schema->kind == AUG_SCHEMA_SET) result = aug_set_new(items, count);
|
|
158
163
|
else if (schema->kind == AUG_SCHEMA_MAP) { result = aug_map_new(); items[count] = result; for (size_t i = 0; i < count; i += 2) aug_map_set(result, items[i], items[i + 1]); }
|
package/runtime/aug_runtime.c
CHANGED
|
@@ -28,6 +28,10 @@ static size_t next_collection = 1024;
|
|
|
28
28
|
static bool collecting = false;
|
|
29
29
|
static AugValue cli_args = {0};
|
|
30
30
|
static bool equal(AugValue left, AugValue right);
|
|
31
|
+
/* Map-only metadata keeps ordinary object allocation sizes unchanged. The
|
|
32
|
+
first member permits the existing heap, roots and GC to use AugObject. */
|
|
33
|
+
typedef struct { AugObject object; size_t *field_buckets; } AugMapObject;
|
|
34
|
+
static size_t *map_field_buckets(AugObject *object) { return ((AugMapObject *)object)->field_buckets; }
|
|
31
35
|
bool aug_test_failed = false;
|
|
32
36
|
size_t aug_test_assertions = 0;
|
|
33
37
|
|
|
@@ -54,7 +58,7 @@ static AugObject *allocate(int kind, const char *type_name, size_t field_count,
|
|
|
54
58
|
const unsigned char *owned_fields,
|
|
55
59
|
const AugMethodEntry *methods, size_t method_count) {
|
|
56
60
|
if (!collecting && object_count >= next_collection) aug_collect();
|
|
57
|
-
AugObject *object = calloc(1, sizeof(AugObject));
|
|
61
|
+
AugObject *object = calloc(1, kind == AUG_MAP_KIND ? sizeof(AugMapObject) : sizeof(AugObject));
|
|
58
62
|
if (!object) fail("out of memory");
|
|
59
63
|
object->kind = kind;
|
|
60
64
|
object->type_name = type_name;
|
|
@@ -79,7 +83,7 @@ AugValue aug_string_n(const void *value, size_t length) {
|
|
|
79
83
|
AugObject *object = allocate(AUG_STRING, "string", 0, NULL, NULL, 0);
|
|
80
84
|
object->text = malloc(length + 1);
|
|
81
85
|
if (!object->text) fail("out of memory");
|
|
82
|
-
memcpy(object->text, value, length);
|
|
86
|
+
if (length) memcpy(object->text, value, length);
|
|
83
87
|
object->text[length] = 0;
|
|
84
88
|
object->text_length = length;
|
|
85
89
|
return (AugValue){ .tag = AUG_STRING, .as.object = object };
|
|
@@ -209,6 +213,18 @@ static size_t bucket_for(AugObject *object, AugValue key) { return bucket_for_ha
|
|
|
209
213
|
|
|
210
214
|
static bool grow_table(AugObject *object, size_t stride) {
|
|
211
215
|
size_t entries = object->field_count / stride;
|
|
216
|
+
if (object->field_count + stride > object->capacity) {
|
|
217
|
+
size_t capacity = object->capacity ? object->capacity * 2 : 8;
|
|
218
|
+
AugValue *fields = realloc(object->fields, capacity * sizeof(AugValue));
|
|
219
|
+
if (!fields) fail("out of memory");
|
|
220
|
+
object->fields = fields;
|
|
221
|
+
if (stride == 2) {
|
|
222
|
+
size_t *positions = realloc(map_field_buckets(object), (capacity / 2) * sizeof(size_t));
|
|
223
|
+
if (!positions) fail("out of memory");
|
|
224
|
+
((AugMapObject *)object)->field_buckets = positions;
|
|
225
|
+
}
|
|
226
|
+
object->capacity = capacity;
|
|
227
|
+
}
|
|
212
228
|
bool rehashed = !object->bucket_count || (entries + 1) * 10 > object->bucket_count * 7;
|
|
213
229
|
if (rehashed) {
|
|
214
230
|
size_t count = object->bucket_count ? object->bucket_count * 2 : 8;
|
|
@@ -217,15 +233,11 @@ static bool grow_table(AugObject *object, size_t stride) {
|
|
|
217
233
|
free(object->buckets);
|
|
218
234
|
object->buckets = buckets;
|
|
219
235
|
object->bucket_count = count;
|
|
220
|
-
for (size_t i = 0; i < object->field_count; i += stride)
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
AugValue *fields = realloc(object->fields, capacity * sizeof(AugValue));
|
|
226
|
-
if (!fields) fail("out of memory");
|
|
227
|
-
object->fields = fields;
|
|
228
|
-
object->capacity = capacity;
|
|
236
|
+
for (size_t i = 0; i < object->field_count; i += stride) {
|
|
237
|
+
size_t bucket = bucket_for(object, object->fields[i]);
|
|
238
|
+
object->buckets[bucket] = i + 1;
|
|
239
|
+
if (stride == 2) map_field_buckets(object)[i / 2] = bucket;
|
|
240
|
+
}
|
|
229
241
|
}
|
|
230
242
|
return rehashed;
|
|
231
243
|
}
|
|
@@ -251,6 +263,7 @@ void aug_map_set(AugValue map, AugValue key, AugValue value) {
|
|
|
251
263
|
if (field) { object->fields[field] = value; return; }
|
|
252
264
|
}
|
|
253
265
|
if (grow_table(object, 2)) bucket = bucket_for_hash(object, key, hash);
|
|
266
|
+
map_field_buckets(object)[object->field_count / 2] = bucket;
|
|
254
267
|
object->buckets[bucket] = object->field_count + 1;
|
|
255
268
|
object->fields[object->field_count++] = key;
|
|
256
269
|
object->fields[object->field_count++] = value;
|
|
@@ -264,12 +277,29 @@ AugValue aug_map_get(AugValue map, AugValue key) {
|
|
|
264
277
|
}
|
|
265
278
|
AugValue aug_map_take(AugValue map, AugValue key) {
|
|
266
279
|
AugObject *object = expect_map(map); if (object->frozen) fail("cannot mutate a frozen Map");
|
|
267
|
-
if (!object->bucket_count) return aug_null();
|
|
280
|
+
if (!object->bucket_count) return aug_null();
|
|
281
|
+
size_t bucket = bucket_for(object, key), field = object->buckets[bucket];
|
|
268
282
|
if (!field) return aug_null(); AugValue result = object->fields[field]; size_t first = field - 1;
|
|
269
283
|
memmove(object->fields + first, object->fields + first + 2, (object->field_count - first - 2) * sizeof(AugValue));
|
|
270
284
|
object->field_count -= 2; object->fields[object->field_count] = aug_null(); object->fields[object->field_count + 1] = aug_null();
|
|
271
|
-
|
|
272
|
-
|
|
285
|
+
object->buckets[bucket] = 0;
|
|
286
|
+
/* Ordered fields remain dense. Adjust only moved entry offsets, then repair
|
|
287
|
+
the probe chain after the removed bucket. Neither step rehashes the map. */
|
|
288
|
+
size_t *positions = map_field_buckets(object);
|
|
289
|
+
for (size_t i = first / 2 + 1; i <= object->field_count / 2; i++)
|
|
290
|
+
object->buckets[positions[i]] -= 2;
|
|
291
|
+
memmove(positions + first / 2, positions + first / 2 + 1,
|
|
292
|
+
(object->field_count - first) / 2 * sizeof(size_t));
|
|
293
|
+
size_t mask = object->bucket_count - 1, hole = bucket;
|
|
294
|
+
for (size_t next = (hole + 1) & mask; object->buckets[next]; next = (next + 1) & mask) {
|
|
295
|
+
size_t home = (size_t)hash_value(object->fields[object->buckets[next] - 1]) & mask;
|
|
296
|
+
if (((next - home) & mask) >= ((next - hole) & mask)) {
|
|
297
|
+
object->buckets[hole] = object->buckets[next];
|
|
298
|
+
positions[(object->buckets[hole] - 1) / 2] = hole;
|
|
299
|
+
hole = next;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
object->buckets[hole] = 0;
|
|
273
303
|
return result;
|
|
274
304
|
}
|
|
275
305
|
|
|
@@ -409,6 +439,10 @@ void aug_set_field(AugValue object, size_t index, AugValue value) {
|
|
|
409
439
|
fail("invalid field assignment");
|
|
410
440
|
if (object.as.object->dropped) fail("use of dropped object");
|
|
411
441
|
if (object.as.object->frozen) fail("cannot assign a frozen field");
|
|
442
|
+
AugValue previous = object.as.object->fields[index];
|
|
443
|
+
if (object.as.object->owned_fields && object.as.object->owned_fields[index] &&
|
|
444
|
+
!(previous.tag == AUG_OBJECT && value.tag == AUG_OBJECT && previous.as.object == value.as.object))
|
|
445
|
+
aug_drop(previous);
|
|
412
446
|
object.as.object->fields[index] = value;
|
|
413
447
|
}
|
|
414
448
|
|
|
@@ -417,7 +451,10 @@ AugValue aug_call_method(AugValue object, const char *name, AugValue *args, int
|
|
|
417
451
|
if (object.as.object->dropped) fail("use of dropped object");
|
|
418
452
|
for (size_t i = 0; i < object.as.object->method_count; i++) {
|
|
419
453
|
const AugMethodEntry *entry = &object.as.object->methods[i];
|
|
420
|
-
if (strcmp(entry->name, name) == 0)
|
|
454
|
+
if (strcmp(entry->name, name) == 0) {
|
|
455
|
+
if(entry->pointer_function){AugValue result=aug_null();entry->pointer_function(&result,&object,args,count);return result;}
|
|
456
|
+
return entry->function(object, args, count);
|
|
457
|
+
}
|
|
421
458
|
}
|
|
422
459
|
fprintf(stderr, "AugScript runtime error: %s has no method %s\n",
|
|
423
460
|
object.as.object->type_name, name);
|
|
@@ -736,6 +773,7 @@ void aug_collect(void) {
|
|
|
736
773
|
free(object->text);
|
|
737
774
|
free(object->fields);
|
|
738
775
|
free(object->buckets);
|
|
776
|
+
if (object->kind == AUG_MAP_KIND) free(map_field_buckets(object));
|
|
739
777
|
free(object);
|
|
740
778
|
object_count--;
|
|
741
779
|
}
|
|
@@ -748,20 +786,48 @@ void aug_drop(AugValue value) {
|
|
|
748
786
|
if (value.tag != AUG_OBJECT && value.tag != AUG_STRING) return;
|
|
749
787
|
AugObject *object = value.as.object;
|
|
750
788
|
if (!object || object->dropped) return;
|
|
789
|
+
AugValue roots[2] = {value, aug_error}; AugFrame frame; aug_frame_enter(&frame, roots, 2);
|
|
790
|
+
bool failed = aug_has_error, cancelled = aug_cancelled;
|
|
791
|
+
aug_error = aug_null(); aug_has_error = false; aug_cancelled = false;
|
|
751
792
|
if (object->kind == AUG_OBJECT) {
|
|
752
793
|
if (getenv("AUG_TRACE_DROPS")) fprintf(stderr, "drop: %s\n", object->type_name);
|
|
753
794
|
for (size_t i = 0; i < object->method_count; i++)
|
|
754
795
|
if (strcmp(object->methods[i].name, "drop") == 0) {
|
|
755
|
-
object->methods[i].
|
|
796
|
+
if(object->methods[i].pointer_function){AugValue ignored=aug_null();object->methods[i].pointer_function(&ignored,&value,NULL,0);}
|
|
797
|
+
else object->methods[i].function(value, NULL, 0);
|
|
756
798
|
break;
|
|
757
799
|
}
|
|
758
800
|
}
|
|
759
801
|
object->dropped = true;
|
|
802
|
+
if(object->kind==AUG_NATIVE_RESOURCE_KIND&&object->finalize){
|
|
803
|
+
void *native=object->native;void(*release)(void *)=object->finalize;
|
|
804
|
+
object->native=NULL;object->finalize=NULL;
|
|
805
|
+
if(native)release(native);
|
|
806
|
+
}
|
|
760
807
|
for (size_t i = 0; i < object->field_count; i++)
|
|
761
808
|
if (object->owned_fields && object->owned_fields[i]) aug_drop(object->fields[i]);
|
|
809
|
+
if (failed) aug_throw(roots[1]); aug_cancelled = aug_cancelled || cancelled;
|
|
810
|
+
aug_frame_leave(&frame);
|
|
762
811
|
}
|
|
763
812
|
|
|
764
813
|
void aug_throw(AugValue value) { aug_error = value; aug_has_error = true; }
|
|
814
|
+
void aug_constructor_result_cleanup(AugValue value, AugValue result) {
|
|
815
|
+
if (value.tag != AUG_OBJECT || !value.as.object || value.as.object->dropped) return;
|
|
816
|
+
if (aug_has_error || aug_cancelled || result.tag != AUG_OBJECT || result.as.object != value.as.object)
|
|
817
|
+
aug_drop(value);
|
|
818
|
+
}
|
|
819
|
+
void aug_drop_partial(AugValue value) {
|
|
820
|
+
if(value.tag!=AUG_OBJECT||!value.as.object||value.as.object->dropped)return;
|
|
821
|
+
AugValue roots[2]={value,aug_error};AugFrame frame;aug_frame_enter(&frame,roots,2);
|
|
822
|
+
bool pending=aug_has_error,cancelled=aug_cancelled;
|
|
823
|
+
aug_error=aug_null();aug_has_error=false;aug_cancelled=false;
|
|
824
|
+
AugObject *object=value.as.object;object->dropped=true;
|
|
825
|
+
for(size_t i=0;i<object->field_count;i++)
|
|
826
|
+
if(object->owned_fields&&object->owned_fields[i])aug_drop(object->fields[i]);
|
|
827
|
+
/* A constructor's checked failure remains primary during implicit cleanup. */
|
|
828
|
+
if(pending)aug_throw(roots[1]);aug_cancelled=aug_cancelled||cancelled;
|
|
829
|
+
aug_frame_leave(&frame);
|
|
830
|
+
}
|
|
765
831
|
AugValue aug_take_error(void) {
|
|
766
832
|
AugValue value = aug_error;
|
|
767
833
|
aug_error = aug_null();
|
package/runtime/aug_runtime.h
CHANGED
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
typedef struct AugObject AugObject;
|
|
10
10
|
typedef struct AugValue AugValue;
|
|
11
11
|
typedef AugValue (*AugMethod)(AugValue self, AugValue *args, int count);
|
|
12
|
+
typedef void (*AugPointerMethod)(AugValue *out, const AugValue *self, AugValue *args, int count);
|
|
12
13
|
|
|
13
14
|
enum { AUG_NULL, AUG_INT, AUG_FLOAT, AUG_BOOL, AUG_STRING, AUG_OBJECT };
|
|
14
|
-
enum { AUG_LIST_KIND = 6, AUG_MAP_KIND, AUG_SET_KIND, AUG_TUPLE_KIND, AUG_RECORD_KIND, AUG_BYTES_KIND, AUG_PRIVATE_KEY_KIND, AUG_PUBLIC_KEY_KIND, AUG_JSON_KIND, AUG_HTTP_REQUEST_KIND, AUG_HTTP_RESPONSE_KIND, AUG_HEADERS_KIND, AUG_HTML_KIND, AUG_TASK_KIND, AUG_HTTP_ACTION_KIND };
|
|
15
|
+
enum { AUG_LIST_KIND = 6, AUG_MAP_KIND, AUG_SET_KIND, AUG_TUPLE_KIND, AUG_RECORD_KIND, AUG_BYTES_KIND, AUG_PRIVATE_KEY_KIND, AUG_PUBLIC_KEY_KIND, AUG_JSON_KIND, AUG_HTTP_REQUEST_KIND, AUG_HTTP_RESPONSE_KIND, AUG_HEADERS_KIND, AUG_HTML_KIND, AUG_TASK_KIND, AUG_HTTP_ACTION_KIND, AUG_NATIVE_RESOURCE_KIND };
|
|
15
16
|
|
|
16
17
|
struct AugValue {
|
|
17
18
|
int tag;
|
|
@@ -21,6 +22,7 @@ struct AugValue {
|
|
|
21
22
|
typedef struct {
|
|
22
23
|
const char *name;
|
|
23
24
|
AugMethod function;
|
|
25
|
+
AugPointerMethod pointer_function;
|
|
24
26
|
} AugMethodEntry;
|
|
25
27
|
|
|
26
28
|
struct AugObject {
|
|
@@ -85,7 +87,11 @@ extern void (*aug_mutex_wait_hook)(void);
|
|
|
85
87
|
typedef struct AugTask AugTask;
|
|
86
88
|
typedef void (*AugTaskCompletion)(AugValue task, void *data);
|
|
87
89
|
AugValue aug_task_start(AugMethod function, AugValue receiver, AugValue *args, int count);
|
|
90
|
+
AugValue aug_task_start_owned(AugMethod function, AugValue receiver, AugValue *args, int count, const unsigned char *owned);
|
|
88
91
|
AugValue aug_task_spawn(AugMethod function, AugValue receiver, AugValue *args, int count, AugTaskCompletion completion, void *data);
|
|
92
|
+
/* Compiler-private entry points; native package callbacks have a separate ABI. */
|
|
93
|
+
void aug_task_start_pointer(AugValue *out, AugPointerMethod function, const AugValue *receiver, AugValue *args, int count, const unsigned char *owned);
|
|
94
|
+
void aug_task_spawn_pointer(AugValue *out, AugPointerMethod function, const AugValue *receiver, AugValue *args, int count, AugTaskCompletion completion, void *data);
|
|
89
95
|
AugValue aug_task_wait(AugValue *tasks, int count);
|
|
90
96
|
AugTask *aug_task_current(void);
|
|
91
97
|
bool aug_task_finished(AugValue task);
|
|
@@ -134,6 +140,7 @@ bool aug_string_starts_with(AugValue value, AugValue prefix);
|
|
|
134
140
|
bool aug_string_is_token(AugValue value, int64_t minimum, int64_t maximum);
|
|
135
141
|
int64_t aug_bytes_length(AugValue value);
|
|
136
142
|
AugValue aug_bytes_text(AugValue value);
|
|
143
|
+
bool aug_valid_utf8(const void *text, size_t size);
|
|
137
144
|
AugValue aug_bytes_base64url(AugValue value);
|
|
138
145
|
AugValue aug_base64url_decode(AugValue value);
|
|
139
146
|
|
|
@@ -144,8 +151,10 @@ enum { AUG_SCHEMA_INT, AUG_SCHEMA_C_INT, AUG_SCHEMA_FLOAT, AUG_SCHEMA_BOOL, AUG_
|
|
|
144
151
|
struct AugSchema {
|
|
145
152
|
int kind; bool nullable; bool optional; size_t count;
|
|
146
153
|
const AugSchema *const *fields; const char *const *names; AugFunction make;
|
|
154
|
+
AugPointerMethod pointer_make;
|
|
147
155
|
};
|
|
148
156
|
AugValue aug_json_decode(AugValue value, const AugSchema *schema);
|
|
157
|
+
AugValue aug_schema_make(const AugSchema *schema, AugValue *fields, int count);
|
|
149
158
|
AugValue aug_json_stringify(AugValue value);
|
|
150
159
|
AugValue aug_json_get(AugValue value, AugValue name);
|
|
151
160
|
AugValue aug_json_require(AugValue value, AugValue name);
|
|
@@ -155,15 +164,17 @@ bool aug_json_boolean(AugValue value);
|
|
|
155
164
|
AugValue aug_json_items(AugValue value);
|
|
156
165
|
AugValue aug_json_wrap(AugValue value);
|
|
157
166
|
AugValue _aug_json_parse(AugValue input);
|
|
167
|
+
AugValue _aug_time_now(void);
|
|
158
168
|
typedef enum {
|
|
159
169
|
AUG_HTTP_POLICY_REQUIRE_LOGIN=1, AUG_HTTP_POLICY_REQUIRE_PERMISSION,
|
|
160
170
|
AUG_HTTP_POLICY_LOG_REQUEST, AUG_HTTP_POLICY_RATE_LIMIT, AUG_HTTP_POLICY_TIMEOUT,
|
|
161
171
|
AUG_HTTP_POLICY_CORS, AUG_HTTP_POLICY_COMPRESS
|
|
162
172
|
} AugHttpPolicyKind;
|
|
163
173
|
typedef struct {AugHttpPolicyKind kind;const char *permission;int64_t amount,seconds;bool credentials;const char *origins,*headers;} AugHttpPolicy;
|
|
164
|
-
typedef struct { const char *method; const char *path; AugFunction handler; int stream; int status; const AugHttpPolicy *policies;size_t policy_count; } AugRoute;
|
|
174
|
+
typedef struct { const char *method; const char *path; AugFunction handler; int stream; int status; const AugHttpPolicy *policies;size_t policy_count; AugPointerMethod pointer_handler; } AugRoute;
|
|
165
175
|
void aug_http_policy(const AugHttpPolicy *policy, AugValue request, AugValue dependency, AugValue second);
|
|
166
176
|
AugValue aug_http_finish(AugValue response);
|
|
177
|
+
bool aug_http_head_response(AugValue *response);
|
|
167
178
|
AugValue aug_http_bind(AugValue request, const char *source, const char *name, const AugSchema *schema);
|
|
168
179
|
AugValue aug_httprequest_form(AugValue request, const AugSchema *schema);
|
|
169
180
|
AugValue aug_http_response(AugValue body, int status);
|
|
@@ -236,6 +247,9 @@ void aug_scope_restore(size_t depth);
|
|
|
236
247
|
void aug_collect(void);
|
|
237
248
|
void aug_freeze(AugValue value);
|
|
238
249
|
void aug_drop(AugValue value);
|
|
250
|
+
/* Failed construction releases initialized ownership without invoking drop. */
|
|
251
|
+
void aug_drop_partial(AugValue value);
|
|
252
|
+
void aug_constructor_result_cleanup(AugValue value, AugValue result);
|
|
239
253
|
void aug_throw(AugValue value);
|
|
240
254
|
AugValue aug_take_error(void);
|
|
241
255
|
bool aug_error_is(const char *name);
|
package/runtime/aug_tasks.c
CHANGED
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
/* C stack suspension preserves ordinary August calls and their precise GC frames. */
|
|
9
9
|
struct AugTask {
|
|
10
|
-
mco_coro *coroutine; AugExecution execution; AugMethod function;
|
|
10
|
+
mco_coro *coroutine; AugExecution execution; AugMethod function; AugPointerMethod pointer_function;
|
|
11
11
|
AugValue value; AugRetained retained; bool retained_active, queued, complete, observed;
|
|
12
12
|
size_t base_depth; struct AugTask *ready_next, *sibling; AugScope *owner;
|
|
13
13
|
AugTaskCompletion completion; void *completion_data; unsigned ticks;
|
|
14
|
+
unsigned char *owned_inputs;
|
|
14
15
|
};
|
|
15
16
|
static AugTask *ready_first, *ready_last;
|
|
16
17
|
void (*aug_scheduler_io)(bool wait);
|
|
@@ -32,7 +33,7 @@ void aug_task_wake(AugTask *task) {
|
|
|
32
33
|
static void destroy_task(void *native) {
|
|
33
34
|
AugTask *task = native;
|
|
34
35
|
if (!task->complete) fatal("collected an unfinished task");
|
|
35
|
-
mco_destroy(task->coroutine); free(task);
|
|
36
|
+
mco_destroy(task->coroutine); free(task->owned_inputs); free(task);
|
|
36
37
|
}
|
|
37
38
|
void aug_task_release(AugValue value) {
|
|
38
39
|
AugTask *task = task_of(value);
|
|
@@ -52,8 +53,22 @@ static void run_task(mco_coro *coroutine) {
|
|
|
52
53
|
AugTask *task = mco_get_user_data(coroutine);
|
|
53
54
|
AugValue arguments = aug_field(task->value, 1);
|
|
54
55
|
if (!aug_cancelled) {
|
|
55
|
-
AugValue
|
|
56
|
-
|
|
56
|
+
AugValue roots[2] = {aug_field(task->value, 0), aug_null()};
|
|
57
|
+
AugFrame frame; aug_frame_enter(&frame, roots, 2);
|
|
58
|
+
if (task->pointer_function) task->pointer_function(&roots[1], &roots[0], arguments.as.object->fields, (int)arguments.as.object->field_count);
|
|
59
|
+
else roots[1] = task->function(roots[0], arguments.as.object->fields, (int)arguments.as.object->field_count);
|
|
60
|
+
aug_set_field(task->value, 2, roots[1]);
|
|
61
|
+
aug_frame_leave(&frame);
|
|
62
|
+
} else if (task->owned_inputs) {
|
|
63
|
+
/* Ownership crossed at start, even if a sibling cancels this child before
|
|
64
|
+
entry. No callee ran to release these captures. Cleanup must run with
|
|
65
|
+
cancellation suspended, just as an always block does. */
|
|
66
|
+
AugValue pending = aug_error; AugFrame frame; aug_frame_enter(&frame, &pending, 1);
|
|
67
|
+
bool failed = aug_has_error; aug_error = aug_null(); aug_has_error = false; aug_cancelled = false;
|
|
68
|
+
for (size_t i = 0; i < arguments.as.object->field_count; i++) if (task->owned_inputs[i]) {
|
|
69
|
+
aug_drop(aug_field(arguments, i)); aug_set_field(arguments, i, aug_null());
|
|
70
|
+
}
|
|
71
|
+
if (failed) aug_throw(pending); aug_cancelled = true; aug_frame_leave(&frame);
|
|
57
72
|
}
|
|
58
73
|
aug_scope_restore(task->base_depth);
|
|
59
74
|
if (aug_has_error) { aug_set_field(task->value, 3, aug_take_error()); cancel_group(task); }
|
|
@@ -110,14 +125,15 @@ static void join_scope(AugScope *scope) {
|
|
|
110
125
|
if (!aug_has_error && first_error.tag != AUG_NULL) aug_throw(first_error);
|
|
111
126
|
aug_frame_leave(&frame);
|
|
112
127
|
}
|
|
113
|
-
AugValue
|
|
128
|
+
static AugValue spawn_task(AugMethod function, AugPointerMethod pointer_function, AugValue receiver, AugValue *args, int count, const unsigned char *owned, AugTaskCompletion completion, void *data) {
|
|
114
129
|
aug_scope_join_hook = join_scope;
|
|
115
130
|
AugValue roots[3] = {receiver, aug_null(), aug_null()}; AugFrame frame; aug_frame_enter(&frame, roots, 3);
|
|
116
131
|
roots[1] = aug_list_new(args, (size_t)count);
|
|
117
132
|
roots[2] = aug_new_object("Task", 4, NULL, NULL, 0); roots[2].as.object->kind = AUG_TASK_KIND;
|
|
118
133
|
aug_set_field(roots[2], 0, receiver); aug_set_field(roots[2], 1, roots[1]);
|
|
119
134
|
AugTask *task = calloc(1, sizeof(*task)); if (!task) fatal("out of memory");
|
|
120
|
-
task->function = function; task->value = roots[2]; task->completion = completion; task->completion_data = data;
|
|
135
|
+
task->function = function; task->pointer_function = pointer_function; task->value = roots[2]; task->completion = completion; task->completion_data = data;
|
|
136
|
+
if (owned && count) { task->owned_inputs = malloc((size_t)count); if (!task->owned_inputs) fatal("out of memory"); memcpy(task->owned_inputs, owned, (size_t)count); }
|
|
121
137
|
aug_execution_init(&task->execution); task->execution.fiber = task;
|
|
122
138
|
AugExecution *parent = aug_execution_current();
|
|
123
139
|
task->execution.scope_stack = parent->scope_stack; task->execution.scope_depth = parent->scope_depth; task->base_depth = parent->scope_depth;
|
|
@@ -128,10 +144,25 @@ AugValue aug_task_spawn(AugMethod function, AugValue receiver, AugValue *args, i
|
|
|
128
144
|
if (mco_create(&task->coroutine, &description) != MCO_SUCCESS) fatal("cannot allocate coroutine stack");
|
|
129
145
|
aug_task_wake(task); AugValue result = roots[2]; aug_frame_leave(&frame); return result;
|
|
130
146
|
}
|
|
147
|
+
AugValue aug_task_spawn(AugMethod function, AugValue receiver, AugValue *args, int count, AugTaskCompletion completion, void *data) {
|
|
148
|
+
return spawn_task(function, NULL, receiver, args, count, NULL, completion, data);
|
|
149
|
+
}
|
|
150
|
+
void aug_task_spawn_pointer(AugValue *out, AugPointerMethod function, const AugValue *receiver, AugValue *args, int count, AugTaskCompletion completion, void *data) {
|
|
151
|
+
*out = spawn_task(NULL, function, receiver ? *receiver : aug_null(), args, count, NULL, completion, data);
|
|
152
|
+
}
|
|
153
|
+
void aug_task_start_pointer(AugValue *out, AugPointerMethod function, const AugValue *receiver, AugValue *args, int count, const unsigned char *owned) {
|
|
154
|
+
AugScope *scope = aug_execution_current()->scope_stack;
|
|
155
|
+
if (!scope) { *out = aug_error_named("ConcurrencyError"); return; }
|
|
156
|
+
*out = spawn_task(NULL, function, receiver ? *receiver : aug_null(), args, count, owned, NULL, NULL);
|
|
157
|
+
AugTask *task = task_of(*out); task->owner = scope; task->sibling = scope->tasks; scope->tasks = task;
|
|
158
|
+
}
|
|
131
159
|
AugValue aug_task_start(AugMethod function, AugValue receiver, AugValue *args, int count) {
|
|
160
|
+
return aug_task_start_owned(function, receiver, args, count, NULL);
|
|
161
|
+
}
|
|
162
|
+
AugValue aug_task_start_owned(AugMethod function, AugValue receiver, AugValue *args, int count, const unsigned char *owned) {
|
|
132
163
|
AugScope *scope = aug_execution_current()->scope_stack;
|
|
133
164
|
if (!scope) return aug_error_named("ConcurrencyError");
|
|
134
|
-
AugValue value =
|
|
165
|
+
AugValue value = spawn_task(function, NULL, receiver, args, count, owned, NULL, NULL); AugTask *task = task_of(value);
|
|
135
166
|
task->owner = scope; task->sibling = scope->tasks; scope->tasks = task; return value;
|
|
136
167
|
}
|
|
137
168
|
static AugValue wait_one(AugValue value) {
|
package/runtime/aug_values.c
CHANGED
|
@@ -25,22 +25,28 @@ AugValue aug_string_split(AugValue value, AugValue separator) {
|
|
|
25
25
|
AugValue result = roots[1]; aug_frame_leave(&frame); return result;
|
|
26
26
|
}
|
|
27
27
|
int64_t aug_bytes_length(AugValue value) { return (int64_t)value.as.object->text_length; }
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
bool aug_valid_utf8(const void *data, size_t size) {
|
|
29
|
+
if (!data && size) return false;
|
|
30
|
+
const unsigned char *text = data;
|
|
31
31
|
for (size_t i = 0; i < size;) {
|
|
32
32
|
unsigned char first = text[i++];
|
|
33
33
|
if (first < 0x80) continue;
|
|
34
34
|
int extra = first >= 0xc2 && first <= 0xdf ? 1 : first >= 0xe0 && first <= 0xef ? 2 : first >= 0xf0 && first <= 0xf4 ? 3 : -1;
|
|
35
|
-
if (extra < 0 ||
|
|
35
|
+
if (extra < 0 || (size_t)extra > size - i) return false;
|
|
36
36
|
uint32_t code = first & (extra == 1 ? 0x1f : extra == 2 ? 0x0f : 0x07);
|
|
37
37
|
for (int j = 0; j < extra; j++) {
|
|
38
38
|
unsigned char next = text[i++];
|
|
39
|
-
if ((next & 0xc0) != 0x80) return
|
|
39
|
+
if ((next & 0xc0) != 0x80) return false;
|
|
40
40
|
code = (code << 6) | (next & 0x3f);
|
|
41
41
|
}
|
|
42
|
-
if (code < (extra == 1 ? 0x80u : extra == 2 ? 0x800u : 0x10000u) || code > 0x10ffff || (code >= 0xd800 && code <= 0xdfff)) return
|
|
42
|
+
if (code < (extra == 1 ? 0x80u : extra == 2 ? 0x800u : 0x10000u) || code > 0x10ffff || (code >= 0xd800 && code <= 0xdfff)) return false;
|
|
43
43
|
}
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
AugValue aug_bytes_text(AugValue value) {
|
|
47
|
+
const void *text = value.as.object->text;
|
|
48
|
+
size_t size = value.as.object->text_length;
|
|
49
|
+
if (!aug_valid_utf8(text, size)) return aug_error_named("ConversionError");
|
|
44
50
|
return aug_string_n(text, size);
|
|
45
51
|
}
|
|
46
52
|
|