Displaying 20 results from an estimated 20 matches for "translate_bad_symbols".
2019 Jun 27
0
[PATCH 5/9] Rust bindings: Add generator of structs for optional arguments
...ake 1 c))
+
+let snake2caml name =
+ let l = split_on_char '_' name in
+ let l = List.map (fun x -> String.capitalize_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...
2019 Aug 11
5
[PATCH 1/2] Rust bindings: Add long description
...`cargo doc` is far different
from the documents which already exist.
---
generator/rust.ml | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/generator/rust.ml b/generator/rust.ml
index 1f5cefa62..3a07c3b53 100644
--- a/generator/rust.ml
+++ b/generator/rust.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 C...
2019 Jun 27
0
Re: [PATCH 08/11] Rust bindings: Fix memory management and format the file
...pr "/* Optional Structs */\n";
pr "#[derive(Default)]\n";
- pr "pub struct OptArgs%s {\n" cname;
+ pr "pub struct %sOptArgs%s {\n" cname opt_life_parameter;
List.iter (
fun optarg ->
let n = translate_bad_symbols (name_of_optargt optarg) in
match optarg with
| OBool _ ->
- pr " _%s: Option<bool>,\n" n
+ pr " pub %s: Option<bool>,\n" n
| OInt _ ->
- pr " _%s: Option<i32>,\n&...
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
16
[PATCH 1/9] Rust bindings: Add Rust bindings
From: Hiroyuki_Katsura <hiroyuki.katsura.0513@gmail.com>
---
Makefile.am | 4 ++++
configure.ac | 3 +++
generator/Makefile.am | 3 +++
generator/bindtests.ml | 3 +++
generator/bindtests.mli | 1 +
generator/main.ml | 5 +++++
generator/rust.ml | 34 ++++++++++++++++++++++++++++++++++
generator/rust.mli | 19 +++++++++++++++++++
2019 Aug 12
0
Re: [PATCH 1/2] Rust bindings: Add long description
...it is
mostly unrelated.
> ---
> generator/rust.ml | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/generator/rust.ml b/generator/rust.ml
> index 1f5cefa62..3a07c3b53 100644
> --- a/generator/rust.ml
> +++ b/generator/rust.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 =
indent_depth seems always 1, so I'd say to hardcode this indentation
level for now (it can be always changed).
> + let l = pod2text name longdesc in
Better...
2019 Jun 27
0
[PATCH 7/9] Rust bindings: Complete actions
...) optargs;
pr "}\n\n";
+
+ (* raw struct for C bindings *)
+ pr "#[repr(C)]\n";
+ pr "struct RawOptArgs%s {\n" cname;
+ pr " bitmask: u64,\n";
+ List.iter (
+ fun optarg ->
+ let n = translate_bad_symbols (name_of_optargt optarg) in
+ match optarg with
+ | OBool _ ->
+ pr " %s: c_int,\n" n
+ | OInt _ ->
+ pr " %s: c_int,\n" n
+ | OInt64 _ ->
+ pr " %s: i64,\n" n
+...
2019 Jul 23
2
Re: [PATCH] Rust bindings: Add Rust bindings
...; + let l = split_on_char '_' name in
> + let l = List.map (fun x -> String.capitalize_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;
> +
> + pr "
> +use crate::base::*;
> +use crate::utils::*;
> +use crate::error::*;...
2019 Jul 26
4
Re: [PATCH] Rust bindings: Add Rust bindings
...d currying:
let snake2caml name =
let l = String.nsplit "_" name in
let l = List.map String.capitalize_ascii 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
Hm IMHO the condition in the if sounds like List.mem :) What about:
if List.mem s black_list then
> + let cname = snake2caml name in
> + let rec contains_ptr args...
2019 Jul 17
2
[PATCH] Rust bindings: Add Rust bindings
....make 1 c))
+
+let snake2caml name =
+ let l = split_on_char '_' name in
+ let l = List.map (fun x -> String.capitalize_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;
+
+ pr "
+use std::collections;
+use std::convert;
+use std::convert::TryFrom;
+use std::ffi;
+use std::os::raw::{c_char, c_int, c_vo...
2019 Jul 20
2
Re: [PATCH] Rust bindings: Add Rust bindings
...#39;_' name in
> >+ let l = List.map (fun x -> String.capitalize_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;
> >+
> >+ pr "
>
> I started with this as well (for...
2019 Jul 20
0
[PATCH] Rust bindings: Add Rust bindings
....make 1 c))
+
+let snake2caml name =
+ let l = split_on_char '_' name in
+ let l = List.map (fun x -> String.capitalize_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;
+
+ pr "
+use crate::base::*;
+use crate::utils::*;
+use crate::error::*;
+use std::collections;
+use std::convert;
+use std::convert...
2019 Jul 23
0
Re: [PATCH] Rust bindings: Add Rust bindings
....make 1 c))
+
+let snake2caml name =
+ let l = split_on_char '_' name in
+ let l = List.map (fun x -> String.capitalize_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;
+
+ pr "
+use crate::base::*;
+use crate::utils::*;
+use crate::error::*;
+use std::collections;
+use std::convert;
+use std::convert...
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 08
2
Re: [PATCH] Add Rust bindings
On Mon, Jul 08, 2019 at 10:04:57AM +0100, Richard W.M. Jones wrote:
>On Mon, Jul 08, 2019 at 10:49:55AM +0200, Martin Kletzander wrote:
>> On Mon, Jul 08, 2019 at 10:10:10AM +0200, Pino Toscano wrote:
>> >On Saturday, 6 July 2019 13:03:24 CEST Martin Kletzander wrote:
>> >>Just one thing, the Cargo.toml includes a version under which the crate would be
>>
2019 Jun 27
0
[PATCH 9/9] Rust bindings: Complete bindings
...Optional Structs */\n";
pr "#[derive(Default)]\n";
- pr "pub struct OptArgs%s%s {\n" cname opt_life_parameter;
+ pr "pub struct %sOptArgs%s {\n" cname opt_life_parameter;
List.iter (
fun optarg ->
let n = translate_bad_symbols (name_of_optargt optarg) in
match optarg with
| OBool _ ->
- pr " _%s: Option<bool>,\n" n
+ pr " pub %s: Option<bool>,\n" n
| OInt _ ->
- pr " _%s: Option<i32>,\n&...
2019 Jul 29
1
Re: [PATCH] Rust bindings: Add Rust bindings
...t (x - 1)
+ | _ -> ()
+
+let snake2caml name =
+ let l = String.nsplit "_" name in
+ let l = List.map String.capitalize_ascii 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.mem s black_list then
+ s ^ "_"
+ else
+ s
+
+let generate_rust () =
+ generate_header ~copywrites:copywrites CStyle LGPLv2plus;
+
+ pr "
+use crate::base::*;
+use crate::utils::*;
+use crate::error::*;
+use std::collections;
+use std::convert;
+use std::conve...
2019 Jul 29
0
Re: [PATCH] Rust bindings: Add Rust bindings
...let l = String.nsplit "_" name in
> let l = List.map String.capitalize_ascii 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
>
> Hm IMHO the condition in the if sounds like List.mem :) What about:
>
> if List.mem s black_list then
>
> > + let cname = snake2cam...
2019 Aug 13
2
Re: [PATCH 1/2] Rust bindings: Add long description
...---
>> generator/rust.ml | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/generator/rust.ml b/generator/rust.ml
>> index 1f5cefa62..3a07c3b53 100644
>> --- a/generator/rust.ml
>> +++ b/generator/rust.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 =
>
> indent_depth seems always 1, so I'd say to hardcode this indentation
> level for now (it can be always changed).
OK.
>
>&g...
2019 Jul 17
0
Re: [PATCH] Rust bindings: Add Rust bindings
...me =
>+ let l = split_on_char '_' name in
>+ let l = List.map (fun x -> String.capitalize_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;
>+
>+ pr "
I started with this as well (for the libnbd bindings), but it was a PITA for me
to modi...