Remove old code
This commit is contained in:
parent
79ac328fb6
commit
1d502ee9a2
@ -1,28 +0,0 @@
|
||||
import wasm3 # type: ignore
|
||||
|
||||
from phasmplatform.common.exceptions import PhashPlatformNonIntMainReturnError
|
||||
|
||||
|
||||
def post_message(namespace: int, topic: int, kind: int, body: int) -> None:
|
||||
print('namespace', namespace)
|
||||
print('topic', topic)
|
||||
print('kind', kind)
|
||||
print('body', body)
|
||||
|
||||
|
||||
def run_once_wasm3(wasm_bin: bytes) -> int:
|
||||
env = wasm3.Environment()
|
||||
rtime = env.new_runtime(1024 * 1024)
|
||||
|
||||
mod = env.parse_module(wasm_bin)
|
||||
mod.link_function('imports', 'post_message', post_message)
|
||||
|
||||
rtime.load(mod)
|
||||
result = rtime.find_function('handle_message')()
|
||||
if result is None:
|
||||
return 0
|
||||
|
||||
if not isinstance(result, int):
|
||||
raise PhashPlatformNonIntMainReturnError(result)
|
||||
|
||||
return result
|
||||
Loading…
x
Reference in New Issue
Block a user