Back to index

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

Go to the source code of this file.

Defines

#define ENC_IS_ISO_8859_1_CTYPE(code, ctype)   ((EncISO_8859_1_CtypeTable[code] & ctype) != 0)

Functions

static int iso_8859_1_mbc_to_normalize (OnigAmbigType flag, const UChar **pp, const UChar *end, UChar *lower)
static int iso_8859_1_is_mbc_ambiguous (OnigAmbigType flag, const UChar **pp, const UChar *end)
static int iso_8859_1_is_code_ctype (OnigCodePoint code, unsigned int ctype)

Variables

static const unsigned short EncISO_8859_1_CtypeTable [256]
OnigEncodingType OnigEncodingISO_8859_1

Define Documentation

#define ENC_IS_ISO_8859_1_CTYPE (   code,
  ctype 
)    ((EncISO_8859_1_CtypeTable[code] & ctype) != 0)

Definition at line 32 of file iso8859_1.c.


Function Documentation

static int iso_8859_1_is_code_ctype ( OnigCodePoint  code,
unsigned int  ctype 
) [static]

Definition at line 116 of file iso8859_1.c.

{
  if (code < 256)
    return ENC_IS_ISO_8859_1_CTYPE(code, ctype);
  else
    return FALSE;
}
static int iso_8859_1_is_mbc_ambiguous ( OnigAmbigType  flag,
const UChar **  pp,
const UChar end 
) [static]

Definition at line 89 of file iso8859_1.c.

{
  const UChar* p = *pp;

  (*pp)++;
  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))) {
    int v = (EncISO_8859_1_CtypeTable[*p] &
             (ONIGENC_CTYPE_UPPER | ONIGENC_CTYPE_LOWER));

    if ((v | ONIGENC_CTYPE_LOWER) != 0) {
      /* 0xdf, 0xaa, 0xb5, 0xba are lower case letter, but can't convert. */
      if (*p == 0xdf || (*p >= 0xaa && *p <= 0xba))
        return FALSE;
      else
        return TRUE;
    }

    return (v != 0 ? TRUE : FALSE);
  }
  return FALSE;
}
static int iso_8859_1_mbc_to_normalize ( OnigAmbigType  flag,
const UChar **  pp,
const UChar end,
UChar lower 
) [static]

Definition at line 71 of file iso8859_1.c.

{
  const UChar* p = *pp;

  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)++;
  return 1; /* return byte length of converted char to lower */
}

Variable Documentation

const unsigned short EncISO_8859_1_CtypeTable[256] [static]

Definition at line 35 of file iso8859_1.c.