*** empty log message ***
[m17n/m17n-docs.git] / data-usr / dbformat.txt
1 /*** @addtogroup m17nDatabase */
2 ////
3 /*** @{ */
4 ////
5 /***@defgroup m17nDatabaseFormat DatabaseFormat
6
7 This section describes the formats of predefined @e plist @e type data
8 in the m17n database.
9
10 @section general General format
11
12 The m17n library expects that the function mdatabase_load () returns a
13 plist of a specific format on loading data identified by a specific
14 set of tags.  As the plist format used for the database data is
15 strongly limited, we can use the equivalent text of simple syntax
16 (S-expression) to represent the plist as below.
17
18 The text consists of one or more @e elements .  Each element
19 represents a property, i.e. a single element of a plist, and the
20 sequence of the elements constitute a plist.
21
22 Elements are separated by one or more @e whitespaces, i.e. a space
23 (code 32), a tab (code 9), or a newline (code 10).  Comments begin
24 with a semicolon (<tt>;</tt>) and extend to the end of the line.
25
26 The key and the value of each property are determined based on the
27 form of element as below:
28
29 <ul>
30
31 <li> INTEGER
32
33 An element that matches the regular expression @c -?[0-9]+ or @c
34 0[xX][0-9A-Fa-f]+ represents a property whose key is @c Minteger .  An
35 element matching the former expression is interpreted as an integer in
36 decimal notation, and one matching the latter expression is
37 interpreted as an integer in hexadecimal notation.  The resulting
38 integer is the value of the property.
39
40 For instance, the element 0xA0 represents a property whose value is
41 the integer 160.
42
43 <li> SYMBOL
44
45 An element that matchs the regular expression @c
46 [^-0-9(]([^\\()]|\\.)+ represents a property whose key is @c Msymbol .
47 In the sequence, @c \\t , @c \\n , @c \\r , and @c \\e are replaced
48 with tab (code 9), newline (code 10), carriage return (code 13), and
49 escape (code 27) respectively.  Other characters following a backslash
50 is interpreted as it is.  The symbol having the name of the resulting
51 sequence is the value of the property.
52
53 For instance, the element <tt>abc\ def</tt> represents a property
54 whose value is the symbol of name "abc def".
55
56 <li> M-TEXT
57
58 An element that matches the regular expression @c "([^"]|\\")*"
59 represents a property whose key is @c Mtext .  The backslash escape
60 explained above also applies here.  Moreover, each part in the
61 sequence matching the regular expression @c
62 \\[xX][0-9A-Fa-f][0-9A-Fa-f] is replaced with its hexadecimal
63 interpretation.
64
65 After having resolved the backslash escapes, the byte sequence between
66 the double quotes is interpreted as a UTF-8 sequence and decoded into
67 an M-text.  This M-text is the value of the property.
68
69 <li> PLIST
70
71 An element that is preceded by a left parenthesis, followed zero or
72 more elements, and terminated by a right parenthesis represents a
73 property whose key is @c Mplist .  Parentheses also serve as a
74 separator, which means whitespaces before and after a parenthesis can
75 be omitted.  The value of the property is a plist, which is the result
76 of recursive interpretation of the elements between the parentheses.
77
78 </ul>
79
80 EXAMPLE
81
82 Suppose (K1:V1, K2:V2, ... ,Kn:Vn) represents a plist whose first
83 property key and value are K1 and V1, second key and value are K2 and
84 V2, and so on.  Then the line:
85 @verbatim
86 abc 123 (pqr 0xff) "m\"text" (_\\_ ("string" xyz) -456)
87 @endverbatim
88 is interpreted as follows.
89 @verbatim
90 (Msymbol:abc,
91  Minteger:123,
92  Mplist:(Msymbol:pqr,
93          Minteger:255),
94  Mtext:m"text,
95  Mplist:(Msymbol:_\_,
96          Mplist:(Mtext:string,
97                  Msymbol:xyz),
98          Minteger:-456))
99 @endverbatim
100
101 The default database loader of the m17n library actually read a text
102 of this syntax from the database file.
103
104 Here after we describes the plist format of each data by this syntax.
105
106 @section flt Font Layout Table
107
108 @verbinclude flt.txt
109
110 @section im Input Method
111
112 @verbinclude im.txt */
113 ////
114 /*** @} */
115 ////