2 * Copyright (C) 2011 Red Hat Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 open Wrappi_boilerplate
26 let c_of_any_type = function
30 | TPathname -> "const char *"
31 | TUInt32 -> "uint32_t"
32 | TUInt64 -> "uint64_t"
34 let c_of_return_type = function
36 | Return t -> c_of_any_type t
38 let generate_lib_wrappi_h api =
39 generate_header CStyle LGPLv2plus;
42 /* Please read the wrappi(1) man page for full documentation. If you
43 * are not familiar with man pages or don't have the documentation
44 * installed, it is also available online at http://wrappi.org/
57 typedef struct wrap_h wrap_h;
59 /* Connection management. */
60 extern wrap_h *wrap_create (void);
61 extern void wrap_close (wrap_h *w);
63 /* API entry points. */
68 pr "extern %s wrap_%s (wrap_h *w, %s);\n"
69 (c_of_return_type ep.ep_return)
74 let t = c_of_any_type t in
75 let last_char = t.[String.length t - 1] in
76 let sep = if isalnum last_char then " " else "" in
77 sprintf "%s%s%s" t sep name
79 ) api.api_entry_points;
87 #endif /* WRAPPI_H_ */
91 output_to "lib/wrappi.h" generate_lib_wrappi_h api