# m17n-core.h File Reference

## Data Structures

struct | M17NObjectHead
| The first member of a managed object. More...

## Defines

#define | M17N_BEGIN_HEADER
#define | M17N_END_HEADER
#define | M17N_FUNC(func) ((M17NFunc) (func))
| Wrapper for a generic function type.

## Typedefs

typedef void(* | M17NFunc )(void)
| Generic function type.
typedef struct MSymbolStruct * | MSymbol
| Type of symbols.
typedef struct MPlist | MPlist
| Type of property list objects.
typedef struct MCharTable | MCharTable
| Type of chartables.
typedef struct MText | MText
| Type of M-texts.
typedef MPlist *(* | MTextPropSerializeFunc )(void *val)
| Type of serializer functions.
typedef void *(* | MTextPropDeserializeFunc )(MPlist *plist)
| Type of deserializer functions.
typedef struct MTextProperty | MTextProperty
| Type of text properties.
typedef struct MDatabase | MDatabase
| Type of database.

## Enumerations

enum | M17NStatus { M17N_NOT_INITIALIZED, M17N_CORE_INITIALIZED, M17N_SHELL_INITIALIZED, M17N_GUI_INITIALIZED }
| Enumeration for the status of the m17n library. More...
enum | MTextFormat { MTEXT_FORMAT_US_ASCII, MTEXT_FORMAT_UTF_8, MTEXT_FORMAT_UTF_16LE, MTEXT_FORMAT_UTF_16BE, MTEXT_FORMAT_UTF_32LE, MTEXT_FORMAT_UTF_32BE, MTEXT_FORMAT_MAX }
| Enumeration for specifying the format of an M-text. More...
enum | MTextLineBreakOption { MTEXT_LBO_SP_CM = 1, MTEXT_LBO_KOREAN_SP = 2, MTEXT_LBO_AI_AS_ID = 4, MTEXT_LBO_MAX }
| Enumeration for specifying a set of line breaking option. More...
enum | MTextPropertyControl { MTEXTPROP_FRONT_STICKY = 0x01, MTEXTPROP_REAR_STICKY = 0x02, MTEXTPROP_VOLATILE_WEAK = 0x04, MTEXTPROP_VOLATILE_STRONG = 0x08, MTEXTPROP_NO_MERGE = 0x10, MTEXTPROP_CONTROL_MAX = 0x1F }
| Flag bits to control text property. More...

## Functions

enum M17NStatus | m17n_status (void)
| Report which part of the m17n library is initialized.
void * | m17n_object (int size, void(*freer)(void *))
| Allocate a managed object.
int | m17n_object_ref (void *object)
| Increment the reference count of a managed object.
int | m17n_object_unref (void *object)
| Decrement the reference count of a managed object.
MSymbol | msymbol (const char *name)
| Get a symbol.
MSymbol | msymbol_as_managing_key (const char *name)
| Create a managing key.
int | msymbol_is_managing_key (MSymbol symbol)
| Check if a symbol is a managing key.
MSymbol | msymbol_exist (const char *name)
| Search for a symbol that has a specified name.
char * | msymbol_name (MSymbol symbol)
| Get symbol name.
int | msymbol_put (MSymbol symbol, MSymbol key, void *val)
| Set the value of a symbol property.
void * | msymbol_get (MSymbol symbol, MSymbol key)
| Get the value of a symbol property.
int | msymbol_put_func (MSymbol symbol, MSymbol key, M17NFunc func)
| Set the value (function pointer) of a symbol property.
M17NFunc | msymbol_get_func (MSymbol symbol, MSymbol key)
| Get the value (function pointer) of a symbol property.
MPlist * | mplist ()
| Create a property list object.
MPlist * | mplist_copy (MPlist *plist)
| Copy a property list.
MPlist * | mplist_add (MPlist *plist, MSymbol key, void *val)
| Add a property at the end of a property list.
MPlist * | mplist_push (MPlist *plist, MSymbol key, void *val)
| Add a property at the beginning of a property list.
void * | mplist_pop (MPlist *plist)
| Remove a property at the beginning of a property list.
MPlist * | mplist_put (MPlist *plist, MSymbol key, void *val)
| Set the value of a property in a property list.
void * | mplist_get (MPlist *plist, MSymbol key)
| Get the value of a property in a property list.
MPlist * | mplist_put_func (MPlist *plist, MSymbol key, M17NFunc func)
| Set the value (function pointer) of a property in a property list.
M17NFunc | mplist_get_func (MPlist *plist, MSymbol key)
| Get the value (function pointer) of a property in a property list.
MPlist * | mplist_find_by_key (MPlist *plist, MSymbol key)
| Find a property of a specific key in a property list.
MPlist * | mplist_find_by_value (MPlist *plist, void *val)
| Find a property of a specific value in a property list.
MPlist * | mplist_next (MPlist *plist)
| Return the next sublist of a property list.
MPlist * | mplist_set (MPlist *plist, MSymbol key, void *val)
| Set the first property in a property list.
int | mplist_length (MPlist *plist)
| Return the length of a property list.
MSymbol | mplist_key (MPlist *plist)
| Return the key of the first property in a property list.
void * | mplist_value (MPlist *plist)
| Return the value of the first property in a property list.
MSymbol | mchar_define_property (const char *name, MSymbol type)
| Define a character property.
void * | mchar_get_prop (int c, MSymbol key)
| Get the value of a character property.
int | mchar_put_prop (int c, MSymbol key, void *val)
| Set the value of a character property.
MCharTable * | mchartable (MSymbol key, void *default_value)
| Create a new chartable.
int | mchartable_min_char (MCharTable *table)
| Return the minimum character whose value is set in a chartabe.
int | mchartable_max_char (MCharTable *table)
| Return the maximum character whose value is set in a chartabe.
void * | mchartable_lookup (MCharTable *table, int c)
| Return the assigned value of a character in a chartable.
int | mchartable_set (MCharTable *table, int c, void *val)
| Assign a value to a character in a chartable.
int | mchartable_set_range (MCharTable *table, int from, int to, void *val)
| Assign a value to the characters in the specified range.
int | mchartable_map (MCharTable *table, void *ignore, void(*func)(int, int, void *, void *), void *func_arg)
| Call a function for characters in a chartable.
void | mchartable_range (MCharTable *table, int *from, int *to)
| Search for characters that have non-default value.
MCharTable * | mchar_get_prop_table (MSymbol key, MSymbol *type)
| Get the char-table for a character property.
MText * | mtext ()
| Allocate a new M-text.
void * | mtext_data (MText *mt, enum MTextFormat *fmt, int *nunits, int *pos_idx, int *unit_idx)
| Get information about the text data in M-text.
MText * | mtext_from_data (const void *data, int nitems, enum MTextFormat format)
| Allocate a new M-text with specified data.
int | mtext_len (MText *mt)
| Number of characters in M-text.
int | mtext_ref_char (MText *mt, int pos)
| Return the character at the specified position in an M-text.
int | mtext_set_char (MText *mt, int pos, int c)
| Store a character into an M-text.
MText * | mtext_copy (MText *mt1, int pos, MText *mt2, int from, int to)
| Copy characters in the specified range into an M-text.
int | mtext_compare (MText *mt1, int from1, int to1, MText *mt2, int from2, int to2)
| Compare specified regions of two M-texts.
int | mtext_case_compare (MText *mt1, int from1, int to1, MText *mt2, int from2, int to2)
| Compare specified regions of two M-texts ignoring cases.
int | mtext_character (MText *mt, int from, int to, int c)
| Search a character in an M-text.
int | mtext_del (MText *mt, int from, int to)
| Delete characters in the specified range destructively.
int | mtext_ins (MText *mt1, int pos, MText *mt2)
| Insert an M-text into another M-text.
int | mtext_insert (MText *mt1, int pos, MText *mt2, int from, int to)
| Insert sub-text of an M-text into another M-text.
int | mtext_ins_char (MText *mt, int pos, int c, int n)
| Insert a character into an M-text.
int | mtext_replace (MText *mt1, int from1, int to1, MText *mt2, int from2, int to2)
| Replace sub-text of M-text with another.
MText * | mtext_cat_char (MText *mt, int c)
| Append a character to an M-text.
MText * | mtext_duplicate (MText *mt, int from, int to)
| Create a new M-text from a part of an existing M-text.
MText * | mtext_dup (MText *mt)
| Create a copy of an M-text.
MText * | mtext_cat (MText *mt1, MText *mt2)
| Append an M-text to another.
MText * | mtext_ncat (MText *mt1, MText *mt2, int n)
| Append a part of an M-text to another.
MText * | mtext_cpy (MText *mt1, MText *mt2)
| Copy an M-text to another.
MText * | mtext_ncpy (MText *mt1, MText *mt2, int n)
| Copy the first some characters in an M-text to another.
int | mtext_chr (MText *mt, int c)
| Return the position of the first occurrence of a character in an M-text.
int | mtext_rchr (MText *mt, int c)
| Return the position of the last occurrence of a character in an M-text.
int | mtext_cmp (MText *mt1, MText *mt2)
| Compare two M-texts character-by-character.
int | mtext_ncmp (MText *mt1, MText *mt2, int n)
| Compare initial parts of two M-texts character-by-character.
int | mtext_spn (MText *mt1, MText *mt2)
| Search an M-text for a set of characters.
int | mtext_cspn (MText *mt1, MText *mt2)
| Search an M-text for the complement of a set of characters.
int | mtext_pbrk (MText *mt1, MText *mt2)
| Search an M-text for any of a set of characters.
int | mtext_text (MText *mt1, int pos, MText *mt2)
| Locate an M-text in another.
int | mtext_search (MText *mt1, int from, int to, MText *mt2)
| Locate an M-text in a specific range of another.
MText * | mtext_tok (MText *mt, MText *delim, int *pos)
| Look for a token in an M-text.
int | mtext_casecmp (MText *mt1, MText *mt2)
| Compare two M-texts ignoring cases.
int | mtext_ncasecmp (MText *mt1, MText *mt2, int n)
| Compare initial parts of two M-texts ignoring cases.
int | mtext_lowercase (MText *mt)
| Lowercase an M-text.
int | mtext_titlecase (MText *mt)
| Titlecase an M-text.
int | mtext_uppercase (MText *mt)
| Uppercase an M-text.
int | mtext_line_break (MText *mt, int pos, int option, int *after)
| Find a linebreak postion of an M-text.
MPlist * | mplist_deserialize (MText *mt)
| Generate a property list by deserializing an M-text.
void * | mtext_get_prop (MText *mt, int pos, MSymbol key)
| Get the value of the topmost text property.
int | mtext_get_prop_values (MText *mt, int pos, MSymbol key, void **values, int num)
| Get multiple values of a text property.
int | mtext_get_prop_keys (MText *mt, int pos, MSymbol **keys)
| Get a list of text property keys at a position of an M-text.
int | mtext_put_prop (MText *mt, int from, int to, MSymbol key, void *val)
| Set a text property.
int | mtext_put_prop_values (MText *mt, int from, int to, MSymbol key, void **values, int num)
| Set multiple text properties with the same key.
int | mtext_push_prop (MText *mt, int from, int to, MSymbol key, void *val)
| Push a text property.
int | mtext_pop_prop (MText *mt, int from, int to, MSymbol key)
| Pop a text property.
int | mtext_prop_range (MText *mt, MSymbol key, int pos, int *from, int *to, int deeper)
| Find the range where the value of a text property is the same.
MTextProperty * | mtext_property (MSymbol key, void *val, int control_bits)
| Create a text property.
MText * | mtext_property_mtext (MTextProperty *prop)
| Return the M-text of a text property.
MSymbol | mtext_property_key (MTextProperty *prop)
| Return the key of a text property.
void * | mtext_property_value (MTextProperty *prop)
| Return the value of a text property.
int | mtext_property_start (MTextProperty *prop)
| Return the start position of a text property.
int | mtext_property_end (MTextProperty *prop)
| Return the end position of a text property.
MTextProperty * | mtext_get_property (MText *mt, int pos, MSymbol key)
| Get the topmost text property.
int | mtext_get_properties (MText *mt, int pos, MSymbol key, MTextProperty **props, int num)
| Get multiple text properties.
int | mtext_attach_property (MText *mt, int from, int to, MTextProperty *prop)
| Attach a text property to an M-text.
int | mtext_detach_property (MTextProperty *prop)
| Detach a text property from an M-text.
int | mtext_push_property (MText *mt, int from, int to, MTextProperty *prop)
| Push a text property onto an M-text.
MText * | mtext_serialize (MText *mt, int from, int to, MPlist *property_list)
| Serialize text properties in an M-text.
MText * | mtext_deserialize (MText *mt)
| Deserialize text properties in an M-text.
MDatabase * | mdatabase_find (MSymbol tag1, MSymbol tag2, MSymbol tag3, MSymbol tag4)
| Look for a data in the database.
MPlist * | mdatabase_list (MSymbol tag0, MSymbol tag1, MSymbol tag2, MSymbol tag3)
| Return a data list of the m17n database.
void * | mdatabase_load (MDatabase *mdb)
| Load a data from the database.
MSymbol * | mdatabase_tag (MDatabase *mdb)
| Get tags of a data.
MDatabase * | mdatabase_define (MSymbol tag1, MSymbol tag2, MSymbol tag3, MSymbol tag4, void *(*loader)(MSymbol *, void *), void *extra_info)
| Define a data of the m17n database.

## Variables

MSymbol | Mnil
| Symbol whose name is "nil".
MSymbol | Mt
| Symbol whose name is "t".
MSymbol | Mstring
| Symbol whose name is "string".
MSymbol | Msymbol
| Symbol whose name is "symbol".
MSymbol | Mtext
| Symbol whose name is "mtext".
MSymbol | Mcharset
| The symbol `Mcharset`.
MSymbol | Mplist
| Symbol whose name is "plist".
MSymbol | Minteger
| Symbol whose name is "integer".
MSymbol | Mscript
| Key for script.
MSymbol | Mname
| Key for character name.
MSymbol | Mcategory
| Key for general category.
MSymbol | Mcombining_class
| Key for canonical combining class.
MSymbol | Mbidi_category
| Key for bidi category.
MSymbol | Msimple_case_folding
| Key for corresponding single lowercase character.
MSymbol | Mcomplicated_case_folding
| Key for corresponding multiple lowercase characters.
MSymbol | Mcased
| Key for values used in case operation.
MSymbol | Msoft_dotted
| Key for values used in case operation.
MSymbol | Mcase_mapping
| Key for values used in case operation.
MSymbol | Mblock
| Key for script block name.
MSymbol | Mchar_table
| Symbol whose name is "char-table".
MSymbol | Mlanguage
MSymbol | Mtext_prop_serializer
| Symbol for specifying serializer functions.
MSymbol | Mtext_prop_deserializer
| Symbol for specifying deserializer functions.
char * | mdatabase_dir
| Directory for application specific data.
Variables: Default Endian of UTF-16 and UTF-32
enum MTextFormat | MTEXT_FORMAT_UTF_16
| Variable of value MTEXT_FORMAT_UTF_16LE or MTEXT_FORMAT_UTF_16BE.
const int | MTEXT_FORMAT_UTF_32
| Variable of value MTEXT_FORMAT_UTF_32LE or MTEXT_FORMAT_UTF_32BE.

## Define Documentation

#define M17N_BEGIN_HEADER

#define M17N_END_HEADER