|
|
|
|
|
|
|
|
|
|
xen-api
[Xen-API] [PATCH 06 of 17] [rpc-light] Add some basic RPC int functions
# HG changeset patch
# User Thomas Gazagnaire <thomas.gazagnaire@xxxxxxxxxx>
# Date 1262958466 0
# Node ID 45bd84d8701763d0e13863113cf6c3e9f2135063
# Parent 8e5e1af38c22077f98510231918d83ff5c715e05
[rpc-light] Add some basic RPC int functions.
This patch adds rpc_of_{int,int32,int64} and {int,int32,int64}_of_rpc
Signed-off-by: Thomas Gazagnaire <thomas.gazagnaire@xxxxxxxxxx>
diff -r 8e5e1af38c22 -r 45bd84d87017 rpc-light/rpc.ml
--- a/rpc-light/rpc.ml Fri Jan 08 13:47:46 2010 +0000
+++ b/rpc-light/rpc.ml Fri Jan 08 13:47:46 2010 +0000
@@ -42,14 +42,30 @@
let rpc_of_t x = x
let rpc_of_int64 i = Int i
+let rpc_of_int32 i = Int (Int64.of_int32 i)
+let rpc_of_int i = Int (Int64.of_int i)
let rpc_of_bool b = Bool b
let rpc_of_float f = Float f
let rpc_of_string s = String s
let t_of_rpc x = x
-let int64_of_rpc = function Int i -> i | _ -> failwith "int64_of_rpc"
+let int64_of_rpc = function
+ | Int i -> i
+ | String s -> Int64.of_string s
+ | _ -> failwith "int64_of_rpc"
+let int32_of_rpc = function
+ | Int i -> Int64.to_int32 i
+ | String s -> Int32.of_string s
+ | _ -> failwith "int32_of_rpc"
+let int_of_rpc = function
+ | Int i -> Int64.to_int i
+ | String s -> int_of_string s
+ | _ -> failwith "int_of_rpc"
let bool_of_rpc = function Bool b -> b | _ -> failwith "bool_of_rpc"
-let float_of_rpc = function Float f -> f | _ -> failwith "float_of_rpc"
+let float_of_rpc = function
+ | Float f -> f
+ | String s -> float_of_string s
+ | _ -> failwith "float_of_rpc"
let string_of_rpc = function String s -> s | _ -> failwith "string_of_rpc"
type callback = string list -> t -> unit
diff -r 8e5e1af38c22 -r 45bd84d87017 rpc-light/rpc.mli
--- a/rpc-light/rpc.mli Fri Jan 08 13:47:46 2010 +0000
+++ b/rpc-light/rpc.mli Fri Jan 08 13:47:46 2010 +0000
@@ -29,6 +29,12 @@
val int64_of_rpc : t -> int64
val rpc_of_int64 : int64 -> t
+
+val int32_of_rpc : t -> int32
+val rpc_of_int32 : int32 -> t
+
+val int_of_rpc : t -> int
+val rpc_of_int : int -> t
val bool_of_rpc : t -> bool
val rpc_of_bool : bool -> t
2 files changed, 24 insertions(+), 2 deletions(-)
rpc-light/rpc.ml | 20 ++++++++++++++++++--
rpc-light/rpc.mli | 6 ++++++
xen-api-libs.hg-17.patch
Description: Text Data
_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [Xen-API] [PATCH 00 of 17] Improvments to RPC-light, Thomas Gazagnaire
- [Xen-API] [PATCH 03 of 17] [rpc-light] test (un)marshalling of phatom types, Thomas Gazagnaire
- [Xen-API] [PATCH 01 of 17] [rpc-light] Make the abstraction layer more uniform, especially for the error handling, Thomas Gazagnaire
- [Xen-API] [PATCH 04 of 17] [rpc-light] Add a function to parse XMLRPC from an input channel, Thomas Gazagnaire
- [Xen-API] [PATCH 06 of 17] [rpc-light] Add some basic RPC int functions,
Thomas Gazagnaire <=
- [Xen-API] [PATCH 09 of 17] [rpc-light] Add some friendly error messages on runtime errors, Thomas Gazagnaire
- [Xen-API] [PATCH 08 of 17] [rpc-light] Add a function to marshal and unmarshal XMLRPC to a bigbuffer, Thomas Gazagnaire
- [Xen-API] [PATCH 07 of 17] [rpc-light] Add some basic RPC int functions, Thomas Gazagnaire
- [Xen-API] [PATCH 05 of 17] [rpc-light] Add some explicit runtime exceptions when an runtime error occurs, Thomas Gazagnaire
- [Xen-API] [PATCH 02 of 17] [rpc-light] Backport the value library and clean-up the Makefile and the library building, Thomas Gazagnaire
- [Xen-API] [PATCH 11 of 17] [rpc-light] Never call 'exit i' on error, because that's not good when you run it in a daemon, Thomas Gazagnaire
- [Xen-API] [PATCH 16 of 17] [rpc-light] when (un)marshaling variant, if it has no arguments then consider it as a string, Thomas Gazagnaire
- [Xen-API] [PATCH 17 of 17] [rpc-light] In xmlrpc, when waiting for a tag opening, do not pay attention to any DTD, Thomas Gazagnaire
- [Xen-API] [PATCH 14 of 17] [rpc-light] Protect the XML strings as xml-light2, Thomas Gazagnaire
- [Xen-API] [PATCH 10 of 17] [rpc-light] Fix-up some bugs in the XML parser code, Thomas Gazagnaire
|
|
|
|
|