webengine/osswebengine/WebCore/css/makeprop
changeset 0 dd21522fd290
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/osswebengine/WebCore/css/makeprop	Mon Mar 30 12:54:55 2009 +0300
@@ -0,0 +1,80 @@
+#   This file is part of the KDE libraries
+#
+#   Copyright (C) 1999 Waldo Bastian (bastian@kde.org)
+#   Copyright (C) 2007 Apple Inc. All rights reserved.
+#
+#   This library is free software; you can redistribute it and/or
+#   modify it under the terms of the GNU Library General Public
+#   License as published by the Free Software Foundation; either
+#   version 2 of the License, or (at your option) any later version.
+#
+#   This library is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#   Library General Public License for more details.
+#
+#   You should have received a copy of the GNU Library General Public License
+#   along with this library; see the file COPYING.LIB.  If not, write to
+#   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+#   Boston, MA 02111-1307, USA.
+#
+#----------------------------------------------------------------------------
+#
+#  KDE HTML Widget -- Script to generate CSSPropertyNames.c and CSSPropertyNames.h
+#
+grep "^[^\#]" CSSPropertyNames.in > CSSPropertyNames.strip
+
+rm CSSPropertyNames.gperf
+echo '%{' > CSSPropertyNames.gperf
+echo '/* This file is automatically generated from CSSPropertyNames.in by makeprop, do not edit */' >> CSSPropertyNames.gperf
+echo '#include "CSSPropertyNames.h"' >> CSSPropertyNames.gperf
+echo '%}' >> CSSPropertyNames.gperf
+echo 'struct props {' >> CSSPropertyNames.gperf
+echo '    const char* name;' >> CSSPropertyNames.gperf
+echo '    int id;' >> CSSPropertyNames.gperf
+echo '};' >> CSSPropertyNames.gperf
+echo '%%' >> CSSPropertyNames.gperf
+
+cat CSSPropertyNames.strip | awk '{ do { prop = $0; gsub("-", "_"); print prop ", CSS_PROP_" toupper($0) } while (getline) }' >> CSSPropertyNames.gperf
+
+echo '%%' >> CSSPropertyNames.gperf
+
+echo '/* This file is automatically generated from CSSPropertyNames.in by makeprop, do not edit */' > CSSPropertyNames.h
+echo '' >> CSSPropertyNames.h
+echo '#ifndef CSSPropertyNames_h' >> CSSPropertyNames.h
+echo '#define CSSPropertyNames_h' >> CSSPropertyNames.h
+echo '' >> CSSPropertyNames.h
+
+echo 'enum CSSPropertyID {' >> CSSPropertyNames.h
+cat CSSPropertyNames.strip | awk '{ \
+i=1; \
+print "    CSS_PROP_INVALID = 0,"; \
+do { gsub("-", "_"); print "    CSS_PROP_" toupper($0) " = " i ","; i = i + 1 } while (getline); \
+print "};"; \
+print ""; \
+print "const int numCSSProperties = " i ";" \
+}' >> CSSPropertyNames.h
+perl -e 'my $max = 0; while (<>) { chomp; $max = length if $max < length; } print "const size_t maxCSSPropertyNameLength = $max;\n"' < CSSPropertyNames.strip >> CSSPropertyNames.h
+
+echo '' >> CSSPropertyNames.h
+echo 'const char* getPropertyName(CSSPropertyID);' >> CSSPropertyNames.h
+echo '' >> CSSPropertyNames.h
+echo '#endif' >> CSSPropertyNames.h
+
+gperf -a -L 'ANSI-C' -E -C -c -o -t -k '*' -NfindProp -Hhash_prop -Wwordlist_prop -D -s 2 CSSPropertyNames.gperf > CSSPropertyNames.c || exit 1
+
+cat CSSPropertyNames.strip | awk '{ \
+i=1; \
+print "static const char * const propertyList[] = {"; \
+print "\"\","; \
+do { print "\"" $0 "\", "; i = i + 1 } while (getline); \
+print "    0"; \
+print "};"; \
+print "const char* getPropertyName(CSSPropertyID id)"; \
+print "{"; \
+print "    if (id >= numCSSProperties || id <= 0)"; \
+print "        return 0;";\
+print "    return propertyList[id];"; \
+print "}"; \
+print ""; \
+}' >> CSSPropertyNames.c