ffi.WASM_RELEASE_SYNC.d.ts 5.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import { QuickJSEmscriptenModule } from "../emscripten-types";
  2. import { JSRuntimePointer, JSContextPointer, JSContextPointerPointer, JSValuePointer, JSValueConstPointer, JSValuePointerPointer, JSValueConstPointerPointer, BorrowedHeapCharPointer, OwnedHeapCharPointer, JSBorrowedCharPointer, JSVoidPointer, EvalFlags, EvalDetectModule } from "../types-ffi";
  3. /**
  4. * Low-level FFI bindings to QuickJS's Emscripten module.
  5. * See instead [[QuickJSContext]], the public Javascript interface exposed by this
  6. * library.
  7. *
  8. * @unstable The FFI interface is considered private and may change.
  9. */
  10. export declare class QuickJSFFI {
  11. private module;
  12. constructor(module: QuickJSEmscriptenModule);
  13. /** Set at compile time. */
  14. readonly DEBUG = false;
  15. QTS_Throw: (ctx: JSContextPointer, error: JSValuePointer | JSValueConstPointer) => JSValuePointer;
  16. QTS_NewError: (ctx: JSContextPointer) => JSValuePointer;
  17. QTS_RuntimeSetMemoryLimit: (rt: JSRuntimePointer, limit: number) => void;
  18. QTS_RuntimeComputeMemoryUsage: (rt: JSRuntimePointer, ctx: JSContextPointer) => JSValuePointer;
  19. QTS_RuntimeDumpMemoryUsage: (rt: JSRuntimePointer) => OwnedHeapCharPointer;
  20. QTS_RecoverableLeakCheck: () => number;
  21. QTS_BuildIsSanitizeLeak: () => number;
  22. QTS_RuntimeSetMaxStackSize: (rt: JSRuntimePointer, stack_size: number) => void;
  23. QTS_GetUndefined: () => JSValueConstPointer;
  24. QTS_GetNull: () => JSValueConstPointer;
  25. QTS_GetFalse: () => JSValueConstPointer;
  26. QTS_GetTrue: () => JSValueConstPointer;
  27. QTS_NewRuntime: () => JSRuntimePointer;
  28. QTS_FreeRuntime: (rt: JSRuntimePointer) => void;
  29. QTS_NewContext: (rt: JSRuntimePointer) => JSContextPointer;
  30. QTS_FreeContext: (ctx: JSContextPointer) => void;
  31. QTS_FreeValuePointer: (ctx: JSContextPointer, value: JSValuePointer) => void;
  32. QTS_FreeValuePointerRuntime: (rt: JSRuntimePointer, value: JSValuePointer) => void;
  33. QTS_FreeVoidPointer: (ctx: JSContextPointer, ptr: JSVoidPointer) => void;
  34. QTS_FreeCString: (ctx: JSContextPointer, str: JSBorrowedCharPointer) => void;
  35. QTS_DupValuePointer: (ctx: JSContextPointer, val: JSValuePointer | JSValueConstPointer) => JSValuePointer;
  36. QTS_NewObject: (ctx: JSContextPointer) => JSValuePointer;
  37. QTS_NewObjectProto: (ctx: JSContextPointer, proto: JSValuePointer | JSValueConstPointer) => JSValuePointer;
  38. QTS_NewArray: (ctx: JSContextPointer) => JSValuePointer;
  39. QTS_NewFloat64: (ctx: JSContextPointer, num: number) => JSValuePointer;
  40. QTS_GetFloat64: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => number;
  41. QTS_NewString: (ctx: JSContextPointer, string: BorrowedHeapCharPointer) => JSValuePointer;
  42. QTS_GetString: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => JSBorrowedCharPointer;
  43. QTS_NewSymbol: (ctx: JSContextPointer, description: BorrowedHeapCharPointer, isGlobal: number) => JSValuePointer;
  44. QTS_GetSymbolDescriptionOrKey: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => JSBorrowedCharPointer;
  45. QTS_IsGlobalSymbol: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => number;
  46. QTS_IsJobPending: (rt: JSRuntimePointer) => number;
  47. QTS_ExecutePendingJob: (rt: JSRuntimePointer, maxJobsToExecute: number, lastJobContext: JSContextPointerPointer) => JSValuePointer;
  48. QTS_GetProp: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: JSValuePointer | JSValueConstPointer) => JSValuePointer;
  49. QTS_SetProp: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: JSValuePointer | JSValueConstPointer, prop_value: JSValuePointer | JSValueConstPointer) => void;
  50. QTS_DefineProp: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: JSValuePointer | JSValueConstPointer, prop_value: JSValuePointer | JSValueConstPointer, get: JSValuePointer | JSValueConstPointer, set: JSValuePointer | JSValueConstPointer, configurable: boolean, enumerable: boolean, has_value: boolean) => void;
  51. QTS_Call: (ctx: JSContextPointer, func_obj: JSValuePointer | JSValueConstPointer, this_obj: JSValuePointer | JSValueConstPointer, argc: number, argv_ptrs: JSValueConstPointerPointer) => JSValuePointer;
  52. QTS_ResolveException: (ctx: JSContextPointer, maybe_exception: JSValuePointer) => JSValuePointer;
  53. QTS_Dump: (ctx: JSContextPointer, obj: JSValuePointer | JSValueConstPointer) => JSBorrowedCharPointer;
  54. QTS_Eval: (ctx: JSContextPointer, js_code: BorrowedHeapCharPointer, filename: string, detectModule: EvalDetectModule, evalFlags: EvalFlags) => JSValuePointer;
  55. QTS_Typeof: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => OwnedHeapCharPointer;
  56. QTS_GetGlobalObject: (ctx: JSContextPointer) => JSValuePointer;
  57. QTS_NewPromiseCapability: (ctx: JSContextPointer, resolve_funcs_out: JSValuePointerPointer) => JSValuePointer;
  58. QTS_TestStringArg: (string: string) => void;
  59. QTS_BuildIsDebug: () => number;
  60. QTS_BuildIsAsyncify: () => number;
  61. QTS_NewFunction: (ctx: JSContextPointer, func_id: number, name: string) => JSValuePointer;
  62. QTS_ArgvGetJSValueConstPointer: (argv: JSValuePointer | JSValueConstPointer, index: number) => JSValueConstPointer;
  63. QTS_RuntimeEnableInterruptHandler: (rt: JSRuntimePointer) => void;
  64. QTS_RuntimeDisableInterruptHandler: (rt: JSRuntimePointer) => void;
  65. QTS_RuntimeEnableModuleLoader: (rt: JSRuntimePointer, use_custom_normalize: number) => void;
  66. QTS_RuntimeDisableModuleLoader: (rt: JSRuntimePointer) => void;
  67. }