⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makeattrs

📁 monqueror一个很具有参考价值的源玛
💻
字号:
#!/usr/bin/perl##   This file is part of the KDE libraries##   Copyright (C) 1999 Lars Knoll (knoll@mpi-hd.mpg.de)##   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 khtmlattrs.c and khtmlattrs.h#  $Id: makeattrs,v 1.1.1.1 2002/01/16 10:39:56 ymwei Exp $#open IN, "htmlattrs.in"  or die "Can't open in\n";open header, ">htmlattrs.h"  or die "Can't open header\n";open out, ">htmlattrs.gperf"  or die "Can't open out\n";print out "%{\n/* This file is automatically generated from#htmlattrs.in by makeattrs, do not edit */\n/* Copyright 1999 Lars Knoll */\n#include \"htmlattrs.h\"\n%}\n";print out "struct attrs {\n    const char *name;\n    int id;\n};\n%%\n";print header "/* This file is automatically generated fromhtmlattrs.in by makeattrs, do not edit */\n/* Copyright 1999 Lars Knoll */\n\n#ifndef HTML_ATTRS_H\n#define HTML_ATTRS_H\n\n#include \"dom_string.h\"\nusing namespace DOM;\n\n";$num = 0;while (<IN>) {    chomp;    $attr = $_;    $num = $num + 1;    $up = uc($attr);    push(@a, "    \"$up\",");    $up =~ s/-/_/;    print out $attr . ", ATTR_" . $up . "\n";    print header "#define ATTR_" . $up . " " . $num . "\n";    }print out "%%\n";close out;print header "DOMString getAttrName(unsigned short id);\n";print header "\n#endif\n";close header;system("/bin/sh", "-c", "gperf -a -L 'ANSI-C' -E -C -c -o -t -k '*' -NfindAttr -Hhash_attr -Wwordlist_attr -D -s 2 htmlattrs.gperf > htmlattrs.c");open(OUT, ">>htmlattrs.c");print OUT "\n\nstatic const char *attrList[$len] = {\n";while(defined ($line = shift @a)){    print OUT $line."\n";}print OUT "    0\n};\n";print OUT "DOMString getAttrName(unsigned short id)\n{\n";print OUT "    return attrList[id-1];\n";print OUT "};\n";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -