Permalink
Browse files

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

Add the Int32 type to rpc-light.
  • Loading branch information...
2 parents 6b42ec0 + c56c959 commit 7a0e40eb1b6396b2d59d67fce648b9fb066c9902 @jonludlam jonludlam committed Jan 29, 2013
Showing with 9 additions and 0 deletions.
  1. +1 −0 rpc-light/jsonrpc.ml
  2. +2 −0 rpc-light/rpc.ml
  3. +1 −0 rpc-light/rpc.mli
  4. +5 −0 rpc-light/xmlrpc.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)
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
View
@@ -16,6 +16,7 @@
type t =
Int of int64
+ | Int32 of int32
| Bool of bool
| Float of float
| String of string
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");

0 comments on commit 7a0e40e

Please sign in to comment.