-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from jonathanharg/next
Version 117.1.0
- Loading branch information
Showing
11 changed files
with
103 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from .__expression import Expression | ||
from ._binaryen import lib | ||
|
||
|
||
class Global: | ||
def __init__(self, ref): | ||
self.ref = ref | ||
|
||
def get_name(self): | ||
return str(lib.BinaryenGlobalGetName(self.ref)) | ||
|
||
def get_type(self): | ||
return lib.BinaryenGlobalGetType(self.ref) | ||
|
||
def is_mutable(self): | ||
return bool(lib.BinaryenGlobalIsMutable(self.ref)) | ||
|
||
def get_init_expr(self): | ||
return Expression(lib.BinaryenGlobalGetInitExpr(self.ref)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from .._binaryen import lib | ||
from ..internals import BinaryenType | ||
|
||
|
||
def to_str(type: BinaryenType) -> str: | ||
return { | ||
lib.BinaryenTypeNone(): "None", | ||
lib.BinaryenTypeInt32(): "Int32", | ||
lib.BinaryenTypeInt64(): "Int64", | ||
lib.BinaryenTypeFloat32(): "Float32", | ||
lib.BinaryenTypeFloat64(): "Float64", | ||
lib.BinaryenTypeVec128(): "Vec128", | ||
lib.BinaryenTypeFuncref(): "Funcref", | ||
lib.BinaryenTypeExternref(): "Externref", | ||
lib.BinaryenTypeAnyref(): "Anyref", | ||
lib.BinaryenTypeEqref(): "Eqref", | ||
lib.BinaryenTypeI31ref(): "I31ref", | ||
lib.BinaryenTypeStructref(): "Structref", | ||
lib.BinaryenTypeArrayref(): "Arrayref", | ||
lib.BinaryenTypeStringref(): "Stringref", | ||
lib.BinaryenTypeStringviewWTF8(): "StringviewWTF8", | ||
lib.BinaryenTypeStringviewWTF16(): "StringviewWTF16", | ||
lib.BinaryenTypeStringviewIter(): "StringviewIter", | ||
lib.BinaryenTypeNullref(): "Nullref", | ||
lib.BinaryenTypeNullExternref(): "NullExternref", | ||
lib.BinaryenTypeNullFuncref(): "NullFuncref", | ||
lib.BinaryenTypeUnreachable(): "Unreachable", | ||
lib.BinaryenTypeAuto(): "Auto", | ||
}[type] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import binaryen | ||
|
||
mod = binaryen.Module() | ||
|
||
# f_sub = mod.unary(binaryen.operations.NegFloat32(), mod.f32(6.7)) | ||
f_sub = mod.unary( | ||
binaryen.operations.NegFloat32(), mod.local_get(0, binaryen.type.Float32) | ||
) | ||
|
||
mod.add_function(b"float_test", binaryen.type.Float32, binaryen.type.Float32, [], f_sub) | ||
mod.add_function_export(b"float_test", b"float_test") | ||
|
||
# i_sub = mod.binary(binaryen.operations.SubInt32(), mod.i32(0), mod.i32(10)) | ||
# i_sub = mod.binary(binaryen.operations.S, mod.i32(0), mod.local_get(0, binaryen.type.Int32)) | ||
|
||
mod.add_function(b"int_test", binaryen.type.Int32, binaryen.type.Int32, [], i_sub) | ||
mod.add_function_export(b"int_test", b"int_test") | ||
|
||
mod.optimize() | ||
|
||
mod.print() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" | |
|
||
[project] | ||
name = "binaryen.py" | ||
version = "117.0.0" | ||
version = "117.1.0" | ||
description = "A Python wrapper for Binaryen" | ||
authors = [{ name = "Jonathan Hargreaves", email = "[email protected]" }] | ||
readme = "README.md" | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from setuptools import setup | ||
|
||
setup( | ||
cffi_modules=["binaryen/binaryen_build.py:ffibuilder"], | ||
cffi_modules=["scripts/binaryen_build.py:ffibuilder"], | ||
) |