Back to index

php5  5.3.10
Functions | Variables
utf32_be.c File Reference
#include "regenc.h"

Go to the source code of this file.

Functions

static int utf32be_mbc_enc_len (const UChar *p)
static int utf32be_is_mbc_newline (const UChar *p, const UChar *end)
static OnigCodePoint utf32be_mbc_to_code (const UChar *p, const UChar *end)
static int utf32be_code_to_mbclen (OnigCodePoint code)
static int utf32be_code_to_mbc (OnigCodePoint code, UChar *buf)
static int utf32be_mbc_to_normalize (OnigAmbigType flag, const UChar **pp, const UChar *end, UChar *lower)
static int utf32be_is_mbc_ambiguous (OnigAmbigType flag, const UChar **pp, const UChar *end)
static UCharutf32be_left_adjust_char_head (const UChar *start, const UChar *s)

Variables

OnigEncodingType OnigEncodingUTF32_BE

Function Documentation

static int utf32be_code_to_mbc ( OnigCodePoint  code,
UChar buf 
) [static]

Definition at line 69 of file utf32_be.c.

{
  UChar* p = buf;

  *p++ = (UChar )((code & 0xff000000) >>24);
  *p++ = (UChar )((code & 0xff0000)   >>16);
  *p++ = (UChar )((code & 0xff00)     >> 8);
  *p++ = (UChar ) (code & 0xff);
  return 4;
}
static int utf32be_code_to_mbclen ( OnigCodePoint  code) [static]

Definition at line 63 of file utf32_be.c.

{
  return 4;
}
static int utf32be_is_mbc_ambiguous ( OnigAmbigType  flag,
const UChar **  pp,
const UChar end 
) [static]

Definition at line 118 of file utf32_be.c.

{
  const UChar* p = *pp;

  (*pp) += 4;

  if (*(p+2) == 0 && *(p+1) == 0 && *p == 0) {
    int c, v;

    p += 3;
    if (((flag & ONIGENC_AMBIGUOUS_MATCH_ASCII_CASE) != 0 &&
        ONIGENC_IS_MBC_ASCII(p)) ||
       ((flag & ONIGENC_AMBIGUOUS_MATCH_NONASCII_CASE) != 0 &&
        !ONIGENC_IS_MBC_ASCII(p))) {
      c = *p;
      v = ONIGENC_IS_UNICODE_ISO_8859_1_CTYPE(c,
                       (ONIGENC_CTYPE_UPPER | ONIGENC_CTYPE_LOWER));
      if ((v | ONIGENC_CTYPE_LOWER) != 0) {
        /* 0xaa, 0xb5, 0xba are lower case letter, but can't convert. */
        if (c >= 0xaa && c <= 0xba)
          return FALSE;
        else
          return TRUE;
      }
      return (v != 0 ? TRUE : FALSE);
    }
  }

  return FALSE;
}
static int utf32be_is_mbc_newline ( const UChar p,
const UChar end 
) [static]

Definition at line 39 of file utf32_be.c.

{
  if (p + 3 < end) {
    if (*(p+3) == 0x0a && *(p+2) == 0 && *(p+1) == 0 && *p == 0)
      return 1;
#ifdef USE_UNICODE_ALL_LINE_TERMINATORS
    if ((*(p+3) == 0x0d || *(p+3) == 0x85)
       && *(p+2) == 0 && *(p+1) == 0 && *p == 0x00)
      return 1;
    if (*(p+2) == 0x20 && (*(p+3) == 0x29 || *(p+3) == 0x28)
       && *(p+1) == 0 && *p == 0)
      return 1;
#endif
  }
  return 0;
}
static UChar* utf32be_left_adjust_char_head ( const UChar start,
const UChar s 
) [static]

Definition at line 150 of file utf32_be.c.

{
  int rem;

  if (s <= start) return (UChar* )s;

  rem = (s - start) % 4;
  return (UChar* )(s - rem);
}
static int utf32be_mbc_enc_len ( const UChar p) [static]

Definition at line 33 of file utf32_be.c.

{
  return 4;
}
static OnigCodePoint utf32be_mbc_to_code ( const UChar p,
const UChar end 
) [static]

Definition at line 57 of file utf32_be.c.

{
  return (OnigCodePoint )(((p[0] * 256 + p[1]) * 256 + p[2]) * 256 + p[3]);
}
static int utf32be_mbc_to_normalize ( OnigAmbigType  flag,
const UChar **  pp,
const UChar end,
UChar lower 
) [static]

Definition at line 81 of file utf32_be.c.

{
  const UChar* p = *pp;

  if (*(p+2) == 0 && *(p+1) == 0 && *p == 0) {
    p += 3;
    *lower++ = '\0';
    *lower++ = '\0';
    *lower++ = '\0';
    if (((flag & ONIGENC_AMBIGUOUS_MATCH_ASCII_CASE) != 0 &&
        ONIGENC_IS_MBC_ASCII(p)) ||
       ((flag & ONIGENC_AMBIGUOUS_MATCH_NONASCII_CASE) != 0 &&
        !ONIGENC_IS_MBC_ASCII(p))) {
      *lower = ONIGENC_ISO_8859_1_TO_LOWER_CASE(*p);
    }
    else {
      *lower = *p;
    }

    (*pp) += 4;
    return 4;  /* return byte length of converted char to lower */
  }
  else {
    int len = 4;
    if (lower != p) {
      int i;
      for (i = 0; i < len; i++) {
       *lower++ = *p++;
      }
    }
    (*pp) += len;
    return len; /* return byte length of converted char to lower */
  }
}

Variable Documentation