Use explicit global namespaces in codegen (#1928)

* ipc as a deault feature

* first part of purge

* second part of ns purge
This commit is contained in:
Nikolay Volf 2016-08-17 17:54:24 +04:00 committed by Gav Wood
parent e01ba60dd9
commit 46f029e65c
31 changed files with 16 additions and 94 deletions

View File

@ -16,9 +16,6 @@
//! Ethcore database trait //! Ethcore database trait
use std::mem;
use ipc::binary::BinaryConvertError;
use std::collections::VecDeque;
use std::cell::RefCell; use std::cell::RefCell;
pub type IteratorHandle = u32; pub type IteratorHandle = u32;

View File

@ -14,9 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use std::collections::VecDeque; use ipc::IpcConfig;
use std::mem;
use ipc::{IpcConfig, BinaryConvertError};
use util::H256; use util::H256;
/// Represents what has to be handled by actor listening to chain events /// Represents what has to be handled by actor listening to chain events

View File

@ -33,9 +33,7 @@ use executive::Executed;
use env_info::LastHashes; use env_info::LastHashes;
use types::call_analytics::CallAnalytics; use types::call_analytics::CallAnalytics;
use block_import_error::BlockImportError; use block_import_error::BlockImportError;
use std::mem; use ipc::IpcConfig;
use std::collections::VecDeque;
use ipc::{IpcConfig, BinaryConvertError};
use types::blockchain_info::BlockChainInfo; use types::blockchain_info::BlockChainInfo;
use types::block_status::BlockStatus; use types::block_status::BlockStatus;

View File

@ -17,10 +17,10 @@
//! Diff between two accounts. //! Diff between two accounts.
use std::cmp::*; use std::cmp::*;
use std::{fmt, mem}; use std::fmt;
use std::collections::{VecDeque, BTreeMap}; use std::collections::BTreeMap;
use util::{U256, H256, Uint, Bytes}; use util::{U256, H256, Uint, Bytes};
use ipc::binary::{BinaryConvertError, BinaryConvertable}; use ipc::binary::BinaryConvertable;
#[derive(Debug, PartialEq, Eq, Clone, Binary)] #[derive(Debug, PartialEq, Eq, Clone, Binary)]
/// Diff type for specifying a change (or not). /// Diff type for specifying a change (or not).

View File

@ -16,9 +16,6 @@
//! Block import error related types //! Block import error related types
use std::mem;
use ipc::binary::BinaryConvertError;
use std::collections::VecDeque;
use error::{ImportError, BlockError, Error}; use error::{ImportError, BlockError, Error};
use std::convert::From; use std::convert::From;

View File

@ -16,10 +16,6 @@
//! Block queue info types //! Block queue info types
use std::mem;
use ipc::binary::BinaryConvertError;
use std::collections::VecDeque;
/// Block queue status /// Block queue status
#[derive(Debug, Binary)] #[derive(Debug, Binary)]
pub struct BlockQueueInfo { pub struct BlockQueueInfo {

View File

@ -16,9 +16,6 @@
//! Block status description module //! Block status description module
use ipc::binary::BinaryConvertError;
use std::collections::VecDeque;
/// General block status /// General block status
#[derive(Debug, Eq, PartialEq, Binary)] #[derive(Debug, Eq, PartialEq, Binary)]
pub enum BlockStatus { pub enum BlockStatus {

View File

@ -16,10 +16,7 @@
//! Blockhain info type definition //! Blockhain info type definition
use std::mem;
use std::collections::VecDeque;
use util::{U256, H256}; use util::{U256, H256};
use ipc::binary::BinaryConvertError;
use header::BlockNumber; use header::BlockNumber;
/// Information about the blockchain gathered together. /// Information about the blockchain gathered together.

View File

@ -16,10 +16,6 @@
//! Call analytics related types //! Call analytics related types
use std::mem;
use ipc::binary::{BinaryConvertError};
use std::collections::VecDeque;
/// Options concerning what analytics we run on the call. /// Options concerning what analytics we run on the call.
#[derive(Eq, PartialEq, Default, Clone, Copy, Debug, Binary)] #[derive(Eq, PartialEq, Default, Clone, Copy, Debug, Binary)]
pub struct CallAnalytics { pub struct CallAnalytics {

View File

@ -21,10 +21,7 @@ use util::rlp::*;
use trace::{VMTrace, FlatTrace}; use trace::{VMTrace, FlatTrace};
use types::log_entry::LogEntry; use types::log_entry::LogEntry;
use types::state_diff::StateDiff; use types::state_diff::StateDiff;
use ipc::binary::BinaryConvertError;
use std::fmt; use std::fmt;
use std::mem;
use std::collections::VecDeque;
/// The type of the call-like instruction. /// The type of the call-like instruction.
#[derive(Debug, PartialEq, Clone, Binary)] #[derive(Debug, PartialEq, Clone, Binary)]

View File

@ -16,13 +16,10 @@
//! Blockchain filter //! Blockchain filter
use std::mem;
use std::collections::VecDeque;
use util::{Address, H256, Hashable, H2048}; use util::{Address, H256, Hashable, H2048};
use util::bloom::Bloomable; use util::bloom::Bloomable;
use client::BlockID; use client::BlockID;
use log_entry::LogEntry; use log_entry::LogEntry;
use ipc::binary::BinaryConvertError;
/// Blockchain Filter. /// Blockchain Filter.
#[derive(Binary)] #[derive(Binary)]

View File

@ -18,9 +18,6 @@
use util::hash::H256; use util::hash::H256;
use header::BlockNumber; use header::BlockNumber;
use ipc::binary::BinaryConvertError;
use std::mem;
use std::collections::VecDeque;
/// Uniquely identifies block. /// Uniquely identifies block.
#[derive(Debug, PartialEq, Copy, Clone, Hash, Eq, Binary)] #[derive(Debug, PartialEq, Copy, Clone, Hash, Eq, Binary)]

View File

@ -16,13 +16,10 @@
//! Log entry type definition. //! Log entry type definition.
use std::mem;
use std::ops::Deref; use std::ops::Deref;
use std::collections::VecDeque;
use util::{H256, Address, Bytes, HeapSizeOf, Hashable}; use util::{H256, Address, Bytes, HeapSizeOf, Hashable};
use util::rlp::*; use util::rlp::*;
use util::bloom::Bloomable; use util::bloom::Bloomable;
use ipc::binary::BinaryConvertError;
use basic_types::LogBloom; use basic_types::LogBloom;
use header::BlockNumber; use header::BlockNumber;
use ethjson; use ethjson;

View File

@ -16,15 +16,12 @@
//! Receipt //! Receipt
use std::mem;
use std::collections::VecDeque;
use util::{H256, U256, Address}; use util::{H256, U256, Address};
use util::rlp::*; use util::rlp::*;
use util::HeapSizeOf; use util::HeapSizeOf;
use basic_types::LogBloom; use basic_types::LogBloom;
use header::BlockNumber; use header::BlockNumber;
use log_entry::{LogEntry, LocalizedLogEntry}; use log_entry::{LogEntry, LocalizedLogEntry};
use ipc::binary::BinaryConvertError;
/// Information describing execution of a transaction. /// Information describing execution of a transaction.
#[derive(Default, Debug, Clone, Binary)] #[derive(Default, Debug, Clone, Binary)]

View File

@ -16,12 +16,11 @@
//! State diff module. //! State diff module.
use std::{mem, fmt}; use std::fmt;
use std::ops::*; use std::ops::*;
use std::collections::{VecDeque, BTreeMap}; use std::collections::BTreeMap;
use util::Address; use util::Address;
use account_diff::*; use account_diff::*;
use ipc::binary::BinaryConvertError;
#[derive(Debug, PartialEq, Eq, Clone, Binary)] #[derive(Debug, PartialEq, Eq, Clone, Binary)]
/// Expression for the delta between two system states. Encoded the /// Expression for the delta between two system states. Encoded the

View File

@ -16,9 +16,6 @@
//! Trace filter related types //! Trace filter related types
use std::mem;
use ipc::binary::{BinaryConvertError};
use std::collections::VecDeque;
use std::ops::Range; use std::ops::Range;
use util::{Address}; use util::{Address};
use types::ids::BlockID; use types::ids::BlockID;

View File

@ -17,8 +17,6 @@
//! Trace filters type definitions //! Trace filters type definitions
use std::ops::Range; use std::ops::Range;
use std::mem;
use std::collections::VecDeque;
use bloomchain::{Filter as BloomFilter, Bloom, Number}; use bloomchain::{Filter as BloomFilter, Bloom, Number};
use util::Address; use util::Address;
use util::sha3::Hashable; use util::sha3::Hashable;
@ -26,7 +24,6 @@ use util::bloom::Bloomable;
use basic_types::LogBloom; use basic_types::LogBloom;
use trace::flat::FlatTrace; use trace::flat::FlatTrace;
use types::trace_types::trace::{Action, Res}; use types::trace_types::trace::{Action, Res};
use ipc::binary::BinaryConvertError;
/// Addresses filter. /// Addresses filter.
/// ///

View File

@ -17,8 +17,6 @@
//! Flat trace module //! Flat trace module
use std::collections::VecDeque; use std::collections::VecDeque;
use std::mem;
use ipc::binary::BinaryConvertError;
use util::rlp::*; use util::rlp::*;
use util::HeapSizeOf; use util::HeapSizeOf;
use basic_types::LogBloom; use basic_types::LogBloom;

View File

@ -19,9 +19,6 @@
use util::H256; use util::H256;
use super::trace::{Action, Res}; use super::trace::{Action, Res};
use header::BlockNumber; use header::BlockNumber;
use ipc::binary::BinaryConvertError;
use std::mem;
use std::collections::VecDeque;
/// Localized trace. /// Localized trace.
#[derive(Debug, PartialEq, Binary)] #[derive(Debug, PartialEq, Binary)]

View File

@ -23,9 +23,6 @@ use util::bloom::Bloomable;
use action_params::ActionParams; use action_params::ActionParams;
use basic_types::LogBloom; use basic_types::LogBloom;
use types::executed::CallType; use types::executed::CallType;
use ipc::binary::BinaryConvertError;
use std::mem;
use std::collections::VecDeque;
/// `Call` result. /// `Call` result.
#[derive(Debug, Clone, PartialEq, Default, Binary)] #[derive(Debug, Clone, PartialEq, Default, Binary)]

View File

@ -16,8 +16,6 @@
//! Transaction data structure. //! Transaction data structure.
use std::mem;
use std::collections::VecDeque;
use util::{H256, Address, U256, H520}; use util::{H256, Address, U256, H520};
use std::ops::Deref; use std::ops::Deref;
use util::rlp::*; use util::rlp::*;
@ -29,7 +27,6 @@ use error::*;
use evm::Schedule; use evm::Schedule;
use header::BlockNumber; use header::BlockNumber;
use ethjson; use ethjson;
use ipc::binary::BinaryConvertError;
use ethstore::ethkey::Signature as EthkeySignature; use ethstore::ethkey::Signature as EthkeySignature;
#[derive(Debug, Clone, PartialEq, Eq, Binary)] #[derive(Debug, Clone, PartialEq, Eq, Binary)]

View File

@ -17,9 +17,7 @@
//! Transaction import result related types //! Transaction import result related types
use ipc::binary::{BinaryConvertError, BinaryConvertable}; use ipc::binary::{BinaryConvertError, BinaryConvertable};
use std::collections::VecDeque;
use error::{TransactionError, Error}; use error::{TransactionError, Error};
use std::mem;
use util::Populatable; use util::Populatable;
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]

View File

@ -16,9 +16,6 @@
//! Tree route info type definition //! Tree route info type definition
use std::collections::VecDeque;
use std::mem;
use ipc::BinaryConvertError;
use util::H256; use util::H256;
/// Represents a tree route between `from` block and `to` block: /// Represents a tree route between `from` block and `to` block:

View File

@ -95,11 +95,11 @@ fn serialize_item(
$size_expr $size_expr
} }
fn to_bytes(&self, buffer: &mut [u8], length_stack: &mut VecDeque<usize>) -> Result<(), BinaryConvertError> { fn to_bytes(&self, buffer: &mut [u8], length_stack: &mut ::std::collections::VecDeque<usize>) -> Result<(), ::ipc::BinaryConvertError> {
$write_expr $write_expr
} }
fn from_bytes(buffer: &[u8], length_stack: &mut VecDeque<usize>) -> Result<Self, BinaryConvertError> { fn from_bytes(buffer: &[u8], length_stack: &mut ::std::collections::VecDeque<usize>) -> Result<Self, ::ipc::BinaryConvertError> {
$read_expr $read_expr
} }
@ -210,13 +210,13 @@ fn binary_expr_struct(
let field_id = builder.id(field.ident.unwrap()); let field_id = builder.id(field.ident.unwrap());
Some(quote_expr!(cx, Some(quote_expr!(cx,
match $field_type_ident_qualified::len_params() { match $field_type_ident_qualified::len_params() {
0 => mem::size_of::<$field_type_ident>(), 0 => ::std::mem::size_of::<$field_type_ident>(),
_ => $x. $field_id .size(), _ => $x. $field_id .size(),
})) }))
}) })
.unwrap_or_else(|| { .unwrap_or_else(|| {
quote_expr!(cx, match $field_type_ident_qualified::len_params() { quote_expr!(cx, match $field_type_ident_qualified::len_params() {
0 => mem::size_of::<$field_type_ident>(), 0 => ::std::mem::size_of::<$field_type_ident>(),
_ => $index_ident .size(), _ => $index_ident .size(),
}) })
}) })
@ -279,7 +279,7 @@ fn binary_expr_struct(
} }
_ => { _ => {
write_stmts.push(quote_stmt!(cx, let next_line = offset + match $field_type_ident_qualified::len_params() { write_stmts.push(quote_stmt!(cx, let next_line = offset + match $field_type_ident_qualified::len_params() {
0 => mem::size_of::<$field_type_ident>(), 0 => ::std::mem::size_of::<$field_type_ident>(),
_ => { let size = $member_expr .size(); length_stack.push_back(size); size }, _ => { let size = $member_expr .size(); length_stack.push_back(size); size },
}).unwrap()); }).unwrap());
write_stmts.push(quote_stmt!(cx, let $range_ident = offset..next_line; ).unwrap()); write_stmts.push(quote_stmt!(cx, let $range_ident = offset..next_line; ).unwrap());
@ -309,7 +309,7 @@ fn binary_expr_struct(
}, },
_ => { _ => {
map_stmts.push(quote_stmt!(cx, let size = match $field_type_ident_qualified::len_params() { map_stmts.push(quote_stmt!(cx, let size = match $field_type_ident_qualified::len_params() {
0 => mem::size_of::<$field_type_ident>(), 0 => ::std::mem::size_of::<$field_type_ident>(),
_ => length_stack.pop_front().unwrap(), _ => length_stack.pop_front().unwrap(),
}).unwrap()); }).unwrap());
map_stmts.push(quote_stmt!(cx, total += size;).unwrap()); map_stmts.push(quote_stmt!(cx, total += size;).unwrap());
@ -412,7 +412,7 @@ fn binary_expr_enum(
arms.iter().map(|x| x.write.clone()).collect::<Vec<ast::Arm>>(), arms.iter().map(|x| x.write.clone()).collect::<Vec<ast::Arm>>(),
arms.iter().map(|x| x.read.clone()).collect::<Vec<ast::Arm>>()); arms.iter().map(|x| x.read.clone()).collect::<Vec<ast::Arm>>());
read_arms.push(quote_arm!(cx, _ => { Err(BinaryConvertError::variant(buffer[0])) } )); read_arms.push(quote_arm!(cx, _ => { Err(::ipc::BinaryConvertError::variant(buffer[0])) } ));
Ok(BinaryExpressions { Ok(BinaryExpressions {
size: quote_expr!(cx, 1usize + match *self { $size_arms }), size: quote_expr!(cx, 1usize + match *self { $size_arms }),

View File

@ -17,9 +17,6 @@
use std::sync::{RwLock,Arc}; use std::sync::{RwLock,Arc};
use ipc::IpcConfig; use ipc::IpcConfig;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem;
use ipc::binary::BinaryConvertError;
use std::collections::VecDeque;
pub type IpcModuleId = u64; pub type IpcModuleId = u64;

View File

@ -707,7 +707,7 @@ pub fn serialize<T: BinaryConvertable>(t: &T) -> Result<Vec<u8>, BinaryError> {
macro_rules! binary_fixed_size { macro_rules! binary_fixed_size {
($target_ty: ty) => { ($target_ty: ty) => {
impl BinaryConvertable for $target_ty { impl BinaryConvertable for $target_ty {
fn from_bytes(bytes: &[u8], _length_stack: &mut VecDeque<usize>) -> Result<Self, BinaryConvertError> { fn from_bytes(bytes: &[u8], _length_stack: &mut ::std::collections::VecDeque<usize>) -> Result<Self, BinaryConvertError> {
match bytes.len().cmp(&::std::mem::size_of::<$target_ty>()) { match bytes.len().cmp(&::std::mem::size_of::<$target_ty>()) {
::std::cmp::Ordering::Equal => (), ::std::cmp::Ordering::Equal => (),
_ => return Err(BinaryConvertError::size(::std::mem::size_of::<$target_ty>(), bytes.len())), _ => return Err(BinaryConvertError::size(::std::mem::size_of::<$target_ty>(), bytes.len())),
@ -717,7 +717,7 @@ macro_rules! binary_fixed_size {
Ok(res) Ok(res)
} }
fn to_bytes(&self, buffer: &mut [u8], _length_stack: &mut VecDeque<usize>) -> Result<(), BinaryConvertError> { fn to_bytes(&self, buffer: &mut [u8], _length_stack: &mut ::std::collections::VecDeque<usize>) -> Result<(), BinaryConvertError> {
let sz = ::std::mem::size_of::<$target_ty>(); let sz = ::std::mem::size_of::<$target_ty>();
let ip: *const $target_ty = self; let ip: *const $target_ty = self;
let ptr: *const u8 = ip as *const _; let ptr: *const u8 = ip as *const _;

View File

@ -16,8 +16,6 @@
use ipc::*; use ipc::*;
use std::mem;
use std::collections::VecDeque;
use util::Bytes; use util::Bytes;
#[derive(Binary)] #[derive(Binary)]

View File

@ -16,9 +16,6 @@
use std::sync::RwLock; use std::sync::RwLock;
use ipc::IpcConfig; use ipc::IpcConfig;
use std::mem;
use ipc::binary::BinaryConvertError;
use std::collections::VecDeque;
pub struct DB<L: Sized> { pub struct DB<L: Sized> {
pub writes: RwLock<u64>, pub writes: RwLock<u64>,

View File

@ -16,9 +16,6 @@
use std::sync::RwLock; use std::sync::RwLock;
use ipc::IpcConfig; use ipc::IpcConfig;
use std::mem;
use ipc::binary::BinaryConvertError;
use std::collections::VecDeque;
pub struct Service { pub struct Service {
pub commits: RwLock<usize>, pub commits: RwLock<usize>,

View File

@ -15,9 +15,6 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use ipc::IpcConfig; use ipc::IpcConfig;
use std::mem;
use ipc::binary::BinaryConvertError;
use std::collections::VecDeque;
pub struct BadlyNamedService; pub struct BadlyNamedService;

View File

@ -25,8 +25,6 @@ use sync_io::NetSyncIo;
use chain::{ChainSync, SyncStatus}; use chain::{ChainSync, SyncStatus};
use std::net::{SocketAddr, AddrParseError}; use std::net::{SocketAddr, AddrParseError};
use ipc::{BinaryConvertable, BinaryConvertError, IpcConfig}; use ipc::{BinaryConvertable, BinaryConvertError, IpcConfig};
use std::mem;
use std::collections::VecDeque;
use std::str::FromStr; use std::str::FromStr;
use parking_lot::RwLock; use parking_lot::RwLock;