numbl 0.4.15 → 0.4.17

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.
@@ -12,4 +12,4 @@ export declare function dictInsert(d: RuntimeDictionary, keysArg: RuntimeValue,
12
12
  /** Remove keys from a dictionary, returning a new dictionary. */
13
13
  export declare function dictRemove(d: RuntimeDictionary, keysArg: RuntimeValue): RuntimeDictionary;
14
14
  /** Lookup values by keys. Returns single value or tensor/cell array. */
15
- export declare function dictLookup(d: RuntimeDictionary, keysArg: RuntimeValue): RuntimeValue;
15
+ export declare function dictLookup(d: RuntimeDictionary, keysArg: RuntimeValue, fallbackValue?: RuntimeValue): RuntimeValue;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * hash builtin (Octave-compatible): hash(hfun, str) -> lowercase hex digest.
3
+ * Supported algorithms: MD5, SHA256. Pure-JS implementations because
4
+ * builtins execute synchronously (WebCrypto is async).
5
+ */
6
+ export {};
@@ -33,6 +33,7 @@ import "./special-math.js";
33
33
  import "./geometry.js";
34
34
  import "./misc.js";
35
35
  import "./dictionary.js";
36
+ import "./hash.js";
36
37
  import "./help-text.js";
37
38
  export { getIBuiltin, getIBuiltinHelp, getIBuiltinNargin, getAllIBuiltinNames, registerBuiltinHelp, inferJitType, } from "./types.js";
38
39
  export type { IBuiltin, IBuiltinResolution, BuiltinHelp } from "./types.js";
@@ -1,2 +1,2 @@
1
- export function mtoc2_isequal_tt(a: any, b: any): 1 | 0;
2
- export function mtoc2_isequal_st(s: any, t: any): 1 | 0;
1
+ export function mtoc2_isequal_tt(a: any, b: any): 0 | 1;
2
+ export function mtoc2_isequal_st(s: any, t: any): 0 | 1;
@@ -1,2 +1,2 @@
1
- export function mtoc2_strcmp(a: any, b: any): 1 | 0;
2
- export function mtoc2_strcmpi(a: any, b: any): 1 | 0;
1
+ export function mtoc2_strcmp(a: any, b: any): 0 | 1;
2
+ export function mtoc2_strcmpi(a: any, b: any): 0 | 1;
@@ -322,7 +322,7 @@ export declare class Runtime {
322
322
  isClassInstance(value: unknown, className: string): boolean;
323
323
  indexCellStore(base: unknown, indices: unknown[], rhs: unknown): unknown;
324
324
  multiOutputCellAssign(base: unknown, indices: unknown, results: unknown[]): unknown;
325
- getMember(base: unknown, name: string): unknown;
325
+ getMember(base: unknown, name: string, nargout?: number): unknown;
326
326
  getMemberDynamic(base: unknown, nameExpr: unknown): RuntimeValue;
327
327
  getMemberOrEmpty(base: unknown, name: string): RuntimeValue;
328
328
  setMember(_base: unknown, _name: string, _rhs: unknown): void;
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { type RuntimeValue } from "../runtime/index.js";
5
5
  import type { Runtime } from "./runtime.js";
6
- export declare function getMember(rt: Runtime, base: unknown, name: string): unknown;
6
+ export declare function getMember(rt: Runtime, base: unknown, name: string, nargout?: number): unknown;
7
7
  export declare function getMemberDynamic(rt: Runtime, base: unknown, nameExpr: unknown): RuntimeValue;
8
8
  export declare function getMemberOrEmpty(base: unknown, name: string): RuntimeValue;
9
9
  export declare function setMemberReturn(rt: Runtime, base: unknown, name: string, rhs: unknown): unknown;
@@ -1,2 +1,2 @@
1
1
  /** Numbl version, used for JIT disk cache invalidation. */
2
- export declare const NUMBL_VERSION = "0.4.15";
2
+ export declare const NUMBL_VERSION = "0.4.17";
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Synchronous input channel between a web worker and the main thread.
3
+ *
4
+ * Protocol uses a SharedArrayBuffer:
5
+ * Int32[0] = signal: 0 = idle, 1 = response ready
6
+ * Int32[1] = response byte length
7
+ * Uint8[8..] = response as UTF-8 bytes
8
+ *
9
+ * Worker side: posts { type: "request-input", prompt } then Atomics.wait().
10
+ * Main side: receives the message, collects input, writes to SAB, Atomics.notify().
11
+ */
12
+ /** Create a SharedArrayBuffer for the input channel, or null if unavailable. */
13
+ export declare function createInputSAB(): SharedArrayBuffer | null;
14
+ /**
15
+ * Worker-side: create an onInput callback that blocks until the main thread responds.
16
+ */
17
+ export declare function workerOnInput(sab: SharedArrayBuffer): (prompt: string) => string;
18
+ /**
19
+ * Main-thread side: write a response string into the SAB and wake the worker.
20
+ */
21
+ export declare function mainThreadRespond(sab: SharedArrayBuffer, response: string): void;