Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: Source/core/scripts/make_names.pl

Issue 14456006: Fixes to make scripts generate includes with paths. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/perl -w 1 #!/usr/bin/perl -w
2 2
3 # Copyright (C) 2005, 2006, 2007, 2009 Apple Inc. All rights reserved. 3 # Copyright (C) 2005, 2006, 2007, 2009 Apple Inc. All rights reserved.
4 # Copyright (C) 2009, Julien Chaffraix <jchaffraix@webkit.org> 4 # Copyright (C) 2009, Julien Chaffraix <jchaffraix@webkit.org>
5 # Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmob ile.com/) 5 # Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmob ile.com/)
6 # Copyright (C) 2011 Ericsson AB. All rights reserved. 6 # Copyright (C) 2011 Ericsson AB. All rights reserved.
7 # 7 #
8 # Redistribution and use in source and binary forms, with or without 8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions 9 # modification, are permitted provided that the following conditions
10 # are met: 10 # are met:
(...skipping 21 matching lines...) Expand all
32 use strict; 32 use strict;
33 33
34 use StaticString; 34 use StaticString;
35 use Config; 35 use Config;
36 use Getopt::Long; 36 use Getopt::Long;
37 use File::Path; 37 use File::Path;
38 use File::Spec; 38 use File::Spec;
39 use IO::File; 39 use IO::File;
40 use InFilesParser; 40 use InFilesParser;
41 41
42 use FindBin; # locate this script
43 use lib "$FindBin::Bin/../../../../../third_party/WebKit/Source/bindings/scripts "; # use the binding generator directory.
44 #use lib "$FindBin::Bin/../bindings/scripts"; # use the binding generator direc tory.
45 use idltopath;
46
42 sub readTags($$); 47 sub readTags($$);
43 sub readAttrs($$); 48 sub readAttrs($$);
44 49
45 my $printFactory = 0; 50 my $printFactory = 0;
46 my $printWrapperFactory = 0; 51 my $printWrapperFactory = 0;
47 my $printWrapperFactoryV8 = 0; 52 my $printWrapperFactoryV8 = 0;
48 my $fontNamesIn = ""; 53 my $fontNamesIn = "";
49 my $tagsFile = ""; 54 my $tagsFile = "";
50 my $attrsFile = ""; 55 my $attrsFile = "";
51 my $outputDir = "."; 56 my $outputDir = ".";
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 "; 624 ";
620 } 625 }
621 626
622 sub printNamesHeaderFile 627 sub printNamesHeaderFile
623 { 628 {
624 my ($headerPath) = shift; 629 my ($headerPath) = shift;
625 my $F; 630 my $F;
626 open F, ">$headerPath"; 631 open F, ">$headerPath";
627 632
628 printLicenseHeader($F); 633 printLicenseHeader($F);
629 printHeaderHead($F, "DOM", $parameters{namespace}, "#include \"QualifiedName .h\""); 634 printHeaderHead($F, "DOM", $parameters{namespace}, "#include \"core/dom/Qual ifiedName.h\"");
630 635
631 my $lowerNamespace = lc($parameters{namespacePrefix}); 636 my $lowerNamespace = lc($parameters{namespacePrefix});
632 print F "// Namespace\n"; 637 print F "// Namespace\n";
633 print F "extern const WTF::AtomicString ${lowerNamespace}NamespaceURI;\n\n"; 638 print F "extern const WTF::AtomicString ${lowerNamespace}NamespaceURI;\n\n";
634 639
635 if (keys %allTags) { 640 if (keys %allTags) {
636 print F "// Tags\n"; 641 print F "// Tags\n";
637 printMacros($F, "extern const WebCore::QualifiedName", "Tag", \%allTags) ; 642 printMacros($F, "extern const WebCore::QualifiedName", "Tag", \%allTags) ;
638 } 643 }
639 644
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 my %tagsSeen; 738 my %tagsSeen;
734 for my $tagName (sort keys %enabledTags) { 739 for my $tagName (sort keys %enabledTags) {
735 my $JSInterfaceName = $enabledTags{$tagName}{JSInterfaceName}; 740 my $JSInterfaceName = $enabledTags{$tagName}{JSInterfaceName};
736 next if defined($tagsSeen{$JSInterfaceName}) || usesDefaultJSWrapper($ta gName); 741 next if defined($tagsSeen{$JSInterfaceName}) || usesDefaultJSWrapper($ta gName);
737 if ($enabledTags{$tagName}{conditional}) { 742 if ($enabledTags{$tagName}{conditional}) {
738 # We skip feature-define-specific #includes here since we handle the m separately. 743 # We skip feature-define-specific #includes here since we handle the m separately.
739 next; 744 next;
740 } 745 }
741 $tagsSeen{$JSInterfaceName} = 1; 746 $tagsSeen{$JSInterfaceName} = 1;
742 747
743 print F "#include \"${wrapperFactoryType}${JSInterfaceName}.h\"\n"; 748 # V8HTMLElementWrapperFactory.cpp that uses this code is generated into "webkit" and for instance V8HTMLAnchorElement.h is in "webkit/bindings"
749 print F "#include \"bindings/${wrapperFactoryType}${JSInterfaceName}.h\" \n";
744 } 750 }
745 print F "#include \"${wrapperFactoryType}$parameters{fallbackInterfaceName}. h\"\n"; 751 print F "#include \"bindings/${wrapperFactoryType}$parameters{fallbackInterf aceName}.h\"\n";
746 } 752 }
747 753
748 sub printElementIncludes 754 sub printElementIncludes
749 { 755 {
750 my $F = shift; 756 my $F = shift;
751 757
752 my %tagsSeen; 758 my %tagsSeen;
753 for my $tagName (sort keys %enabledTags) { 759 for my $tagName (sort keys %enabledTags) {
754 my $interfaceName = $enabledTags{$tagName}{interfaceName}; 760 my $interfaceName = $enabledTags{$tagName}{interfaceName};
755 next if defined($tagsSeen{$interfaceName}); 761 next if defined($tagsSeen{$interfaceName});
756 if ($enabledTags{$tagName}{conditional}) { 762 if ($enabledTags{$tagName}{conditional}) {
757 # We skip feature-define-specific #includes here since we handle the m separately. 763 # We skip feature-define-specific #includes here since we handle the m separately.
758 next; 764 next;
759 } 765 }
760 $tagsSeen{$interfaceName} = 1; 766 $tagsSeen{$interfaceName} = 1;
761 767
762 print F "#include \"${interfaceName}.h\"\n"; 768 my $includepath = idl_to_path($interfaceName);
769 print F "#include \"$includepath${interfaceName}.h\"\n";
763 } 770 }
764 print F "#include \"$parameters{fallbackInterfaceName}.h\"\n"; 771 print F "#include \"$parameters{fallbackInterfaceName}.h\"\n";
765 } 772 }
766 773
767 sub printConditionalElementIncludes 774 sub printConditionalElementIncludes
768 { 775 {
769 my ($F, $wrapperFactoryType) = @_; 776 my ($F, $wrapperFactoryType) = @_;
770 777
771 my %conditionals; 778 my %conditionals;
772 my %unconditionalElementIncludes; 779 my %unconditionalElementIncludes;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 ; 853 ;
847 854
848 printElementIncludes($F); 855 printElementIncludes($F);
849 856
850 print F "\n#include <wtf/HashMap.h>\n"; 857 print F "\n#include <wtf/HashMap.h>\n";
851 858
852 printConditionalElementIncludes($F); 859 printConditionalElementIncludes($F);
853 860
854 print F <<END 861 print F <<END
855 862
856 #include "ContextFeatures.h" 863 #include "core/dom/ContextFeatures.h"
857 #include "RuntimeEnabledFeatures.h" 864 #include "core/page/RuntimeEnabledFeatures.h"
858 865
859 #if ENABLE(CUSTOM_ELEMENTS) 866 #if ENABLE(CUSTOM_ELEMENTS)
860 #include "CustomElementConstructor.h" 867 #include "CustomElementConstructor.h"
861 #include "CustomElementRegistry.h" 868 #include "CustomElementRegistry.h"
862 #endif 869 #endif
863 870
864 #if ENABLE(VIDEO) 871 #if ENABLE(VIDEO)
865 #include "Document.h" 872 #include "core/dom/Document.h"
866 #include "Settings.h" 873 #include "core/page/Settings.h"
867 #endif 874 #endif
868 875
869 namespace WebCore { 876 namespace WebCore {
870 877
871 using namespace $parameters{namespace}Names; 878 using namespace $parameters{namespace}Names;
872 879
873 END 880 END
874 ; 881 ;
875 882
876 print F "typedef PassRefPtr<$parameters{namespace}Element> (*ConstructorFunction )(const QualifiedName&, Document*"; 883 print F "typedef PassRefPtr<$parameters{namespace}Element> (*ConstructorFunction )(const QualifiedName&, Document*";
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 print F "\n#include \"$parameters{namespace}Names.h\"\n\n"; 1186 print F "\n#include \"$parameters{namespace}Names.h\"\n\n";
1180 1187
1181 printElementIncludes($F); 1188 printElementIncludes($F);
1182 1189
1183 print F "\n#include <wtf/StdLibExtras.h>\n"; 1190 print F "\n#include <wtf/StdLibExtras.h>\n";
1184 1191
1185 printConditionalElementIncludes($F, $wrapperFactoryType); 1192 printConditionalElementIncludes($F, $wrapperFactoryType);
1186 1193
1187 print F <<END 1194 print F <<END
1188 1195
1189 #include "ContextFeatures.h" 1196 #include "core/dom/ContextFeatures.h"
1190 #include "RuntimeEnabledFeatures.h" 1197 #include "core/page/RuntimeEnabledFeatures.h"
1191 1198
1192 #if ENABLE(VIDEO) 1199 #if ENABLE(VIDEO)
1193 #include "Document.h" 1200 #include "core/dom/Document.h"
1194 #include "Settings.h" 1201 #include "core/page/Settings.h"
1195 #endif 1202 #endif
1196 1203
1197 END 1204 END
1198 ; 1205 ;
1199 1206
1200 if ($wrapperFactoryType eq "V8") { 1207 if ($wrapperFactoryType eq "V8") {
1201 print F <<END 1208 print F <<END
1202 #include "V8$parameters{namespace}Element.h" 1209 #include "V8$parameters{namespace}Element.h"
1203 1210
1204 #if ENABLE(CUSTOM_ELEMENTS) 1211 #if ENABLE(CUSTOM_ELEMENTS)
1205 #include "CustomElementHelpers.h" 1212 #include "bindings/v8/CustomElementHelpers.h"
1206 #endif 1213 #endif
1207 1214
1208 #include <v8.h> 1215 #include <v8.h>
1209 END 1216 END
1210 ; 1217 ;
1211 } 1218 }
1212 1219
1213 print F <<END 1220 print F <<END
1214 1221
1215 namespace WebCore { 1222 namespace WebCore {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 1391
1385 printLicenseHeader($F); 1392 printLicenseHeader($F);
1386 1393
1387 print F "#ifndef $wrapperFactoryType$parameters{namespace}ElementWrapperFact ory_h\n"; 1394 print F "#ifndef $wrapperFactoryType$parameters{namespace}ElementWrapperFact ory_h\n";
1388 print F "#define $wrapperFactoryType$parameters{namespace}ElementWrapperFact ory_h\n\n"; 1395 print F "#define $wrapperFactoryType$parameters{namespace}ElementWrapperFact ory_h\n\n";
1389 1396
1390 print F "#if $parameters{guardFactoryWith}\n" if $parameters{guardFactoryWit h}; 1397 print F "#if $parameters{guardFactoryWith}\n" if $parameters{guardFactoryWit h};
1391 1398
1392 if ($wrapperFactoryType eq "V8") { 1399 if ($wrapperFactoryType eq "V8") {
1393 print F <<END 1400 print F <<END
1394 #include <V8$parameters{namespace}Element.h> 1401 #include <bindings/V8$parameters{namespace}Element.h>
1395 #include <V8$parameters{fallbackInterfaceName}.h> 1402 #include <bindings/V8$parameters{fallbackInterfaceName}.h>
1396 #include <v8.h> 1403 #include <v8.h>
1397 1404
1398 namespace WebCore { 1405 namespace WebCore {
1399 1406
1400 class $parameters{namespace}Element; 1407 class $parameters{namespace}Element;
1401 1408
1402 const QualifiedName* find$parameters{namespace}TagNameOfV8Type(const Wrapper TypeInfo*); 1409 const QualifiedName* find$parameters{namespace}TagNameOfV8Type(const Wrapper TypeInfo*);
1403 v8::Handle<v8::Object> createV8$parameters{namespace}Wrapper($parameters{nam espace}Element*, v8::Handle<v8::Object> creationContext, v8::Isolate*); 1410 v8::Handle<v8::Object> createV8$parameters{namespace}Wrapper($parameters{nam espace}Element*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
1404 inline v8::Handle<v8::Object> createV8$parameters{namespace}DirectWrapper($p arameters{namespace}Element* element, v8::Handle<v8::Object> creationContext, v8 ::Isolate* isolate) 1411 inline v8::Handle<v8::Object> createV8$parameters{namespace}DirectWrapper($p arameters{namespace}Element* element, v8::Handle<v8::Object> creationContext, v8 ::Isolate* isolate)
1405 { 1412 {
1406 return V8$parameters{namespace}Element::createWrapper(element, creationC ontext, isolate); 1413 return V8$parameters{namespace}Element::createWrapper(element, creationC ontext, isolate);
1407 } 1414 }
1408 inline v8::Handle<v8::Object> createV8$parameters{namespace}FallbackWrapper( $parameters{fallbackInterfaceName}* element, v8::Handle<v8::Object> creationCont ext, v8::Isolate* isolate) 1415 inline v8::Handle<v8::Object> createV8$parameters{namespace}FallbackWrapper( $parameters{fallbackInterfaceName}* element, v8::Handle<v8::Object> creationCont ext, v8::Isolate* isolate)
1409 { 1416 {
1410 return V8$parameters{fallbackInterfaceName}::createWrapper(element, crea tionContext, isolate); 1417 return V8$parameters{fallbackInterfaceName}::createWrapper(element, crea tionContext, isolate);
1411 } 1418 }
1412 } 1419 }
1413 END 1420 END
1414 ; 1421 ;
1415 } 1422 }
1416 1423
1417 print F "#endif // $parameters{guardFactoryWith}\n\n" if $parameters{guardFa ctoryWith}; 1424 print F "#endif // $parameters{guardFactoryWith}\n\n" if $parameters{guardFa ctoryWith};
1418 1425
1419 print F "#endif // $wrapperFactoryType$parameters{namespace}ElementWrapperFa ctory_h\n"; 1426 print F "#endif // $wrapperFactoryType$parameters{namespace}ElementWrapperFa ctory_h\n";
1420 1427
1421 close F; 1428 close F;
1422 } 1429 }
OLDNEW
« Source/bindings/scripts/idltopathgenerator.py ('K') | « Source/core/scripts/make_event_factory.pl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698