Tage Johansson
2023-Jun-26 08:02 UTC
[Libguestfs] [PATCH v2 1/3] generator: Move [camel_case] function from GoLang.ml to utils.ml as it will be used in Rust.ml as well
From: Tage Johansson <frans.tage at gmail.com>
---
generator/GoLang.ml | 11 -----------
generator/utils.ml | 8 ++++++++
generator/utils.mli | 3 +++
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/generator/GoLang.ml b/generator/GoLang.ml
index 4ab6b26..50ed722 100644
--- a/generator/GoLang.ml
+++ b/generator/GoLang.ml
@@ -30,17 +30,6 @@ open Printf
open API
open Utils
-(* Convert C function name to camel-case name.
- * Regular but somewhat hit and miss.
- *)
-let camel_case name - let xs = nsplit "_" name in
- List.fold_left (
- fun a x ->
- a ^ String.uppercase_ascii (Str.first_chars x 1) ^
- String.lowercase_ascii (Str.string_after x 1)
- ) "" xs
-
let go_name_of_arg = function
| Bool n -> n
| BytesIn (n, len) -> n
diff --git a/generator/utils.ml b/generator/utils.ml
index 6d77e51..3a96929 100644
--- a/generator/utils.ml
+++ b/generator/utils.ml
@@ -500,3 +500,11 @@ let pod2text longdesc Hashtbl.add cache key lines;
save_cache ();
lines
+
+let camel_case name + let xs = nsplit "_" name in
+ List.fold_left (
+ fun a x ->
+ a ^ String.uppercase_ascii (Str.first_chars x 1) ^
+ String.lowercase_ascii (Str.string_after x 1)
+ ) "" xs
diff --git a/generator/utils.mli b/generator/utils.mli
index e622e31..b4a2525 100644
--- a/generator/utils.mli
+++ b/generator/utils.mli
@@ -65,3 +65,6 @@ val line_directive_of_location : location -> string
type cache_key = string
type cache_value = string list
val pod2text : cache_key -> cache_value
+
+(* Convert C function name to upper-camel-case name. *)
+val camel_case : string -> string
--
2.41.0
Richard W.M. Jones
2023-Jun-26 16:29 UTC
[Libguestfs] [PATCH v2 1/3] generator: Move [camel_case] function from GoLang.ml to utils.ml as it will be used in Rust.ml as well
Thanks, this one is upstream in commit 557ed93df3. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW