|
1 # This file is part of the KDE libraries |
|
2 # |
|
3 # Copyright (C) 1999 Waldo Bastian (bastian@kde.org) |
|
4 # |
|
5 # This library is free software; you can redistribute it and/or |
|
6 # modify it under the terms of the GNU Library General Public |
|
7 # License as published by the Free Software Foundation; either |
|
8 # version 2 of the License, or (at your option) any later version. |
|
9 # |
|
10 # This library is distributed in the hope that it will be useful, |
|
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 # Library General Public License for more details. |
|
14 # |
|
15 # You should have received a copy of the GNU Library General Public License |
|
16 # along with this library; see the file COPYING.LIB. If not, write to |
|
17 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
18 # Boston, MA 02111-1307, USA. |
|
19 # |
|
20 #---------------------------------------------------------------------------- |
|
21 # |
|
22 # KDE HTML Widget -- Script to generate CSSValueKeywords.c and CSSValueKeywords.h |
|
23 # |
|
24 grep "^[^\#]" CSSValueKeywords.in > CSSValueKeywords.strip |
|
25 |
|
26 rm CSSValueKeywords.gperf |
|
27 echo '%{' > CSSValueKeywords.gperf |
|
28 echo '/* This file is automatically generated from CSSValueKeywords.in by makevalues, do not edit */' >> CSSValueKeywords.gperf |
|
29 echo '/* Copyright 1999 W. Bastian */' >> CSSValueKeywords.gperf |
|
30 echo '#include "CSSValueKeywords.h"' >> CSSValueKeywords.gperf |
|
31 echo '%}' >> CSSValueKeywords.gperf |
|
32 echo 'struct css_value {' >> CSSValueKeywords.gperf |
|
33 echo ' const char *name;' >> CSSValueKeywords.gperf |
|
34 echo ' int id;' >> CSSValueKeywords.gperf |
|
35 echo '};' >> CSSValueKeywords.gperf |
|
36 echo '%%' >> CSSValueKeywords.gperf |
|
37 |
|
38 cat CSSValueKeywords.strip | awk '{ do { prop = $0; gsub("-", "_"); print prop ", CSS_VAL_" toupper($0) } while (getline) }' >> CSSValueKeywords.gperf |
|
39 |
|
40 echo '%%' >> CSSValueKeywords.gperf |
|
41 |
|
42 echo '/* This file is automatically generated from CSSValueKeywords.in by makevalues, do not edit */' > CSSValueKeywords.h |
|
43 echo '/* Copyright 1998 W. Bastian */' >> CSSValueKeywords.h |
|
44 echo '#ifndef CSSVALUES_H' >> CSSValueKeywords.h |
|
45 echo '#define CSSVALUES_H' >> CSSValueKeywords.h |
|
46 echo 'WebCore::String getValueName(unsigned short id);' >> CSSValueKeywords.h |
|
47 |
|
48 cat CSSValueKeywords.strip | awk '{ \ |
|
49 i=1; \ |
|
50 print "#define CSS_VAL_INVALID 0"; \ |
|
51 print "#define CSS_VAL_MIN 1"; \ |
|
52 do { gsub("-", "_"); print "#define CSS_VAL_" toupper($0) " " i; i = i + 1 } while (getline); \ |
|
53 print ""; \ |
|
54 print "#define CSS_VAL_TOTAL " i \ |
|
55 }' >> CSSValueKeywords.h |
|
56 |
|
57 gperf -L 'ANSI-C' -E -C -n -o -t -k '*' -NfindValue -Hhash_val -Wwordlist_value -D CSSValueKeywords.gperf > CSSValueKeywords.c || exit 1 |
|
58 |
|
59 echo '#endif' >> CSSValueKeywords.h |
|
60 |
|
61 cat CSSValueKeywords.strip | awk '{ \ |
|
62 i=1; \ |
|
63 print "static const char * const valueList[] = {"; \ |
|
64 print "\"\","; \ |
|
65 do { print "\"" $0 "\", "; i = i + 1 } while (getline); \ |
|
66 print " 0"; \ |
|
67 print "};"; \ |
|
68 print "String getValueName(unsigned short id)"; \ |
|
69 print "{"; \ |
|
70 print " if(id >= CSS_VAL_TOTAL || id == 0)"; \ |
|
71 print " return String();";\ |
|
72 print " else";\ |
|
73 print " return String(valueList[id]);"; \ |
|
74 print "}"; \ |
|
75 print ""; \ |
|
76 }' >> CSSValueKeywords.c |