charset.h File Reference
This graph shows which files directly or indirectly include this file:

## Data Structures

struct | MCharset
struct | MCharsetISO2022Table

## Macros

#define | MCHARSET(charset_sym)
#define | CODE_POINT_TO_INDEX(charset, code)
#define | INDEX_TO_CODE_POINT(charset, idx)
#define | DECODE_CHAR(charset, code)
#define | ENCODE_CHAR(charset, c)
#define | ISO_MAX_DIMENSION 3
#define | ISO_MAX_CHARS 2
#define | ISO_MAX_FINAL 0x80
#define | MCHARSET_ISO_2022(dim, chars, final) mcharset__iso_2022_table.classified[(dim) - 1][(chars) == 96][(final)]

## Enumerations

enum | mcharset_method { MCHARSET_METHOD_OFFSET , MCHARSET_METHOD_MAP , MCHARSET_METHOD_DEFERRED , MCHARSET_METHOD_SUBSET , MCHARSET_METHOD_SUPERSET , MCHARSET_METHOD_MAX }

## Functions

MCharset * | mcharset__find (MSymbol name)
int | mcharset__decode_char (MCharset *charset, unsigned code)
unsigned | mcharset__encode_char (MCharset *charset, int c)
int | mcharset__load_from_database ()

## Variables

MPlist * | mcharset__cache
MCharset * | mcharset__ascii
MCharset * | mcharset__binary
MCharset * | mcharset__m17n
MCharset * | mcharset__unicode
MCharsetISO2022Table | mcharset__iso_2022_table

## Macro Definition Documentation

## MCHARSET

#define MCHARSET | ( |  | charset_sym | ) |

Value:
(((charset_sym) == MPLIST_KEY (mcharset__cache) \
|| (MPLIST_KEY (mcharset__cache) = (charset_sym), \
MPLIST_VAL (mcharset__cache) \
= (MCharset *) msymbol_get ((charset_sym), Mcharset))) \
? MPLIST_VAL (mcharset__cache) \
: mcharset__find (charset_sym))
mcharset__find
MCharset * mcharset__find(MSymbol name)
mcharset__cache
MPlist * mcharset__cache
Mcharset
MSymbol Mcharset
Definition: database.c:1007
msymbol_get
void * msymbol_get(MSymbol symbol, MSymbol key)
Get the value of a symbol property.
Definition: symbol.c:433
MPLIST_KEY
#define MPLIST_KEY(plist)
Definition: plist.h:13
MPLIST_VAL
#define MPLIST_VAL(plist)
Definition: plist.h:14
MCharset
Definition: charset.h:14

## CODE_POINT_TO_INDEX

#define CODE_POINT_TO_INDEX | ( |  | charset,
|  |  | code
| ) |  |

Value:
((charset)->no_code_gap \
? (code) - (charset)->min_code \
: (((charset)->code_range_mask[(code) >> 24] & 0x8) \
&& ((charset)->code_range_mask[((code) >> 16) & 0xFF] & 0x4) \
&& ((charset)->code_range_mask[((code) >> 8) & 0xFF] & 0x2) \
&& ((charset)->code_range_mask[(code) & 0xFF] & 0x1)) \
? (((((code) >> 24) - (charset)->code_range[12]) \
* (charset)->code_range[11]) \
+ (((((code) >> 16) & 0xFF) - (charset)->code_range[8]) \
* (charset)->code_range[7]) \
+ (((((code) >> 8) & 0xFF) - (charset)->code_range[4]) \
* (charset)->code_range[3]) \
+ (((code) & 0xFF) - (charset)->code_range[0]) \
- ((charset)->min_code - (charset)->code_range_min_code)) \
: -1)

## INDEX_TO_CODE_POINT

#define INDEX_TO_CODE_POINT | ( |  | charset,
|  |  | idx
| ) |  |

Value:
((charset)->no_code_gap \
? (idx) + (charset)->min_code \
: (idx += (charset)->min_code - (charset)->code_range_min_code, \
(((charset)->code_range[0] + (idx) % (charset)->code_range[2]) \
| (((charset)->code_range[4] \
+ ((idx) / (charset)->code_range[3] % (charset)->code_range[6])) \
<< 8) \
| (((charset)->code_range[8] \
+ ((idx) / (charset)->code_range[7] % (charset)->code_range[10])) \
<< 16) \
| (((charset)->code_range[12] + ((idx) / (charset)->code_range[11])) \
<< 24))))

## DECODE_CHAR

#define DECODE_CHAR | ( |  | charset,
|  |  | code
| ) |  |

Value:
(((code) < 128 && (charset)->ascii_compatible) \
? (int) (code) \
: ((code) < (charset)->min_code || (code) > (charset)->max_code) \
? -1 \
: ! (charset)->simple \
? mcharset__decode_char ((charset), (code)) \
: (charset)->method == Moffset \
? (code) - (charset)->min_code + (charset)->min_char \
: (charset)->decoder[(code) - (charset)->min_code])
mcharset__decode_char
int mcharset__decode_char(MCharset *charset, unsigned code)
Moffset
MSymbol Moffset
Definition: charset.c:666

## ENCODE_CHAR

#define ENCODE_CHAR | ( |  | charset,
|  |  | c
| ) |  |

Value:
(! (charset)->simple \
? mcharset__encode_char ((charset), (c)) \
: ((c) < (charset)->min_char || (c) > (charset)->max_char) \
? MCHAR_INVALID_CODE \
: (charset)->method == Moffset \
? (c) - (charset)->min_char + (charset)->min_code \
: (unsigned) mchartable_lookup ((charset)->encoder, (c)))
mcharset__encode_char
unsigned mcharset__encode_char(MCharset *charset, int c)
MCHAR_INVALID_CODE
#define MCHAR_INVALID_CODE
Invalid code-point.
Definition: charset.c:559
mchartable_lookup
void * mchartable_lookup(MCharTable *table, int c)
Return the assigned value of a character in a chartable.
Definition: chartab.c:514

## ISO_MAX_DIMENSION

#define ISO_MAX_DIMENSION 3

## ISO_MAX_CHARS

#define ISO_MAX_CHARS 2

## ISO_MAX_FINAL

#define ISO_MAX_FINAL 0x80

## MCHARSET_ISO_2022

#define MCHARSET_ISO_2022 | ( |  | dim,
|  |  | chars,
|  |  | final
| ) |  | mcharset__iso_2022_table.classified[(dim) - 1][(chars) == 96][(final)]

## Enumeration Type Documentation

## mcharset_method

enum mcharset_method

Enumerator
MCHARSET_METHOD_OFFSET |
MCHARSET_METHOD_MAP |
MCHARSET_METHOD_DEFERRED |
MCHARSET_METHOD_SUBSET |
MCHARSET_METHOD_SUPERSET |
MCHARSET_METHOD_MAX |

## Function Documentation

## mcharset__find()

MCharset* mcharset__find | ( | MSymbol | name | ) |

## mcharset__decode_char()

int mcharset__decode_char | ( | MCharset * | charset,
|  | unsigned | code
| ) |  |

## mcharset__encode_char()

unsigned mcharset__encode_char | ( | MCharset * | charset,
|  | int | c
| ) |  |

## mcharset__load_from_database()

int mcharset__load_from_database | ( |  | ) |

## Variable Documentation

## mcharset__cache

MPlist* mcharset__cache

extern

## mcharset__ascii

MCharset* mcharset__ascii

extern

## mcharset__binary

MCharset* mcharset__binary

extern

## mcharset__m17n

MCharset* mcharset__m17n

extern

## mcharset__unicode

MCharset* mcharset__unicode

extern

## mcharset__iso_2022_table

MCharsetISO2022Table mcharset__iso_2022_table

extern