summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Booth <mbooth@redhat.com>2012-01-09 10:16:34 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-01-09 10:34:19 +0000
commite24af214fe8f9dccac39ed520b57ce7d458f9fd1 (patch)
tree6e3e24d6a43f2e9defff6f6a7d68375ade29d1c2
parent6f6485ec34f29401bbab65dd4275a3b564ed11b3 (diff)
downloadlibguestfs-e24af214fe8f9dccac39ed520b57ce7d458f9fd1.tar.gz
libguestfs-e24af214fe8f9dccac39ed520b57ce7d458f9fd1.tar.xz
libguestfs-e24af214fe8f9dccac39ed520b57ce7d458f9fd1.zip
generator: Rename java_structs to camel_structs to better reflect their purpose
This map was originally included just for the java bindings, but is generally useful to any binding which uses camel case by requirement or convention.
-rw-r--r--generator/generator_haskell.ml4
-rw-r--r--generator/generator_java.ml10
-rw-r--r--generator/generator_main.ml2
-rw-r--r--generator/generator_structs.ml12
-rw-r--r--generator/generator_structs.mli8
5 files changed, 17 insertions, 19 deletions
diff --git a/generator/generator_haskell.ml b/generator/generator_haskell.ml
index 29b260f2..a57cfd83 100644
--- a/generator/generator_haskell.ml
+++ b/generator/generator_haskell.ml
@@ -239,10 +239,10 @@ and generate_haskell_prototype ~handle ?(hs = false) (ret, args, optargs) =
| RString _ -> pr "%s" string
| RStringList _ -> pr "[%s]" string
| RStruct (_, typ) ->
- let name = java_name_of_struct typ in
+ let name = camel_name_of_struct typ in
pr "%s" name
| RStructList (_, typ) ->
- let name = java_name_of_struct typ in
+ let name = camel_name_of_struct typ in
pr "[%s]" name
| RHashtable _ -> pr "Hashtable"
| RBufferOut _ -> pr "%s" string
diff --git a/generator/generator_java.ml b/generator/generator_java.ml
index 68972bcf..69d5e24b 100644
--- a/generator/generator_java.ml
+++ b/generator/generator_java.ml
@@ -219,10 +219,10 @@ and generate_java_prototype ?(public=false) ?(privat=false) ?(native=false)
| RBufferOut _ -> pr "String ";
| RStringList _ -> pr "String[] ";
| RStruct (_, typ) ->
- let name = java_name_of_struct typ in
+ let name = camel_name_of_struct typ in
pr "%s " name;
| RStructList (_, typ) ->
- let name = java_name_of_struct typ in
+ let name = camel_name_of_struct typ in
pr "%s[] " name;
| RHashtable _ ->
if not native then
@@ -657,11 +657,11 @@ Java_com_redhat_et_libguestfs_GuestFS__1close
pr " free (r);\n";
pr " return jr;\n"
| RStruct (_, typ) ->
- let jtyp = java_name_of_struct typ in
+ let jtyp = camel_name_of_struct typ in
let cols = cols_of_struct typ in
generate_java_struct_return typ jtyp cols
| RStructList (_, typ) ->
- let jtyp = java_name_of_struct typ in
+ let jtyp = camel_name_of_struct typ in
let cols = cols_of_struct typ in
generate_java_struct_list_return typ jtyp cols
| RBufferOut _ ->
@@ -767,5 +767,5 @@ and generate_java_makefile_inc () =
List.iter (
fun (typ, jtyp) ->
pr "\tcom/redhat/et/libguestfs/%s.java \\\n" jtyp;
- ) java_structs;
+ ) camel_structs;
pr "\tcom/redhat/et/libguestfs/GuestFS.java\n"
diff --git a/generator/generator_main.ml b/generator/generator_main.ml
index 7e4e4ed4..53a0f29f 100644
--- a/generator/generator_main.ml
+++ b/generator/generator_main.ml
@@ -124,7 +124,7 @@ Run it from the top source directory using the command
let cols = cols_of_struct typ in
let filename = sprintf "java/com/redhat/et/libguestfs/%s.java" jtyp in
output_to filename (generate_java_struct jtyp cols);
- ) java_structs;
+ ) camel_structs;
output_to "java/Makefile.inc" generate_java_makefile_inc;
output_to "java/com_redhat_et_libguestfs_GuestFS.c" generate_java_c;
diff --git a/generator/generator_structs.ml b/generator/generator_structs.ml
index 8fd12e4e..83442d18 100644
--- a/generator/generator_structs.ml
+++ b/generator/generator_structs.ml
@@ -193,10 +193,8 @@ let structs = [
];
] (* end of structs *)
-(* Ugh, Java has to be different ..
- * These names are also used by the Haskell bindings.
- *)
-let java_structs = [
+(* For bindings which want camel case *)
+let camel_structs = [
"int_bool", "IntBool";
"lvm_pv", "PV";
"lvm_vg", "VG";
@@ -211,11 +209,11 @@ let java_structs = [
"application", "Application";
]
-let java_name_of_struct typ =
- try List.assoc typ java_structs
+let camel_name_of_struct typ =
+ try List.assoc typ camel_structs
with Not_found ->
failwithf
- "java_name_of_struct: no java_structs entry corresponding to %s" typ
+ "camel_name_of_struct: no camel_structs entry corresponding to %s" typ
let cols_of_struct typ =
try List.assoc typ structs
diff --git a/generator/generator_structs.mli b/generator/generator_structs.mli
index 66ae2eaf..f47a9ad7 100644
--- a/generator/generator_structs.mli
+++ b/generator/generator_structs.mli
@@ -26,8 +26,8 @@ type cols = (string * Generator_types.field) list
val structs : (string * cols) list
(** List of structures. *)
-val java_structs : (string * string) list
-(** Of course, Java has to be different from everyone else. *)
+val camel_structs : (string * string) list
+(** For bindings which want camel case struct names *)
val lvm_pv_cols : cols
val lvm_vg_cols : cols
@@ -36,8 +36,8 @@ val lvm_lv_cols : cols
used to generate code for parsing the output of commands like
[lvs]. One day replace this with liblvm API calls. *)
-val java_name_of_struct : string -> string
-(** Extract Java name of struct. *)
+val camel_name_of_struct : string -> string
+(** Camel case name of struct. *)
val cols_of_struct : string -> cols
(** Extract columns of a struct. *)