diff options
author | Jyun-Yan You <jyyou.tw@gmail.com> | 2015-01-01 00:05:49 +0800 |
---|---|---|
committer | Jyun-Yan You <jyyou.tw@gmail.com> | 2015-01-01 00:05:49 +0800 |
commit | 4482a25cb4657cf1ce280999db37b7beb843f6bc (patch) | |
tree | 0ce2ea417532f552503b764d420a57e224c96918 /src/types.rs | |
parent | e81f8e2420b7aff83207ec18d866c3af096da016 (diff) | |
parent | 97945161d298bb89f7f1ea015c5cc54acc9e7c43 (diff) |
Merge branch 'func_proto' of https://github.com/chris-chambers/rust-bindgen
Conflicts:
src/parser.rs
tests/forward_declared_struct.rs
tests/test_struct.rs
Diffstat (limited to 'src/types.rs')
-rw-r--r-- | src/types.rs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/types.rs b/src/types.rs index 1a0b353b..fbd108b2 100644 --- a/src/types.rs +++ b/src/types.rs @@ -70,18 +70,28 @@ impl fmt::Show for Global { } #[deriving(Clone, PartialEq)] +pub struct FuncSig { + pub ret_ty: Box<Type>, + pub args: Vec<(String, Type)>, + pub is_variadic: bool, + pub abi: abi::Abi, +} + +#[deriving(Clone, PartialEq)] pub enum Type { TVoid, TInt(IKind, Layout), TFloat(FKind, Layout), TPtr(Box<Type>, bool, Layout), TArray(Box<Type>, uint, Layout), - TFunc(Box<Type>, Vec<(String, Type)>, bool, abi::Abi), + TFuncProto(FuncSig), + TFuncPtr(FuncSig), TNamed(Rc<RefCell<TypeInfo>>), TComp(Rc<RefCell<CompInfo>>), TEnum(Rc<RefCell<EnumInfo>>) } +#[allow(dead_code)] impl Type { pub fn size(&self) -> uint { match self { @@ -93,7 +103,8 @@ impl Type { &TComp(ref ci) => ci.borrow().layout.size, &TEnum(ref ei) => ei.borrow().layout.size, &TVoid => 0, - &TFunc(..) => 0, + &TFuncProto(..) => 0, + &TFuncPtr(..) => 0, } } @@ -107,7 +118,8 @@ impl Type { &TComp(ref ci) => ci.borrow().layout.align, &TEnum(ref ei) => ei.borrow().layout.align, &TVoid => 0, - &TFunc(..) => 0, + &TFuncProto(..) => 0, + &TFuncPtr(..) => 0, } } } |