m17n.h File Reference

Data Structures

struct  MConverter
 Structure to be used in code conversion. More...
struct  MCodingInfoISO2022
 Structure for a coding system of type MCODING_TYPE_ISO_2022. More...
struct  MCodingInfoUTF
 Structure for extra information about a coding system of type MCODING_TYPE_UTF. More...
struct  MInputDriver
 Structure of input method driver. More...
struct  MInputMethod
 Structure of input method. More...
struct  MInputContext
 Structure of input context. More...

Typedefs

typedef struct MLocale MLocale
 struct MLocale.
typedef void(* MInputCallbackFunc )(MInputContext *ic, MSymbol command)
 Type of input method callback functions.

Enumerations

enum  MConversionResult {
  MCONVERSION_RESULT_SUCCESS,
  MCONVERSION_RESULT_INVALID_BYTE,
  MCONVERSION_RESULT_INVALID_CHAR,
  MCONVERSION_RESULT_INSUFFICIENT_SRC,
  MCONVERSION_RESULT_INSUFFICIENT_DST,
  MCONVERSION_RESULT_IO_ERROR
}
 

Codes that represent the result of code conversion.

More...
enum  MCodingType {
  MCODING_TYPE_CHARSET,
  MCODING_TYPE_UTF,
  MCODING_TYPE_ISO_2022,
  MCODING_TYPE_MISC
}
 

Types of coding system.

More...
enum  MCodingFlagISO2022 {
  MCODING_ISO_RESET_AT_EOL = 0x1,
  MCODING_ISO_RESET_AT_CNTL = 0x2,
  MCODING_ISO_EIGHT_BIT = 0x4,
  MCODING_ISO_LONG_FORM = 0x8,
  MCODING_ISO_DESIGNATION_G0 = 0x10,
  MCODING_ISO_DESIGNATION_G1 = 0x20,
  MCODING_ISO_DESIGNATION_CTEXT = 0x40,
  MCODING_ISO_DESIGNATION_CTEXT_EXT = 0x80,
  MCODING_ISO_LOCKING_SHIFT = 0x100,
  MCODING_ISO_SINGLE_SHIFT = 0x200,
  MCODING_ISO_SINGLE_SHIFT_7 = 0x400,
  MCODING_ISO_EUC_TW_SHIFT = 0x800,
  MCODING_ISO_ISO6429 = 0x1000,
  MCODING_ISO_REVISION_NUMBER = 0x2000,
  MCODING_ISO_FULL_SUPPORT = 0x3000,
  MCODING_ISO_FLAG_MAX
}
 

Bit-masks to specify the detail of coding system whose type is MCODING_TYPE_ISO_2022.

More...
enum  MInputCandidatesChanged {
  MINPUT_CANDIDATES_LIST_CHANGED = 1,
  MINPUT_CANDIDATES_INDEX_CHANGED = 2,
  MINPUT_CANDIDATES_SHOW_CHANGED = 4,
  MINPUT_CANDIDATES_CHANGED_MAX
}
 

Bit-masks to specify how candidates of input method is changed.

More...

Functions

MSymbol mchar_define_charset (const char *name, MPlist *plist)
 Define a charset.
MSymbol mchar_resolve_charset (MSymbol symbol)
 Resolve charset name.
int mchar_list_charset (MSymbol **symbols)
 List symbols representing charsets.
int mchar_decode (MSymbol charset_name, unsigned code)
 Decode a code-point.
unsigned mchar_encode (MSymbol charset_name, int c)
 Encode a character code.
int mchar_map_charset (MSymbol charset_name, void(*func)(int from, int to, void *arg), void *func_arg)
 Call a function for all the characters in a specified charset.
MSymbol mconv_define_coding (const char *name, MPlist *plist, int(*resetter)(MConverter *), int(*decoder)(const unsigned char *, int, MText *, MConverter *), int(*encoder)(MText *, int, int, unsigned char *, int, MConverter *), void *extra_info)
 Define a coding system.
MSymbol mconv_resolve_coding (MSymbol symbol)
 Resolve coding system name.
int mconv_list_codings (MSymbol **symbols)
 List symbols representing coding systems.
MConvertermconv_buffer_converter (MSymbol coding, const unsigned char *buf, int n)
 Create a code converter bound to a buffer.
MConvertermconv_stream_converter (MSymbol coding, FILE *fp)
 Create a code converter bound to a stream.
int mconv_reset_converter (MConverter *converter)
 Reset a code converter.
void mconv_free_converter (MConverter *converter)
 Free a code converter.
MConvertermconv_rebind_buffer (MConverter *converter, const unsigned char *buf, int n)
 Bind a buffer to a code converter.
MConvertermconv_rebind_stream (MConverter *converter, FILE *fp)
 Bind a stream to a code converter.
MTextmconv_decode (MConverter *converter, MText *mt)
 Decode a byte sequence into an M-text.
MTextmconv_decode_buffer (MSymbol name, const unsigned char *buf, int n)
 Decode a buffer area based on a coding system.
MTextmconv_decode_stream (MSymbol name, FILE *fp)
 Decode a stream input based on a coding system.
int mconv_encode (MConverter *converter, MText *mt)
 Encode an M-text into a byte sequence.
int mconv_encode_range (MConverter *converter, MText *mt, int from, int to)
 Encode a part of an M-text.
int mconv_encode_buffer (MSymbol name, MText *mt, unsigned char *buf, int n)
 Encode an M-text into a buffer area.
int mconv_encode_stream (MSymbol name, MText *mt, FILE *fp)
 Encode an M-text to write to a stream.
int mconv_getc (MConverter *converter)
 Read a character via a code converter.
int mconv_ungetc (MConverter *converter, int c)
 Push a character back to a code converter.
int mconv_putc (MConverter *converter, int c)
 Write a character via a code converter.
MTextmconv_gets (MConverter *converter, MText *mt)
 Read a line using a code converter.
MPlistmlanguage_list (void)
 List 3-letter language codes.
MSymbol mlanguage_code (MSymbol language, int len)
 Get a language code.
MPlistmlanguage_name_list (MSymbol language, MSymbol target, MSymbol script, MSymbol territory)
 Return the language names written in the specified language.
MTextmlanguage_text (MSymbol language)
 Return the language name written in that language.
MPlistmscript_list (void)
 List script names.
MPlistmscript_language_list (MSymbol script)
 List languages that use a specified script.
MSymbol mlanguage_name (MSymbol language)
MLocalemlocale_set (int category, const char *locale)
 Set the current locale.
MSymbol mlocale_get_prop (MLocale *locale, MSymbol key)
 Get the value of a locale property.
int mtext_ftime (MText *mt, const char *format, const struct tm *tm, MLocale *locale)
 Format date and time.
MTextmtext_getenv (const char *name)
 Get an environment variable.
int mtext_putenv (MText *mt)
 Change or add an environment variable.
int mtext_coll (MText *mt1, MText *mt2)
 Compare two M-texts using the current locale.
MInputMethodminput_open_im (MSymbol language, MSymbol name, void *arg)
 Open an input method.
void minput_close_im (MInputMethod *im)
 Close an input method.
MInputContextminput_create_ic (MInputMethod *im, void *arg)
 Create an input context.
void minput_destroy_ic (MInputContext *ic)
 Destroy an input context.
int minput_filter (MInputContext *ic, MSymbol key, void *arg)
 Filter an input key.
int minput_lookup (MInputContext *ic, MSymbol key, void *arg, MText *mt)
 Look up a text produced in the input context.
void minput_set_spot (MInputContext *ic, int x, int y, int ascent, int descent, int fontsize, MText *mt, int pos)
 Set the spot of the input context.
void minput_toggle (MInputContext *ic)
 Toggle input method.
void minput_reset_ic (MInputContext *ic)
 Reset an input context.
MTextminput_get_description (MSymbol language, MSymbol name)
 Get description text of an input method.
MPlistminput_get_title_icon (MSymbol language, MSymbol name)
 Get title and icon filename of an input method.
MPlistminput_get_command (MSymbol language, MSymbol name, MSymbol command)
 Get information about input method command(s).
int minput_config_command (MSymbol language, MSymbol name, MSymbol command, MPlist *keyseq)
 Configure the key sequence of an input method command.
MPlistminput_get_variable (MSymbol language, MSymbol name, MSymbol variable)
 Get information about input method variable(s).
int minput_config_variable (MSymbol language, MSymbol name, MSymbol variable, MPlist *value)
 Configure the value of an input method variable.
char * minput_config_file (void)
 Get the name of per-user customization file.
int minput_save_config (void)
 Save configurations in per-user customization file.
int minput_callback (MInputContext *ic, MSymbol command)
 Call a callback function.
MPlistminput_get_commands (MSymbol language, MSymbol name)
 Get information about input method commands.
int minput_assign_command_keys (MSymbol language, MSymbol name, MSymbol command, MPlist *keys)
 Assign a key sequence to an input method command (obsolete).
MPlistminput_get_variables (MSymbol language, MSymbol name)
 Get a list of variables of an input method (obsolete).
int minput_set_variable (MSymbol language, MSymbol name, MSymbol variable, void *value)
 Set the initial value of an input method variable.
MInputMethodmdebug_dump_im (MInputMethod *im, int indent)
 Dump an input method.

Variables

MSymbol Mcharset_ascii
 Symbol representing the charset ASCII.
MSymbol Mcharset_iso_8859_1
 Symbol representing the charset ISO/IEC 8859/1.
MSymbol Mcharset_unicode
 Symbol representing the charset Unicode.
MSymbol Mcharset_m17n
 Symbol representing the largest charset.
MSymbol Mcharset_binary
 Symbol representing the charset for ill-decoded characters.
MSymbol Mmethod
MSymbol Mdimension
MSymbol Mmin_range
MSymbol Mmax_range
MSymbol Mmin_code
MSymbol Mmax_code
MSymbol Mascii_compatible
MSymbol Mfinal_byte
MSymbol Mrevision
MSymbol Mmin_char
MSymbol Mmapfile
MSymbol Mparents
MSymbol Msubset_offset
MSymbol Mdefine_coding
MSymbol Maliases
MSymbol Moffset
 Symbol for the offset type method of charset.
MSymbol Mmap
 Symbol for the map type method of charset.
MSymbol Munify
 Symbol for the unify type method of charset.
MSymbol Msubset
 Symbol for the subset type method of charset.
MSymbol Msuperset
 Symbol for the superset type method of charset.
MSymbol Mcoding_us_ascii
 Symbol for the coding system US-ASCII.
MSymbol Mcoding_iso_8859_1
 Symbol for the coding system ISO-8859-1.
MSymbol Mcoding_utf_8
 Symbol for the coding system UTF-8.
MSymbol Mcoding_utf_8_full
 Symbol for the coding system UTF-8-FULL.
MSymbol Mcoding_utf_16
 Symbol for the coding system UTF-16.
MSymbol Mcoding_utf_16be
 Symbol for the coding system UTF-16BE.
MSymbol Mcoding_utf_16le
 Symbol for the coding system UTF-16LE.
MSymbol Mcoding_utf_32
 Symbol for the coding system UTF-32.
MSymbol Mcoding_utf_32be
 Symbol for the coding system UTF-32BE.
MSymbol Mcoding_utf_32le
 Symbol for the coding system UTF-32LE.
MSymbol Mcoding_sjis
 Symbol for the coding system SJIS.
MSymbol Mtype
MSymbol Mcharsets
MSymbol Mflags
MSymbol Mdesignation
MSymbol Minvocation
MSymbol Mcode_unit
MSymbol Mbom
MSymbol Mlittle_endian
MSymbol Mutf
MSymbol Miso_2022
MSymbol Mreset_at_eol
MSymbol Mreset_at_cntl
MSymbol Meight_bit
MSymbol Mlong_form
MSymbol Mdesignation_g0
MSymbol Mdesignation_g1
MSymbol Mdesignation_ctext
MSymbol Mdesignation_ctext_ext
MSymbol Mlocking_shift
MSymbol Msingle_shift
MSymbol Msingle_shift_7
MSymbol Meuc_tw_shift
MSymbol Miso_6429
MSymbol Mrevision_number
MSymbol Mfull_support
MSymbol Mcoding
 The symbol Mcoding.
MSymbol Mmaybe
 Symbol whose name is "maybe".
MSymbol Miso639_1
MSymbol Miso639_2
MSymbol Mterritory
MSymbol Mmodifier
MSymbol Mcodeset
MInputDriver minput_default_driver
 The default driver for internal input methods.
MSymbol Minput_method
 Symbol whose name is "input-method".
MSymbol Minput_driver
MInputDriverminput_driver
 The driver for internal input methods.
MSymbol Minput_preedit_start
MSymbol Minput_preedit_draw
MSymbol Minput_preedit_done
MSymbol Minput_status_start
MSymbol Minput_status_draw
MSymbol Minput_status_done
MSymbol Minput_candidates_start
MSymbol Minput_candidates_draw
MSymbol Minput_candidates_done
MSymbol Minput_set_spot
MSymbol Minput_toggle
MSymbol Minput_reset
MSymbol Minput_get_surrounding_text
MSymbol Minput_delete_surrounding_text
MSymbol Minput_focus_move
MSymbol Minput_focus_in
MSymbol Minput_focus_out
MSymbol Minherited
MSymbol Mcustomized
MSymbol Mconfigured

Function Documentation

MPlist* mlanguage_list ( void   ) 

List 3-letter language codes.

The mlanguage_list() funciton returns a well-formed plist whose keys are Msymbol and values are symbols whose names are ISO639-2 3-letter language codes.

Return value:
This function returns a plist. The caller should free it by m17n_object_unref().
See Also:
mscript_list().
MSymbol mlanguage_code ( MSymbol  language,
int  len 
)

Get a language code.

The mlanguage_code() function returns a symbol whose name is the ISO639 language code of language. language is a symbol whose name is an ISO639-2 3-letter language code, an ISO639-1 2-letter language codes, or an English word.

len specifies the type of the returned language code. If it is 3, an ISO639-2 3-letter language code is returned. If it is 2, an ISO639-1 2-letter language code is returned when defined; otherwise Mnil is returned. If it is 0, a 2-letter code is returned when defined; otherwise a 3-letter code is returned.

Return value:
If the information is available, this function returns a non-Mnil symbol. Otherwise, it returns Mnil.
See Also:
mlanguage_name_list(), mlanguage_text().
MPlist* mlanguage_name_list ( MSymbol  language,
MSymbol  target,
MSymbol  script,
MSymbol  territory 
)

Return the language names written in the specified language.

The mlanguage_name_list() function returns a plist of LANGUAGE's names written in TARGET language. SCRIPT and TERRITORY, if not Mnil, specifies which script and territory to concern at first.

LANGUAGE and TARGET must be a symbol whose name is an ISO639-2 3-letter language code or an ISO639-1 2-letter language codes. TARGET may be Mnil, in which case, the language of the current locale is used. If locale is not set or is C, English is used.

SCRIPT and TERRITORY must be a symbol whose name is a script and territory name of a locale (e.g. "TW", "SG") respectively.

Return value:
If the translation is available, this function returns a non-empty plist. The first element has key MText and the value is an M-text of a translated language name. If the succeeding elements also have key MText, their values are M-texts of alternate translations.

If no translation is available, NULL is returned.

The returned plist should not be modified nor freed.

See Also:
mlanguage_code(), mlanguage_text().
MText* mlanguage_text ( MSymbol  language  ) 

Return the language name written in that language.

The mlanguage_text() function returns, in the form of M-text, the language name of language written in language. If the representative characters of the language are known, the characters of the returned M-text has a text property whose key is Mtext and whose value is an M-text that contains the representative characters.

Return value:
If the information is available, this function returns an M-text that should not be modified nor freed. Otherwise, it returns NULL.
See Also:
mlanguage_code(), mlanguage_name().
MPlist* mscript_list ( void   ) 

List script names.

The mscript_list() funciton returns a well-formed plist whose keys are Msymbol and values are symbols whose names are script names.

Return value:
This function returns a plist. The caller should free it by m17n_object_unref().
See Also:
mscript_language_list(), mlanguage_list().
MPlist* mscript_language_list ( MSymbol  script  ) 

List languages that use a specified script.

The mscript_language_list() function lists languages that use script. script is a symbol whose name is the lower-cased version of a script name that appears in the Unicode Character Database.

Return value:

This function returns a well-formed plist whose keys are Msymbol and values are symbols whose names are ISO639-1 2-letter codes (or ISO639-2 3-letter codes, if the former is not available). The caller should not modify nor free it. If the m17n library does not know about script, it returns @ c NULL.

See Also:
mscript_list(), mlanguage_list().
MSymbol mlanguage_name ( MSymbol  language  ) 

Variable Documentation

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

m17n-lib Home