From: nisikimi Date: Thu, 26 Nov 2009 01:34:16 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: XML-BEFORE-XEX~4 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=1359647f34c860733a97d5c5352c80aa8ec5905d;p=m17n%2Fm17n-db.git *** empty log message *** --- diff --git a/FORMATS/IM-tut.txt b/FORMATS/IM-tut.txt index b7a3bcb..7d3d181 100644 --- a/FORMATS/IM-tut.txt +++ b/FORMATS/IM-tut.txt @@ -73,25 +73,25 @@ characters through some actions. Tags should be written as they are. Contents and attribute values (written with uppercases here) may be restricted to some patterns. (See m17n-db-xml/MIM/mim.rng for details.) Every child -element but is optional. We will not see the variable-list, +element but <tags> is optional. We will not see the variable-list, command-list, module-list and macro-list in this tutorial. -Input sequence is translated into characters according to the s -in the s and actions in the s. The characters are +Input sequence is translated into characters according to the <rule>s +in the <map>s and actions in the <state>s. The characters are temporarily put into a special place called @c preedit @c buffer. The input method driver uses this buffer to store, change or re-arrenge characters, and when it is done, commit the characters in the buffer to applications. - consists of a that triggers the rule and actions to +<rule> consists of a <keyseq> that triggers the rule and actions to apply to the characters in the preedit buffer. - specifies a sequence of keys in one of the following two +<keyseq> specifies a sequence of keys in one of the following two ways. -@li a list of s or s. A variable that refers -to a , or a function call that returns a or a - can also appear as an element of the list. A symbol +@li a list of <symbol>s or <integer>s. A variable that refers +to a <integer>, or a function call that returns a <symbol> or a +<integer> can also appear as an element of the list. A symbol specifies a key event (the keysym value returned by the xev command) and an integer specifies a character-code. @@ -111,11 +111,11 @@ contain Latin-1 characters.) @endverbatim -These are both valid s. +These are both valid <keyseq>s. -Actions for the translation are defined in s and s. +Actions for the translation are defined in <map>s and <state>s. -Actions are a sequence of . They may or may not have +Actions are a sequence of <funcall>. They may or may not have contents that specify its details. For example, the action for character insertion takes the character to be inserted as its content, the action for calling external function requires the function to be @@ -178,33 +178,33 @@ Here is a simple example of an input method that works as Caps Lock. @endverbatim When an input method is activated, the input method driver is in the -initial condition of the first in the . In this +initial condition of the first <state> in the <state-list>. In this case, it is the state whose @c mname is @c state-init. In the initial condition, no key is being processed and no action is suspended. -Each has es. Each has an attribute @c mname -that defines the correspondent . A has s, and a - has a , so when a key sequence is given, a for -the key sequence is determined, a that contains the rule is -determined, and a that is responsible for the map is +Each <state> has <branch>es. Each <branch> has an attribute @c mname +that defines the correspondent <map>. A <map> has <rule>s, and a +<rule> has a <keyseq>, so when a key sequence is given, a <rule> for +the key sequence is determined, a <map> that contains the rule is +determined, and a <branch> that is responsible for the map is determined. When the input method driver receives a key sequence "a", it searches -for a whose part matches with "a", and finds one in -the whose @c mname is @c map-to-upper. The selected branch is +for a <rule> whose <keyseq> part matches with "a", and finds one in +the <map> whose @c mname is @c map-to-upper. The selected branch is the one whose @c mname is @c map-to-upper. -When a given key sequence does not match with any in any -that corresponds with a of the current , that event is +When a given key sequence does not match with any <rule> in any <map> +that corresponds with a <branch> of the current <state>, that event is unhandled and given back to the application program. -The driver then executes actions of the . In this case, it +The driver then executes actions of the <rule>. In this case, it is @verbatim A @endverbatim that inserts an "A" in the preedit buffer. Then actions in the -, if any, are executed. When all actions in the rules and the +s, but not in s. -Actions in s are executed only after a matching rule has been +We have so far explained actions in <rule>s, but not in <branch>s. +Actions in <branch>s are executed only after a matching rule has been determined its actions have been executed. A typical use of action in -a is to shift to a different state. +a <branch> is to shift to a different state. -In order to see how actions in a are used, let us modify the +In order to see how actions in a <branch> are used, let us modify the current input method to upcase only such letters that start a word (i.e. to capitalize). For this purpose, the "state-init" state should be modified as below. @@ -275,7 +275,7 @@ be modified as below. @endverbatim -The action in here is that shifts the input method +The action in <state> here is <shift> that shifts the input method driver to another state whose sname is @c state-non-upcase. Let us define the state. It has one branch and one catchall. @@ -400,7 +400,7 @@ whose Unicode character code is 32 (i.e. SPACE). The variable value can be set to any term. Terms contain, in addtion to other items, integer values, variable references and function -calls. (See EXPR.txt for the definition of .) For example, +calls. (See EXPR.txt for the definition of <term>.) For example, the action below contains two variable references and two function calls and sets the value of the variable @c X to @c Y*32+Z. @@ -413,7 +413,7 @@ and sets the value of the variable @c X to @c Y*32+Z. @endverbatim - and here, in addiotn to others, are calls to predefined +<mul> and <add> here, in addiotn to others, are calls to predefined functions. Predefined functions include arithmetic and bitwise operators (add, subtract, etc.) , relational operators (equal to, greater than, etc.), logical operators (and, not, etc.), list @@ -432,20 +432,20 @@ that has the following form. @endverbatim - checks the value of EXPRESSION in s one by one, and when -the whose EXPRESSION has a nonzero value is encountered, -ACTIONs in that are performed. +<cond> checks the value of EXPRESSION in <list>s one by one, and when +the <list> whose EXPRESSION has a nonzero value is encountered, +ACTIONs in that <list> are performed. Now let us return to surrounding text support. Calls to the -predefined function returns -1 if surrounding +predefined function <surround-text-flag> returns -1 if surrounding text is supported, and -2 if not. In order to know what characters surrounds the input spot, we need the -help of and . indicates a position in the -buffer and the predefined function returns the character at +help of <marker> and <char-at>. <marker> indicates a position in the +buffer and the predefined function <char-at> returns the character at the specified position. -@@+N and @@-N (N is an positive +<marker>@@+N</marker> and <marker>@@-N<marker> (N is an positive integer) mark the N-th preceding or following position, and are used to specify a character inside or outside of the preedit buffer. If the number of preceding or following characters in the preedit buffer @@ -459,7 +459,7 @@ and your current position in the preedit buffer is between "d" and "e": ABCdefGHI @endverbatim -The calls to the functions return the following values. +The calls to the <char-at> functions return the following values. @verbatim -3 --> ?B @@ -554,8 +554,8 @@ Now we are ready to write a new version of the input method The above example contains the new action <delete>, Several markers are predefined to mark a specific position in the preedit -buffer. When the content of is a marker, a function call to -the deletes the characters between the marked position and +buffer. When the content of <delete> is a marker, a function call to +the <delete> deletes the characters between the marked position and the current position. The examples are: @verbatim @@ -575,12 +575,12 @@ lower letter key falls into the branch whose @c mname is @c map-to-upper and handled by <rule>s in that <map>, the key is changed into the corresponding uppercase character and inserted into the preedit buffer. Now this uppercase character can be accessed -with -1. +with <char-at><marker>-1</marker></char-at>. How can we tell whether the new character should be left as an uppercase or changed back to a lowercase? We need to check the character before. That character can be accessed by --2. +<char-at><marker>-2</marker></char-at>. The character is checked by the @c EXPRESSION part of the <list> in the first <cond> of the branch for @c map-to-upper. It is the