search for: generate_rust

Displaying 20 results from an estimated 26 matches for "generate_rust".

2019 Jul 02
0
[PATCH 01/12] Rust bindings: Add Rust bindings
...bindtests.cmo \ errnostring.cmo \ customize.cmo \ diff --git a/generator/bindtests.ml b/generator/bindtests.ml index 58d7897b3..8a5682d5e 100644 --- a/generator/bindtests.ml +++ b/generator/bindtests.ml @@ -983,6 +983,9 @@ and generate_php_bindtests () = dump "bindtests" +and generate_rust_bindtests () = + generate_header CStyle GPLv2plus + (* Language-independent bindings tests - we do it this way to * ensure there is parity in testing bindings across all languages. *) diff --git a/generator/bindtests.mli b/generator/bindtests.mli index 6f469b3a1..0e18a4c44 100644 --- a/genera...
2019 Jun 27
16
[PATCH 1/9] Rust bindings: Add Rust bindings
...bindtests.cmo \ errnostring.cmo \ customize.cmo \ diff --git a/generator/bindtests.ml b/generator/bindtests.ml index 58d7897b3..41aef47ea 100644 --- a/generator/bindtests.ml +++ b/generator/bindtests.ml @@ -983,6 +983,9 @@ and generate_php_bindtests () = dump "bindtests" +and generate_rust_bindtests () = + generate_header CStyle GPLv2plus; + (* Language-independent bindings tests - we do it this way to * ensure there is parity in testing bindings across all languages. *) diff --git a/generator/bindtests.mli b/generator/bindtests.mli index 6f469b3a1..0e18a4c44 100644 --- a/gener...
2019 Jul 02
16
[PATCH] Add Rust bindings
I fixed the patch I submitted before based on comments, and there are some commits which are merged or divided. So, I will re-send all the patches. Regards, Hiroyuki Katsura
2019 Jul 03
1
Re: [PATCH 01/12] Rust bindings: Add Rust bindings
...General Public License for more details. >+ * >+ * You should have received a copy of the GNU General Public License >+ * along with this program; if not, write to the Free Software >+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA >+*) >+ >+val generate_rust: unit -> unit >\ No newline at end of file I'm not sure what editor you use, but either setting it up so that there is a '\n' in the end of the file (at least by default unless you remove it or something) would probably be favourable. >diff --git a/m4/guestfs-rust.m4 b/m4/gue...
2019 Aug 11
5
[PATCH 1/2] Rust bindings: Add long description
...ust.ml @@ -52,6 +52,14 @@ let translate_bad_symbols s = else s +(* output longdesc to the rust file *) +let pr_longdesc name longdesc indent_depth = + let l = pod2text name longdesc in + List.iter (fun x -> + indent indent_depth; + pr "/// %s\n" x; + ) l + let generate_rust () = generate_header ~copyrights CStyle LGPLv2plus; @@ -398,6 +406,8 @@ extern \"C\" { style = (ret, args, optargs) } as f) -> let cname = snake2caml name in pr " /// %s\n" shortdesc; + pr " ///\n"; + pr_longdesc name lo...
2019 Jun 27
0
[PATCH 2/9] Rust bindings: Add create / close functions
...++++++++++++++++++++++++++++++++++++++++++++++- rust/Cargo.toml | 2 ++ 2 files changed, 85 insertions(+), 1 deletion(-) diff --git a/generator/rust.ml b/generator/rust.ml index 83afdfe73..dbe9db010 100644 --- a/generator/rust.ml +++ b/generator/rust.ml @@ -31,4 +31,86 @@ open Events let generate_rust () = - generate_header CStyle LGPLv2plus; \ No newline at end of file + generate_header CStyle LGPLv2plus; + + pr " +#[allow(non_camel_case_types)] +enum guestfs_h {} + +extern \"C\" { + fn guestfs_create() -> *mut guestfs_h; + fn guestfs_create_flags(flags: i64) -> *m...
2019 Jun 27
0
[PATCH 5/9] Rust bindings: Add generator of structs for optional arguments
...alize_ascii x) l in + String.concat "" l + + +(* because there is a function which contains 'unsafe' field *) +let black_list = ["unsafe"] + +let translate_bad_symbols s = + if List.exists (fun x -> s = x) black_list then + s ^ "_" + else + s + let generate_rust () = generate_header CStyle LGPLv2plus; @@ -204,3 +226,52 @@ impl UUID { pr " }\n"; pr "}\n" ) external_structs; + List.iter ( + fun ({ name = name; shortdesc = shortdesc; + style = (ret, args, optargs) }) -> + let cname = snake2caml...
2019 Jun 27
0
[PATCH 4/9] Rust bindings: Add generator of structs
...it a/generator/rust.ml b/generator/rust.ml index 251eb1594..174f6ded3 100644 --- a/generator/rust.ml +++ b/generator/rust.ml @@ -29,13 +29,21 @@ open Structs open C open Events +let rec indent n = match n with + | x when x > 0 -> pr " "; indent (x - 1) + | _ -> () let generate_rust () = generate_header CStyle LGPLv2plus; pr " +use std::ffi; +use std::slice; +use std::os::raw::c_char; + + #[allow(non_camel_case_types)] -enum guestfs_h {} +enum guestfs_h {} // opaque struct #[link(name = \"guestfs\")] extern \"C\" { @@ -119,5 +127,80 @@ im...
2019 Jun 27
4
Re: [PATCH 9/9] Rust bindings: Complete bindings
Patch 9 is a kind of dumping ground of all kinds of stuff. It may be better to spend some time with git rebase -i trying to work this into more coherent patches. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live
2019 Jun 27
0
[PATCH 6/9] Rust bindings: Add generator of function signatures
...uki.katsura.0513@gmail.com> --- generator/rust.ml | 137 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) diff --git a/generator/rust.ml b/generator/rust.ml index a229d5eac..aa8b249ff 100644 --- a/generator/rust.ml +++ b/generator/rust.ml @@ -59,8 +59,10 @@ let generate_rust () = generate_header CStyle LGPLv2plus; pr " +use std::collections; use std::ffi; use std::slice; +use std::ptr; use std::os::raw::c_char; @@ -130,6 +132,18 @@ impl CreateFlags { } } +fn arg_string_list (v: &Vec<String>) -> Vec<*const i8> { + let le...
2019 Jun 27
2
Re: [PATCH 3/9] Rust bindings: Add 4 bindings tests
...; create mode 100644 rust/tests/030_create_flags.rs > create mode 100644 rust/tests/040_create_multiple.rs > > diff --git a/generator/rust.ml b/generator/rust.ml > index dbe9db010..251eb1594 100644 > --- a/generator/rust.ml > +++ b/generator/rust.ml > @@ -37,14 +37,16 @@ let generate_rust () = > #[allow(non_camel_case_types)] > enum guestfs_h {} > > +#[link(name = \"guestfs\")] > extern \"C\" { > fn guestfs_create() -> *mut guestfs_h; > fn guestfs_create_flags(flags: i64) -> *mut guestfs_h; > fn guestfs_close(g: *...
2019 Jun 27
1
Re: [PATCH 3/9] Rust bindings: Add 4 bindings tests
...create mode 100644 rust/tests/040_create_multiple.rs > > > > > > diff --git a/generator/rust.ml b/generator/rust.ml > > > index dbe9db010..251eb1594 100644 > > > --- a/generator/rust.ml > > > +++ b/generator/rust.ml > > > @@ -37,14 +37,16 @@ let generate_rust () = > > > #[allow(non_camel_case_types)] > > > enum guestfs_h {} > > > > > > +#[link(name = \"guestfs\")] > > > extern \"C\" { > > > fn guestfs_create() -> *mut guestfs_h; > > > fn guestfs_create_fla...
2019 Jun 27
0
[PATCH 9/9] Rust bindings: Complete bindings
...cted 'yes'" echo "then you should check the preceding messages." diff --git a/generator/bindtests.ml b/generator/bindtests.ml index 41aef47ea..e88e71c8a 100644 --- a/generator/bindtests.ml +++ b/generator/bindtests.ml @@ -986,6 +986,69 @@ and generate_php_bindtests () = and generate_rust_bindtests () = generate_header CStyle GPLv2plus; + pr "extern crate guestfs;\n"; + pr "use guestfs::*;\n"; + pr "use std::default::Default;\n"; + pr "\n"; + pr "fn main() {\n"; + pr " let g = match Handle::create() {\n"; + p...
2019 Jun 27
0
[PATCH 3/9] Rust bindings: Add 4 bindings tests
...mode 100644 rust/tests/020_create.rs create mode 100644 rust/tests/030_create_flags.rs create mode 100644 rust/tests/040_create_multiple.rs diff --git a/generator/rust.ml b/generator/rust.ml index dbe9db010..251eb1594 100644 --- a/generator/rust.ml +++ b/generator/rust.ml @@ -37,14 +37,16 @@ let generate_rust () = #[allow(non_camel_case_types)] enum guestfs_h {} +#[link(name = \"guestfs\")] extern \"C\" { fn guestfs_create() -> *mut guestfs_h; fn guestfs_create_flags(flags: i64) -> *mut guestfs_h; fn guestfs_close(g: *mut guestfs_h); - static GUESTFS_CREA...
2019 Jun 27
0
Re: [PATCH 3/9] Rust bindings: Add 4 bindings tests
...30_create_flags.rs > > create mode 100644 rust/tests/040_create_multiple.rs > > > > diff --git a/generator/rust.ml b/generator/rust.ml > > index dbe9db010..251eb1594 100644 > > --- a/generator/rust.ml > > +++ b/generator/rust.ml > > @@ -37,14 +37,16 @@ let generate_rust () = > > #[allow(non_camel_case_types)] > > enum guestfs_h {} > > > > +#[link(name = \"guestfs\")] > > extern \"C\" { > > fn guestfs_create() -> *mut guestfs_h; > > fn guestfs_create_flags(flags: i64) -> *mut guestfs_h...
2019 Jul 17
2
[PATCH] Rust bindings: Add Rust bindings
...bindtests.cmo \ errnostring.cmo \ customize.cmo \ diff --git a/generator/bindtests.ml b/generator/bindtests.ml index 58d7897b3..e88e71c8a 100644 --- a/generator/bindtests.ml +++ b/generator/bindtests.ml @@ -983,6 +983,72 @@ and generate_php_bindtests () = dump "bindtests" +and generate_rust_bindtests () = + generate_header CStyle GPLv2plus; + + pr "extern crate guestfs;\n"; + pr "use guestfs::*;\n"; + pr "use std::default::Default;\n"; + pr "\n"; + pr "fn main() {\n"; + pr " let g = match Handle::create() {\n"; + p...
2019 Jul 17
0
Re: [PATCH] Rust bindings: Add Rust bindings
...;" l >+ >+(* because there is a function which contains 'unsafe' field *) >+let black_list = ["unsafe"] >+ >+let translate_bad_symbols s = >+ if List.exists (fun x -> s = x) black_list then >+ s ^ "_" >+ else >+ s >+ >+let generate_rust () = >+ generate_header CStyle LGPLv2plus; >+ >+ pr " I started with this as well (for the libnbd bindings), but it was a PITA for me to modify parts of the generator. I then realized that I found out two things, each one should help you move part of this outside the generator:...
2019 Jun 27
0
[PATCH 7/9] Rust bindings: Complete actions
...mail.com> --- generator/rust.ml | 283 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 259 insertions(+), 24 deletions(-) diff --git a/generator/rust.ml b/generator/rust.ml index aa8b249ff..79e16dfc6 100644 --- a/generator/rust.ml +++ b/generator/rust.ml @@ -60,10 +60,11 @@ let generate_rust () = pr " use std::collections; +use std::convert; use std::ffi; use std::slice; use std::ptr; -use std::os::raw::c_char; +use std::os::raw::{c_char, c_int}; #[allow(non_camel_case_types)] @@ -74,6 +75,8 @@ extern \"C\" { fn guestfs_create() -> *mut guestfs_h;...
2019 Jul 20
2
Re: [PATCH] Rust bindings: Add Rust bindings
...nction which contains 'unsafe' field *) > >+let black_list = ["unsafe"] > >+ > >+let translate_bad_symbols s = > >+ if List.exists (fun x -> s = x) black_list then > >+ s ^ "_" > >+ else > >+ s > >+ > >+let generate_rust () = > >+ generate_header CStyle LGPLv2plus; > >+ > >+ pr " > > I started with this as well (for the libnbd bindings), but it was a PITA > for me > to modify parts of the generator. I then realized that I found out two > things, > each one should help you...
2019 Jul 20
0
[PATCH] Rust bindings: Add Rust bindings
...bindtests.cmo \ errnostring.cmo \ customize.cmo \ diff --git a/generator/bindtests.ml b/generator/bindtests.ml index 58d7897b3..e88e71c8a 100644 --- a/generator/bindtests.ml +++ b/generator/bindtests.ml @@ -983,6 +983,72 @@ and generate_php_bindtests () = dump "bindtests" +and generate_rust_bindtests () = + generate_header CStyle GPLv2plus; + + pr "extern crate guestfs;\n"; + pr "use guestfs::*;\n"; + pr "use std::default::Default;\n"; + pr "\n"; + pr "fn main() {\n"; + pr " let g = match Handle::create() {\n"; + p...