From 112d9f8f3f9e4b2d1d3714e22c3916bb0eabbcbd Mon Sep 17 00:00:00 2001 From: Prashanth Mundkur Date: Fri, 15 May 2009 12:25:23 -0700 Subject: [PATCH] slightly prettify codegen --- gen/rpc/codegen.ml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gen/rpc/codegen.ml b/gen/rpc/codegen.ml index 07f0d79..e8de181 100644 --- a/gen/rpc/codegen.ml +++ b/gen/rpc/codegen.ml @@ -73,13 +73,17 @@ module Server = struct let sig_name = (String.lowercase server.server_name) ^ "_impl" in fprintf ff "type %s =@\n" sig_name; fprintf ff "@[{@,"; - fprintf ff "(* RPCs *)"; + if List.length rpc_list > 0 then + fprintf ff "(* RPCs *)"; List.iter (fun (rpc, resp) -> let sg = get_arg_types rpc.rpc_request.request_params in let sg = sg @ [ resp.response_value.param_type ] in fprintf ff "@,%s: %s;" rpc.rpc_request.request_handler (String.concat " -> " sg) ) rpc_list; - fprintf ff "@,@,(* Notifications *)"; + if List.length notif_list > 0 then + (if List.length rpc_list > 0 + then fprintf ff "@,@,(* Notifications *)" + else fprintf ff "(* Notifications *)"); List.iter (fun n -> let sg = get_arg_types n.rpc_request.request_params in let sg = sg @ [ "unit" ] in -- 2.39.5