/* Copyright (C) 2003, 2004, 2005 National Institute of Advanced Industrial Science and Technology (AIST) Registration Number H15PRO112 See the end for copying conditions. */ /***en @page mdbIM Input Method @section im-description DESCRIPTION The m17n library provides a driver for input methods that are dynamically loadable from the m17n database (see @ref m17nInputMethod @latexonly (P.\pageref{group__m17nInputMethod}) @endlatexonly). This section describes the data format that defines those input methods. @section im-format SYNTAX and SEMANTICS The following data format defines an input method. The driver loads a definition from a file, a stream, etc. A definitions is converted into the form of plist in the driver. @verbatim INPUT-METHOD ::= IM-DECLARATION ? DESCRIPTION ? VARIABLE-LIST ? COMMAND-LIST ? TITLE MAP-LIST MACRO-LIST ? MODULE-LIST ? STATE-LIST IM-DECLARATION ::= '(' 'input-method' LANGUAGE NAME ')' DESCRIPTION ::= '(' 'description' MTEXT ')' VARIABLE-LIST ::= '(' 'variable' VARIABLE-DECLARATION * ')' COMMAND-LIST ::= '(' 'command' COMMAND-DECLARATION * ')' TITLE ::= '(' 'title' TITLE-TEXT ')' VARIABLE-DECLARATION ::= '(' VAR-NAME [ VAR-DESCRIPTION | nil ] VALUE VALUE-CANDIDATE * ')' COMMAND-DECLARATION ::= '(' CMD-NAME [ CMD-DESCRIPTION | nil ] KEYSEQ * ')' LANGUAGE ::= SYMBOL NAME ::= SYMBOL IM-DESCRIPTION ::= MTEXT VAR-NAME ::= SYMBOL VAR-DESCRIPTION ::= MTEXT VALUE ::= MTEXT | SYMBOL | INTEGER VALUE-CANDIDATE ::= VALUE | '(' RANGE-FROM RANGE-TO ')' RANGE-FROM ::= INTEGER RANGE-TO ::= INTEGER CMD-NAME ::= SYMBOL CMD-DESCRIPTION ::= MTEXT TITLE-TEXT ::= MTEXT @endverbatim @c IM-DECLARATION ...to be filled... @c DESCRIPTION ...to be filled... @c VARIABLE-DECLARATION ...to be filled... @c COMMAND-DECLARATION ...to be filled... @c TITLE-TEXT is a text displayed on the screen when this input method is active. @verbatim MAP-LIST ::= '(' 'map' MAP * ')' MAP ::= '(' MAP-NAME RULE * ')' MAP-NAME ::= SYMBOL RULE ::= '(' KEYSEQ MAP-ACTION * ')' KEYSEQ ::= MTEXT | '(' [ SYMBOL | INTEGER ] * ')' @endverbatim @c SYMBOL in the definitions of @c MAP-NAME must not be @c t nor @c nil. @c MTEXT in the definition of @c KEYSEQ consists of characters that can be generated by a keyboard. Therefore @c MTEXT usually contains only ASCII characters. However, if the input method is intended to be used, for instance, with a West European keyboard, @c MTEXT may contain Latin-1 characters. @c SYMBOL in the definition of @c KEYSEQ must be the return value of the minput_event_to_key () function. @c INTEGER in the definition of @c KEYSEQ must be a valid character code. @verbatim MAP-ACTION ::= ACTION ACTION ::= INSERT | DELETE | SELECT | MOVE | MARK | SHOW | HIDE | PUSHBACK | UNDO | SHIFT | CALL | SET | IF | COND | '(' MACRO-NAME ')' PREDEFINED-SYMBOL ::= '@0' | '@1' | '@2' | '@3' | '@4' | '@5' | '@6' | '@7' | '@8' | '@9' | '@<' | '@=' | '@>' | '@-' | '@+' | '@[' | '@]' | '@@ @endverbatim @verbatim MACRO-LIST ::= '(' 'macro' MACRO * ')' MACRO ::= '(' MACRO-NAME MACRO-ACTION * ')' MACRO-NAME ::= SYMBOL MACRO-ACTION ::= ACTION @endverbatim @verbatim MODULE-LIST ::= '(' 'module' MODULE * ')' MODULE ::= '(' MODULE-NAME FUNCTION * ')' MODULE-NAME ::= SYMBOL FUNCTION ::= SYMBOL @endverbatim Each @c MODULE declares the name of external module (i.e. dynamic library) and function names exported by the module. If a @c FUNCTION has name "init", it is called with only the default arguments (see the section about @c CALL) when an input context is created for the input method. If a @c FUNCTION has name "fini", it is called with only the default arguments when an input context is destroyed. @verbatim STATE-LIST ::= '(' 'state' STATE * ')' STATE ::= '(' STATE-NAME BRANCH * ')' STATE-NAME ::= SYMBOL BRANCH ::= '(' MAP-NAME BRANCH-ACTION * ')' | '(' nil BRANCH-ACTION * ')' | '(' t BRANCH-ACTION * ')' @endverbatim In the first form of @c BRANCH, @c MAP-NAME must be an item that appears in @c MAP. In this case, if a key sequence matching one of @c KEYSEQs of @c MAP-NAME is typed, @c BRANCH-ACTIONs are executed. In the second form of @c BRANCH, @c BRANCH-ACTIONs are executed if a key sequence that doesn't match any of @c Branch's of the current state is typed. In the third form of @c BRANCH, @c BRANCH-ACTIONs are executed when we shift to the current state. If the current state is the initial state, @c BRANCH-ACTIONs are executed also when an input context of the input method is created. @verbatim BRANCH-ACTION ::= ACTION @endverbatim An input method has the following two lists of symbols. Each @c PREDEFINED-SYMBOL has a special meaning when used as a marker. Some of the @c PREDEFINED-SYMBOL has a special meaning when used as a candidate index in the @c SELECT action. And, this also has a special meaning.