/* 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. The definition 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 [ '(version' VERSION ')'] ')' DESCRIPTION ::= '(' 'description' [ MTEXT-OR-GETTEXT | nil] ')' VARIABLE-LIST ::= '(' 'variable' VARIABLE-DECLARATION * ')' COMMAND-LIST ::= '(' 'command' COMMAND-DECLARATION * ')' TITLE ::= '(' 'title' TITLE-TEXT ')' VARIABLE-DECLARATION ::= '(' VAR-NAME [ MTEXT-OR-GETTEXT | nil ] VALUE VALUE-CANDIDATE * ')' COMMAND-DECLARATION ::= '(' CMD-NAME [ MTEXT-OR-GETTEXT | nil ] KEYSEQ * ')' MTEXT-OR-GETTEXT ::= [ MTEXT | '(' '_' MTEXT ')'] LANGUAGE ::= SYMBOL NAME ::= SYMBOL VERSION ::= MTEXT 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 specifies the language and name of this input method. @c VERSION specifies the required minimum version number of the m17n library. The format is "XX.YY.ZZ" where XX is a major version number, YY is a minor version number, and ZZ is a patch level. @c DESCRIPTION specifies the description text of this input method by MTEXT-OR-GETTEXT. It it takes the second form, the text is translated according to the current locale by "gettext" (if the translation is provided). @c VARIABLE-DECLARATION declares a variable used in this input method. If a variable must be initialized to the default value, or is to be customized by a user, it must be declared here. @c COMMAND-DECLARATION declares a command used in this input method. If a command must be bound to the default key sequence, or is to be customized by a user, it must be declared here. @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. Under the X window system, you can quickly check the value using the @c xev command. For example, the return key, the backspace key, and the 0 key on the keypad are represented as @c (Return) , @c (BackSpace) , and @c (KP_0) respectively. If the shift, control, meta, alt, super, and hyper modifiers are used, they are represented by the S- , C- , M- , A- , s- , and H- prefixes respectively in this oreder. Thus, "return with shift with meta with hyper" is @c (S-M-H-Return) . Note that "a with shift" .. "z with shift" are represented simply as A .. Z . Thus "a with shift with meta with hyper" is @c (M-H-A) . @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 | POP | UNDO | UNHANDLE | SHIFT | CALL | SET | IF | COND | '(' MACRO-NAME ')' PREDEFINED-SYMBOL ::= '@0' | '@1' | '@2' | '@3' | '@4' | '@5' | '@6' | '@7' | '@8' | '@9' | '@<' | '@=' | '@>' | '@-' | '@+' | '@[' | '@]' | '@@' | '@-0' | '@-N' | '@+N' @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 [ STATE-TITLE-TEXT ] BRANCH * ')' STATE-NAME ::= SYMBOL STATE-TITLE-TEXT ::= MTEXT BRANCH ::= '(' MAP-NAME BRANCH-ACTION * ')' | '(' nil BRANCH-ACTION * ')' | '(' t BRANCH-ACTION * ')' @endverbatim The optional @c STATE-TITLE-TEXT specifies a title text displayed on the screen when the input method is in this state. If @c STATE-TITLE-TEXT is omitted, @c TITLE-TEXT is used. 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 shifted 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. These are for supporting surround text handling.