diff --git a/csbindgen-tests/Cargo.toml b/csbindgen-tests/Cargo.toml index 68fc965..202e2d2 100644 --- a/csbindgen-tests/Cargo.toml +++ b/csbindgen-tests/Cargo.toml @@ -14,7 +14,7 @@ path = "src/lib.rs" [dependencies] csbindgen = { path = "../csbindgen" } -physx-sys = "0.11.0" +# physx-sys = "0.11.0" [build-dependencies] cc = "1.0.79" diff --git a/csbindgen/src/builder.rs b/csbindgen/src/builder.rs index c7de846..6d44107 100644 --- a/csbindgen/src/builder.rs +++ b/csbindgen/src/builder.rs @@ -185,8 +185,8 @@ impl Builder { Ok(()) } - fn has_input_file(&self) -> bool { - !self.options.input_bindgen_file.to_string_lossy().is_empty() + fn has_input_files(&self) -> bool { + !self.options.input_bindgen_files.is_empty() } fn has_input_externals(&self) -> bool { !self.options.input_extern_files.is_empty() @@ -197,7 +197,7 @@ impl Builder { rust_output_path: P, csharp_output_path: P, ) -> Result<(), Box> { - if !self.options.input_bindgen_files.is_empty() { + if self.has_input_files() { let (rust, csharp) = generate(GenerateKind::InputBindgen, &self.options)?; if let Some(rust) = rust { diff --git a/csbindgen/src/parser.rs b/csbindgen/src/parser.rs index 19758a8..689fb4a 100644 --- a/csbindgen/src/parser.rs +++ b/csbindgen/src/parser.rs @@ -1,6 +1,6 @@ use crate::{alias_map::AliasMap, builder::BindgenOptions, field_map::FieldMap, type_meta::*}; use std::collections::HashSet; -use syn::{ForeignItem, Item, Pat, ReturnType}; +use syn::{ForeignItem, Item, Pat, ReturnType, __private::ToTokens}; enum FnItem { ForeignItem(syn::ForeignItemFn), @@ -209,6 +209,24 @@ pub fn collect_enum(ast: &syn::File, result: &mut Vec) { repr, }); } + else if let Item::Macro(t) = item { + let last_segment = t.mac.path.segments.last().unwrap(); + if last_segment.ident == "bitflags" { + // t.mac.tokens + //let inner_ast = syn::parse(t.mac.tokens); + //let ttt = t.mac.to_token_stream(); + + let input = t.mac.to_tokens(tokens); + //let foo = syn::parse(tokens); + //let tako = syn::parse2(tokens); + + //t.mac.tokens.to_string() + + let ast: syn::DeriveInput = syn::parse_file(content) + + //let file_ast = syn::parse_file(t.mac.to_tokens(tokens) + } + } } }