-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rust: Procedural macro for automatic VM declaration
- Loading branch information
Showing
13 changed files
with
527 additions
and
56 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,3 @@ | ||
/target | ||
**/*.rs.bk | ||
/Cargo.lock |
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,18 @@ | ||
# EVMC: Ethereum Client-VM Connector API. | ||
# Copyright 2019 The EVMC Authors. | ||
# Licensed under the Apache License, Version 2.0. | ||
|
||
[package] | ||
name = "evmc-declare-tests" | ||
version = "6.3.0-dev" | ||
authors = ["Jake Lang <[email protected]>"] | ||
license = "Apache-2.0" | ||
repository = "https://github.com/ethereum/evmc" | ||
description = "Bindings to EVMC (VM declare macro) -- Test crate" | ||
edition = "2018" | ||
publish = false | ||
|
||
[dependencies] | ||
evmc-declare = { path = "../evmc-declare" } | ||
evmc-sys = { path = "../evmc-sys" } | ||
evmc-vm = { path = "../evmc-vm" } |
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,25 @@ | ||
/* EVMC: Ethereum Client-VM Connector API. | ||
* Copyright 2019 The EVMC Authors. | ||
* Licensed under the Apache License, Version 2.0. | ||
*/ | ||
|
||
use evmc_vm::EvmcVm; | ||
use evmc_vm::ExecutionContext; | ||
use evmc_vm::ExecutionResult; | ||
#[macro_use] | ||
use evmc_declare::evmc_declare_vm; | ||
|
||
#[evmc_declare_vm("Foo VM", "ewasm, evm", "1.42-alpha.gamma.starship")] | ||
pub struct FooVM { | ||
a: i32, | ||
} | ||
|
||
impl EvmcVm for FooVM { | ||
fn init() -> Self { | ||
FooVM { a: 105023 } | ||
} | ||
|
||
fn execute(&self, code: &[u8], context: &ExecutionContext) -> ExecutionResult { | ||
ExecutionResult::success(1337, None) | ||
} | ||
} |
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,3 @@ | ||
/target | ||
**/*.rs.bk | ||
/Cargo.lock |
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,27 @@ | ||
# EVMC: Ethereum Client-VM Connector API. | ||
# Copyright 2019 The EVMC Authors. | ||
# Licensed under the Apache License, Version 2.0. | ||
|
||
[package] | ||
name = "evmc-declare" | ||
version = "6.3.0-dev" | ||
authors = ["Jake Lang <[email protected]>"] | ||
license = "Apache-2.0" | ||
repository = "https://github.com/ethereum/evmc" | ||
description = "Bindings to EVMC (VM declare macro)" | ||
edition = "2018" | ||
|
||
[dependencies] | ||
quote = "0.6.12" | ||
heck = "0.3.1" | ||
proc-macro2 = "0.4.29" | ||
|
||
# For documentation examples | ||
evmc-vm = { path = "../evmc-vm" } | ||
|
||
[dependencies.syn] | ||
version = "0.15.33" | ||
features = ["full"] | ||
|
||
[lib] | ||
proc-macro = true |
Oops, something went wrong.