search for: capitalize_ascii

Displaying 20 results from an estimated 28 matches for "capitalize_ascii".

2016 Dec 08
4
[PATCH] generator: Share Common_utils code.
...nly need to write utility functions once. As with other tools, we still have generator-specific utility functions in generator/utils.ml. Also in this change: - Use String.uppercase_ascii and String.lowercase_ascii in place of deprecated String.uppercase/String.lowercase. - Implement String.capitalize_ascii to replace deprecated String.capitalize. - Move isspace, isdigit, isxdigit functions to Char module. --- .gitignore | 3 + dib/utils.ml | 2 +- generator/Makefile.am | 23 ++++++- generator/bindtests.ml | 25 +++---- generator/c.ml | 53 ++++++++...
2020 Mar 17
0
[PATCH libnbd v2 3/3] golang: Add straightforward bindings, without callbacks.
...n _ -> "string" + | String _ -> "string" + | StringList _ -> "[]string" + | UInt _ -> "uint" + | UInt32 _ -> "uint32" + | UInt64 _ -> "uint64" + +let go_name_of_optarg = function + | OClosure { cbname } -> String.capitalize_ascii cbname + | OFlags (n, _) -> String.capitalize_ascii n + +(* For consistency every method will return (type, error) where + * type is defined by this function. However some functions + * never really have a type (RErr) and others never really have + * an error (RUInt). + *) +let go_ret_type = f...
2019 Jul 29
0
Re: [PATCH] Rust bindings: Add Rust bindings
...mon/mlstdutils. One of the things provided are extra functions for > the String module, and one in particular can help here: String.nsplit. > Also... > > > +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 > > ... this can be simplified a bit using String.nsplit, and currying: > > let snake2caml name = > let l = String.nsplit "_" name in > let l = List.map String.capitalize_ascii l in > String.concat "" l...
2019 Jun 27
0
[PATCH 5/9] Rust bindings: Add generator of structs for optional arguments
...ot;; indent (x - 1) | _ -> () +(* split_on_char exists since OCaml 4.04 *) +(* but current requirements: >=4.01 *) +let split_on_char c = Str.split (Str.regexp (String.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_ru...
2020 Sep 11
0
[libnbd PATCH v2 2/5] generator: Refactor filtering of accepted OFlags
...l b/generator/GoLang.ml index f07b074..81446a6 100644 --- a/generator/GoLang.ml +++ b/generator/GoLang.ml @@ -83,7 +83,7 @@ let go_arg_type = function let go_name_of_optarg = function | OClosure { cbname } -> sprintf "%sCallback" (camel_case cbname) - | OFlags (n, _) -> String.capitalize_ascii n + | OFlags (n, _, _) -> String.capitalize_ascii n let go_ret_type = function (* RErr returns only the error, with no return value. *) @@ -202,7 +202,7 @@ let print_binding (name, { args; optargs; ret; shortdesc }) = pr " %s " fname; (match optarg with...
2019 Jul 26
4
Re: [PATCH] Rust bindings: Add Rust bindings
...stdutils shared code, see common/mlstdutils. One of the things provided are extra functions for the String module, and one in particular can help here: String.nsplit. Also... > +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 ... this can be simplified a bit using String.nsplit, and 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...
2020 Mar 17
5
[PATCH libnbd v2 0/3] Unfinished golang bindings.
These bindings get as far as running very simple connections. However there are many missing parts still: * No callbacks. * No functions which handle buffers (pread/pwrite!) This is posted just for general early interest, not even for review. Rich.
2019 Jul 17
0
Re: [PATCH] Rust bindings: Add Rust bindings
...() >+ >+(* split_on_char exists since OCaml 4.04 *) >+(* but current requirements: >=4.01 *) >+let split_on_char c = Str.split (Str.regexp (String.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 ^ "_" &gt...
2019 Jul 17
2
[PATCH] Rust bindings: Add Rust bindings
...ot;; indent (x - 1) + | _ -> () + +(* split_on_char exists since OCaml 4.04 *) +(* but current requirements: >=4.01 *) +let split_on_char c = Str.split (Str.regexp (String.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...
2020 Sep 11
10
[libnbd PATCH v2 0/5] Add knobs for client- vs. server-side validation
In v2: - now based on my proposal to add LIBNBD_SHUTDOWN_IMMEDIATE - four flags instead of two: STRICT_FLAGS is new (patch 4), and STRICT_BOUNDS is separate from STRICT_ZERO_SIZE (patch 5) - various refactorings for more shared code and less duplication Eric Blake (5): api: Add xxx_MASK constant for each Flags type generator: Refactor filtering of accepted OFlags api: Add
2019 Jul 23
2
Re: [PATCH] Rust bindings: Add Rust bindings
...+ > +(* split_on_char exists since OCaml 4.04 *) > +(* but current requirements: >=4.01 *) > +let split_on_char c = Str.split (Str.regexp (String.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 ^ "_&q...
2017 Jun 15
0
[PATCH v6 04/41] mllib: Split ‘Common_utils’ into ‘Std_utils’ + ‘Common_utils’.
...= String.length s in + let b = Bytes.create len in + for i = 0 to len-1 do + Bytes.unsafe_set b i (f (unsafe_get s i)) + done; + Bytes.to_string b + + let lowercase_ascii s = map Char.lowercase_ascii s + let uppercase_ascii s = map Char.uppercase_ascii s + + let capitalize_ascii s = + let b = Bytes.of_string s in + Bytes.unsafe_set b 0 (Char.uppercase_ascii (Bytes.unsafe_get b 0)); + Bytes.to_string b + + let is_prefix str prefix = + let n = length prefix in + length str >= n && sub str 0 n = prefix + + let is_suffix str suffix = +...
2019 Jul 20
2
Re: [PATCH] Rust bindings: Add Rust bindings
...r exists since OCaml 4.04 *) > >+(* but current requirements: >=4.01 *) > >+let split_on_char c = Str.split (Str.regexp (String.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...
2017 Oct 04
0
[PATCH 2/9] ocaml: Replace pattern matching { field = field } with { field }.
...7 @@ func return_hashtable (argv **C.char) map[string]string { (* Actions. *) List.iter ( - fun ({ name = name; shortdesc = shortdesc; - style = (ret, args, optargs) } as f) -> + fun ({ name; shortdesc; style = (ret, args, optargs) } as f) -> let go_name = String.capitalize_ascii name in (* If it has optional arguments, pass them in a struct diff --git a/generator/haskell.ml b/generator/haskell.ml index ec3f311df..e304d1a9c 100644 --- a/generator/haskell.ml +++ b/generator/haskell.ml @@ -61,7 +61,7 @@ module Guestfs ( (* List out the names of the actions we wa...
2019 Jul 20
0
[PATCH] Rust bindings: Add Rust bindings
...ot;; indent (x - 1) + | _ -> () + +(* split_on_char exists since OCaml 4.04 *) +(* but current requirements: >=4.01 *) +let split_on_char c = Str.split (Str.regexp (String.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...
2019 Jul 23
0
Re: [PATCH] Rust bindings: Add Rust bindings
...ot;; indent (x - 1) + | _ -> () + +(* split_on_char exists since OCaml 4.04 *) +(* but current requirements: >=4.01 *) +let split_on_char c = Str.split (Str.regexp (String.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...
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 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 Jul 29
1
Re: [PATCH] Rust bindings: Add Rust bindings
...*) +(* Are there corresponding functions to them? *) +(* Should they be placed in utils.ml? *) +let rec indent = function + | x when x > 0 -> pr " "; indent (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...
2020 Mar 24
1
[PATCH libnbd v3] Add Go language bindings (golang) (RHBZ#1814538).
This feature is roughly finished now, although it needs a few more tests and some examples. It's pretty much up to par with all the other bindings, but it lacks a completely safe AIO buffer. It won't stop you from freeing the buffer too early) because golang's GC inexplicably lacks a way to declare a root from C. I can probably do it with a global variable and ref counting on the