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

📄 htmltags.cpp

📁 monqueror一个很具有参考价值的源玛
💻 CPP
字号:
/* ANSI-C code produced by gperf version 2.7.1 (19981006 egcs) *//* Command-line: gperf -a -L ANSI-C -E -C -c -o -t -k * -NfindTag -Hhash_tag -Wwordlist_tag -D -s 2 htmltags.gperf  *//* This file is automatically generated from htmltags.in by maketags, do not edit *//* Copyright 1999 Lars Knoll */#include "htmltags.h"struct tags {    const char *name;    int id;};/* maximum key range = 368, duplicates = 1 */#ifdef __GNUC____inline#endifstatic unsigned inthash_tag (register const char *str, register unsigned int len){  static const unsigned short asso_values[] =    {      369, 369, 369, 369, 369, 369, 369, 369, 369, 369,      369, 369, 369, 369, 369, 369, 369, 369, 369, 369,      369, 369, 369, 369, 369, 369, 369, 369, 369, 369,      369, 369, 369, 369, 369, 369, 369, 369, 369, 369,      369, 369, 369, 369, 369, 369, 369, 369, 369,  60,       35,  40,  55,  10,  25, 369, 369, 369, 369, 369,      369, 369, 369, 369, 369, 369, 369, 369, 369, 369,      369, 369, 369, 369, 369, 369, 369, 369, 369, 369,      369, 369, 369, 369, 369, 369, 369, 369, 369, 369,      369, 369, 369, 369, 369, 369, 369,   0,  70, 100,       20,   0, 110,  20,  45,  25,   5,  10,  10,  25,        5,   0, 140,  10,   5,   5,   0,  55,   0, 369,        5,   5, 369, 369, 369, 369, 369, 369, 369, 369,      369, 369, 369, 369, 369, 369, 369, 369, 369, 369,      369, 369, 369, 369, 369, 369, 369, 369, 369, 369,      369, 369, 369, 369, 369, 369, 369, 369, 369, 369,      369, 369, 369, 369, 369, 369, 369, 369, 369, 369,      369, 369, 369, 369, 369, 369, 369, 369, 369, 369,      369, 369, 369, 369, 369, 369, 369, 369, 369, 369,      369, 369, 369, 369, 369, 369, 369, 369, 369, 369,      369, 369, 369, 369, 369, 369, 369, 369, 369, 369,      369, 369, 369, 369, 369, 369, 369, 369, 369, 369,      369, 369, 369, 369, 369, 369, 369, 369, 369, 369,      369, 369, 369, 369, 369, 369, 369, 369, 369, 369,      369, 369, 369, 369, 369, 369, 369, 369, 369, 369,      369, 369, 369, 369, 369, 369    };  register int hval = len;  switch (hval)    {      default:      case 10:        hval += asso_values[(unsigned char)str[9]];      case 9:        hval += asso_values[(unsigned char)str[8]];      case 8:        hval += asso_values[(unsigned char)str[7]];      case 7:        hval += asso_values[(unsigned char)str[6]];      case 6:        hval += asso_values[(unsigned char)str[5]];      case 5:        hval += asso_values[(unsigned char)str[4]];      case 4:        hval += asso_values[(unsigned char)str[3]];      case 3:        hval += asso_values[(unsigned char)str[2]];      case 2:        hval += asso_values[(unsigned char)str[1]];      case 1:        hval += asso_values[(unsigned char)str[0]];        break;    }  return hval;}#ifdef __GNUC____inline#endifconst struct tags *findTag (register const char *str, register unsigned int len){  enum    {      TOTAL_KEYWORDS = 95,      MIN_WORD_LENGTH = 1,      MAX_WORD_LENGTH = 10,      MIN_HASH_VALUE = 1,      MAX_HASH_VALUE = 368    };  static const struct tags wordlist_tag[] =    {      {"a", ID_A},      {"tt", ID_TT},      {"s", ID_S},      {"tr", ID_TR},      {"var", ID_VAR},      {"area", ID_AREA},      {"q", ID_Q},      {"ol", ID_OL},      {"textarea", ID_TEXTAREA},      {"dt", ID_DT},      {"td", ID_TD},      {"style", ID_STYLE},      {"i", ID_I},      {"em", ID_EM},      {"meta", ID_META},      {"dl", ID_DL},      {"del", ID_DEL},      {"li", ID_LI},      {"ins", ID_INS},      {"title", ID_TITLE},      {"strong", ID_STRONG},      {"dd", ID_DD},      {"th", ID_TH},      {"div", ID_DIV},      {"strike", ID_STRIKE},      {"hr", ID_HR},      {"dir", ID_DIR},      {"link", ID_LINK},      {"small", ID_SMALL},      {"u", ID_U},      {"h5", ID_H5},      {"legend", ID_LEGEND},      {"address", ID_ADDRESS},      {"ul", ID_UL},      {"head", ID_HEAD},      {"thead", ID_THEAD},      {"b", ID_B},      {"h6", ID_H6},      {"img", ID_IMG},      {"br", ID_BR},      {"base", ID_BASE},      {"h2", ID_H2},      {"html", ID_HTML},      {"table", ID_TABLE},      {"h3", ID_H3},      {"menu", ID_MENU},      {"isindex", ID_ISINDEX},      {"bdo", ID_BDO},      {"label", ID_LABEL},      {"listing", ID_LISTING},      {"body", ID_BODY},      {"tbody", ID_TBODY},      {"h4", ID_H4},      {"kbd", ID_KBD},      {"h1", ID_H1},      {"col", ID_COL},      {"tfoot", ID_TFOOT},      {"center", ID_CENTER},      {"big", ID_BIG},      {"font", ID_FONT},      {"embed", ID_EMBED},      {"select", ID_SELECT},      {"code", ID_CODE},      {"noembed", ID_NOEMBED},      {"cite", ID_CITE},      {"sub", ID_SUB},      {"button", ID_BUTTON},      {"dfn", ID_DFN},      {"p", ID_P},      {"form", ID_FORM},      {"frame", ID_FRAME},      {"acronym", ID_ACRONYM},      {"pre", ID_PRE},      {"abbr", ID_ABBR},      {"frameset", ID_FRAMESET},      {"span", ID_SPAN},      {"noframes", ID_NOFRAMES},      {"map", ID_MAP},      {"iframe", ID_IFRAME},      {"samp", ID_SAMP},      {"param", ID_PARAM},      {"option", ID_OPTION},      {"fieldset", ID_FIELDSET},      {"object", ID_OBJECT},      {"plain", ID_PLAIN},      {"basefont", ID_BASEFONT},      {"sup", ID_SUP},      {"input", ID_INPUT},      {"blockquote", ID_BLOCKQUOTE},      {"caption", ID_CAPTION},      {"script", ID_SCRIPT},      {"noscript", ID_NOSCRIPT},      {"applet", ID_APPLET},      {"colgroup", ID_COLGROUP},      {"optgroup", ID_OPTGROUP}    };  static const signed char lookup[] =    {        -1,    0,    1,   -1,   -1,   -1,    2,    3,         4,    5,   -1,    6,    7,   -1,   -1,   -1,        -1,   -1,    8,   -1,   -1,   -1, -119,  -86,        -2,   11,   12,   13,   -1,   14,   -1,   -1,        15,   16,   -1,   -1,   -1,   17,   18,   -1,        19,   20,   21,   -1,   -1,   -1,   -1,   22,        23,   -1,   -1,   24,   25,   26,   27,   28,        29,   30,   -1,   -1,   -1,   31,   32,   -1,        -1,   -1,   -1,   33,   -1,   34,   35,   36,        37,   38,   -1,   -1,   -1,   39,   -1,   40,        -1,   -1,   41,   -1,   42,   43,   -1,   44,        -1,   45,   -1,   -1,   46,   47,   -1,   48,        -1,   49,   -1,   50,   51,   -1,   52,   53,        -1,   -1,   -1,   54,   -1,   -1,   -1,   -1,        -1,   55,   -1,   56,   57,   -1,   58,   59,        60,   61,   -1,   -1,   62,   -1,   -1,   63,        -1,   64,   -1,   -1,   -1,   65,   -1,   -1,        66,   -1,   67,   -1,   -1,   68,   -1,   -1,        69,   70,   -1,   71,   72,   73,   -1,   -1,        -1,   74,   75,   -1,   -1,   -1,   76,   -1,        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,        77,   -1,   -1,   78,   -1,   -1,   79,   80,        81,   -1,   82,   -1,   -1,   83,   -1,   -1,        -1,   84,   -1,   -1,   -1,   -1,   -1,   -1,        -1,   -1,   -1,   -1,   -1,   -1,   85,   -1,        -1,   -1,   -1,   86,   -1,   -1,   -1,   -1,        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,        -1,   -1,   -1,   -1,   -1,   -1,   87,   -1,        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,        -1,   88,   -1,   -1,   -1,   -1,   -1,   -1,        -1,   -1,   -1,   -1,   -1,   89,   -1,   -1,        -1,   90,   -1,   -1,   -1,   -1,   -1,   -1,        91,   -1,   -1,   -1,   -1,   -1,   -1,   -1,        92,   -1,   -1,   -1,   -1,   -1,   -1,   -1,        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,        -1,   -1,   93,   -1,   -1,   -1,   -1,   -1,        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,        94    };  if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)    {      register int key = hash_tag (str, len);      if (key <= MAX_HASH_VALUE && key >= 0)        {          register int index = lookup[key];          if (index >= 0)            {              register const char *s = wordlist_tag[index].name;              if (*str == *s && !strncmp (str + 1, s + 1, len - 1))                return &wordlist_tag[index];            }          else if (index < -TOTAL_KEYWORDS)            {              register int offset = - 1 - TOTAL_KEYWORDS - index;              register const struct tags *wordptr = &wordlist_tag[TOTAL_KEYWORDS + lookup[offset]];              register const struct tags *wordendptr = wordptr + -lookup[offset + 1];              while (wordptr < wordendptr)                {                  register const char *s = wordptr->name;                  if (*str == *s && !strncmp (str + 1, s + 1, len - 1))                    return wordptr;                  wordptr++;                }            }        }    }  return 0;}static const char * tagList[] = {    "",    "A",    "ABBR",    "ACRONYM",    "ADDRESS",    "APPLET",    "AREA",    "B",    "BASE",    "BASEFONT",    "BDO",    "BIG",    "BLOCKQUOTE",    "BODY",    "BR",    "BUTTON",    "CAPTION",    "CENTER",    "CITE",    "CODE",    "COL",    "COLGROUP",    "DD",    "DEL",    "DFN",    "DIR",    "DIV",    "DL",    "DT",    "EM",    "EMBED",    "FIELDSET",    "FONT",    "FORM",    "FRAME",    "FRAMESET",    "H1",    "H2",    "H3",    "H4",    "H5",    "H6",    "HEAD",    "HR",    "HTML",    "I",    "IFRAME",    "IMG",    "INPUT",    "INS",    "ISINDEX",    "KBD",    "LABEL",    "LEGEND",    "LI",    "LINK",    "LISTING",    "MAP",    "MENU",    "META",    "NOEMBED",    "NOFRAMES",    "NOSCRIPT",    "OBJECT",    "OL",    "OPTGROUP",    "OPTION",    "P",    "PARAM",    "PLAIN",    "PRE",    "Q",    "S",    "SAMP",    "SCRIPT",    "SELECT",    "SMALL",    "SPAN",    "STRIKE",    "STRONG",    "STYLE",    "SUB",    "SUP",    "TABLE",    "TBODY",    "TD",    "TEXTAREA",    "TFOOT",    "TH",    "THEAD",    "TITLE",    "TR",    "TT",    "U",    "UL",    "VAR",    "TEXT",    "COMMENT",    "/A",    "/ABBR",    "/ACRONYM",    "/ADDRESS",    "/APPLET",    "/AREA",    "/B",    "/BASE",    "/BASEFONT",    "/BDO",    "/BIG",    "/BLOCKQUOTE",    "/BODY",    "/BR",    "/BUTTON",    "/CAPTION",    "/CENTER",    "/CITE",    "/CODE",    "/COL",    "/COLGROUP",    "/DD",    "/DEL",    "/DFN",    "/DIR",    "/DIV",    "/DL",    "/DT",    "/EM",    "/EMBED",    "/FIELDSET",    "/FONT",    "/FORM",    "/FRAME",    "/FRAMESET",    "/H1",    "/H2",    "/H3",    "/H4",    "/H5",    "/H6",    "/HEAD",    "/HR",    "/HTML",    "/I",    "/IFRAME",    "/IMG",    "/INPUT",    "/INS",    "/ISINDEX",    "/KBD",    "/LABEL",    "/LEGEND",    "/LI",    "/LINK",    "/LISTING",    "/MAP",    "/MENU",    "/META",    "/NOEMBED",    "/NOFRAMES",    "/NOSCRIPT",    "/OBJECT",    "/OL",    "/OPTGROUP",    "/OPTION",    "/P",    "/PARAM",    "/PLAIN",    "/PRE",    "/Q",    "/S",    "/SAMP",    "/SCRIPT",    "/SELECT",    "/SMALL",    "/SPAN",    "/STRIKE",    "/STRONG",    "/STYLE",    "/SUB",    "/SUP",    "/TABLE",    "/TBODY",    "/TD",    "/TEXTAREA",    "/TFOOT",    "/TH",    "/THEAD",    "/TITLE",    "/TR",    "/TT",    "/U",    "/UL",    "/VAR",    NULL};DOMString getTagName (unsigned short id){    if (id > ID_CLOSE_TAG*2)        id = ID_CLOSE_TAG+1;    return DOMString(tagList[id]);};

⌨️ 快捷键说明

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