@greenpandastudios/aug-cli 0.20.1 → 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 +1 -1
- 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 +6 -6
- package/docs/contributing-benchmarks.md +36 -6
- package/docs/dev-containers.md +8 -15
- 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 +1 -1
- package/docs/docker.md +16 -17
- package/docs/example-projects.json +32 -0
- package/docs/examples/approved-design/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/approved-design/domain/app.md +4 -4
- package/docs/examples/approved-design/main.md +2 -2
- 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/developer-workflow/calculator.md +5 -5
- package/docs/examples/developer-workflow/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/developer-workflow/logging/console.md +2 -2
- package/docs/examples/developer-workflow/logging/logger.md +2 -2
- package/docs/examples/developer-workflow/main.md +2 -2
- 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/float-benchmark/index.md +35 -0
- package/docs/examples/float-benchmark/main.md +75 -0
- package/docs/examples/generic-di/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/generic-di/main.md +2 -2
- package/docs/examples/generic-di/types.md +3 -3
- package/docs/examples/hello/app/greeter.md +3 -3
- package/docs/examples/hello/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/hello/logging/console.md +2 -2
- package/docs/examples/hello/logging/logger.md +2 -2
- package/docs/examples/hello/main.md +2 -2
- package/docs/examples/index.md +18 -1
- package/docs/examples/interceptors/app.md +5 -5
- package/docs/examples/interceptors/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/interceptors/interceptors.md +2 -2
- package/docs/examples/interceptors/logging.md +3 -3
- package/docs/examples/interceptors/main.md +2 -2
- 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 +2 -2
- package/docs/examples/new-syntax/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/new-syntax/greeter.md +3 -3
- package/docs/examples/new-syntax/logger.md +2 -2
- package/docs/examples/new-syntax/main.md +2 -2
- package/docs/examples/ownership-transfer/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/ownership-transfer/main.md +2 -2
- package/docs/examples/ownership-transfer/resource.md +2 -2
- package/docs/examples/packages-math/aug-package-json.md +1 -1
- 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/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/getting-started.md +3 -3
- package/docs/grammar.md +2 -2
- package/docs/gym-results.json +784 -0
- package/docs/implementation-map.md +6 -0
- package/docs/index.md +1 -1
- package/docs/kernel-results.json +1170 -0
- package/docs/language-conformance.md +6 -0
- package/docs/language-constructs.md +9 -1
- package/docs/learn/index.md +1 -1
- package/docs/maintaining-docs.md +1 -1
- 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 +2 -2
- package/docs/performance.md +50 -29
- package/docs/production-readiness.md +11 -1
- package/docs/public/downloads/approved-design.zip +0 -0
- package/docs/public/downloads/calls-benchmark.zip +0 -0
- package/docs/public/downloads/developer-workflow.zip +0 -0
- package/docs/public/downloads/errors-benchmark.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/hello.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/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/strings-benchmark.zip +0 -0
- package/docs/public/downloads/tasks-benchmark.zip +0 -0
- package/docs/qualification-results.md +66 -0
- package/docs/reference.md +24 -0
- package/docs/releasing.md +81 -6
- 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/roadmap.md +1 -0
- package/docs/safety-gyms.md +41 -0
- package/docs/tooling.md +16 -15
- package/docs/web-library-gaps.md +1 -1
- package/docs/web.md +4 -0
- package/examples/approved-design/.aug-spec/manifest.json +3 -3
- package/examples/approved-design/domain/app.aug.md +4 -4
- package/examples/approved-design/main.aug.md +2 -2
- package/examples/developer-workflow/.aug-spec/manifest.json +3 -3
- package/examples/developer-workflow/calculator.aug.md +5 -5
- package/examples/developer-workflow/logging/console.aug.md +2 -2
- package/examples/developer-workflow/logging/logger.aug.md +2 -2
- package/examples/developer-workflow/main.aug.md +2 -2
- package/examples/generic-di/.aug-spec/manifest.json +3 -3
- package/examples/generic-di/main.aug.md +2 -2
- package/examples/generic-di/types.aug.md +3 -3
- package/examples/hello/.aug-spec/manifest.json +3 -3
- package/examples/hello/app/greeter.aug.md +3 -3
- package/examples/hello/logging/console.aug.md +2 -2
- package/examples/hello/logging/logger.aug.md +2 -2
- package/examples/hello/main.aug.md +2 -2
- package/examples/interceptors/.aug-spec/manifest.json +3 -3
- package/examples/interceptors/app.aug.md +5 -5
- package/examples/interceptors/interceptors.aug.md +2 -2
- package/examples/interceptors/logging.aug.md +3 -3
- package/examples/interceptors/main.aug.md +2 -2
- 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/manifest.json +3 -3
- package/examples/new-syntax/console.aug.md +2 -2
- package/examples/new-syntax/greeter.aug.md +3 -3
- package/examples/new-syntax/logger.aug.md +2 -2
- package/examples/new-syntax/main.aug.md +2 -2
- package/examples/oidc-login/aug.lock.json +6 -6
- package/examples/ownership-transfer/.aug-spec/manifest.json +3 -3
- package/examples/ownership-transfer/main.aug.md +2 -2
- package/examples/ownership-transfer/resource.aug.md +2 -2
- package/examples/packages/math/aug-package.json +1 -1
- package/native/compiler-packs.json +43 -0
- package/package.json +3 -2
- 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 +4 -1
- package/src/ast.js +1 -1
- package/src/checker.js +110 -28
- package/src/cli.js +92 -14
- package/src/codegen.js +31 -6
- package/src/compiler-packs.js +66 -0
- package/src/config.js +2 -2
- package/src/editor.js +15 -6
- package/src/formatter.js +4 -2
- package/src/git-http.js +137 -0
- package/src/git-packages.js +9 -1
- package/src/help.js +10 -2
- package/src/ir-types.js +5 -0
- package/src/ir-verify.js +277 -0
- package/src/ir.js +962 -0
- 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/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/package-locking.js +43 -0
- package/src/package-manager.js +23 -8
- package/src/parser.js +20 -2
- package/src/project.js +2 -2
- package/src/runtime-abi.js +23 -0
- package/src/runtime-adapters.js +18 -0
- package/src/schemas.js +24 -17
- package/src/semantic.js +8 -3
- package/src/snippets.js +1 -0
- package/src/spec.js +49 -8
- /package/examples/approved-design/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/approved-design/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/developer-workflow/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/developer-workflow/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/generic-di/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/generic-di/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/hello/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/hello/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/interceptors/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/interceptors/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/new-syntax/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/new-syntax/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/ownership-transfer/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/ownership-transfer/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "packages/@greenpandastudios/aug-sqlite/0.1.3/bindings.aug · A database with SQLite"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/bindings.aug"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
search: false
|
|
10
|
+
pageClass: aug-example-page
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# `packages/@greenpandastudios/aug-sqlite/0.1.3/bindings.aug`
|
|
14
|
+
|
|
15
|
+
[A database with SQLite](../../../../../index.md) · Dependency source and specification
|
|
16
|
+
|
|
17
|
+
This is the exact dependency version used by this example.
|
|
18
|
+
|
|
19
|
+
::::: example-compare
|
|
20
|
+
|
|
21
|
+
:::: example-code
|
|
22
|
+
|
|
23
|
+
## Code {#code}
|
|
24
|
+
|
|
25
|
+
::: code-group
|
|
26
|
+
|
|
27
|
+
```aug [Indentation]
|
|
28
|
+
// aug-spec: "bindings.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
29
|
+
extern C resource Database
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```aug [Braces]
|
|
33
|
+
// aug-spec: "bindings.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
34
|
+
extern C resource Database
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
:::
|
|
38
|
+
|
|
39
|
+
::::
|
|
40
|
+
|
|
41
|
+
:::: example-spec
|
|
42
|
+
|
|
43
|
+
## Compiled specification {#specification}
|
|
44
|
+
|
|
45
|
+
### `Database` · native resource · [source](bindings.md#code) {#symbol-Database}
|
|
46
|
+
|
|
47
|
+
Native implementation: `@greenpandastudios/aug-sqlite@0.1.3`, `3.53.4`. Supported targets: linux arm64 glibc 2.36+, linux x64 glibc 2.36+, macos arm64 14.0+. Binding contract: [`native.abi.json`](native.abi-json.md) (SHA-256 `3c75c2925c85f1b83db06ee00fa04f1d2d37c9fd6edca0d074ce89b4647ffffb`). An owned value releases its opaque handle through `aug_sqlite_release_v1` when its scope ends, including error and return paths.
|
|
48
|
+
|
|
49
|
+
::::
|
|
50
|
+
|
|
51
|
+
:::::
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "packages/@greenpandastudios/aug-sqlite/0.1.3/contracts.aug · A database with SQLite"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/contracts.aug"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
search: false
|
|
10
|
+
pageClass: aug-example-page
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# `packages/@greenpandastudios/aug-sqlite/0.1.3/contracts.aug`
|
|
14
|
+
|
|
15
|
+
[A database with SQLite](../../../../../index.md) · Dependency source and specification
|
|
16
|
+
|
|
17
|
+
This is the exact dependency version used by this example.
|
|
18
|
+
|
|
19
|
+
::::: example-compare
|
|
20
|
+
|
|
21
|
+
:::: example-code
|
|
22
|
+
|
|
23
|
+
## Code {#code}
|
|
24
|
+
|
|
25
|
+
::: code-group
|
|
26
|
+
|
|
27
|
+
```aug [Indentation]
|
|
28
|
+
// aug-spec: "contracts.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
29
|
+
import Database from bindings
|
|
30
|
+
SqliteError(int code, string message) implements Error:
|
|
31
|
+
pass
|
|
32
|
+
/** Permission to open database files. Select the native adapter in main.aug. */
|
|
33
|
+
capability DatabaseStorage:
|
|
34
|
+
open(string path) returns own Database uses DatabaseStorage.open unless SqliteError
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```aug [Braces]
|
|
38
|
+
// aug-spec: "contracts.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
39
|
+
import Database from bindings
|
|
40
|
+
SqliteError(int code, string message) implements Error {
|
|
41
|
+
pass
|
|
42
|
+
}
|
|
43
|
+
/** Permission to open database files. Select the native adapter in main.aug. */
|
|
44
|
+
capability DatabaseStorage {
|
|
45
|
+
open(string path) returns own Database uses DatabaseStorage.open unless SqliteError
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
:::
|
|
50
|
+
|
|
51
|
+
::::
|
|
52
|
+
|
|
53
|
+
:::: example-spec
|
|
54
|
+
|
|
55
|
+
## Compiled specification {#specification}
|
|
56
|
+
|
|
57
|
+
### `SqliteError` · class · [source](contracts.md#code) {#symbol-SqliteError}
|
|
58
|
+
|
|
59
|
+
It implements `Error`. It takes `code` as an integer, kept read-only and `message` as a string, kept read-only.
|
|
60
|
+
|
|
61
|
+
### `DatabaseStorage` · capability interface · [source](contracts.md#code) {#symbol-DatabaseStorage}
|
|
62
|
+
|
|
63
|
+
Permission to open database files. Select the native adapter in main.aug.
|
|
64
|
+
|
|
65
|
+
#### `DatabaseStorage.open` · [source](contracts.md#code) {#symbol-DatabaseStorage.open}
|
|
66
|
+
|
|
67
|
+
It takes `path` as a string. It returns ownership of [`Database`](bindings.md#symbol-Database). It can call [`DatabaseStorage.open`](contracts.md#symbol-DatabaseStorage.open). Failures can raise [`SqliteError`](contracts.md#symbol-SqliteError).
|
|
68
|
+
|
|
69
|
+
### Dependencies
|
|
70
|
+
|
|
71
|
+
It uses [`Database`](bindings.md#symbol-Database) from `bindings`.
|
|
72
|
+
|
|
73
|
+
::::
|
|
74
|
+
|
|
75
|
+
:::::
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Native binding contract · A database with SQLite"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/native.abi.json"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
search: false
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Native binding contract
|
|
13
|
+
|
|
14
|
+
[A database with SQLite](../../../../../index.md)
|
|
15
|
+
|
|
16
|
+
This is the exact descriptor checked for this dependency. It records native symbols, ownership, errors, and ABI boundaries. The compiler checks August declarations against it; foreign implementations remain the native author’s responsibility.
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"format": 1,
|
|
21
|
+
"profile": "aug-native-abi-1",
|
|
22
|
+
"resources": [
|
|
23
|
+
{
|
|
24
|
+
"module": "bindings",
|
|
25
|
+
"name": "Database",
|
|
26
|
+
"release": "aug_sqlite_release_v1"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"functions": [
|
|
30
|
+
{
|
|
31
|
+
"module": "api",
|
|
32
|
+
"name": "_open",
|
|
33
|
+
"symbol": "aug_sqlite_open_v1",
|
|
34
|
+
"params": [
|
|
35
|
+
{
|
|
36
|
+
"name": "path",
|
|
37
|
+
"kind": "utf8"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"result": {
|
|
41
|
+
"kind": "resource",
|
|
42
|
+
"resource": "bindings.Database"
|
|
43
|
+
},
|
|
44
|
+
"error": "contracts.SqliteError",
|
|
45
|
+
"callingConvention": "C",
|
|
46
|
+
"status": "i32",
|
|
47
|
+
"uses": [],
|
|
48
|
+
"changes": [],
|
|
49
|
+
"thread": "caller",
|
|
50
|
+
"retainsInputs": false
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"module": "api",
|
|
54
|
+
"name": "_execute",
|
|
55
|
+
"symbol": "aug_sqlite_execute_v1",
|
|
56
|
+
"params": [
|
|
57
|
+
{
|
|
58
|
+
"name": "database",
|
|
59
|
+
"kind": "resource",
|
|
60
|
+
"resource": "bindings.Database",
|
|
61
|
+
"ownership": "borrow"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "sql",
|
|
65
|
+
"kind": "utf8"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "parameters",
|
|
69
|
+
"kind": "utf8-list"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"result": {
|
|
73
|
+
"kind": "i64"
|
|
74
|
+
},
|
|
75
|
+
"error": "contracts.SqliteError",
|
|
76
|
+
"callingConvention": "C",
|
|
77
|
+
"status": "i32",
|
|
78
|
+
"uses": [],
|
|
79
|
+
"changes": [
|
|
80
|
+
"database"
|
|
81
|
+
],
|
|
82
|
+
"thread": "caller",
|
|
83
|
+
"retainsInputs": false
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"module": "api",
|
|
87
|
+
"name": "_queryScalar",
|
|
88
|
+
"symbol": "aug_sqlite_scalar_v1",
|
|
89
|
+
"params": [
|
|
90
|
+
{
|
|
91
|
+
"name": "database",
|
|
92
|
+
"kind": "resource",
|
|
93
|
+
"resource": "bindings.Database",
|
|
94
|
+
"ownership": "read"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"name": "sql",
|
|
98
|
+
"kind": "utf8"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "parameters",
|
|
102
|
+
"kind": "utf8-list"
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"result": {
|
|
106
|
+
"kind": "utf8",
|
|
107
|
+
"release": "aug_sqlite_text_release_v1"
|
|
108
|
+
},
|
|
109
|
+
"error": "contracts.SqliteError",
|
|
110
|
+
"callingConvention": "C",
|
|
111
|
+
"status": "i32",
|
|
112
|
+
"uses": [],
|
|
113
|
+
"changes": [],
|
|
114
|
+
"thread": "caller",
|
|
115
|
+
"retainsInputs": false
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "A database with SQLite"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "examples/native-sqlite"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# A database with SQLite
|
|
12
|
+
|
|
13
|
+
Create an in-memory database, insert a labeled bound value, and query it through the real SQLite implementation. Mutation requires a borrow; scope exit closes the database.
|
|
14
|
+
|
|
15
|
+
Open a file to read its source beside the explanation produced by `aug spec`. **Indentation** and **Braces** display the same checked program; your choice carries across file pages.
|
|
16
|
+
|
|
17
|
+
This project requires the August `0.21.0` LLVM preview on macOS 14+ with Apple Silicon, or Debian/Ubuntu GNU/Linux x64 or ARM64 with glibc 2.36+. The library archives are public; the matching compiler release is still being qualified.
|
|
18
|
+
|
|
19
|
+
## Project files
|
|
20
|
+
|
|
21
|
+
- [`main.aug`](main.md)
|
|
22
|
+
- [`database.aug`](database.md)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## Try this project
|
|
26
|
+
|
|
27
|
+
[Download this project](/downloads/native-sqlite.zip), then extract the archive in an empty working folder. It contains the checked source, configuration, and generated specs. [Install August](../../getting-started.md) once, then run these commands. Native libraries are prepared automatically when needed:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
cd native-sqlite
|
|
31
|
+
aug install .
|
|
32
|
+
aug check .
|
|
33
|
+
aug spec .
|
|
34
|
+
aug test .
|
|
35
|
+
aug run .
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
[Browse all examples](../index.md)
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "main.aug · A database with SQLite"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "examples/native-sqlite/main.aug"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
pageClass: aug-example-page
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# `main.aug`
|
|
13
|
+
|
|
14
|
+
[A database with SQLite](index.md) · Source and specification
|
|
15
|
+
|
|
16
|
+
::: details Files in this project
|
|
17
|
+
|
|
18
|
+
- [`main.aug`](main.md)
|
|
19
|
+
- [`database.aug`](database.md)
|
|
20
|
+
|
|
21
|
+
:::
|
|
22
|
+
|
|
23
|
+
::::: example-compare
|
|
24
|
+
|
|
25
|
+
:::: example-code
|
|
26
|
+
|
|
27
|
+
## Code {#code}
|
|
28
|
+
|
|
29
|
+
::: code-group
|
|
30
|
+
|
|
31
|
+
```aug [Indentation]
|
|
32
|
+
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
33
|
+
import storedName from database
|
|
34
|
+
import SqliteError from "https://github.com/GreenPandaStudios/aug-sqlite#v0.1.3"
|
|
35
|
+
try:
|
|
36
|
+
print(value=storedName())
|
|
37
|
+
catch SqliteError error:
|
|
38
|
+
print(value=error.message)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```aug [Braces]
|
|
42
|
+
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
43
|
+
import storedName from database
|
|
44
|
+
import SqliteError from "https://github.com/GreenPandaStudios/aug-sqlite#v0.1.3"
|
|
45
|
+
try {
|
|
46
|
+
print(value=storedName())
|
|
47
|
+
}
|
|
48
|
+
catch SqliteError error {
|
|
49
|
+
print(value=error.message)
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
:::
|
|
54
|
+
|
|
55
|
+
::::
|
|
56
|
+
|
|
57
|
+
:::: example-spec
|
|
58
|
+
|
|
59
|
+
## Compiled specification {#specification}
|
|
60
|
+
|
|
61
|
+
### Startup
|
|
62
|
+
|
|
63
|
+
It prints [`storedName`](database.md#symbol-storedName). If this work raises [`SqliteError`](dependencies/packages/%40greenpandastudios/aug-sqlite/0.1.3/contracts.md#symbol-SqliteError) as `error`, it prints `error.message`.
|
|
64
|
+
|
|
65
|
+
### Dependencies
|
|
66
|
+
|
|
67
|
+
It uses [`SqliteError`](dependencies/packages/%40greenpandastudios/aug-sqlite/0.1.3/contracts.md#symbol-SqliteError) (`message`) from `https://github.com/GreenPandaStudios/aug-sqlite#v0.1.3`. It uses [`storedName`](database.md#symbol-storedName) from `database`.
|
|
68
|
+
|
|
69
|
+
Built-in operations follow the [language reference](https://greenpandastudios.github.io/augscript/language-constructs).
|
|
70
|
+
|
|
71
|
+
::::
|
|
72
|
+
|
|
73
|
+
:::::
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "compression.aug · Compression with zlib"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "examples/native-zlib/compression.aug"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
pageClass: aug-example-page
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# `compression.aug`
|
|
13
|
+
|
|
14
|
+
[Compression with zlib](index.md) · Source and specification
|
|
15
|
+
|
|
16
|
+
::: details Files in this project
|
|
17
|
+
|
|
18
|
+
- [`main.aug`](main.md)
|
|
19
|
+
- [`compression.aug`](compression.md)
|
|
20
|
+
|
|
21
|
+
:::
|
|
22
|
+
|
|
23
|
+
::::: example-compare
|
|
24
|
+
|
|
25
|
+
:::: example-code
|
|
26
|
+
|
|
27
|
+
## Code {#code}
|
|
28
|
+
|
|
29
|
+
::: code-group
|
|
30
|
+
|
|
31
|
+
```aug [Indentation]
|
|
32
|
+
// aug-spec: "compression.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
33
|
+
import CompressionError and compress and decompress from "https://github.com/GreenPandaStudios/aug-zlib#v0.1.3"
|
|
34
|
+
/** Compress text with zlib, then restore its bytes within a fixed output limit. */
|
|
35
|
+
roundTrip() returns Bytes unless CompressionError:
|
|
36
|
+
Bytes input = "The world runs on language".bytes()
|
|
37
|
+
Bytes compressed = compress(input)
|
|
38
|
+
return decompress(input=compressed, maximumOutput=4096)
|
|
39
|
+
test roundTrip:
|
|
40
|
+
when "compression":
|
|
41
|
+
it "preserves_the_original_bytes":
|
|
42
|
+
Bytes restored = roundTrip()
|
|
43
|
+
assert(restored.text() == "The world runs on language")
|
|
44
|
+
assert(restored.length() == 26)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```aug [Braces]
|
|
48
|
+
// aug-spec: "compression.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
49
|
+
import CompressionError and compress and decompress from "https://github.com/GreenPandaStudios/aug-zlib#v0.1.3"
|
|
50
|
+
/** Compress text with zlib, then restore its bytes within a fixed output limit. */
|
|
51
|
+
roundTrip() returns Bytes unless CompressionError {
|
|
52
|
+
Bytes input = "The world runs on language".bytes()
|
|
53
|
+
Bytes compressed = compress(input)
|
|
54
|
+
return decompress(input=compressed, maximumOutput=4096)
|
|
55
|
+
}
|
|
56
|
+
test roundTrip {
|
|
57
|
+
when "compression" {
|
|
58
|
+
it "preserves_the_original_bytes" {
|
|
59
|
+
Bytes restored = roundTrip()
|
|
60
|
+
assert(restored.text() == "The world runs on language")
|
|
61
|
+
assert(restored.length() == 26)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
:::
|
|
68
|
+
|
|
69
|
+
::::
|
|
70
|
+
|
|
71
|
+
:::: example-spec
|
|
72
|
+
|
|
73
|
+
## Compiled specification {#specification}
|
|
74
|
+
|
|
75
|
+
### `roundTrip` · [source](compression.md#code) {#symbol-roundTrip}
|
|
76
|
+
|
|
77
|
+
Compress text with zlib, then restore its bytes within a fixed output limit. Failures can raise [`CompressionError`](dependencies/packages/%40greenpandastudios/aug-zlib/0.1.3/contracts.md#symbol-CompressionError).
|
|
78
|
+
|
|
79
|
+
It sets `input` of type `Bytes` to the UTF-8 bytes of `"The world runs on language"`. It sets `compressed` of type `Bytes` to [`compress`](dependencies/packages/%40greenpandastudios/aug-zlib/0.1.3/api.md#symbol-compress) with `input`. It returns [`decompress`](dependencies/packages/%40greenpandastudios/aug-zlib/0.1.3/api.md#symbol-decompress) with `input` from `compressed` and `maximumOutput` `4096`.
|
|
80
|
+
|
|
81
|
+
### `test roundTrip` · [source](compression.md#code) {#symbol-test-20-roundTrip}
|
|
82
|
+
|
|
83
|
+
Tests [`roundTrip`](compression.md#symbol-roundTrip). Each case gets fresh setup and dependencies.
|
|
84
|
+
|
|
85
|
+
#### `compression`
|
|
86
|
+
|
|
87
|
+
##### `preserves_the_original_bytes` · [source](compression.md#code)
|
|
88
|
+
|
|
89
|
+
It gets `restored` of type `Bytes` from [`roundTrip`](compression.md#symbol-roundTrip). The test requires `restored.text` equals `"The world runs on language"`. The test requires the byte length of `restored` equals `26`.
|
|
90
|
+
|
|
91
|
+
### Dependencies
|
|
92
|
+
|
|
93
|
+
It uses [`compress`](dependencies/packages/%40greenpandastudios/aug-zlib/0.1.3/api.md#symbol-compress), [`decompress`](dependencies/packages/%40greenpandastudios/aug-zlib/0.1.3/api.md#symbol-decompress), and [`CompressionError`](dependencies/packages/%40greenpandastudios/aug-zlib/0.1.3/contracts.md#symbol-CompressionError) from `https://github.com/GreenPandaStudios/aug-zlib#v0.1.3`.
|
|
94
|
+
|
|
95
|
+
Built-in operations follow the [language reference](https://greenpandastudios.github.io/augscript/language-constructs).
|
|
96
|
+
|
|
97
|
+
::::
|
|
98
|
+
|
|
99
|
+
:::::
|
package/docs/examples/native-zlib/dependencies/packages/@greenpandastudios/aug-zlib/0.1.3/api.md
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "packages/@greenpandastudios/aug-zlib/0.1.3/api.aug · Compression with zlib"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/api.aug"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
search: false
|
|
10
|
+
pageClass: aug-example-page
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# `packages/@greenpandastudios/aug-zlib/0.1.3/api.aug`
|
|
14
|
+
|
|
15
|
+
[Compression with zlib](../../../../../index.md) · Dependency source and specification
|
|
16
|
+
|
|
17
|
+
This is the exact dependency version used by this example.
|
|
18
|
+
|
|
19
|
+
::::: example-compare
|
|
20
|
+
|
|
21
|
+
:::: example-code
|
|
22
|
+
|
|
23
|
+
## Code {#code}
|
|
24
|
+
|
|
25
|
+
::: code-group
|
|
26
|
+
|
|
27
|
+
```aug [Indentation]
|
|
28
|
+
// aug-spec: "api.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
29
|
+
import CompressionError from contracts
|
|
30
|
+
extern C _compress(Bytes input) returns Bytes unless CompressionError
|
|
31
|
+
extern C _decompress(Bytes input, int maximumOutput) returns Bytes unless CompressionError
|
|
32
|
+
/** Compress bytes with the standard zlib framing. */
|
|
33
|
+
compress(Bytes input) returns Bytes:
|
|
34
|
+
unsafe:
|
|
35
|
+
return _compress(input)
|
|
36
|
+
/** Decompress at most maximumOutput bytes (maximum 256 MiB). */
|
|
37
|
+
decompress(Bytes input, int maximumOutput) returns Bytes:
|
|
38
|
+
unsafe:
|
|
39
|
+
return _decompress(input, maximumOutput)
|
|
40
|
+
test compress:
|
|
41
|
+
when "compression":
|
|
42
|
+
it "preserves_bytes":
|
|
43
|
+
Bytes input = "The world runs on language".bytes()
|
|
44
|
+
Bytes packed = compress(input)
|
|
45
|
+
Bytes restored = decompress(input=packed, maximumOutput=4096)
|
|
46
|
+
assert(restored.text() == "The world runs on language")
|
|
47
|
+
it "checks_output_limit":
|
|
48
|
+
Bytes packed = compress(input="length limit".bytes())
|
|
49
|
+
bool rejected = false
|
|
50
|
+
try:
|
|
51
|
+
decompress(input=packed, maximumOutput=1)
|
|
52
|
+
catch CompressionError error:
|
|
53
|
+
rejected = true
|
|
54
|
+
assert(rejected)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```aug [Braces]
|
|
58
|
+
// aug-spec: "api.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
59
|
+
import CompressionError from contracts
|
|
60
|
+
extern C _compress(Bytes input) returns Bytes unless CompressionError
|
|
61
|
+
extern C _decompress(Bytes input, int maximumOutput) returns Bytes unless CompressionError
|
|
62
|
+
/** Compress bytes with the standard zlib framing. */
|
|
63
|
+
compress(Bytes input) returns Bytes {
|
|
64
|
+
unsafe {
|
|
65
|
+
return _compress(input)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** Decompress at most maximumOutput bytes (maximum 256 MiB). */
|
|
69
|
+
decompress(Bytes input, int maximumOutput) returns Bytes {
|
|
70
|
+
unsafe {
|
|
71
|
+
return _decompress(input, maximumOutput)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
test compress {
|
|
75
|
+
when "compression" {
|
|
76
|
+
it "preserves_bytes" {
|
|
77
|
+
Bytes input = "The world runs on language".bytes()
|
|
78
|
+
Bytes packed = compress(input)
|
|
79
|
+
Bytes restored = decompress(input=packed, maximumOutput=4096)
|
|
80
|
+
assert(restored.text() == "The world runs on language")
|
|
81
|
+
}
|
|
82
|
+
it "checks_output_limit" {
|
|
83
|
+
Bytes packed = compress(input="length limit".bytes())
|
|
84
|
+
bool rejected = false
|
|
85
|
+
try {
|
|
86
|
+
decompress(input=packed, maximumOutput=1)
|
|
87
|
+
}
|
|
88
|
+
catch CompressionError error {
|
|
89
|
+
rejected = true
|
|
90
|
+
}
|
|
91
|
+
assert(rejected)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
:::
|
|
98
|
+
|
|
99
|
+
::::
|
|
100
|
+
|
|
101
|
+
:::: example-spec
|
|
102
|
+
|
|
103
|
+
## Compiled specification {#specification}
|
|
104
|
+
|
|
105
|
+
### `compress` · [source](api.md#code) {#symbol-compress}
|
|
106
|
+
|
|
107
|
+
Compress bytes with the standard zlib framing. It takes `input` as `Bytes`. Failures can raise [`CompressionError`](contracts.md#symbol-CompressionError).
|
|
108
|
+
|
|
109
|
+
Within an unsafe block, it returns [`_compress`](api.md#symbol-_compress) with `input`. Native operations must satisfy their declared C contracts.
|
|
110
|
+
|
|
111
|
+
### `decompress` · [source](api.md#code) {#symbol-decompress}
|
|
112
|
+
|
|
113
|
+
Decompress at most maximumOutput bytes (maximum 256 MiB). It takes `input` as `Bytes` and `maximumOutput` as an integer. Failures can raise [`CompressionError`](contracts.md#symbol-CompressionError).
|
|
114
|
+
|
|
115
|
+
Within an unsafe block, it returns [`_decompress`](api.md#symbol-_decompress) with `input` and `maximumOutput`. Native operations must satisfy their declared C contracts.
|
|
116
|
+
|
|
117
|
+
### `_compress` · [source](api.md#code) {#symbol-_compress}
|
|
118
|
+
|
|
119
|
+
It is private to its defining scope. It takes `input` as `Bytes`. It returns `Bytes`. Failures can raise [`CompressionError`](contracts.md#symbol-CompressionError).
|
|
120
|
+
|
|
121
|
+
Native implementation: `@greenpandastudios/aug-zlib@0.1.3`, `1.3.2`. Supported targets: linux arm64 glibc 2.36+, linux x64 glibc 2.36+, macos arm64 14.0+. Binding contract: [`native.abi.json`](native.abi-json.md) (SHA-256 `c3d4b36eadcccd13caff71597ed77a8e7307f0cfe3d13660a8e9127efe942b3d`). It calls `aug_zlib_compress_v1` through the C ABI on the caller thread; a blocking native call blocks that thread. August copies the returned buffer, then calls `aug_zlib_release_v1` to release it. The compiler checks the provider, descriptor digest, signature and ownership at August call sites. The native author promises not to retain inputs, enter August from foreign threads, or unwind across the C boundary; internal native workers may run. The compiler does not prove those promises.
|
|
122
|
+
|
|
123
|
+
### `_decompress` · [source](api.md#code) {#symbol-_decompress}
|
|
124
|
+
|
|
125
|
+
It is private to its defining scope. It takes `input` as `Bytes` and `maximumOutput` as an integer. It returns `Bytes`. Failures can raise [`CompressionError`](contracts.md#symbol-CompressionError).
|
|
126
|
+
|
|
127
|
+
Native implementation: `@greenpandastudios/aug-zlib@0.1.3`, `1.3.2`. Supported targets: linux arm64 glibc 2.36+, linux x64 glibc 2.36+, macos arm64 14.0+. Binding contract: [`native.abi.json`](native.abi-json.md) (SHA-256 `c3d4b36eadcccd13caff71597ed77a8e7307f0cfe3d13660a8e9127efe942b3d`). It calls `aug_zlib_decompress_v1` through the C ABI on the caller thread; a blocking native call blocks that thread. August copies the returned buffer, then calls `aug_zlib_release_v1` to release it. The compiler checks the provider, descriptor digest, signature and ownership at August call sites. The native author promises not to retain inputs, enter August from foreign threads, or unwind across the C boundary; internal native workers may run. The compiler does not prove those promises.
|
|
128
|
+
|
|
129
|
+
### `test compress` · [source](api.md#code) {#symbol-test-20-compress}
|
|
130
|
+
|
|
131
|
+
Tests [`compress`](api.md#symbol-compress). Each case gets fresh setup and dependencies.
|
|
132
|
+
|
|
133
|
+
#### `compression`
|
|
134
|
+
|
|
135
|
+
##### `preserves_bytes` · [source](api.md#code)
|
|
136
|
+
|
|
137
|
+
It sets `input` of type `Bytes` to `bytes` on `"The world runs on language"`. It sets `packed` of type `Bytes` to [`compress`](api.md#symbol-compress) with `input`. It sets `restored` of type `Bytes` to [`decompress`](api.md#symbol-decompress) with `input` from `packed` and `maximumOutput` `4096`. The test requires `restored.text` equals `"The world runs on language"`.
|
|
138
|
+
|
|
139
|
+
##### `checks_output_limit` · [source](api.md#code)
|
|
140
|
+
|
|
141
|
+
It sets `packed` of type `Bytes` to [`compress`](api.md#symbol-compress) with `input` from `bytes` on `"length limit"`. It sets `rejected` to `false`.
|
|
142
|
+
|
|
143
|
+
It tries to call [`decompress`](api.md#symbol-decompress) with `input` from `packed` and `maximumOutput` `1`. If this work raises [`CompressionError`](contracts.md#symbol-CompressionError), it sets `rejected` to `true`. The test requires `rejected` is true.
|
|
144
|
+
|
|
145
|
+
### Dependencies
|
|
146
|
+
|
|
147
|
+
It uses [`CompressionError`](contracts.md#symbol-CompressionError) from `contracts`.
|
|
148
|
+
|
|
149
|
+
Built-in operations follow the [language reference](https://greenpandastudios.github.io/augscript/language-constructs).
|
|
150
|
+
|
|
151
|
+
::::
|
|
152
|
+
|
|
153
|
+
:::::
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "packages/@greenpandastudios/aug-zlib/0.1.3/contracts.aug · Compression with zlib"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/contracts.aug"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
search: false
|
|
10
|
+
pageClass: aug-example-page
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# `packages/@greenpandastudios/aug-zlib/0.1.3/contracts.aug`
|
|
14
|
+
|
|
15
|
+
[Compression with zlib](../../../../../index.md) · Dependency source and specification
|
|
16
|
+
|
|
17
|
+
This is the exact dependency version used by this example.
|
|
18
|
+
|
|
19
|
+
::::: example-compare
|
|
20
|
+
|
|
21
|
+
:::: example-code
|
|
22
|
+
|
|
23
|
+
## Code {#code}
|
|
24
|
+
|
|
25
|
+
::: code-group
|
|
26
|
+
|
|
27
|
+
```aug [Indentation]
|
|
28
|
+
// aug-spec: "contracts.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
29
|
+
CompressionError(int code, string message) implements Error:
|
|
30
|
+
pass
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```aug [Braces]
|
|
34
|
+
// aug-spec: "contracts.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
35
|
+
CompressionError(int code, string message) implements Error {
|
|
36
|
+
pass
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
:::
|
|
41
|
+
|
|
42
|
+
::::
|
|
43
|
+
|
|
44
|
+
:::: example-spec
|
|
45
|
+
|
|
46
|
+
## Compiled specification {#specification}
|
|
47
|
+
|
|
48
|
+
### `CompressionError` · class · [source](contracts.md#code) {#symbol-CompressionError}
|
|
49
|
+
|
|
50
|
+
It implements `Error`. It takes `code` as an integer, kept read-only and `message` as a string, kept read-only.
|
|
51
|
+
|
|
52
|
+
::::
|
|
53
|
+
|
|
54
|
+
:::::
|