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
25 let this_year = 1900 + (localtime (time ())).tm_year in
26 if this_year > 2011 then sprintf "2011-%04d" this_year else "2011"
28 (* Generate a header block in a number of standard styles. *)
30 | CStyle | CPlusPlusStyle | HashStyle | OCamlStyle | HaskellStyle
32 type license = GPLv2plus | LGPLv2plus
34 let generate_header comment license =
35 let inputs = [ "generator/wrappi_*.ml" ] in
36 let c = match comment with
37 | CStyle -> pr "/* "; " *"
38 | CPlusPlusStyle -> pr "// "; "//"
39 | HashStyle -> pr "# "; "#"
40 | OCamlStyle -> pr "(* "; " *"
41 | HaskellStyle -> pr "{- "; " "
42 | ErlangStyle -> pr "%% "; "% " in
43 pr "wrappi generated file\n";
44 pr "%s WARNING: THIS FILE IS GENERATED FROM:\n" c;
45 List.iter (pr "%s %s\n" c) inputs;
46 pr "%s ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.\n" c;
48 pr "%s Copyright (C) %s Red Hat Inc.\n" c copyright_years;
52 pr "%s This program is free software; you can redistribute it and/or modify\n" c;
53 pr "%s it under the terms of the GNU General Public License as published by\n" c;
54 pr "%s the Free Software Foundation; either version 2 of the License, or\n" c;
55 pr "%s (at your option) any later version.\n" c;
57 pr "%s This program is distributed in the hope that it will be useful,\n" c;
58 pr "%s but WITHOUT ANY WARRANTY; without even the implied warranty of\n" c;
59 pr "%s MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" c;
60 pr "%s GNU General Public License for more details.\n" c;
62 pr "%s You should have received a copy of the GNU General Public License along\n" c;
63 pr "%s with this program; if not, write to the Free Software Foundation, Inc.,\n" c;
64 pr "%s 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n" c;
67 pr "%s This library is free software; you can redistribute it and/or\n" c;
68 pr "%s modify it under the terms of the GNU Lesser General Public\n" c;
69 pr "%s License as published by the Free Software Foundation; either\n" c;
70 pr "%s version 2 of the License, or (at your option) any later version.\n" c;
72 pr "%s This library is distributed in the hope that it will be useful,\n" c;
73 pr "%s but WITHOUT ANY WARRANTY; without even the implied warranty of\n" c;
74 pr "%s MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" c;
75 pr "%s Lesser General Public License for more details.\n" c;
77 pr "%s You should have received a copy of the GNU Lesser General Public\n" c;
78 pr "%s License along with this library; if not, write to the Free Software\n" c;
79 pr "%s Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n" c;
82 | CStyle -> pr " */\n"
86 | OCamlStyle -> pr " *)\n"
87 | HaskellStyle -> pr "-}\n"