Changeset 117


Ignore:
Timestamp:
Apr 29, 2008, 6:15:30 AM (11 years ago)
Author:
cameron
Message:

at_PubIdChar, ASCII/EBCDIC templated CR, LF, HT

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bytelex.h

    r115 r117  
    3030inline bool at_WhiteSpace(unsigned char x8data[]);
    3131
     32// Workaround because we lack function partial specialization.
     33template<CodeUnit_Base C>
     34inline bool at_WhiteSpace_10(unsigned char x8data[]) {
     35  unsigned char ch = x8data[0];
     36  return (ch == Ord<C, ' '>::value) ||
     37         (ch == LF<C>::value) || (ch == LF<C>::value) || (ch == HT<C>::value);
     38}
     39
    3240template<>
    3341inline bool at_WhiteSpace<XML_1_0, ASCII>(unsigned char x8data[]) {
    34   unsigned char ch = x8data[0];
    35   return (ch == Ord<ASCII, ' '>::value) ||
    36          (ch == 0x0A) || (ch == 0x0D) || (ch == 0x09);
     42        return at_WhiteSpace_10<ASCII>(x8data);
    3743}
    3844
    3945template<>
    4046inline bool at_WhiteSpace<XML_1_0, EBCDIC>(unsigned char x8data[]) {
    41   unsigned char ch = x8data[0];
    42   return (ch == Ord<EBCDIC, ' '>::value) ||
    43          (ch == 0x25) || (ch == 0x0D) || (ch == 0x05);
     47        return at_WhiteSpace_10<EBCDIC>(x8data);
    4448}
    4549
     
    366370        return s3int32(x8data) == c3int32<C, '<', '!', '['>::value;
    367371}
    368 template<CodeUnit_Base C>
    369 inline bool at_xml(unsigned char x8data[]) {
    370   return (s4int32(x8data) == c4int32<C, '?', 'x', 'm', 'l'>::value);
     372
     373template<CodeUnit_Base C>
     374inline bool at_PubidChar(unsigned char x8data[]) {
     375        switch (x8data[0]) {
     376                case Ord<C, '0'>::value: case Ord<C, '1'>::value:
     377                case Ord<C, '2'>::value: case Ord<C, '3'>::value:
     378                case Ord<C, '4'>::value: case Ord<C, '5'>::value:
     379                case Ord<C, '6'>::value: case Ord<C, '7'>::value:
     380                case Ord<C, '8'>::value: case Ord<C, '9'>::value:
     381                case Ord<C, 'A'>::value: case Ord<C, 'a'>::value:
     382                case Ord<C, 'B'>::value: case Ord<C, 'b'>::value:
     383                case Ord<C, 'C'>::value: case Ord<C, 'c'>::value:
     384                case Ord<C, 'D'>::value: case Ord<C, 'd'>::value:
     385                case Ord<C, 'E'>::value: case Ord<C, 'e'>::value:
     386                case Ord<C, 'F'>::value: case Ord<C, 'f'>::value:
     387                case Ord<C, 'G'>::value: case Ord<C, 'g'>::value:
     388                case Ord<C, 'H'>::value: case Ord<C, 'h'>::value:
     389                case Ord<C, 'I'>::value: case Ord<C, 'i'>::value:
     390                case Ord<C, 'J'>::value: case Ord<C, 'j'>::value:
     391                case Ord<C, 'K'>::value: case Ord<C, 'k'>::value:
     392                case Ord<C, 'L'>::value: case Ord<C, 'l'>::value:
     393                case Ord<C, 'M'>::value: case Ord<C, 'm'>::value:
     394                case Ord<C, 'N'>::value: case Ord<C, 'n'>::value:
     395                case Ord<C, 'O'>::value: case Ord<C, 'o'>::value:
     396                case Ord<C, 'P'>::value: case Ord<C, 'p'>::value:
     397                case Ord<C, 'Q'>::value: case Ord<C, 'q'>::value:
     398                case Ord<C, 'R'>::value: case Ord<C, 'r'>::value:
     399                case Ord<C, 'S'>::value: case Ord<C, 's'>::value:
     400                case Ord<C, 'T'>::value: case Ord<C, 't'>::value:
     401                case Ord<C, 'U'>::value: case Ord<C, 'u'>::value:
     402                case Ord<C, 'V'>::value: case Ord<C, 'v'>::value:
     403                case Ord<C, 'W'>::value: case Ord<C, 'w'>::value:
     404                case Ord<C, 'X'>::value: case Ord<C, 'x'>::value:
     405                case Ord<C, 'Y'>::value: case Ord<C, 'y'>::value:
     406                case Ord<C, 'Z'>::value: case Ord<C, 'z'>::value:
     407                case Ord<C, '-'>::value: case Ord<C, '\''>::value:
     408                case Ord<C, '('>::value: case Ord<C, ')'>::value:
     409                case Ord<C, '+'>::value: case Ord<C, ','>::value:
     410                case Ord<C, '.'>::value: case Ord<C, '/'>::value:
     411                case Ord<C, ':'>::value: case Ord<C, '='>::value:
     412                case Ord<C, '?'>::value: case Ord<C, ';'>::value:
     413                case Ord<C, '!'>::value: case Ord<C, '*'>::value:
     414                case Ord<C, '#'>::value: case Ord<C, '@'>::value:
     415                case Ord<C, '$'>::value: case Ord<C, '_'>::value:
     416                case Ord<C, '%'>::value: case Ord<C, ' '>::value:
     417                case CR<C>::value: case LF<C>::value:
     418return true;
     419                default: return false;
     420        }
    371421}
    372422#endif
  • trunk/src/charsets/ASCII_EBCDIC.h

    r89 r117  
    1818#endif
    1919#include "../xmlmodel.h"
     20
     21template<CodeUnit_Base C> struct CR;
     22template<> struct CR<ASCII> {static unsigned char const value = 0x0D;};
     23template<> struct CR<EBCDIC> {static unsigned char const value = 0x0D;};
     24
     25template<CodeUnit_Base C> struct LF;
     26template<> struct LF<ASCII> {static unsigned char const value = 0x0A;};
     27template<> struct LF<EBCDIC> {static unsigned char const value = 0x25;};
     28
     29template<CodeUnit_Base C> struct HT;
     30template<> struct HT<ASCII> {static unsigned char const value = 0x09;};
     31template<> struct HT<EBCDIC> {static unsigned char const value = 0x05;};
    2032
    2133template<CodeUnit_Base C, unsigned char c> struct Ord;
Note: See TracChangeset for help on using the changeset viewer.