@hazae41/stdbob 0.0.9 → 0.0.11

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@hazae41/stdbob",
4
- "version": "0.0.9",
4
+ "version": "0.0.11",
5
5
  "description": "Standard libraries for Bobine WebAssembly VM",
6
6
  "repository": "github:hazae41/stdbob",
7
7
  "author": "hazae41",
@@ -5,6 +5,14 @@ export type bigintref = externref
5
5
 
6
6
  export namespace bigints {
7
7
 
8
+ // @ts-ignore: decorator
9
+ @external("bigints", "identity")
10
+ export declare function from(bigint: i64): bigintref
11
+
12
+ // @ts-ignore: decorator
13
+ @external("bigints", "identity")
14
+ export declare function into(bigint: bigintref): i64
15
+
8
16
  // @ts-ignore: decorator
9
17
  @external("bigints", "zero")
10
18
  export declare function zero(): bigintref
@@ -23,7 +23,7 @@ export namespace blobs {
23
23
  export function load(blob: blobref): ArrayBuffer {
24
24
  const bytes = new Uint8Array(length(blob))
25
25
 
26
- $load(blob, bytes.dataStart)
26
+ $load(blob, <i32>bytes.dataStart)
27
27
 
28
28
  return bytes.buffer
29
29
  }
@@ -13,6 +13,15 @@ export namespace texts {
13
13
  return text
14
14
  }
15
15
 
16
+ export function into(text: textref): string {
17
+ const blob = toUtf8(text)
18
+ const utf8 = blobs.load(blob)
19
+
20
+ const string = String.UTF8.decode(utf8)
21
+
22
+ return string
23
+ }
24
+
16
25
  // @ts-ignore: decorator
17
26
  @external("texts", "length")
18
27
  export declare function length(text: textref): i32