Changeset 34484 in webkit


Ignore:
Timestamp:
Jun 10, 2008 1:49:27 PM (16 years ago)
Author:
jchaffraix@webkit.org
Message:

WebCore:

2008-06-10 Julien Chaffraix <jchaffraix@webkit.org>

Reviewed by Eric.

Part of bug 19200: *.in files should embed more information
https://bugs.webkit.org/show_bug.cgi?id=19200

Move more parameters to the XML files.

  • dom/make_names.pl:
  • html/HTMLAttributeNames.in:
  • html/HTMLTagNames.in:
  • svg/svgattrs.in:
  • svg/svgtags.in:
Location:
trunk/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r34475 r34484  
     12008-06-10  Julien Chaffraix  <jchaffraix@webkit.org>
     2
     3        Reviewed by Eric.
     4
     5        Part of bug 19200: *.in files should embed more information
     6        https://bugs.webkit.org/show_bug.cgi?id=19200
     7
     8        Move more parameters to the XML files.
     9
     10        * dom/make_names.pl:
     11        * html/HTMLAttributeNames.in:
     12        * html/HTMLTagNames.in:
     13        * svg/svgattrs.in:
     14        * svg/svgtags.in:
     15
    1162008-06-09  Dan Bernstein  <mitz@apple.com>
    217
  • trunk/WebCore/dom/make_names.pl

    r34467 r34484  
    3636use XMLTiny qw(parsefile);
    3737
    38 my $printFactory = 0;
    39 my $printWrapperFactory = 0;
    4038my $tagsFile = "";
    4139my $attrsFile = "";
     
    4442my %attrs = ();
    4543my %parameters = ();
    46 my $tagsNullNamespace = 0;
    47 my $attrsNullNamespace = 0;
    4844my $extraDefines = 0;
    4945my $preprocessor = "/usr/bin/gcc -E -P -x c++";
    50 my $guardFactoryWith = 0;
    5146my %svgCustomMappings = ();
    5247my %htmlCustomMappings = ();
     
    5550    'attrs=s' => \$attrsFile,
    5651    'outputDir=s' => \$outputDir,
    57     'factory' => \$printFactory,
    58     'wrapperFactory' => \$printWrapperFactory,
    59     'tagsNullNamespace' => \$tagsNullNamespace,
    60     'attrsNullNamespace' => \$attrsNullNamespace,
    6152    'extraDefines=s' => \$extraDefines,
    62     'preprocessor=s' => \$preprocessor,
    63     'guardFactoryWith=s' => \$guardFactoryWith);
     53    'preprocessor=s' => \$preprocessor);
    6454
    6555die "You must specify at least one of --tags <file> or --attrs <file>" unless (length($tagsFile) || length($attrsFile));
     
    8272printNamesCppFile("$namesBasePath.cpp");
    8373
    84 if ($printFactory) {
     74if ($parameters{'generateFactory'}) {
    8575    printFactoryCppFile("$factoryBasePath.cpp");
    8676    printFactoryHeaderFile("$factoryBasePath.h");
    8777}
    8878
    89 if ($printWrapperFactory) {
     79if ($parameters{'generateWrapperFactory'}) {
    9080    printWrapperFactoryCppFile("$wrapperFactoryBasePath.cpp");
    9181    printWrapperFactoryHeaderFile("$wrapperFactoryBasePath.h");
     
    110100            'namespacePrefix' => '',
    111101            'namespaceURI' => '',
    112             'cppNamespace' => '');
     102            'cppNamespace' => '',
     103            'generateFactory' => 0,
     104            'guardFactoryWith' => '',
     105            'generateWrapperFactory' => 0,
     106            # The 2 nullNamespace properties are generated from the "nullNamespace" attribute with respect to the file parsed (attrs or tags).
     107            'tagsNullNamespace' => 0,
     108            'attrsNullNamespace' => 0);
    113109}
    114110
     
    162158sub parseParameters
    163159{
    164     my $propertiesRef = shift;
     160    my ($propertiesRef, $elementName) = @_;
    165161    my %properties = %$propertiesRef;
    166162
     
    170166    # Parse the XML attributes.
    171167    foreach my $property (keys %properties) {
    172         die "Unknown parameter $property for tags/attrs\n" if !defined($parameters{$property});
    173         $parameters{$property} = $properties{$property};
     168        # This is used in case we want to change the parameter name depending
     169        # on what is parsed.
     170        my $parameter = $property;
     171
     172        # "nullNamespace" case
     173        if ($property eq "nullNamespace") {
     174            $parameter = $elementName.(ucfirst $property);
     175        }
     176
     177        die "Unknown parameter $property for tags/attrs\n" if !defined($parameters{$parameter});
     178        $parameters{$parameter} = $properties{$property};
    174179    }
    175180}
     
    201206    switch($name) {
    202207        case "tags" {
    203             parseParameters(\%{$document{'attrib'}});
     208            parseParameters(\%{$document{'attrib'}}, $name);
    204209            parseTags(\@{$document{'content'}});
    205210        }
    206211        case "attrs" {
    207             parseParameters(\%{$document{'attrib'}});
     212            parseParameters(\%{$document{'attrib'}}, $name);
    208213            parseAttrs(\@{$document{'content'}});
    209214        } else {
     
    230235    my %names = %$namesRef;
    231236
    232     print F "#if $guardFactoryWith\n" if $guardFactoryWith;
     237    print F "#if $parameters{'guardFactoryWith'}\n" if $parameters{'guardFactoryWith'};
    233238    for my $name (sort keys %names) {
    234239        my $ucName = $names{$name}{"upperCase"};
     
    239244        print F "}\n\n";
    240245    }
    241     print F "#endif\n" if $guardFactoryWith;
     246    print F "#endif\n" if $parameters{'guardFactoryWith'};
    242247}
    243248
     
    426431    print(F "    new ((void*)&${lowerNamespace}NamespaceURI) AtomicString(${lowerNamespace}NS);\n\n");
    427432    if (keys %tags) {
    428         my $tagsNamespace = $tagsNullNamespace ? "nullAtom" : "${lowerNamespace}NS";
     433        my $tagsNamespace = $parameters{'tagsNullNamespace'} ? "nullAtom" : "${lowerNamespace}NS";
    429434        printDefinitions($F, \%tags, "tags", $tagsNamespace);
    430435    }
    431436    if (keys %attrs) {
    432         my $attrsNamespace = $attrsNullNamespace ? "nullAtom" : "${lowerNamespace}NS";
     437        my $attrsNamespace = $parameters{'attrsNullNamespace'} ? "nullAtom" : "${lowerNamespace}NS";
    433438        printDefinitions($F, \%attrs, "attributes", $attrsNamespace);
    434439    }
     
    530535printConstructors($F, \%tags);
    531536
    532 print F "#if $guardFactoryWith\n" if $guardFactoryWith;
     537print F "#if $parameters{'guardFactoryWith'}\n" if $parameters{'guardFactoryWith'};
    533538
    534539print F <<END
     
    547552
    548553print F "}\n";
    549 print F "#endif\n\n" if $guardFactoryWith;
     554print F "#endif\n\n" if $parameters{'guardFactoryWith'};
    550555
    551556print F <<END
     
    555560;
    556561
    557 print F "#if $guardFactoryWith\n" if $guardFactoryWith;
     562print F "#if $parameters{'guardFactoryWith'}\n" if $parameters{'guardFactoryWith'};
    558563
    559564print F <<END
     
    577582;
    578583
    579 if ($guardFactoryWith) {
     584if ($parameters{'guardFactoryWith'}) {
    580585
    581586print F <<END
     
    754759    print F "#include \"config.h\"\n\n";
    755760
    756     print F "#if $guardFactoryWith\n\n" if $guardFactoryWith;
     761    print F "#if $parameters{'guardFactoryWith'}\n\n" if $parameters{'guardFactoryWith'};
    757762
    758763    print F "#include \"JS$parameters{'namespace'}ElementWrapperFactory.h\"\n";
     
    817822;
    818823
    819     print F "#endif\n" if $guardFactoryWith;
     824    print F "#endif\n" if $parameters{'guardFactoryWith'};
    820825
    821826    close F;
     
    833838    print F "#define JS$parameters{'namespace'}ElementWrapperFactory_h\n\n";
    834839
    835     print F "#if ${guardFactoryWith}\n" if $guardFactoryWith;
     840    print F "#if $parameters{'guardFactoryWith'}\n" if $parameters{'guardFactoryWith'};
    836841
    837842    print F <<END
     
    854859;
    855860
    856     print F "#endif // $guardFactoryWith\n\n" if $guardFactoryWith;
     861    print F "#endif // $parameters{'guardFactoryWith'}\n\n" if $parameters{'guardFactoryWith'};
    857862
    858863    print F "#endif // JS$parameters{'namespace'}ElementWrapperFactory_h\n";
  • trunk/WebCore/html/HTMLAttributeNames.in

    r34467 r34484  
    1 <attrs namespace="HTML" namespacePrefix="xhtml" cppNamespace="WebCore" namespaceURI="http://www.w3.org/1999/xhtml">
     1<attrs namespace="HTML" namespacePrefix="xhtml" cppNamespace="WebCore" namespaceURI="http://www.w3.org/1999/xhtml" generateFactory="1" generateWrapperFactory="1" nullNamespace="1">
    22<abbr/>
    33<accept_charset/>
  • trunk/WebCore/html/HTMLTagNames.in

    r34467 r34484  
    1 <tags namespace="HTML" namespacePrefix="xhtml" cppNamespace="WebCore" namespaceURI="http://www.w3.org/1999/xhtml">
     1<tags namespace="HTML" namespacePrefix="xhtml" cppNamespace="WebCore" namespaceURI="http://www.w3.org/1999/xhtml" generateFactory="1" generateWrapperFactory="1">
    22<a upperCase="Anchor"/>
    33<abbr/>
  • trunk/WebCore/svg/svgattrs.in

    r34467 r34484  
    1 <attrs namespace="SVG" cppNamespace="WebCore" namespaceURI="http://www.w3.org/2000/svg">
     1<attrs namespace="SVG" cppNamespace="WebCore" namespaceURI="http://www.w3.org/2000/svg" generateFactory="1" generateWrapperFactory="1" guardFactoryWith="ENABLE(SVG)" nullNamespace="1">
    22<accent-height/>
    33<accumulate/>
  • trunk/WebCore/svg/svgtags.in

    r34467 r34484  
    1 <tags namespace="SVG" cppNamespace="WebCore" namespaceURI="http://www.w3.org/2000/svg">
     1<tags namespace="SVG" cppNamespace="WebCore" namespaceURI="http://www.w3.org/2000/svg" generateFactory="1" generateWrapperFactory="1" guardFactoryWith="ENABLE(SVG)">
    22<a/>
    33#if ENABLE_SVG_FONTS
Note: See TracChangeset for help on using the changeset viewer.