diff options
Diffstat (limited to 'khtml/misc/maketags')
-rw-r--r-- | khtml/misc/maketags | 124 |
1 files changed, 0 insertions, 124 deletions
diff --git a/khtml/misc/maketags b/khtml/misc/maketags deleted file mode 100644 index a460cf8e4..000000000 --- a/khtml/misc/maketags +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/perl -# This file is part of the KDE libraries -# -# Copyright (C) 1998 Waldo Bastian (bastian@kde.org) -# 1999 Lars Knoll (knoll@kde.org) -# -# 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., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. -# -#---------------------------------------------------------------------------- -# -# KDE HTML Widget -- Script to generate htmltags.c and htmltags.h -# -open IN, "htmltags.in" - or die "Can't open in\n"; -open header, ">htmltags.h" - or die "Can't open header\n"; -open out, ">htmltags.gperf" - or die "Can't open out\n"; - -print out "%{\n/* This file is automatically generated from htmltags.in by maketags, do not edit */\n/* Copyright 1999 Lars Knoll */\n#include \"htmltags.h\"\n%}\n"; -print out "struct tags {\n int name;\n int id;\n};\n%%\n"; - -print header <<EOF; -/* This file is automatically generated from htmltags.in by maketags, do not edit */ -/* Copyright 1999 Lars Knoll */ - -#ifndef KHTML_TAGS_H -#define KHTML_TAGS_H - -#include "dom/dom_string.h" -#include <kglobal.h> - -KDE_NO_EXPORT const char* getTagName(unsigned short id); - -EOF - -my @tags = (); -$num = 0; -while (<IN>) { - chomp; - $attr = $_; - $num = $num + 1; - push(@tags, $attr); - push(@a, " \"$attr\","); - push(@b, " \"/$attr\","); - $up = uc($attr); - $up =~ s/-/_/; - print out $attr . ", ID_" . $up . "\n"; - print header "#define ID_" . $up . " " . $num . "\n"; -} -print out "anchor, ID_A\n"; -print out "image, ID_IMG\n"; -print out "listing, ID_PRE\n"; -$num = $num+1; -print header "#define ID_TEXT $num\n"; -$num = $num+1; -print header "#define ID_COMMENT $num\n"; -print header "#define ID_CLOSE_TAG $num\n"; -print header "#define ID_LAST_TAG $num\n"; - -print out "%%\n"; -close out; -print header "\n#endif\n"; -close header; - -my $result = system("/bin/sh", "-c", "gperf -a -L 'ANSI-C' -P -D -E -C -l -o -t -k '*' -NfindTag -Hhash_tag -Wwordlist_tag -Qspool_Tag htmltags.gperf > htmltags.c"); -if ($result) { - unlink "htmltags.c"; - exit $result; -} - -open(OUT, ">>htmltags.c"); -print OUT "\n\nstatic const char tagStable[] = {\n \""; -push (@tags, "text"); -push (@tags, "comment"); -my %stable = (); -my $l = 1; -my $line = 5; -foreach my $k(@tags) { - if ($line > 65) { - print OUT "\"\n \""; - $line = 5; - } - #print OUT " \"\\000/$k\"\n"; - print OUT "\\000/$k"; - $stable{$k} = $l; - $l += length($k) + 2; - $line += length($k) + 5; -} -print OUT "\\000\"\n};\n"; - -print OUT "\nstatic const unsigned short tagSList[] = {\n"; -print OUT " 0,\n"; -my $c = 0; -foreach my $line (@tags) -{ - printf OUT "\n " if (($c % 12) == 0); - printf OUT "%4d,", ($stable{$line}+1) ; - ++$c; -} -foreach my $line (@tags) -{ - printf OUT "\n " if (($c % 12) == 0); - printf OUT "%4d,", ($stable{$line}) ; - ++$c; -} -print OUT " 0\n};\n\n"; -print OUT "const char* KDE_NO_EXPORT getTagName(unsigned short id)\n{\n"; -print OUT " if(id > ID_CLOSE_TAG*2) id = ID_CLOSE_TAG+1;\n"; -print OUT " return &tagStable[tagSList[id]];\n}\n"; - |