Keyboard Support

Contact and Search Homepage

Header bottom

On this page

(image: Keyman icon)Stores


Stores are a method of grouping multiple characters together, in order to dealwith them all in a similar way. The most common use of stores is to reduce thenumber of rules required in a keyboard by allowing a single rule to matchmultiple characters through the use of stores and the any statement. Anexample of this is given in the tutorial.System stores are stores with a name beginning with &, which have a special purpose, usually defining properties or behaviour of the keyboard.Stores with only a single character are usually used to definenamed constants.

Creating Stores

Stores are created with the store statement:

store( storename ) storecontents

Where storename is an identifier you give to the store, and storecontentsis the store's contents, expressed as a string or a sequence of Unicode or ANSIcharacter constants. Virtual keys and deadkeys can also be used in stores.All stores must be given unique identifiers, and are visible throughout thekeyboard file. A store statement can be placed anywhere in a keyboard sourcefile, and its visibility is unaffected.

Using Stores

Stores are most often used with the any and index keywords. Theany keyword is used in the context or key section of the rule, and willmatch any character in the specified store, remembering its index.

any( store )

The index statement is used to look up a character in a store at the indexwhere a specified any statement matched a character. The anystatement used to obtain the index is referenced by its position in the contextand key, a 1-based number.

index( store, position )

Note that an index statement may reference an any statement whichuses a different store: the only requirement is that the stores used by each havethe same length.


any(vowel) + '^' > index(vowel_circum, 1)

Outputting Stores

The outs statement can be used to output the contents of a store. Thiscan be used in another store, or in the context or output of a rule.

outs( storename )

The IPAMenu.kmn sample keyboard gives an example of the use of stores andouts to create a menu-based keyboard for entry of characters from theInternational Phonetic Alphabet.


If you have any feedback or questions, just fill in this form to get in touch.