Skip to content

Commit f65f230

Browse files
committed
Update Cargo.toml, Cargo.toml.in, and 2 more files...
1 parent 0cc2cb2 commit f65f230

4 files changed

Lines changed: 11 additions & 15 deletions

File tree

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ zenoh-ext = { version = "1.5.0", git = "https://github.com/eclipse-zenoh/zenoh.g
7878
zenoh-runtime = { version = "1.5.0", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" }
7979
zenoh-util = { version = "1.5.0", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" }
8080
flume = "*"
81-
cbindgen = "0.29.0"
8281

8382
[target.'cfg(unix)'.dependencies]
8483
ctor = "0.4.1"

Cargo.toml.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ zenoh-ext = { version = "1.5.0", git = "https://github.com/eclipse-zenoh/zenoh.g
7878
zenoh-runtime = { version = "1.5.0", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" }
7979
zenoh-util = { version = "1.5.0", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" }
8080
flume = "*"
81-
cbindgen = "0.29.0"
8281

8382
[target.'cfg(unix)'.dependencies]
8483
ctor = "0.4.1"

buildrs/cbindgen_generator.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ fn evaluate_c_defines_line(line: &str) -> bool {
460460

461461
fn make_move_take_signatures(path_in: &str) -> (Vec<FunctionSignature>, Vec<FunctionSignature>) {
462462
let bindings = std::fs::read_to_string(path_in).unwrap();
463-
let re = Regex::new(r"(\w+)_drop\(struct (\w+) \*(\w+)\);").unwrap();
463+
let re = Regex::new(r"(\w+)_drop\((?:struct\s+)?(\w+) \*(\w+)\);").unwrap();
464464
let mut move_funcs = Vec::<FunctionSignature>::new();
465465
let mut take_funcs = Vec::<FunctionSignature>::new();
466466

@@ -493,7 +493,7 @@ fn make_move_take_signatures(path_in: &str) -> (Vec<FunctionSignature>, Vec<Func
493493

494494
fn find_loan_functions(path_in: &str) -> Vec<FunctionSignature> {
495495
let bindings = std::fs::read_to_string(path_in).unwrap();
496-
let re = Regex::new(r"const struct (\w+) \*(\w+)_loan\(const struct (\w+) \*(\w+)\);").unwrap();
496+
let re = Regex::new(r"const (?:struct\s+)?(\w+) \*(\w+)_loan\(const (?:struct\s+)?(\w+) \*(\w+)\);").unwrap();
497497
let mut res = Vec::<FunctionSignature>::new();
498498

499499
for (_, [return_type, func_name, arg_type, arg_name]) in
@@ -516,7 +516,7 @@ fn find_loan_functions(path_in: &str) -> Vec<FunctionSignature> {
516516

517517
fn find_loan_mut_functions(path_in: &str) -> Vec<FunctionSignature> {
518518
let bindings = std::fs::read_to_string(path_in).unwrap();
519-
let re = Regex::new(r"struct (\w+) \*(\w+)_loan_mut\(struct (\w+) \*(\w+)\);").unwrap();
519+
let re = Regex::new(r"(?:struct\s+)?(\w+) \*(\w+)_loan_mut\((?:struct\s+)?(\w+) \*(\w+)\);").unwrap();
520520
let mut res = Vec::<FunctionSignature>::new();
521521

522522
for (_, [return_type, func_name, arg_type, arg_name]) in
@@ -536,7 +536,7 @@ fn find_loan_mut_functions(path_in: &str) -> Vec<FunctionSignature> {
536536

537537
fn find_take_from_loaned_functions(path_in: &str) -> Vec<FunctionSignature> {
538538
let bindings = std::fs::read_to_string(path_in).unwrap();
539-
let re = Regex::new(r"void (\w+)_take_from_loaned\(struct (\w+) \*(\w+)").unwrap();
539+
let re = Regex::new(r"void (\w+)_take_from_loaned\((?:struct\s+)?(\w+) \*(\w+)").unwrap();
540540
let mut res = Vec::<FunctionSignature>::new();
541541

542542
for (_, [func_name, arg_type, arg_name]) in re.captures_iter(&bindings).map(|c| c.extract()) {
@@ -559,7 +559,7 @@ fn find_take_from_loaned_functions(path_in: &str) -> Vec<FunctionSignature> {
559559

560560
fn find_drop_functions(path_in: &str) -> Vec<FunctionSignature> {
561561
let bindings = std::fs::read_to_string(path_in).unwrap();
562-
let re = Regex::new(r"(.+?) +(\w+_drop)\(struct (\w+) \*(\w+)\);").unwrap();
562+
let re = Regex::new(r"(.+?) +(\w+_drop)\((?:struct\s+)?(\w+) \*(\w+)\);").unwrap();
563563
let mut res = Vec::<FunctionSignature>::new();
564564

565565
for (_, [return_type, func_name, arg_type, arg_name]) in
@@ -586,7 +586,7 @@ fn find_drop_functions(path_in: &str) -> Vec<FunctionSignature> {
586586

587587
fn find_null_functions(path_in: &str) -> Vec<FunctionSignature> {
588588
let bindings = std::fs::read_to_string(path_in).unwrap();
589-
let re = Regex::new(r" (z.?_internal_\w+_null)\(struct (\w+) \*(\w+)\);").unwrap();
589+
let re = Regex::new(r" (z.?_internal_\w+_null)\((?:struct\s+)?(\w+) \*(\w+)\);").unwrap();
590590
let mut res = Vec::<FunctionSignature>::new();
591591

592592
for (_, [func_name, arg_type, arg_name]) in re.captures_iter(&bindings).map(|c| c.extract()) {
@@ -604,7 +604,7 @@ fn find_null_functions(path_in: &str) -> Vec<FunctionSignature> {
604604

605605
fn find_check_functions(path_in: &str) -> Vec<FunctionSignature> {
606606
let bindings = std::fs::read_to_string(path_in).unwrap();
607-
let re = Regex::new(r"bool (z.?_internal_\w+_check)\(const struct (\w+) \*(\w+)\);").unwrap();
607+
let re = Regex::new(r"bool (z.?_internal_\w+_check)\(const (?:struct\s+)?(\w+) \*(\w+)\);").unwrap();
608608
let mut res = Vec::<FunctionSignature>::new();
609609

610610
for (_, [func_name, arg_type, arg_name]) in re.captures_iter(&bindings).map(|c| c.extract()) {
@@ -626,7 +626,7 @@ fn find_check_functions(path_in: &str) -> Vec<FunctionSignature> {
626626
fn find_call_functions(path_in: &str) -> Vec<FunctionSignature> {
627627
let bindings = std::fs::read_to_string(path_in).unwrap();
628628
let re = Regex::new(
629-
r"(\w+) (\w+)_call\(const struct (\w+) \*(\w+),\s+(\w*)\s*struct (\w+) (\*?)(\w+)\);",
629+
r"(\w+) (\w+)_call\(const (?:struct\s+)?(\w+) \*(\w+),\s+(\w*)\s*(?:struct\s+)?(\w+) (\*?)(\w+)\);",
630630
)
631631
.unwrap();
632632
let mut res = Vec::<FunctionSignature>::new();
@@ -659,7 +659,7 @@ fn find_call_functions(path_in: &str) -> Vec<FunctionSignature> {
659659
fn find_closure_constructors(path_in: &str) -> Vec<FunctionSignature> {
660660
let bindings = std::fs::read_to_string(path_in).unwrap();
661661
let re = Regex::new(
662-
r"(\w+) (\w+)_closure_(\w+)\(struct\s+(\w+)\s+\*(\w+),\s+void\s+\(\*call\)(\([\s\w,\*]*\)),\s+void\s+\(\*drop\)(\(.*\)),\s+void\s+\*context\);"
662+
r"(\w+) (\w+)_closure_(\w+)\((?:struct\s+)?(\w+)\s+\*(\w+),\s+void\s+\(\*call\)(\([\s\w,\*]*\)),\s+void\s+\(\*drop\)(\(.*\)),\s+void\s+\*context\);"
663663
)
664664
.unwrap();
665665
let mut res = Vec::<FunctionSignature>::new();
@@ -694,7 +694,7 @@ fn find_closure_constructors(path_in: &str) -> Vec<FunctionSignature> {
694694

695695
fn find_recv_functions(path_in: &str) -> Vec<FunctionSignature> {
696696
let bindings = std::fs::read_to_string(path_in).unwrap();
697-
let re = Regex::new(r"(\w+)\s+z_(\w+)_handler_(\w+)_recv\(const\s+struct\s+(\w+)\s+\*(\w+),\s+struct\s+(\w+)\s+\*(\w+)\);").unwrap();
697+
let re = Regex::new(r"(\w+)\s+z_(\w+)_handler_(\w+)_recv\(const\s+(?:struct\s+)?(\w+)\s+\*(\w+),\s+(?:struct\s+)?(\w+)\s+\*(\w+)\);").unwrap();
698698
let mut res = Vec::<FunctionSignature>::new();
699699

700700
for (_, [return_type, handler_type, value_type, arg1_type, arg1_name, arg2_type, arg2_name]) in
@@ -718,7 +718,7 @@ fn find_recv_functions(path_in: &str) -> Vec<FunctionSignature> {
718718
fn find_clone_functions(path_in: &str) -> Vec<FunctionSignature> {
719719
let bindings = std::fs::read_to_string(path_in).unwrap();
720720
let re = Regex::new(
721-
r"(\w+)\s+z_(\w+)_clone\(struct\s+(\w+)\s+\*(\w+),\s+const\s+struct\s+(\w+)\s+\*(\w+)\);",
721+
r"(\w+)\s+z_(\w+)_clone\((?:struct\s+)?(\w+)\s+\*(\w+),\s+const\s+(?:struct\s+)?(\w+)\s+\*(\w+)\);",
722722
)
723723
.unwrap();
724724
let mut res = Vec::<FunctionSignature>::new();

buildrs/opaque_types_generator.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ pub fn generate_opaque_types() {
3535
s += format!(
3636
"#[repr(C, align({align}))]
3737
#[rustfmt::skip]
38-
#[cbindgen::cbindgen(kind = \"struct\")]
3938
pub struct {type_name} {{
4039
{inner_field_name}: [u8; {size}],
4140
}}
@@ -47,7 +46,6 @@ pub struct {type_name} {{
4746
s += format!(
4847
"#[repr(C)]
4948
#[rustfmt::skip]
50-
#[cbindgen::cbindgen(kind = \"struct\")]
5149
pub struct {moved_type_name} {{
5250
_this: {type_name},
5351
}}

0 commit comments

Comments
 (0)