Skip to content

Commit

Permalink
Update to latest wasmtime dev (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
jder authored Nov 15, 2024
1 parent 5defad4 commit 6ead2fa
Show file tree
Hide file tree
Showing 11 changed files with 245 additions and 137 deletions.
16 changes: 16 additions & 0 deletions ci/cbindgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def __init__(self):
self.ret += 'from ctypes import *\n'
self.ret += 'import ctypes\n'
self.ret += 'from typing import Any\n'
self.ret += 'from enum import Enum, auto\n'
self.ret += 'from ._ffi import dll, wasm_val_t, wasm_ref_t\n'

# Skip all function definitions, we don't bind those
Expand Down Expand Up @@ -65,6 +66,19 @@ def visit_Union(self, node):
else:
self.ret += " pass\n"

def visit_Enum(self, node):
if not node.name or not node.name.startswith('was'):
return

self.ret += "\n"
self.ret += "class {}(Enum):\n".format(node.name)
for enumerator in node.values.enumerators:
if enumerator.value:
self.ret += " {} = {}\n".format(enumerator.name, enumerator.value.value)
else:
self.ret += " {} = auto()\n".format(enumerator.name)


def visit_Typedef(self, node):
if not node.name or not node.name.startswith('was'):
return
Expand Down Expand Up @@ -194,6 +208,8 @@ def type_name(ty, ptr=False, typing=False):
return ty.name
elif isinstance(ty, c_ast.Union):
return ty.name
elif isinstance(ty, c_ast.Enum):
return ty.name
elif isinstance(ty, c_ast.FuncDecl):
tys = []
# TODO: apparently errors are thrown if we faithfully represent the
Expand Down
5 changes: 3 additions & 2 deletions ci/download-wasmtime.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Helper script to download a precompiled binary of the wasmtime dll for the
# current platform. Currently always downloads the dev release of wasmtime.
# current platform.

import io
import platform
Expand All @@ -10,7 +10,8 @@
import zipfile
from pathlib import Path

WASMTIME_VERSION = "v25.0.0"
# set to "dev" to download the latest or pick a tag from https://github.com/bytecodealliance/wasmtime/tags
WASMTIME_VERSION = "dev"


def main(platform, arch):
Expand Down
Loading

0 comments on commit 6ead2fa

Please sign in to comment.