2019-08-15 11:50:13 +03:00
|
|
|
import {API, StringInvoke} from "../as-dependencies/crossmodule/assembly/index"
|
2019-03-27 17:48:19 +03:00
|
|
|
|
|
|
|
export declare function allocate(size: usize): i32;
|
|
|
|
export declare function deallocate(ptr: i32, size: usize): void;
|
|
|
|
export declare function invoke(ptr: i32, size: usize): i32;
|
|
|
|
export declare function store(ptr: usize, byte: u8): void;
|
|
|
|
export declare function load(ptr: usize): u8;
|
|
|
|
|
|
|
|
export function getStringInvoker(): StringInvoke {
|
|
|
|
let api = new API(invoke, allocate, deallocate, store, load);
|
|
|
|
return new StringInvoke(api);
|
|
|
|
}
|
2019-08-15 11:50:13 +03:00
|
|
|
|
|
|
|
export function query(request: string): string {
|
2019-08-15 11:53:13 +03:00
|
|
|
let stringInvoker = getStringInvoker();
|
|
|
|
let result = stringInvoker.invoke(request);
|
|
|
|
return result;
|
2019-08-15 11:50:13 +03:00
|
|
|
}
|