1#!/usr/bin/perl -w
2#
3# Copyright (C) 2009 Adam Dingle <adam@yorba.org>
4#
5# This file is part of WebKit
6#
7# This library is free software; you can redistribute it and/or
8# modify it under the terms of the GNU Library General Public
9# License as published by the Free Software Foundation; either
10# version 2 of the License, or (at your option) any later version.
11#
12# This library is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15# Library General Public License for more details.
16#
17# You should have received a copy of the GNU Library General Public License
18# aint with this library; see the file COPYING.LIB.  If not, write to
19# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20# Boston, MA 02110-1301, USA.
21#
22
23my $classlist = <STDIN>;
24chomp($classlist);
25my @classes = split / /, $classlist;
26@classes = sort @classes;
27
28print <<EOF;
29/* This file is part of the WebKit open source project.
30   This file has been generated by gobject-generate-headers.pl.  DO NOT MODIFY!
31
32   This library is free software; you can redistribute it and/or
33   modify it under the terms of the GNU Library General Public
34   License as published by the Free Software Foundation; either
35   version 2 of the License, or (at your option) any later version.
36
37   This library is distributed in the hope that it will be useful,
38   but WITHOUT ANY WARRANTY; without even the implied warranty of
39   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
40   Library General Public License for more details.
41
42   You should have received a copy of the GNU Library General Public License
43   along with this library; see the file COPYING.LIB.  If not, write to
44   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
45   Boston, MA 02110-1301, USA.
46*/
47
48EOF
49
50my $outType = $ARGV[0];
51my $header;
52if ($outType eq "defines") {
53    $header = "webkitdomdefines_h";
54} elsif ($outType eq "gdom") {
55    $header = "webkitdom_h";
56} else {
57    die "unknown output type";
58}
59
60print "#ifndef ${header}\n";
61print "#define ${header}\n";
62print "\n";
63
64if ($outType eq "defines") {
65    foreach my $class (@classes) {
66        print "typedef struct _WebKitDOM${class} WebKitDOM${class};\n";
67        print "typedef struct _WebKitDOM${class}Class WebKitDOM${class}Class;\n";
68        print "\n";
69    }
70} elsif ($outType eq "gdom") {
71    foreach my $class (@classes) {
72        print "#include <webkit/WebKitDOM${class}.h>\n";
73    }
74}
75
76print "\n";
77print "#endif\n";
78