Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #122 from jonludlam/rpc-light-int32

Add the Int32 type to rpc-light.
  • Loading branch information...
commit 7a0e40eb1b6396b2d59d67fce648b9fb066c9902 2 parents 6b42ec0 + c56c959
Jon Ludlam jonludlam authored
1  rpc-light/jsonrpc.ml
View
@@ -44,6 +44,7 @@ let escape_string s =
let rec to_fct t f =
match t with
| Int i -> f (Printf.sprintf "%Ld" i)
+ | Int32 i -> f (Printf.sprintf "%ld" i)
| Bool b -> f (string_of_bool b)
| Float r -> f (Printf.sprintf "%f" r)
| String s -> f (escape_string s)
2  rpc-light/rpc.ml
View
@@ -19,6 +19,7 @@ let lower = String.lowercase
type t =
| Int of int64
+ | Int32 of int32
| Bool of bool
| Float of float
| String of string
@@ -34,6 +35,7 @@ open Printf
let map_strings sep fn l = String.concat sep (List.map fn l)
let rec to_string t = match t with
| Int i -> sprintf "I(%Li)" i
+ | Int32 i -> sprintf "I32(%li)" i
| Bool b -> sprintf "B(%b)" b
| Float f -> sprintf "F(%g)" f
| String s -> sprintf "S(%s)" s
1  rpc-light/rpc.mli
View
@@ -16,6 +16,7 @@
type t =
Int of int64
+ | Int32 of int32
| Bool of bool
| Float of float
| String of string
5 rpc-light/xmlrpc.ml
View
@@ -65,6 +65,11 @@ let rec add_value f = function
f (Int64.to_string i);
f "</value>"
+ | Int32 i ->
+ f "<value><i4>";
+ f (Int32.to_string i);
+ f "</i4></value>"
+
| Bool b ->
f "<value><boolean>";
f (if b then "1" else "0");
Please sign in to comment.
Something went wrong with that request. Please try again.