Commit 9e1d311e authored by paroga@webkit.org's avatar paroga@webkit.org

2010-11-24 Patrick Gansterer <paroga@webkit.org>

        Reviewed by Csaba Osztrogonác.

        Simplify makeprop.pl
        https://bugs.webkit.org/show_bug.cgi?id=49925

        Don't generate CSSPropertyNamesHash.h.
        Instead generate CSSPropertyNames directly.

        * GNUmakefile.am: Removed rule for CSSPropertyNamesHash.h.
        * css/makeprop.pl:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72672 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 96722b1e
2010-11-24 Patrick Gansterer <paroga@webkit.org>
Reviewed by Csaba Osztrogonác.
Simplify makeprop.pl
https://bugs.webkit.org/show_bug.cgi?id=49925
Don't generate CSSPropertyNamesHash.h.
Instead generate CSSPropertyNames directly.
* GNUmakefile.am: Removed rule for CSSPropertyNamesHash.h.
* css/makeprop.pl:
2010-11-24 Patrick Gansterer <paroga@webkit.org>
Reviewed by Csaba Osztrogonác.
......@@ -94,7 +94,6 @@ webcore_built_sources += \
DerivedSources/WebCore/CSSGrammar.h \
DerivedSources/WebCore/CSSPropertyNames.h \
DerivedSources/WebCore/CSSPropertyNames.cpp \
DerivedSources/WebCore/CSSPropertyNamesHash.h \
DerivedSources/WebCore/CSSValueKeywords.h \
DerivedSources/WebCore/CSSValueKeywords.cpp \
DerivedSources/WebCore/ColorData.cpp \
......@@ -4579,7 +4578,6 @@ FEATURE_DEFINES += ENABLE_BLOB=1
webcore_cppflags += -DENABLE_BLOB=1
endif # END ENABLE_BLOB
DerivedSources/WebCore/CSSPropertyNamesHash.h: DerivedSources/WebCore/CSSPropertyNames.cpp
DerivedSources/WebCore/CSSPropertyNames.cpp: DerivedSources/WebCore/CSSPropertyNames.h
DerivedSources/WebCore/CSSPropertyNames.h: $(WEBCORE_CSS_PROPERTY_NAMES) $(WebCore)/css/makeprop.pl
if sort $(WEBCORE_CSS_PROPERTY_NAMES) | uniq -d | grep -E '^[^#]'; then echo 'Duplicate value!'; exit 1; fi
......
......@@ -39,6 +39,10 @@ print GPERF << "EOF";
%{
/* This file is automatically generated from CSSPropertyNames.in by makeprop, do not edit */
#include \"CSSPropertyNames.h\"
#include \"HashTools.h\"
#include <string.h>
namespace WebCore {
%}
%struct-type
struct Property;
......@@ -51,7 +55,6 @@ struct Property;
%define lookup-function-name findPropertyImpl
%define hash-function-name propery_hash_function
%define word-array-name property_wordlist
%includes
%enum
%%
EOF
......@@ -61,8 +64,26 @@ foreach my $name (@names) {
$id =~ s/(^[^-])|-(.)/uc($1||$2)/ge;
print GPERF $name . ", CSSProperty" . $id . "\n";
}
print GPERF "%%\n";
close GPERF;
print GPERF<< "EOF";
%%
const Property* findProperty(register const char* str, register unsigned int len)
{
return CSSPropertyNamesHash::findPropertyImpl(str, len);
}
const char* getPropertyName(CSSPropertyID id)
{
if (id < firstCSSProperty)
return 0;
int index = id - firstCSSProperty;
if (index >= numCSSProperties)
return 0;
return propertyNameStrings[index];
}
} // namespace WebCore
EOF
open HEADER, ">CSSPropertyNames.h" || die "Could not open CSSPropertyNames.h for writing";
print HEADER << "EOF";
......@@ -116,46 +137,4 @@ EOF
close HEADER;
system("gperf --key-positions=\"*\" -D -n -s 2 CSSPropertyNames.gperf > CSSPropertyNamesHash.h") == 0 || die "calling gperf failed: $?";
open C, ">>CSSPropertyNamesHash.h" || die "Could not open CSSPropertyNamesHash.h for writing";
print C << "EOF";
EOF
close C;
my $propertyNamesImpl = "CSSPropertyNames.cpp";
open PROPERTYNAMES, ">$propertyNamesImpl" || die "Could not open $propertyNamesImpl for writing";
print PROPERTYNAMES << "EOF";
/* This file is automatically generated by make-hash-tools.pl, do not edit */
#include "CSSPropertyNames.h"
#include "HashTools.h"
namespace WebCore {
#include "CSSPropertyNamesHash.h"
const Property* findProperty (register const char* str, register unsigned int len)
{
return CSSPropertyNamesHash::findPropertyImpl(str, len);
}
const char* getPropertyName(CSSPropertyID id)
{
if (id < firstCSSProperty)
return 0;
int index = id - firstCSSProperty;
if (index >= numCSSProperties)
return 0;
return propertyNameStrings[index];
}
} // namespace WebCore
EOF
close PROPERTYNAMES;
system("gperf --key-positions=\"*\" -D -n -s 2 CSSPropertyNames.gperf > CSSPropertyNames.cpp") == 0 || die "calling gperf failed: $?";
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment