Changeset 72667 in webkit


Ignore:
Timestamp:
Nov 24, 2010 6:51:14 AM (13 years ago)
Author:
Patrick Gansterer
Message:

2010-11-24 Patrick Gansterer <Patrick Gansterer>

Reviewed by Csaba Osztrogonác.

Simplify makevalues.pl
https://bugs.webkit.org/show_bug.cgi?id=49926

Don't generate CSSValueKeywordsHash.h.
Instead generate CSSValueKeywords.cpp directly.

  • GNUmakefile.am: Removed rule for CSSValueKeywordsHash.h.
  • css/makevalues.pl:
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r72666 r72667  
     12010-11-24  Patrick Gansterer  <paroga@webkit.org>
     2
     3        Reviewed by Csaba Osztrogonác.
     4
     5        Simplify makevalues.pl
     6        https://bugs.webkit.org/show_bug.cgi?id=49926
     7
     8        Don't generate CSSValueKeywordsHash.h.
     9        Instead generate CSSValueKeywords.cpp directly.
     10
     11        * GNUmakefile.am: Removed rule for CSSValueKeywordsHash.h.
     12        * css/makevalues.pl:
     13
    1142010-11-24  Andras Becsi  <abecsi@inf.u-szeged.hu>
    215
  • trunk/WebCore/GNUmakefile.am

    r72614 r72667  
    9898        DerivedSources/WebCore/CSSValueKeywords.h \
    9999        DerivedSources/WebCore/CSSValueKeywords.cpp \
    100         DerivedSources/WebCore/CSSValueKeywordsHash.h \
    101100        DerivedSources/WebCore/ColorData.cpp \
    102101        DerivedSources/WebCore/DocTypeStrings.cpp \
     
    45904589
    45914590# Lower case all the values, as CSS values are case-insensitive
    4592 DerivedSources/WebCore/CSSValueKeywordsHash.h: DerivedSources/WebCore/CSSValueKeywords.cpp
    45934591DerivedSources/WebCore/CSSValueKeywords.cpp: DerivedSources/WebCore/CSSValueKeywords.h
    45944592DerivedSources/WebCore/CSSValueKeywords.h: $(WEBCORE_CSS_VALUE_KEYWORDS) $(WebCore)/css/makevalues.pl
  • trunk/WebCore/css/makevalues.pl

    r68521 r72667  
    4141
    4242#include \"CSSValueKeywords.h\"
     43#include \"HashTools.h\"
     44#include <string.h>
     45
     46namespace WebCore {
    4347%}
    4448%struct-type
     
    5256%define hash-function-name value_hash_function
    5357%define word-array-name value_word_list
    54 %includes
    5558%enum
    5659%%
     
    6265  print GPERF $name . ", CSSValue" . $id . "\n";
    6366}
    64 print GPERF "%%\n";
     67
     68print GPERF << "EOF";
     69%%
     70static const char* const valueList[] = {
     71    "",
     72EOF
     73
     74foreach my $name (@names) {
     75  print GPERF "    \"" . $name . "\",\n";
     76}
     77
     78print GPERF << "EOF";
     79    0
     80};
     81
     82const Value* findValue(register const char* str, register unsigned int len)
     83{
     84    return CSSValueKeywordsHash::findValueImpl(str, len);
     85}
     86
     87const char* getValueName(unsigned short id)
     88{
     89    if (id >= numCSSValueKeywords || id <= 0)
     90        return 0;
     91    return valueList[id];
     92}
     93
     94} // namespace WebCore
     95EOF
    6596close GPERF;
     97
    6698
    6799open HEADER, ">CSSValueKeywords.h" || die "Could not open CSSValueKeywords.h for writing";
     
    103135close HEADER;
    104136
    105 system("gperf --key-positions=\"*\" -D -n -s 2 CSSValueKeywords.gperf > CSSValueKeywordsHash.h") == 0 || die "calling gperf failed: $?";
    106 
    107 open C, ">>CSSValueKeywordsHash.h" || die "Could not open CSSValueKeywordsHash.h for writing";
    108 print C  "static const char * const valueList[] = {\n";
    109 print C  "\"\",\n";
    110 foreach my $name (@names) {
    111   print C  "\"" . $name . "\", \n";
    112 }
    113 print C << "EOF";
    114     0
    115 };
    116 
    117 EOF
    118 
    119 close C;
    120 
    121 my $valueKeywordsImpl = "CSSValueKeywords.cpp";
    122 
    123 open VALUEKEYWORDS, ">$valueKeywordsImpl" || die "Could not open $valueKeywordsImpl for writing";
    124 print VALUEKEYWORDS << "EOF";
    125 /* This file is automatically generated by make-hash-tools.pl, do not edit */
    126 
    127 #include "CSSValueKeywords.h"
    128 #include "HashTools.h"
    129 
    130 namespace WebCore {
    131 #include "CSSValueKeywordsHash.h"
    132 
    133 const Value* findValue (register const char* str, register unsigned int len)
    134 {
    135     return CSSValueKeywordsHash::findValueImpl(str, len);
    136 }
    137 
    138 const char* getValueName(unsigned short id)
    139 {
    140     if (id >= numCSSValueKeywords || id <= 0)
    141         return 0;
    142     return valueList[id];
    143 }
    144 
    145 } // namespace WebCore
    146 
    147 EOF
    148 
    149 close VALUEKEYWORDS;
    150 
     137system("gperf --key-positions=\"*\" -D -n -s 2 CSSValueKeywords.gperf > CSSValueKeywords.cpp") == 0 || die "calling gperf failed: $?";
Note: See TracChangeset for help on using the changeset viewer.