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 "defines-unstable") { 55 $header = "webkitdomdefines_unstable_h"; 56} elsif ($outType eq "gdom") { 57 $header = "webkitdom_h"; 58} else { 59 die "unknown output type"; 60} 61 62print "#ifndef ${header}\n"; 63print "#define ${header}\n"; 64print "\n"; 65 66if ($outType eq "defines") { 67 print "#include <glib.h>\n\n"; 68 print "#ifdef G_OS_WIN32\n"; 69 print " #ifdef BUILDING_WEBKIT\n"; 70 print " #define WEBKIT_API __declspec(dllexport)\n"; 71 print " #else\n"; 72 print " #define WEBKIT_API __declspec(dllimport)\n"; 73 print " #endif\n"; 74 print "#else\n"; 75 print " #define WEBKIT_API __attribute__((visibility(\"default\")))\n"; 76 print "#endif\n\n"; 77 print "#define WEBKIT_DEPRECATED WEBKIT_API G_DEPRECATED\n"; 78 print "#define WEBKIT_DEPRECATED_FOR(f) WEBKIT_API G_DEPRECATED_FOR(f)\n"; 79 print "\n"; 80 print "#ifndef WEBKIT_API\n"; 81 print " #define WEBKIT_API\n"; 82 print "#endif\n"; 83 84 foreach my $class (@classes) { 85 if ($class eq "EventTarget" || $class eq "NodeFilter" || $class eq "XPathNSResolver") { 86 print "typedef struct _WebKitDOM${class} WebKitDOM${class};\n"; 87 print "typedef struct _WebKitDOM${class}Iface WebKitDOM${class}Iface;\n"; 88 print "\n"; 89 } elsif ($class ne "Deprecated" && $class ne "Custom") { 90 print "typedef struct _WebKitDOM${class} WebKitDOM${class};\n"; 91 print "typedef struct _WebKitDOM${class}Class WebKitDOM${class}Class;\n"; 92 print "\n"; 93 } 94 } 95} elsif ($outType eq "defines-unstable") { 96 print "#include <webkitdom/webkitdomdefines.h>\n\n"; 97 print "#ifdef WEBKIT_DOM_USE_UNSTABLE_API\n\n"; 98 99 foreach my $class (@classes) { 100 print "typedef struct _WebKitDOM${class} WebKitDOM${class};\n"; 101 print "typedef struct _WebKitDOM${class}Class WebKitDOM${class}Class;\n"; 102 print "\n"; 103 } 104 105 print "#endif /* WEBKIT_DOM_USE_UNSTABLE_API */\n\n"; 106} elsif ($outType eq "gdom") { 107 print "#define __WEBKITDOM_H_INSIDE__\n\n"; 108 foreach my $class (@classes) { 109 print "#include <webkitdom/WebKitDOM${class}.h>\n"; 110 } 111 print "\n#undef __WEBKITDOM_H_INSIDE__\n"; 112} 113 114print "\n"; 115print "#endif\n"; 116