Skip to content

Commit 33d72f4

Browse files
committed
delete legacy modules, generate snake-case filenames
1 parent 3beb637 commit 33d72f4

File tree

8 files changed

+19
-1101
lines changed

8 files changed

+19
-1101
lines changed

examples/routeguide/proto/dune

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
(libraries pbrt grpc))
77

88
(rule
9-
(targets RouteGuideClient.ml)
9+
(targets route_guide_client.ml)
1010
(deps
1111
(:proto route_guide.proto))
1212
(action
1313
(run %{bin:arpaca-gen} client -I . -o . -s Client %{proto})))
1414

1515
(rule
16-
(targets RouteGuideServer.ml)
16+
(targets route_guide_server.ml)
1717
(deps
1818
(:proto route_guide.proto))
1919
(action

examples/routeguide/src/client.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ let get_feature channel =
1414
in
1515

1616
Printf.printf "[UNARY] Getting a feature...\n%!";
17-
match RouteGuideClient.get_feature ~channel request with
17+
match Route_guide_client.get_feature ~channel request with
1818
| Error status ->
1919
Format.printf "[UNARY] Error getting a feature: %a@." Grpc.Status.pp
2020
status
@@ -41,8 +41,8 @@ let list_features channel =
4141

4242
Printf.printf "[S_STREAMING] Listing features...\n%!";
4343
match
44-
RouteGuideClient.Expert.list_features ~channel ~initial_context:1 rectangle
45-
handler
44+
Route_guide_client.Expert.list_features ~channel ~initial_context:1
45+
rectangle handler
4646
with
4747
| Error status ->
4848
Format.printf "[S_STREAMING] Error listing features: %a@." Grpc.Status.pp
@@ -67,7 +67,7 @@ let run_record_route channel clock =
6767

6868
Printf.printf "[C_STREAMING] Sending points...\n%!";
6969
match
70-
RouteGuideClient.Expert.record_route ~channel ~initial_context:1 handler
70+
Route_guide_client.Expert.record_route ~channel ~initial_context:1 handler
7171
with
7272
| Error status ->
7373
Format.printf "[C_STREAMING] Error recording route: %a@." Grpc.Status.pp
@@ -137,7 +137,7 @@ let run_route_chat channel clock =
137137

138138
Printf.printf "[BI_STREAMING] Exchanging notes...\n%!";
139139
match
140-
RouteGuideClient.Expert.route_chat ~initial_context:(1, 1, route_notes)
140+
Route_guide_client.Expert.route_chat ~initial_context:(1, 1, route_notes)
141141
~channel writer reader
142142
with
143143
| Error status ->

examples/routeguide/src/server.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ let get_server (features : feature_list) clock =
158158
| `End -> (None, `End)
159159
end
160160
end in
161-
(module RouteGuideServerImplementation : RouteGuideServer.Implementation)
161+
(module RouteGuideServerImplementation : Route_guide_server.Implementation)
162162

163163
let serve env addr connection_handler : unit =
164164
Eio.Switch.run @@ fun sw ->
@@ -188,4 +188,4 @@ let () =
188188

189189
Eio_main.run (fun env ->
190190
serve env addr
191-
(RouteGuideServer.connection_handler (get_server features env#clock)))
191+
(Route_guide_server.connection_handler (get_server features env#clock)))

lib/arpaca/bin/codegen.mli

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ val gen_service_client_struct :
1111
Pb_codegen_ocaml_type.service ->
1212
Pb_codegen_formatting.scope ->
1313
unit
14+
15+
val to_snake_case : string -> string

lib/arpaca/bin/main.ml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,11 @@ let client_cmd =
142142
let scope = Pb_codegen_formatting.empty_scope () in
143143
Codegen.gen_service_client_struct ~proto_gen_module svc scope;
144144

145-
let out =
146-
Out_channel.open_text
147-
(output ^ "/" ^ svc.service_name ^ suffix ^ ".ml")
145+
let filename =
146+
svc.service_name ^ suffix ^ ".ml"
147+
|> Codegen.to_snake_case |> String.uncapitalize_ascii
148148
in
149+
let out = Out_channel.open_text (output ^ "/" ^ filename) in
149150

150151
Pb_codegen_all.F.output out scope)
151152
proto_services)
@@ -166,10 +167,11 @@ let server_cmd =
166167
let scope = Pb_codegen_formatting.empty_scope () in
167168
Codegen.gen_service_server_struct ~proto_gen_module svc scope;
168169

169-
let out =
170-
Out_channel.open_text
171-
(output ^ "/" ^ svc.service_name ^ suffix ^ ".ml")
170+
let filename =
171+
svc.service_name ^ suffix ^ ".ml"
172+
|> Codegen.to_snake_case |> String.uncapitalize_ascii
172173
in
174+
let out = Out_channel.open_text (output ^ "/" ^ filename) in
173175

174176
Pb_codegen_all.F.output out scope)
175177
proto_services)

lib/haha_server_io.ml

Lines changed: 0 additions & 227 deletions
This file was deleted.

lib/haha_server_io.mli

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)