Back to index

python3.2  3.2.2
Classes | Defines | Functions
unicodectype.c File Reference
#include "Python.h"
#include "unicodetype_db.h"

Go to the source code of this file.

Classes

struct  _PyUnicode_TypeRecord

Defines

#define ALPHA_MASK   0x01
#define DECIMAL_MASK   0x02
#define DIGIT_MASK   0x04
#define LOWER_MASK   0x08
#define LINEBREAK_MASK   0x10
#define SPACE_MASK   0x20
#define TITLE_MASK   0x40
#define UPPER_MASK   0x80
#define XID_START_MASK   0x100
#define XID_CONTINUE_MASK   0x200
#define PRINTABLE_MASK   0x400
#define NODELTA_MASK   0x800
#define NUMERIC_MASK   0x1000

Functions

static const
_PyUnicode_TypeRecord
gettyperecord (Py_UCS4 code)
Py_UCS4 _PyUnicode_ToTitlecase (register Py_UCS4 ch)
int _PyUnicode_IsTitlecase (Py_UCS4 ch)
int _PyUnicode_IsXidStart (Py_UCS4 ch)
int _PyUnicode_IsXidContinue (Py_UCS4 ch)
int _PyUnicode_ToDecimalDigit (Py_UCS4 ch)
int _PyUnicode_IsDecimalDigit (Py_UCS4 ch)
int _PyUnicode_ToDigit (Py_UCS4 ch)
int _PyUnicode_IsDigit (Py_UCS4 ch)
int _PyUnicode_IsNumeric (Py_UCS4 ch)
int _PyUnicode_IsPrintable (Py_UCS4 ch)
int _PyUnicode_IsLowercase (Py_UCS4 ch)
int _PyUnicode_IsUppercase (Py_UCS4 ch)
Py_UCS4 _PyUnicode_ToUppercase (Py_UCS4 ch)
Py_UCS4 _PyUnicode_ToLowercase (Py_UCS4 ch)
int _PyUnicode_IsAlpha (Py_UCS4 ch)

Class Documentation

struct _PyUnicode_TypeRecord

Definition at line 27 of file unicodectype.c.

Class Members
const unsigned char decimal
const unsigned char digit
const unsigned short flags
const Py_UCS4 lower
const Py_UCS4 title
const Py_UCS4 upper

Define Documentation

#define ALPHA_MASK   0x01

Definition at line 13 of file unicodectype.c.

#define DECIMAL_MASK   0x02

Definition at line 14 of file unicodectype.c.

#define DIGIT_MASK   0x04

Definition at line 15 of file unicodectype.c.

#define LINEBREAK_MASK   0x10

Definition at line 17 of file unicodectype.c.

#define LOWER_MASK   0x08

Definition at line 16 of file unicodectype.c.

#define NODELTA_MASK   0x800

Definition at line 24 of file unicodectype.c.

#define NUMERIC_MASK   0x1000

Definition at line 25 of file unicodectype.c.

#define PRINTABLE_MASK   0x400

Definition at line 23 of file unicodectype.c.

#define SPACE_MASK   0x20

Definition at line 18 of file unicodectype.c.

#define TITLE_MASK   0x40

Definition at line 19 of file unicodectype.c.

#define UPPER_MASK   0x80

Definition at line 20 of file unicodectype.c.

#define XID_CONTINUE_MASK   0x200

Definition at line 22 of file unicodectype.c.

#define XID_START_MASK   0x100

Definition at line 21 of file unicodectype.c.


Function Documentation

int _PyUnicode_IsAlpha ( Py_UCS4  ch)

Definition at line 216 of file unicodectype.c.

{
    const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);

    return (ctype->flags & ALPHA_MASK) != 0;
}

Here is the call graph for this function:

int _PyUnicode_IsDecimalDigit ( Py_UCS4  ch)

Definition at line 111 of file unicodectype.c.

{
    if (_PyUnicode_ToDecimalDigit(ch) < 0)
        return 0;
    return 1;
}

Here is the call graph for this function:

int _PyUnicode_IsDigit ( Py_UCS4  ch)

Definition at line 128 of file unicodectype.c.

{
    if (_PyUnicode_ToDigit(ch) < 0)
        return 0;
    return 1;
}

Here is the call graph for this function:

int _PyUnicode_IsLowercase ( Py_UCS4  ch)

Definition at line 168 of file unicodectype.c.

{
    const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);

    return (ctype->flags & LOWER_MASK) != 0;
}

Here is the call graph for this function:

int _PyUnicode_IsNumeric ( Py_UCS4  ch)

Definition at line 138 of file unicodectype.c.

{
    const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);

    return (ctype->flags & NUMERIC_MASK) != 0;
}

Here is the call graph for this function:

int _PyUnicode_IsPrintable ( Py_UCS4  ch)

Definition at line 158 of file unicodectype.c.

{
    const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);

    return (ctype->flags & PRINTABLE_MASK) != 0;
}

Here is the call graph for this function:

int _PyUnicode_IsTitlecase ( Py_UCS4  ch)

Definition at line 74 of file unicodectype.c.

{
    const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);

    return (ctype->flags & TITLE_MASK) != 0;
}

Here is the call graph for this function:

int _PyUnicode_IsUppercase ( Py_UCS4  ch)

Definition at line 178 of file unicodectype.c.

{
    const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);

    return (ctype->flags & UPPER_MASK) != 0;
}

Here is the call graph for this function:

int _PyUnicode_IsXidContinue ( Py_UCS4  ch)

Definition at line 94 of file unicodectype.c.

{
    const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);

    return (ctype->flags & XID_CONTINUE_MASK) != 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int _PyUnicode_IsXidStart ( Py_UCS4  ch)

Definition at line 84 of file unicodectype.c.

{
    const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);

    return (ctype->flags & XID_START_MASK) != 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int _PyUnicode_ToDecimalDigit ( Py_UCS4  ch)

Definition at line 104 of file unicodectype.c.

{
    const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);

    return (ctype->flags & DECIMAL_MASK) ? ctype->decimal : -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int _PyUnicode_ToDigit ( Py_UCS4  ch)

Definition at line 121 of file unicodectype.c.

{
    const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);

    return (ctype->flags & DIGIT_MASK) ? ctype->digit : -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Py_UCS4 _PyUnicode_ToLowercase ( Py_UCS4  ch)

Definition at line 202 of file unicodectype.c.

{
    const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);
    int delta = ctype->lower;
    if (ctype->flags & NODELTA_MASK)
        return delta;
    if (delta >= 32768)
            delta -= 65536;
    return ch + delta;
}

Here is the call graph for this function:

Py_UCS4 _PyUnicode_ToTitlecase ( register Py_UCS4  ch)

Definition at line 57 of file unicodectype.c.

{
    const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);
    int delta = ctype->title;

    if (ctype->flags & NODELTA_MASK)
        return delta;

    if (delta >= 32768)
            delta -= 65536;

    return ch + delta;
}

Here is the call graph for this function:

Py_UCS4 _PyUnicode_ToUppercase ( Py_UCS4  ch)

Definition at line 188 of file unicodectype.c.

{
    const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);
    int delta = ctype->upper;
    if (ctype->flags & NODELTA_MASK)
        return delta;
    if (delta >= 32768)
            delta -= 65536;
    return ch + delta;
}

Here is the call graph for this function:

static const _PyUnicode_TypeRecord* gettyperecord ( Py_UCS4  code) [static]

Definition at line 39 of file unicodectype.c.

{
    int index;

    if (code >= 0x110000)
        index = 0;
    else
    {
        index = index1[(code>>SHIFT)];
        index = index2[(index<<SHIFT)+(code&((1<<SHIFT)-1))];
    }

    return &_PyUnicode_TypeRecords[index];
}

Here is the caller graph for this function: