- pr "extern %s wrap_%s (wrap_h *w, %s);\n"
- (c_of_return_type ep.ep_return)
- ep.ep_name
- (String.concat ", "
- (List.map (
- fun (name, t) ->
- let t = c_of_any_type t in
- let last_char = t.[String.length t - 1] in
- let sep = if isalnum last_char then " " else "" in
- sprintf "%s%s%s" t sep name
- ) ep.ep_params))
- ) api.api_entry_points;
+ let ret, req, opt = ep.ep_ftype in
+ pr "extern %s wrap_%s (wrap_h *w" (c_of_rtype ret) ep.ep_name;
+
+ (* Required parameters. *)
+ List.iter (
+ fun (name, t, _) ->
+ let t = c_of_ptype ~param:true t in
+ let sep = (* "const char *" - omit space after asterisk *)
+ let len = String.length t in
+ if isalnum t.[len-1] then " " else "" in
+ pr ", %s%s%s" t sep name
+ ) req;
+
+ (* Optional parameters. *)
+ if opt <> [] then
+ pr ", ...";
+
+ pr ");\n"
+
+ );