summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/bindgen.rs26
-rw-r--r--src/macro.rs20
-rw-r--r--src/types.rs5
3 files changed, 28 insertions, 23 deletions
diff --git a/src/bin/bindgen.rs b/src/bin/bindgen.rs
index 4e3ffd11..a0a189d2 100644
--- a/src/bin/bindgen.rs
+++ b/src/bin/bindgen.rs
@@ -40,7 +40,7 @@ fn parse_args(args: &[String]) -> ParseResult {
let mut out = box io::BufferedWriter::new(io::stdout()) as Box<io::Writer>;
if args_len == 0u {
- return CmdUsage;
+ return ParseResult::CmdUsage;
}
let mut ix = 0u;
@@ -51,7 +51,7 @@ fn parse_args(args: &[String]) -> ParseResult {
} else {
match args[ix].as_slice() {
"--help" | "-h" => {
- return CmdUsage;
+ return ParseResult::CmdUsage;
}
"-emit-clang-ast" => {
options.emit_ast = true;
@@ -59,39 +59,39 @@ fn parse_args(args: &[String]) -> ParseResult {
}
"-o" => {
if ix + 1u >= args_len {
- return ParseErr("Missing output filename".to_string());
+ return ParseResult::ParseErr("Missing output filename".to_string());
}
let path = path::Path::new(args[ix + 1].clone());
match fs::File::create(&path) {
Ok(f) => { out = box io::BufferedWriter::new(f) as Box<io::Writer>; }
- Err(_) => { return ParseErr(format!("Open {} failed", args[ix + 1])); }
+ Err(_) => { return ParseResult::ParseErr(format!("Open {} failed", args[ix + 1])); }
}
ix += 2u;
}
"-l" => {
if ix + 1u >= args_len {
- return ParseErr("Missing link name".to_string());
+ return ParseResult::ParseErr("Missing link name".to_string());
}
options.links.push((args[ix + 1u].clone(), None));
ix += 2u;
}
"-static-link" => {
if ix + 1u >= args_len {
- return ParseErr("Missing link name".to_string());
+ return ParseResult::ParseErr("Missing link name".to_string());
}
options.links.push((args[ix + 1u].clone(), Some("static".to_string())));
ix += 2u;
}
"-framework-link" => {
if ix + 1u >= args_len {
- return ParseErr("Missing link name".to_string());
+ return ParseResult::ParseErr("Missing link name".to_string());
}
options.links.push((args[ix + 1u].clone(), Some("framework".to_string())));
ix += 2u;
}
"-match" => {
if ix + 1u >= args_len {
- return ParseErr("Missing match pattern".to_string());
+ return ParseResult::ParseErr("Missing match pattern".to_string());
}
options.match_pat.push(args[ix + 1u].clone());
ix += 2u;
@@ -110,7 +110,7 @@ fn parse_args(args: &[String]) -> ParseResult {
}
"-override-enum-type" => {
if ix + 1u >= args_len {
- return ParseErr("Missing enum type".to_string());
+ return ParseResult::ParseErr("Missing enum type".to_string());
}
options.override_enum_ty = args[ix + 1u].clone();
ix += 2u;
@@ -123,7 +123,7 @@ fn parse_args(args: &[String]) -> ParseResult {
}
}
- return ParseOk(options, out);
+ return ParseResult::ParseOk(options, out);
}
fn print_usage(bin: String) {
@@ -183,9 +183,9 @@ pub fn main() {
let bin = bind_args.remove(0).unwrap();
match parse_args(bind_args.as_slice()) {
- ParseErr(e) => panic!(e),
- CmdUsage => print_usage(bin),
- ParseOk(options, out) => {
+ ParseResult::ParseErr(e) => panic!(e),
+ ParseResult::CmdUsage => print_usage(bin),
+ ParseResult::ParseOk(options, out) => {
let logger = StdLogger;
match generate_bindings(options, Some(&logger as &Logger), DUMMY_SP) {
Ok(items) => {
diff --git a/src/macro.rs b/src/macro.rs
index e3b05a28..3d5345d1 100644
--- a/src/macro.rs
+++ b/src/macro.rs
@@ -206,7 +206,7 @@ enum QuoteState {
fn parse_process_args(s: &str) -> Vec<String> {
let s = s.trim();
let mut parts = Vec::new();
- let mut quote_state = InNone;
+ let mut quote_state = QuoteState::InNone;
let mut positions = vec!(0);
let mut last = ' ';
for (i, c) in s.chars().chain(" ".chars()).enumerate() {
@@ -221,30 +221,30 @@ fn parse_process_args(s: &str) -> Vec<String> {
// Match \\
('\\', '\\') => (),
// Match <any>"
- (_, '\"') if quote_state == InNone => {
- quote_state = InDoubleQuotes;
+ (_, '\"') if quote_state == QuoteState::InNone => {
+ quote_state = QuoteState::InDoubleQuotes;
positions.push(i);
positions.push(i + 1);
},
- (_, '\"') if quote_state == InDoubleQuotes => {
- quote_state = InNone;
+ (_, '\"') if quote_state == QuoteState::InDoubleQuotes => {
+ quote_state = QuoteState::InNone;
positions.push(i);
positions.push(i + 1);
},
// Match <any>'
- (_, '\'') if quote_state == InNone => {
- quote_state = InSingleQuotes;
+ (_, '\'') if quote_state == QuoteState::InNone => {
+ quote_state = QuoteState::InSingleQuotes;
positions.push(i);
positions.push(i + 1);
},
- (_, '\'') if quote_state == InSingleQuotes => {
- quote_state = InNone;
+ (_, '\'') if quote_state == QuoteState::InSingleQuotes => {
+ quote_state = QuoteState::InNone;
positions.push(i);
positions.push(i + 1);
},
// Match <any><space>
// If we are at the end of the string close any open quotes
- (_, ' ') if quote_state == InNone || i >= s.len() => {
+ (_, ' ') if quote_state == QuoteState::InNone || i >= s.len() => {
{
positions.push(i);
diff --git a/src/types.rs b/src/types.rs
index 76200c49..ad0c0faf 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -4,6 +4,11 @@ use std::rc::Rc;
use syntax::abi;
+pub use self::Global::*;
+pub use self::Type::*;
+pub use self::IKind::*;
+pub use self::FKind::*;
+
#[deriving(Clone)]
pub enum Global {
GType(Rc<RefCell<TypeInfo>>),