"Fossies" - the Fresh Open Source Software Archive

Member "tin-2.4.1/pcre/pcre_tables.c" (28 Aug 2013, 9041 Bytes) of archive /linux/misc/tin-2.4.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "pcre_tables.c" see the Fossies "Dox" file reference documentation.

    1 /*************************************************
    2 *      Perl-Compatible Regular Expressions       *
    3 *************************************************/
    4 
    5 /* PCRE is a library of functions to support regular expressions whose syntax
    6 and semantics are as close as possible to those of the Perl 5 language.
    7 
    8                        Written by Philip Hazel
    9            Copyright (c) 1997-2006 University of Cambridge
   10 
   11 -----------------------------------------------------------------------------
   12 Redistribution and use in source and binary forms, with or without
   13 modification, are permitted provided that the following conditions are met:
   14 
   15     * Redistributions of source code must retain the above copyright notice,
   16       this list of conditions and the following disclaimer.
   17 
   18     * Redistributions in binary form must reproduce the above copyright
   19       notice, this list of conditions and the following disclaimer in the
   20       documentation and/or other materials provided with the distribution.
   21 
   22     * Neither the name of the University of Cambridge nor the names of its
   23       contributors may be used to endorse or promote products derived from
   24       this software without specific prior written permission.
   25 
   26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   27 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   28 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   29 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
   30 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   31 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   32 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   33 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   34 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   35 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   36 POSSIBILITY OF SUCH DAMAGE.
   37 -----------------------------------------------------------------------------
   38 */
   39 
   40 
   41 /* This module contains some fixed tables that are used by more than one of the
   42 PCRE code modules. The tables are also #included by the pcretest program, which
   43 uses macros to change their names from _pcre_xxx to xxxx, thereby avoiding name
   44 clashes with the library. */
   45 
   46 
   47 #include "pcre_internal.h"
   48 
   49 
   50 /* Table of sizes for the fixed-length opcodes. It's defined in a macro so that
   51 the definition is next to the definition of the opcodes in pcre_internal.h. */
   52 
   53 const uschar _pcre_OP_lengths[] = { OP_LENGTHS };
   54 
   55 
   56 
   57 /*************************************************
   58 *           Tables for UTF-8 support             *
   59 *************************************************/
   60 
   61 /* These are the breakpoints for different numbers of bytes in a UTF-8
   62 character. */
   63 
   64 const int _pcre_utf8_table1[] =
   65   { 0x7f, 0x7ff, 0xffff, 0x1fffff, 0x3ffffff, 0x7fffffff};
   66 
   67 const int _pcre_utf8_table1_size = sizeof(_pcre_utf8_table1)/sizeof(int);
   68 
   69 /* These are the indicator bits and the mask for the data bits to set in the
   70 first byte of a character, indexed by the number of additional bytes. */
   71 
   72 const int _pcre_utf8_table2[] = { 0,    0xc0, 0xe0, 0xf0, 0xf8, 0xfc};
   73 const int _pcre_utf8_table3[] = { 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
   74 
   75 /* Table of the number of extra bytes, indexed by the first byte masked with
   76 0x3f. The highest number for a valid UTF-8 first byte is in fact 0x3d. */
   77 
   78 const uschar _pcre_utf8_table4[] = {
   79   1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
   80   1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
   81   2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
   82   3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 };
   83 
   84 /* This table translates Unicode property names into type and code values. It
   85 is searched by binary chop, so must be in collating sequence of name. */
   86 
   87 const ucp_type_table _pcre_utt[] = {
   88   { "Any",                 PT_ANY,  0 },
   89   { "Arabic",              PT_SC,   ucp_Arabic },
   90   { "Armenian",            PT_SC,   ucp_Armenian },
   91   { "Balinese",            PT_SC,   ucp_Balinese },
   92   { "Bengali",             PT_SC,   ucp_Bengali },
   93   { "Bopomofo",            PT_SC,   ucp_Bopomofo },
   94   { "Braille",             PT_SC,   ucp_Braille },
   95   { "Buginese",            PT_SC,   ucp_Buginese },
   96   { "Buhid",               PT_SC,   ucp_Buhid },
   97   { "C",                   PT_GC,   ucp_C },
   98   { "Canadian_Aboriginal", PT_SC,   ucp_Canadian_Aboriginal },
   99   { "Cc",                  PT_PC,   ucp_Cc },
  100   { "Cf",                  PT_PC,   ucp_Cf },
  101   { "Cherokee",            PT_SC,   ucp_Cherokee },
  102   { "Cn",                  PT_PC,   ucp_Cn },
  103   { "Co",                  PT_PC,   ucp_Co },
  104   { "Common",              PT_SC,   ucp_Common },
  105   { "Coptic",              PT_SC,   ucp_Coptic },
  106   { "Cs",                  PT_PC,   ucp_Cs },
  107   { "Cuneiform",           PT_SC,   ucp_Cuneiform },
  108   { "Cypriot",             PT_SC,   ucp_Cypriot },
  109   { "Cyrillic",            PT_SC,   ucp_Cyrillic },
  110   { "Deseret",             PT_SC,   ucp_Deseret },
  111   { "Devanagari",          PT_SC,   ucp_Devanagari },
  112   { "Ethiopic",            PT_SC,   ucp_Ethiopic },
  113   { "Georgian",            PT_SC,   ucp_Georgian },
  114   { "Glagolitic",          PT_SC,   ucp_Glagolitic },
  115   { "Gothic",              PT_SC,   ucp_Gothic },
  116   { "Greek",               PT_SC,   ucp_Greek },
  117   { "Gujarati",            PT_SC,   ucp_Gujarati },
  118   { "Gurmukhi",            PT_SC,   ucp_Gurmukhi },
  119   { "Han",                 PT_SC,   ucp_Han },
  120   { "Hangul",              PT_SC,   ucp_Hangul },
  121   { "Hanunoo",             PT_SC,   ucp_Hanunoo },
  122   { "Hebrew",              PT_SC,   ucp_Hebrew },
  123   { "Hiragana",            PT_SC,   ucp_Hiragana },
  124   { "Inherited",           PT_SC,   ucp_Inherited },
  125   { "Kannada",             PT_SC,   ucp_Kannada },
  126   { "Katakana",            PT_SC,   ucp_Katakana },
  127   { "Kharoshthi",          PT_SC,   ucp_Kharoshthi },
  128   { "Khmer",               PT_SC,   ucp_Khmer },
  129   { "L",                   PT_GC,   ucp_L },
  130   { "L&",                  PT_LAMP, 0 },
  131   { "Lao",                 PT_SC,   ucp_Lao },
  132   { "Latin",               PT_SC,   ucp_Latin },
  133   { "Limbu",               PT_SC,   ucp_Limbu },
  134   { "Linear_B",            PT_SC,   ucp_Linear_B },
  135   { "Ll",                  PT_PC,   ucp_Ll },
  136   { "Lm",                  PT_PC,   ucp_Lm },
  137   { "Lo",                  PT_PC,   ucp_Lo },
  138   { "Lt",                  PT_PC,   ucp_Lt },
  139   { "Lu",                  PT_PC,   ucp_Lu },
  140   { "M",                   PT_GC,   ucp_M },
  141   { "Malayalam",           PT_SC,   ucp_Malayalam },
  142   { "Mc",                  PT_PC,   ucp_Mc },
  143   { "Me",                  PT_PC,   ucp_Me },
  144   { "Mn",                  PT_PC,   ucp_Mn },
  145   { "Mongolian",           PT_SC,   ucp_Mongolian },
  146   { "Myanmar",             PT_SC,   ucp_Myanmar },
  147   { "N",                   PT_GC,   ucp_N },
  148   { "Nd",                  PT_PC,   ucp_Nd },
  149   { "New_Tai_Lue",         PT_SC,   ucp_New_Tai_Lue },
  150   { "Nko",                 PT_SC,   ucp_Nko },
  151   { "Nl",                  PT_PC,   ucp_Nl },
  152   { "No",                  PT_PC,   ucp_No },
  153   { "Ogham",               PT_SC,   ucp_Ogham },
  154   { "Old_Italic",          PT_SC,   ucp_Old_Italic },
  155   { "Old_Persian",         PT_SC,   ucp_Old_Persian },
  156   { "Oriya",               PT_SC,   ucp_Oriya },
  157   { "Osmanya",             PT_SC,   ucp_Osmanya },
  158   { "P",                   PT_GC,   ucp_P },
  159   { "Pc",                  PT_PC,   ucp_Pc },
  160   { "Pd",                  PT_PC,   ucp_Pd },
  161   { "Pe",                  PT_PC,   ucp_Pe },
  162   { "Pf",                  PT_PC,   ucp_Pf },
  163   { "Phags_Pa",            PT_SC,   ucp_Phags_Pa },
  164   { "Phoenician",          PT_SC,   ucp_Phoenician },
  165   { "Pi",                  PT_PC,   ucp_Pi },
  166   { "Po",                  PT_PC,   ucp_Po },
  167   { "Ps",                  PT_PC,   ucp_Ps },
  168   { "Runic",               PT_SC,   ucp_Runic },
  169   { "S",                   PT_GC,   ucp_S },
  170   { "Sc",                  PT_PC,   ucp_Sc },
  171   { "Shavian",             PT_SC,   ucp_Shavian },
  172   { "Sinhala",             PT_SC,   ucp_Sinhala },
  173   { "Sk",                  PT_PC,   ucp_Sk },
  174   { "Sm",                  PT_PC,   ucp_Sm },
  175   { "So",                  PT_PC,   ucp_So },
  176   { "Syloti_Nagri",        PT_SC,   ucp_Syloti_Nagri },
  177   { "Syriac",              PT_SC,   ucp_Syriac },
  178   { "Tagalog",             PT_SC,   ucp_Tagalog },
  179   { "Tagbanwa",            PT_SC,   ucp_Tagbanwa },
  180   { "Tai_Le",              PT_SC,   ucp_Tai_Le },
  181   { "Tamil",               PT_SC,   ucp_Tamil },
  182   { "Telugu",              PT_SC,   ucp_Telugu },
  183   { "Thaana",              PT_SC,   ucp_Thaana },
  184   { "Thai",                PT_SC,   ucp_Thai },
  185   { "Tibetan",             PT_SC,   ucp_Tibetan },
  186   { "Tifinagh",            PT_SC,   ucp_Tifinagh },
  187   { "Ugaritic",            PT_SC,   ucp_Ugaritic },
  188   { "Yi",                  PT_SC,   ucp_Yi },
  189   { "Z",                   PT_GC,   ucp_Z },
  190   { "Zl",                  PT_PC,   ucp_Zl },
  191   { "Zp",                  PT_PC,   ucp_Zp },
  192   { "Zs",                  PT_PC,   ucp_Zs }
  193 };
  194 
  195 const int _pcre_utt_size = sizeof(_pcre_utt)/sizeof(ucp_type_table);
  196 
  197 /* End of pcre_tables.c */