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 inputs comment license =
35 let c = match comment with
36 | CStyle -> pr "/* "; " *"
37 | CPlusPlusStyle -> pr "// "; "//"
38 | HashStyle -> pr "# "; "#"
39 | OCamlStyle -> pr "(* "; " *"
40 | HaskellStyle -> pr "{- "; " "
41 | ErlangStyle -> pr "%% "; "% " in
42 pr "wrappi generated file\n";
43 pr "%s WARNING: THIS FILE IS GENERATED FROM:\n" c;
44 List.iter (pr "%s %s\n" c) inputs;
45 pr "%s ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.\n" c;
47 pr "%s Copyright (C) %s Red Hat Inc.\n" c copyright_years;
51 pr "%s This program is free software; you can redistribute it and/or modify\n" c;
52 pr "%s it under the terms of the GNU General Public License as published by\n" c;
53 pr "%s the Free Software Foundation; either version 2 of the License, or\n" c;
54 pr "%s (at your option) any later version.\n" c;
56 pr "%s This program is distributed in the hope that it will be useful,\n" c;
57 pr "%s but WITHOUT ANY WARRANTY; without even the implied warranty of\n" c;
58 pr "%s MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" c;
59 pr "%s GNU General Public License for more details.\n" c;
61 pr "%s You should have received a copy of the GNU General Public License along\n" c;
62 pr "%s with this program; if not, write to the Free Software Foundation, Inc.,\n" c;
63 pr "%s 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n" c;
66 pr "%s This library is free software; you can redistribute it and/or\n" c;
67 pr "%s modify it under the terms of the GNU Lesser General Public\n" c;
68 pr "%s License as published by the Free Software Foundation; either\n" c;
69 pr "%s version 2 of the License, or (at your option) any later version.\n" c;
71 pr "%s This library is distributed in the hope that it will be useful,\n" c;
72 pr "%s but WITHOUT ANY WARRANTY; without even the implied warranty of\n" c;
73 pr "%s MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" c;
74 pr "%s Lesser General Public License for more details.\n" c;
76 pr "%s You should have received a copy of the GNU Lesser General Public\n" c;
77 pr "%s License along with this library; if not, write to the Free Software\n" c;
78 pr "%s Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n" c;
81 | CStyle -> pr " */\n"
85 | OCamlStyle -> pr " *)\n"
86 | HaskellStyle -> pr "-}\n"