Browse files

Completely remove any mention to `light` in the source code

  • Loading branch information...
1 parent 16256cd commit 4185770f0dfa60003aa42afbd271dc610d1e23b7 @samoht committed Sep 17, 2012
Showing with 153 additions and 153 deletions.
  1. +1 −1 README.md
  2. +5 −5 lib/META
  3. +3 −3 lib/Makefile
  4. +111 −111 lib/p4_idl.ml
  5. +18 −18 lib/p4_rpc.ml
  6. +3 −3 lib/pa_rpc.ml
  7. +7 −7 lib/rpc_client.ml
  8. +5 −5 tests/Makefile
View
2 README.md
@@ -46,7 +46,7 @@ with an existing API and the field names are not valid OCaml identifiers.
# Conversion functions
-`rpc-light` currently support two protocols: XMLRPC and JSON(RPC). Functions signatures are:
+`rpc` currently support two protocols: XMLRPC and JSON(RPC). Functions signatures are:
val Xmlrpc.to_string : Rpc.t -> string
val Xmlrpc.of_string : string -> Rpc.t
View
10 lib/META
@@ -1,9 +1,9 @@
version = "1.1.0"
-description = "RPC light: lightweight library to convert plain ML types to and from RPC values"
-requires = "rpc-light.xml, rpc-light.json"
+description = "RPC: lightweight library to convert plain ML types to and from RPC values"
+requires = "rpc.xml, rpc.json"
package "syntax" (
- description = "rpc-light: library to marshalling/unmarshalling ML types to/from RPC intermediate language"
+ description = "rpc: library to marshalling/unmarshalling ML types to/from RPC intermediate language"
requires = "type_conv"
archive(syntax,preprocessor) = "pa_rpc.cma"
archive(syntax,toploop) = "pa_rpc.cma"
@@ -24,14 +24,14 @@ package "core" (
package "xml" (
description = "XML-RPC marshalling/unmarshalling"
- requires = "rpc-light.core,xmlm"
+ requires = "rpc.core,xmlm"
archive(byte) = "xmlrpc.cmo"
archive(native) = "xmlrpc.cmx"
)
package "json" (
description = "JSON-RPC marshalling/unmarshalling"
- requires = "rpc-light.core"
+ requires = "rpc.core"
archive(byte) = "jsonrpc.cmo"
archive(native) = "jsonrpc.cmx"
)
View
6 lib/Makefile
@@ -45,15 +45,15 @@ p4_idl.cmo: p4_idl.ml p4_rpc.cmo
.PHONY: install
install: INSTALL_PATH = $(DESTDIR)$(shell ocamlfind printconf destdir)
install: all
- ocamlfind install -destdir $(INSTALL_PATH) rpc-light META $(TARGETS)
+ ocamlfind install -destdir $(INSTALL_PATH) rpc META $(TARGETS)
.PHONY: uninstall
uninstall:
- ocamlfind remove rpc-light
+ ocamlfind remove rpc
.PHONY: doc
doc: $(INTF)
- python ../doc/doc.py $(DOCDIR) "rpc-light" "package" "jsonrpc pa_rpc rpc xmlrpc" "." "xmlm" ""
+ python ../doc/doc.py $(DOCDIR) "rpc" "package" "jsonrpc pa_rpc rpc xmlrpc" "." "xmlm" ""
clean:
rm -f *.cmo *.cmx *.cma *.cmxa *.annot *.o *.cmi *.a
View
222 lib/p4_idl.ml
@@ -4,35 +4,35 @@ module Make (AstFilters : Camlp4.Sig.AstFilters) =
struct
open AstFilters
- module MyRpcLight = P4_rpc.RpcLight(Ast)
+ module MyRpc = P4_rpc.Rpc(Ast)
- (* We build up a list of the 'external' functions in the ml file *)
+ (* We build up a list of the 'external' functions in the ml file *)
(* For each one, we construct the following record: *)
- type rpc = {
+ type rpc = {
(* Location of the original definition *)
loc : Ast.Loc.t;
(* Capitalized module path (e.g. ["Sr"; "Foo"] for an external defined as Sr.Foo.funct *)
namespace : string list;
-
+
(* Name of the function itself, e.g. funct *)
fname : string;
-
+
(* Name of the wire call, e.g. sr_foo_name *)
name : string;
-
+
(* Arguments *)
- args : MyRpcLight.arg list;
-
+ args : MyRpc.arg list;
+
(* Return type *)
rtype : Ast.ctyp;
- }
+ }
(* As well as keeping track of the namespace within the rpc record *)
(* we keep a hierarchical data structure so that we can reconstruct *)
- (* the module tree as required later *)
- type module_item =
- | Rpc of rpc
+ (* the module tree as required later *)
+ type module_item =
+ | Rpc of rpc
| Namespace of string * (module_item list)
let rec contains_rpc module_item =
@@ -42,32 +42,32 @@ struct
let rpc_name_of_fname_and_namespace fname namespace =
String.concat "." (List.rev (fname::namespace))
-
+
let rec return_type ctyp =
- match ctyp with
+ match ctyp with
| <:ctyp< $x$ -> $y$ >> ->
return_type y
| t -> t
(* Find rpcs - any 'external' definitions in the module *)
- let rec find_rpcs (cur,namespace) si =
+ let rec find_rpcs (cur,namespace) si =
match si with
| <:str_item< module $name$ = struct $sis$ end >> ->
let sis = Ast.list_of_str_item sis [] in
let (rpcs,_) = List.fold_left find_rpcs ([],name::namespace) sis in
((Namespace (name,List.rev rpcs))::cur,namespace)
| <:str_item@loc< external $fname$ : $ctyp$ = $override$ >> ->
- let override_name =
+ let override_name =
match override with
| Ast.LCons (name,Ast.LNil) -> name
| _ -> failwith "Cannot parse external definition"
in
- let args = MyRpcLight.args_of_ctyp (MyRpcLight.decompose_arrows ctyp) in
+ let args = MyRpc.args_of_ctyp (MyRpc.decompose_arrows ctyp) in
- let name =
- if override_name=""
+ let name =
+ if override_name=""
then rpc_name_of_fname_and_namespace fname namespace
- else override_name
+ else override_name
in
let rtype = return_type ctyp in
@@ -79,62 +79,62 @@ struct
name = name;
args = args;
rtype = rtype; }
- in
+ in
((Rpc rpc)::cur,namespace)
| _ -> (cur,namespace)
(* Create the Args module - this contains the of_rpc and to_rpc functions
- used to convert the arguments of the function call to Rpc.t type. It
- also contains converters for the return type, and a function to
+ used to convert the arguments of the function call to Rpc.t type. It
+ also contains converters for the return type, and a function to
construct a Rpc.call record *)
- let make_args rpcs =
+ let make_args rpcs =
let _loc = Ast.Loc.ghost in
let gen_call_module rpc =
- MyRpcLight.Args.gen_one
+ MyRpc.Args.gen_one
(rpc.loc, rpc.namespace, rpc.fname, rpc.name, rpc.args, rpc.rtype)
in
- let rec gen_str_items items = List.map
- (fun item -> match item with
+ let rec gen_str_items items = List.map
+ (fun item -> match item with
| Rpc r -> gen_call_module r
| Namespace (n,sub_rpcs) ->
- if contains_rpc item then
- <:str_item<
+ if contains_rpc item then
+ <:str_item<
module $uid:n$ = struct
$list:gen_str_items sub_rpcs$
end >>
else <:str_item< >>) items
- in
+ in
<:str_item< module Args = struct $list: gen_str_items rpcs$ end >>
- (* Make the client module - the signature of which is very similar to that of
+ (* Make the client module - the signature of which is very similar to that of
the original idl module, except each RPC function takes as first argument
an rpc function of type 'Rpc.call -> Rpc.response' *)
- let make_client rpcs =
+ let make_client rpcs =
let _loc = Ast.Loc.ghost in
let create_call rpc =
let cap_name = String.capitalize rpc.fname in
- let arg_path = MyRpcLight.arg_path rpc.loc (rpc.namespace @ [cap_name]) in
+ let arg_path = MyRpc.arg_path rpc.loc (rpc.namespace @ [cap_name]) in
let _loc = rpc.loc in
- <:expr< $MyRpcLight.list_foldi
+ <:expr< $MyRpc.list_foldi
(fun accu arg i ->
- let lid = MyRpcLight.argi i in
- match arg.MyRpcLight.kind with
+ let lid = MyRpc.argi i in
+ match arg.MyRpc.kind with
| `Optional s -> <:expr< $accu$ ? $lid:s$ >>
| `Named s -> <:expr< $accu$ ~ $lid:s$ >>
| `Anonymous -> <:expr< $accu$ $lid:lid$ >>)
- <:expr< Args.$arg_path$.$lid:MyRpcLight.call_of rpc.fname$ >>
+ <:expr< Args.$arg_path$.$lid:MyRpc.call_of rpc.fname$ >>
rpc.args$
- >>
+ >>
in
let create rpc =
let cap_name = String.capitalize rpc.fname in
- let arg_path = MyRpcLight.arg_path rpc.loc (rpc.namespace @ [cap_name]) in
+ let arg_path = MyRpc.arg_path rpc.loc (rpc.namespace @ [cap_name]) in
<:expr<
let call = $create_call rpc$ in
let response = rpc call in
@@ -148,26 +148,26 @@ struct
let gen_client_fun rpc =
let n = List.length rpc.args - 1 in
<:str_item< value $lid:rpc.fname$ = fun rpc ->
- $MyRpcLight.list_foldi (fun accu arg i ->
- let lid = MyRpcLight.argi (n-i) in
- match arg.MyRpcLight.kind with
+ $MyRpc.list_foldi (fun accu arg i ->
+ let lid = MyRpc.argi (n-i) in
+ match arg.MyRpc.kind with
| `Optional s -> <:expr< fun ? $lid:s$ -> $accu$ >>
| `Named s -> <:expr< fun ~ $lid:s$ -> $accu$ >>
| `Anonymous -> <:expr< fun $lid:lid$ -> $accu$ >>)
(create rpc)
(List.rev rpc.args)$
>>
- in
+ in
- let rec gen_str_items items = List.map
- (fun item -> match item with
+ let rec gen_str_items items = List.map
+ (fun item -> match item with
| Rpc r -> gen_client_fun r
- | Namespace (n,sub_rpcs) ->
- if contains_rpc item then
- <:str_item<
+ | Namespace (n,sub_rpcs) ->
+ if contains_rpc item then
+ <:str_item<
module $uid:n$ = struct
$list:gen_str_items sub_rpcs$
- end >>
+ end >>
else <:str_item< >>) items
in
<:str_item< module Client = struct $list: gen_str_items rpcs$ end >>
@@ -181,103 +181,103 @@ struct
let gen_server_sig r =
let _loc = r.loc in
- <:sig_item<
- value $lid:r.fname$ : context -> $List.fold_left
+ <:sig_item<
+ value $lid:r.fname$ : context -> $List.fold_left
(fun accu arg ->
- match arg.MyRpcLight.kind with
- | `Optional s -> <:ctyp< ? $lid:s$ : $arg.MyRpcLight.ctyp$ -> $accu$ >>
- | `Named s -> <:ctyp< ~ $lid:s$ : $arg.MyRpcLight.ctyp$ -> $accu$ >>
- | `Anonymous -> <:ctyp< $arg.MyRpcLight.ctyp$ -> $accu$ >>
+ match arg.MyRpc.kind with
+ | `Optional s -> <:ctyp< ? $lid:s$ : $arg.MyRpc.ctyp$ -> $accu$ >>
+ | `Named s -> <:ctyp< ~ $lid:s$ : $arg.MyRpc.ctyp$ -> $accu$ >>
+ | `Anonymous -> <:ctyp< $arg.MyRpc.ctyp$ -> $accu$ >>
)
r.rtype
(List.rev r.args)$; >>
- in
-
- let rec gen_sig_items items = List.map
- (fun item -> match item with
+ in
+
+ let rec gen_sig_items items = List.map
+ (fun item -> match item with
| Rpc r -> gen_server_sig r
| Namespace (n,sub_rpcs) ->
- if contains_rpc item then
- <:sig_item<
- module $uid:n$ : sig
+ if contains_rpc item then
+ <:sig_item<
+ module $uid:n$ : sig
$list:gen_sig_items sub_rpcs$
end >>
else <:sig_item< >>) items
in
- <:str_item< module type Server_impl = sig
- type context;
+ <:str_item< module type Server_impl = sig
+ type context;
$list: gen_sig_items rpcs$; end >>
(* Make the functor that generates server modules. The generated module will
- contain a single function - 'process' - which takes an Rpc.call and
+ contain a single function - 'process' - which takes an Rpc.call and
unmarshals the arguments and passes them to the implementation module *)
let make_server_functor rpcs =
let gen_match_case rpc =
let _loc = rpc.loc in
let cap_name = String.capitalize rpc.fname in
- let arg_path = Ast.ExId(_loc,MyRpcLight.arg_path rpc.loc ("Args"::rpc.namespace @ [cap_name])) in
- let impl_path = Ast.ExId(_loc,MyRpcLight.arg_path rpc.loc ("Impl"::rpc.namespace)) in
+ let arg_path = Ast.ExId(_loc,MyRpc.arg_path rpc.loc ("Args"::rpc.namespace @ [cap_name])) in
+ let impl_path = Ast.ExId(_loc,MyRpc.arg_path rpc.loc ("Impl"::rpc.namespace)) in
- let has_names = MyRpcLight.contains_names rpc.args in
+ let has_names = MyRpc.contains_names rpc.args in
- let pattern_list = List.rev (MyRpcLight.list_foldi
+ let pattern_list = List.rev (MyRpc.list_foldi
(fun accu e i ->
- let lid = MyRpcLight.argi (i + 1) in
- match e.MyRpcLight.kind with
- | `Optional s
+ let lid = MyRpc.argi (i + 1) in
+ match e.MyRpc.kind with
+ | `Optional s
| `Named s -> accu
| `Anonymous -> <:patt< $lid:lid$ >> :: accu )
(if has_names then [ <:patt< arg >> ] else [])
rpc.args)
in
- let apply = MyRpcLight.list_foldi
+ let apply = MyRpc.list_foldi
(fun accu e i ->
- match e.MyRpcLight.kind with
+ match e.MyRpc.kind with
| `Optional s -> <:expr< $accu$ ? $lid:s$ : params.$arg_path$.$lid:s$ >>
| `Named s -> <:expr< $accu$ ~ $lid:s$ : params.$arg_path$.$lid:s$ >>
- | `Anonymous -> <:expr< $accu$ ($arg_path$.$lid:MyRpcLight.of_rpc
- (MyRpcLight.argi (i+1))$ $lid:MyRpcLight.argi (i+1)$) >>)
- <:expr< $impl_path$.$lid:rpc.fname$ x >>
+ | `Anonymous -> <:expr< $accu$ ($arg_path$.$lid:MyRpc.of_rpc
+ (MyRpc.argi (i+1))$ $lid:MyRpc.argi (i+1)$) >>)
+ <:expr< $impl_path$.$lid:rpc.fname$ x >>
rpc.args
in
let inner = <:expr< $arg_path$.rpc_of_response ($apply$) >> in
- let outer =
- if has_names
- then <:expr< let params = $arg_path$.request_of_rpc arg in $inner$ >>
- else inner
+ let outer =
+ if has_names
+ then <:expr< let params = $arg_path$.request_of_rpc arg in $inner$ >>
+ else inner
in
- <:match_case<
- ($str:rpc.name$,$MyRpcLight.patt_list_of_list rpc.loc pattern_list$) ->
- $outer$
- | ($str:rpc.name$,_) ->
- raise (RpcFailure ("MESSAGE_PARAMETER_COUNT_MISMATCH",
- [("func",$str:rpc.name$);
- ("expected",$str:(string_of_int (List.length pattern_list))$);
- ("received",string_of_int (List.length call.Rpc.params))]))
+ <:match_case<
+ ($str:rpc.name$,$MyRpc.patt_list_of_list rpc.loc pattern_list$) ->
+ $outer$
+ | ($str:rpc.name$,_) ->
+ raise (RpcFailure ("MESSAGE_PARAMETER_COUNT_MISMATCH",
+ [("func",$str:rpc.name$);
+ ("expected",$str:(string_of_int (List.length pattern_list))$);
+ ("received",string_of_int (List.length call.Rpc.params))]))
>>
in
-
+
let mcs = List.map gen_match_case rpcs in
let _loc = Ast.Loc.ghost in
<:str_item<
module Server = functor (Impl : Server_impl) -> struct
value process x call =
try
let contents = match (call.Rpc.name, call.Rpc.params) with
- [ $Ast.mcOr_of_list mcs$
+ [ $Ast.mcOr_of_list mcs$
| (x,_) -> raise (RpcFailure ("Unknown RPC",[(x,"")]))]
in { Rpc.success = True;
Rpc.contents = contents; }
with
- [ RpcFailure (x,y) ->
+ [ RpcFailure (x,y) ->
{ Rpc.success = False;
Rpc.contents = rpc_of_failure (x,y); }
- | e ->
+ | e ->
{ Rpc.success = False;
Rpc.contents = rpc_of_failure ("INTERNAL_ERROR",[]) } ];
end >>
@@ -286,52 +286,52 @@ struct
let rec filter_types si =
match si with
| <:str_item< type $lid:lid$ = $body$ >> ->
- add_rpcs si lid body
+ add_rpcs si lid body
| <:str_item@_loc< module $foo$ = struct $sis$ end >> ->
<:str_item< module $foo$ = struct $list:List.map filter_types (Ast.list_of_str_item sis [])$ end>>
| <:str_item@_loc< external $fname$ : $ctyp$ = $override$ >> ->
<:str_item< >>
| _ -> si
- and add_rpcs si lid body =
+ and add_rpcs si lid body =
let _loc = Ast.loc_of_str_item si in
<:str_item<
$si$;
- value $MyRpcLight.Rpc_of.gen_one (lid,[],body)$;
- value $MyRpcLight.Of_rpc.gen_one (lid,[],body)$;
+ value $MyRpc.Rpc_of.gen_one (lid,[],body)$;
+ value $MyRpc.Of_rpc.gen_one (lid,[],body)$;
>>;;
AstFilters.register_str_item_filter begin fun si ->
let _loc = Ast.loc_of_str_item si in
let (rev_rpcs,_) = List.fold_left find_rpcs ([],[]) (Ast.list_of_str_item si []) in
let rpcs = List.rev rev_rpcs in
- let rec flatten_rpcs rpcs =
- List.flatten (List.map (function
- | Rpc r -> [r]
+ let rec flatten_rpcs rpcs =
+ List.flatten (List.map (function
+ | Rpc r -> [r]
| Namespace (rs,rpcs) -> flatten_rpcs rpcs) rpcs)
- in
- let failure_bits =
+ in
+ let failure_bits =
let failure_ctyp = <:ctyp< (string * list (string * string)) >> in
<:str_item<
type failure = $failure_ctyp$;
- value $MyRpcLight.Rpc_of.gen_one ("failure",[],failure_ctyp)$;
- value $MyRpcLight.Of_rpc.gen_one ("failure",[],failure_ctyp)$;
+ value $MyRpc.Rpc_of.gen_one ("failure",[],failure_ctyp)$;
+ value $MyRpc.Of_rpc.gen_one ("failure",[],failure_ctyp)$;
exception RpcFailure of (string * list (string * string))
- >>
+ >>
in
let flat_rpcs = flatten_rpcs rpcs in
let sis = Ast.list_of_str_item si [] in
- <:str_item< $list: (List.map filter_types sis) @
- [ failure_bits;
- make_args rpcs;
- make_client rpcs;
- make_server_sig rpcs;
+ <:str_item< $list: (List.map filter_types sis) @
+ [ failure_bits;
+ make_args rpcs;
+ make_client rpcs;
+ make_server_sig rpcs;
make_server_functor flat_rpcs ] $ >>
end
end
-module Id = struct
+module Id = struct
let name = "idl"
let version = "0.1"
end
View
36 lib/p4_rpc.ml
@@ -15,7 +15,7 @@
*)
-module RpcLight = functor (Ast : Camlp4.Sig.Camlp4Ast) ->
+module Rpc = functor (Ast : Camlp4.Sig.Camlp4Ast) ->
struct
open Ast
@@ -74,7 +74,7 @@ let rec decompose_fields _loc fields =
let expr_list_of_list _loc exprs =
match List.rev exprs with
| [] -> <:expr< [] >>
- | h::t -> List.fold_left (fun accu x -> <:expr< [ $x$ :: $accu$ ] >>) <:expr< [ $h$ ] >> t
+ | h::t -> List.fold_left (fun accu x -> <:expr< [ $x$ :: $accu$ ] >>) <:expr< [ $h$ ] >> t
let patt_list_of_list _loc patts =
match List.rev patts with
@@ -130,7 +130,7 @@ let type_not_supported ty =
let module PP = Camlp4.Printers.OCaml.Make(Syntax) in
let pp = new PP.printer () in
Format.eprintf "Type %a@. not supported.\n%!" pp#ctyp ty;
- failwith "type not supported by rpc-light"
+ failwith "type not supported by rpc"
let apply _loc fn fn_i create id modules t a =
let args = decompose_args _loc a in
@@ -158,7 +158,7 @@ let is_string _loc key =
(* Conversion ML type -> Rpc.value *)
module Rpc_of = struct
-
+
let rec product get_field t =
let _loc = loc_of_ctyp t in
let fields = decompose_fields _loc t in
@@ -228,7 +228,7 @@ module Rpc_of = struct
| <:ctyp< option $t$ >> ->
let new_id, new_pid = new_id _loc in
- <:expr< match $id$ with [ Some $new_pid$ -> Rpc.Enum [ $create new_id t$ ] | None -> Rpc.Enum [] ] >>
+ <:expr< match $id$ with [ Some $new_pid$ -> Rpc.Enum [ $create new_id t$ ] | None -> Rpc.Enum [] ] >>
| <:ctyp< $tup:tp$ >> ->
let ctyps = list_of_ctyp tp [] in
@@ -270,7 +270,7 @@ module Rpc_of = struct
args$
>>
- let gen tds =
+ let gen tds =
let _loc = loc_of_ctyp tds in
let bindings = List.map gen_one (list_of_ctyp_decl tds) in
biAnd_of_list bindings
@@ -451,7 +451,7 @@ module Of_rpc = struct
let gen_one (name, args, ctyp) =
let _loc = loc_of_ctyp ctyp in
let id, pid = new_id _loc in
- <:binding< $lid:of_rpc name$ =
+ <:binding< $lid:of_rpc name$ =
$List.fold_left
(fun accu arg -> <:expr< fun $lid:of_rpc_polyvar (name_of_polyvar _loc arg)$ -> $accu$ >>)
(<:expr< fun $pid$ -> $create name id ctyp$ >>)
@@ -495,7 +495,7 @@ let rec decompose_arrows ctyp =
| ctyp -> [ ctyp ] in
List.rev (List.tl (List.rev (aux ctyp)))
-let arg_path _loc namespace =
+let arg_path _loc namespace =
Ast.idAcc_of_list (List.map (fun s -> <:ident< $uid:s$ >>) namespace)
let arg_of_ctyp accu = function
@@ -532,7 +532,7 @@ let rec_binding_of_args name args =
<:expr< { $rbSem_of_list (List.fold_left (rec_binding_of_arg name) [] args)$ } >>
let rec return_type ctyp =
- match ctyp with
+ match ctyp with
| <:ctyp< $x$ -> $y$ >> ->
return_type y
| t -> t
@@ -600,24 +600,24 @@ end
let n = List.length args in
let cap_name = String.capitalize name in
let anonymous_rpcs = list_foldi
- (fun accu arg i -> if arg.kind = `Anonymous then
- (Rpc_of.gen_one (argi (n - i), [], arg.ctyp)) ::
+ (fun accu arg i -> if arg.kind = `Anonymous then
+ (Rpc_of.gen_one (argi (n - i), [], arg.ctyp)) ::
(Of_rpc.gen_one (argi (n - i), [], arg.ctyp)) :: accu else accu)
[] (List.rev args) in
let response_and_call = <:str_item<
type response = $rtype$;
value $Rpc_of.gen_one ("response", [], rtype)$;
- value $Of_rpc.gen_one ("response", [], rtype)$;
+ value $Of_rpc.gen_one ("response", [], rtype)$;
value $Call_of.gen_one (_loc, namespace, name, wire_name, args, rtype)$; >> in
- if contains_names args then
+ if contains_names args then
<:str_item<
module $uid:cap_name$ = struct
type request = $ctyp_of_args args$;
value $Rpc_of.gen_one ("request", [], ctyp_of_args args)$;
value $Of_rpc.gen_one ("request", [], ctyp_of_args args)$;
value $biAnd_of_list anonymous_rpcs$;
$response_and_call$;
- end
+ end
>>
else
<:str_item<
@@ -635,7 +635,7 @@ end
$stSem_of_list sts$
end
>>
-
+
end
@@ -644,8 +644,8 @@ let gen_module mt =
<:str_item<
$Args.gen mt$;
>>
-
+
end
-module RpcLightNormal = RpcLight(Camlp4.PreCast.Ast)
-open RpcLightNormal
+module RpcNormal = Rpc(Camlp4.PreCast.Ast)
+open RpcNormal
View
6 lib/pa_rpc.ml
@@ -27,7 +27,7 @@ end
let _ =
(* type generator *)
- Pa_type_conv.add_generator_with_arg "rpc" Param.rpc P4_rpc.RpcLightNormal.gen;
-
+ Pa_type_conv.add_generator_with_arg "rpc" Param.rpc P4_rpc.RpcNormal.gen;
+
(* module generator *)
- Pa_module_conv.add_generator "rpc" (fun mt -> P4_rpc.RpcLightNormal.gen_module mt)
+ Pa_module_conv.add_generator "rpc" (fun mt -> P4_rpc.RpcNormal.gen_module mt)
View
14 lib/rpc_client.ml
@@ -33,7 +33,7 @@ module Utils = struct
let open_connection_fd host port =
let s = Unix.socket Unix.PF_INET Unix.SOCK_STREAM 0 in
- try
+ try
let he =
try Unix.gethostbyname host
with Not_found -> raise (Host_not_found host) in
@@ -97,11 +97,11 @@ module Headers = struct
user_agent : string;
content_type : content_type;
}
-
+
let create ~host ~content_type = {
host = host;
version = "1.1";
- user_agent = "rpc-light/" ^ lib_version;
+ user_agent = "rpc/" ^ lib_version;
content_type = content_type;
}
@@ -121,7 +121,7 @@ module Headers = struct
| _ -> raise (Http_request_rejected s)
(* Consumes the headers *)
- let strip (fd: Unix.file_descr) =
+ let strip (fd: Unix.file_descr) =
let buffer = " " in
let buf = Buffer.create 64 in
let finished = ref false in
@@ -162,8 +162,8 @@ let http_send_call ~fd ~path ~headers call =
let http_recv_response ~fd ~headers =
Headers.strip fd;
rpc_response_of_fd headers fd
-
-let http_rpc_fd (fd: Unix.file_descr) headers call =
+
+let http_rpc_fd (fd: Unix.file_descr) headers call =
try
http_send_call ~fd ~path ~headers call;
http_recv_response ~fd ~headers
@@ -175,7 +175,7 @@ type connection =
| Remote_port of int
let with_fd ~connection ~headers ~path ~call f =
- let s =
+ let s =
match connection with
| Remote_port port ->
let s = Utils.open_connection_fd headers.Headers.host port in
View
10 tests/Makefile
@@ -2,7 +2,7 @@ OCAMLC = ocamlfind ocamlc
OCAMLOPT = ocamlfind ocamlopt
OCAMLFLAGS = -annot -g
-PACKS = rpc-light,unix
+PACKS = rpc,unix
EXAMPLES = \
all_types \
phantom \
@@ -23,19 +23,19 @@ client.opt: idl_test.cmx idl_test.cmi client.cmx
$(OCAMLOPT) -linkpkg -package $(PACKS) -o $@ idl_test.cmx client.cmx
idl_test.cmx: idl_test.ml idl_test.cmi
- $(OCAMLOPT) -package $(PACKS),rpc-light.idl -syntax camlp4o -c -o $@ $<
+ $(OCAMLOPT) -package $(PACKS),rpc.idl -syntax camlp4o -c -o $@ $<
%.opt: %.cmx
$(OCAMLOPT) -linkpkg -package $(PACKS) -o $@ $<
%.cmx: %.ml
- $(OCAMLOPT) $(OCAMLFLAGS) -package $(PACKS),rpc-light.syntax -syntax camlp4o -c -o $@ $<
+ $(OCAMLOPT) $(OCAMLFLAGS) -package $(PACKS),rpc.syntax -syntax camlp4o -c -o $@ $<
%.cmi: %.mli
- $(OCAMLOPT) $(OCAMLFLAGS) -package $(PACKS),rpc-light.syntax -syntax camlp4o -c -o $@ $<
+ $(OCAMLOPT) $(OCAMLFLAGS) -package $(PACKS),rpc.syntax -syntax camlp4o -c -o $@ $<
%_gen: %.ml
- camlp4o $(shell ocamlfind query rpc-light.syntax -r -format "-I %d %a" -predicates syntax,preprocessor) $< -printer o > $@.ml
+ camlp4o $(shell ocamlfind query rpc.syntax -r -format "-I %d %a" -predicates syntax,preprocessor) $< -printer o > $@.ml
$(OCAMLOPT) $(OCAMLFLAGS) -package $(PACKS) -c -o $@ $@.ml
clean:

0 comments on commit 4185770

Please sign in to comment.