1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
Copyright (C) 2001 Information-technology Promotion Agency (IPA)
Copyright (C) 2001-2004
National Institute of Advanced Industrial Science and Technology (AIST)
This file is part of the m17n library documentation.
See the end for copying conditions.
-->
<html><head><meta http-equiv="Content-Type" content="text/html;charset="UTF-8">
<title>The m17n Library</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#ffffff">
<a name="top-of-page"></a>
<hr><center>
<a class="qindex" href="index.html">Main Page</a>
<a class="qindex" href="modules.html">Modules</a>
<!-- <a class="qindex" href="classes.html">Alphabetical List</a> -->
<a class="qindex" href="annotated.html">Data Structures</a>
<!-- <a class="qindex" href="files.html">File List</a> -->
<!-- <a class="qindex" href="functions.html">Data Fields</a> -->
<a class="qindex" href="globals.html">Globals</a>
<a class="qindex" href="pages.html">Appendix</a>
</center>
<hr>
<!-- Generated by Doxygen 1.3.9.1 -->
<h1>Database<br>
<small>
[<a class="el" href="group__m17nShell.html">SHELL API</a>]</small>
</h1>The m17n database and API for it.
<a href="#_details">More...</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Typedefs</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <a class="el" href="group__m17nDatabase.html#ga0">MDatabase</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__m17nDatabase.html#ga0">MDatabase</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Type of database. <a href="#ga0"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="group__m17nDatabase.html#ga0">MDatabase</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__m17nDatabase.html#ga2">mdatabase_find</a> (<a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> tag0, <a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> tag1, <a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> tag2, <a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> tag3)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Look for a data in the database. <a href="#ga2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="group__m17nPlist.html#ga0">MPlist</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__m17nDatabase.html#ga3">mdatabase_list</a> (<a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> tag0, <a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> tag1, <a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> tag2, <a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> tag3)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Return a data list of the m17n database. <a href="#ga3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="group__m17nDatabase.html#ga0">MDatabase</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__m17nDatabase.html#ga4">mdatabase_define</a> (<a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> tag0, <a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> tag1, <a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> tag2, <a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> tag3, void *(*loader)(<a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> *, void *), void *extra_info)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Define a data of the m17n database. <a href="#ga4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__m17nDatabase.html#ga5">mdatabase_load</a> (<a class="el" href="group__m17nDatabase.html#ga0">MDatabase</a> *mdb)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Load a data from the database. <a href="#ga5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__m17nDatabase.html#ga6">mdatabase_tag</a> (<a class="el" href="group__m17nDatabase.html#ga0">MDatabase</a> *mdb)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Get tags of a data. <a href="#ga6"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Variables</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__m17nDatabase.html#ga1">mdatabase_dir</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Directory for application specific data. <a href="#ga1"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
The m17n library dynamically acquires various kinds of information in need from data in the <em> m17n database</em>. Application programs can also add/load their original data to/from the m17n database. The m17n database contains multiple heterogeneous data, and each data is identified by four tags; TAG0, TAG1, TAG2, TAG3. Each tag must be a symbol.<p>
TAG0 specifies the type of data stored in the database as below.<p>
<ul>
<li>If TAG0 is <a class="el" href="group__m17nChartable.html#ga1">Mchar_table</a>, the data is of the <em>chartable</em> <em>type</em> and provides information about each character. In this case, TAG1 specifies the type of the information and must be <a class="el" href="group__m17nSymbol.html#ga4">Msymbol</a>, <a class="el" href="group__m17nPlist.html#ga1">Minteger</a>, <a class="el" href="group__m17nSymbol.html#ga3">Mstring</a>, <a class="el" href="group__m17nPlist.html#ga3">Mtext</a>, or <a class="el" href="group__m17nPlist.html#ga2">Mplist</a>. TAG2 and TAG3 can be any symbols.</li>
</ul>
<ul>
<li>If TAG0 is <a class="el" href="group__m17nCharset.html#ga0">Mcharset</a>, the data is of the <em>charset</em> <em>type</em> and provides a decode/encode mapping table for a charset. In this case, TAG1 must be a symbol representing a charset. TAG2 and TAG3 can be any symbols.</li>
</ul>
<ul>
<li>If TAG0 is neither <a class="el" href="group__m17nChartable.html#ga1">Mchar_table</a> nor <a class="el" href="group__m17nCharset.html#ga0">Mcharset</a>, the data is of the <em>plist</em> <em>type</em>. See the documentation of the <a class="el" href="group__m17nDatabase.html#ga5">mdatabase_load()</a> function for the details. In this case, TAG1, TAG2, and TAG3 can be any symbols.</li>
</ul>
The notation <TAG0, TAG1, TAG2, TAG3> means a data with those tags.<p>
Application programs first calls the <a class="el" href="group__m17nDatabase.html#ga2">mdatabase_find()</a> function to get a pointer to an object of the type <a class="el" href="group__m17nDatabase.html#ga0">MDatabase</a>. That object holds information about the specified data. When it is successfully returned, the <a class="el" href="group__m17nDatabase.html#ga5">mdatabase_load()</a> function loads the data. The implementation of the structure <a class="el" href="group__m17nDatabase.html#ga0">MDatabase</a> is concealed from application programs. <hr><h2>Typedef Documentation</h2>
<a class="anchor" name="ga0" doxytag="m17n.h::MDatabase"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">typedef struct <a class="el" href="group__m17nDatabase.html#ga0">MDatabase</a> <a class="el" href="group__m17nDatabase.html#ga0">MDatabase</a> </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
The type <a class="el" href="group__m17nDatabase.html#ga0">MDatabase</a> is for a database object. Its internal structure is concealed from an application program. </td>
</tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="ga2" doxytag="database.c::mdatabase_find"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"><a class="el" href="group__m17nDatabase.html#ga0">MDatabase</a>* mdatabase_find </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> </td>
<td class="mdname" nowrap> <em>tag0</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap><a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> </td>
<td class="mdname" nowrap> <em>tag1</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap><a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> </td>
<td class="mdname" nowrap> <em>tag2</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap><a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> </td>
<td class="mdname" nowrap> <em>tag3</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
The <a class="el" href="group__m17nDatabase.html#ga2">mdatabase_find()</a> function searches the m17n database for a data who has tags <b>tag0</b> through <b>tag3</b>, and returns a pointer to the data. If such a data is not found, it returns <code>NULL</code>. </td>
</tr>
</table>
<a class="anchor" name="ga3" doxytag="database.c::mdatabase_list"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"><a class="el" href="group__m17nPlist.html#ga0">MPlist</a>* mdatabase_list </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> </td>
<td class="mdname" nowrap> <em>tag0</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap><a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> </td>
<td class="mdname" nowrap> <em>tag1</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap><a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> </td>
<td class="mdname" nowrap> <em>tag2</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap><a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> </td>
<td class="mdname" nowrap> <em>tag3</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
The <a class="el" href="group__m17nDatabase.html#ga3">mdatabase_list()</a> function searches the m17n database for data who have tags <b>tag0</b> through <b>tag3</b>, and returns their list by a plist. The value <a class="el" href="group__m17nSymbol.html#ga1">Mnil</a> in <b>tagn</b> means a wild card that matches any tag. Each element of the plist has key <a class="el" href="group__m17nSymbol.html#ga2">Mt</a> and value a pointer to type <a class="el" href="group__m17nDatabase.html#ga0">MDatabase</a>. </td>
</tr>
</table>
<a class="anchor" name="ga4" doxytag="database.c::mdatabase_define"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"><a class="el" href="group__m17nDatabase.html#ga0">MDatabase</a>* mdatabase_define </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> </td>
<td class="mdname" nowrap> <em>tag0</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap><a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> </td>
<td class="mdname" nowrap> <em>tag1</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap><a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> </td>
<td class="mdname" nowrap> <em>tag2</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap><a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> </td>
<td class="mdname" nowrap> <em>tag3</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>void *(*)(<a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a> *, void *) </td>
<td class="mdname" nowrap> <em>loader</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>void * </td>
<td class="mdname" nowrap> <em>extra_info</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
The <a class="el" href="group__m17nDatabase.html#ga4">mdatabase_define()</a> function defines a data that has tags <b>tag0</b> through <b>tag3</b> and additional information <b>extra_info</b>.<p>
<b>loader</b> is a pointer to a function that loads the data from the database. This function is called from the <a class="el" href="group__m17nDatabase.html#ga5">mdatabase_load()</a> function with the two arguments <b>tags</b> and <b>extra_info</b>. Here, <b>tags</b> is the array of <b>tag0</b> through <b>tag3</b>.<p>
If <b>loader</b> is <code>NULL</code>, the default loader of the m17n library is used. In this case, <b>extra_info</b> must be a string specifying a filename that contains the data.<p>
<dl compact><dt><b>Return value:</b></dt><dd>If the operation was successful, <a class="el" href="group__m17nDatabase.html#ga4">mdatabase_define()</a> returns a pointer to the defined data, which can be used as an argument to <a class="el" href="group__m17nDatabase.html#ga5">mdatabase_load()</a>. Otherwise, it returns <code>NULL</code>.</dd></dl>
<dl compact><dt><b>See Also:</b></dt><dd><a class="el" href="group__m17nDatabase.html#ga5">mdatabase_load()</a>, <a class="el" href="group__m17nDatabase.html#ga4">mdatabase_define()</a> </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="ga5" doxytag="database.c::mdatabase_load"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void* mdatabase_load </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="group__m17nDatabase.html#ga0">MDatabase</a> * </td>
<td class="mdname1" valign="top" nowrap> <em>mdb</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
The <a class="el" href="group__m17nDatabase.html#ga5">mdatabase_load()</a> function loads a data specified in <b>mdb</b> and returns the contents. The type of contents depends on the type of the data.<p>
If the data is of the <em>plist</em> type, this function returns a pointer to <em>plist</em>.<p>
If the database is of the <em>chartable</em> type, it returns a chartable. The default value of the chartable is set according to the second tag of the data as below:<p>
<ul>
<li>If the tag is <a class="el" href="group__m17nSymbol.html#ga4">Msymbol</a>, the default value is <a class="el" href="group__m17nSymbol.html#ga1">Mnil</a>. </li>
<li>If the tag is <a class="el" href="group__m17nPlist.html#ga1">Minteger</a>, the default value is -1. </li>
<li>Otherwise, the default value is <code>NULL</code>.</li>
</ul>
If the data is of the <em>charset</em> type, it returns a plist of length 2 (keys are both <a class="el" href="group__m17nSymbol.html#ga2">Mt</a>). The value of the first element is an array of integers that maps code points to the corresponding character codes. The value of the second element is a chartable of integers that does the reverse mapping. The charset must be defined in advance.<p>
<dl compact><dt><b>See Also:</b></dt><dd><a class="el" href="group__m17nDatabase.html#ga5">mdatabase_load()</a>, <a class="el" href="group__m17nDatabase.html#ga4">mdatabase_define()</a> </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="ga6" doxytag="database.c::mdatabase_tag"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"><a class="el" href="group__m17nSymbol.html#ga0">MSymbol</a>* mdatabase_tag </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="group__m17nDatabase.html#ga0">MDatabase</a> * </td>
<td class="mdname1" valign="top" nowrap> <em>mdb</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
The <a class="el" href="group__m17nDatabase.html#ga6">mdatabase_tag()</a> function returns an array of tags (symbols) that identify the data in <b>mdb</b>. The length of the array is four. </td>
</tr>
</table>
<hr><h2>Variable Documentation</h2>
<a class="anchor" name="ga1" doxytag="database.c::mdatabase_dir"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">char* <a class="el" href="group__m17nDatabase.html#ga1">mdatabase_dir</a> </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
If an application program wants to provide a data specific to the program or a data overriding what supplied by the m17n database, it must set this variable to a name of directory that contains the data files before it calls the macro <a class="el" href="group__m17nIntro.html#ga5">M17N_INIT()</a>. The directory may contain a file "mdb.dir" which contains a list of data definitions in the format described in <a class="el" href="m17nDBFormat.html#mdbDir">mdbDir(5)</a>.<p>
The default value is NULL. </td>
</tr>
</table>
<hr>
<center>
<a href="#top-of-page">Top of this page</a><br><br>
<a class="qindex" href="index.html">Main Page</a>
<a class="qindex" href="modules.html">Modules</a>
<!-- <a class="qindex" href="classes.html">Alphabetical List</a> -->
<a class="qindex" href="annotated.html">Data Structures</a>
<!-- <a class="qindex" href="files.html">File List</a> -->
<!-- <a class="qindex" href="functions.html">Data Fields</a> -->
<a class="qindex" href="globals.html">Globals</a>
<a class="qindex" href="pages.html">Appendix</a>
</center>
<hr>
<ADDRESS>
<a href="http://www.m17n.org/m17n-lib/index.html" target="mulewindow"><img src="parrot.png" align=bottom alt="mulemark" border=0></a>
<A HREF="mailto:mule-aist@m17n.org">mule-aist@m17n.org</a>
</ADDRESS>
</body>
</HTML>
<!-- Copyright information
Copyright (C) 2001 Information-technology Promotion Agency (IPA)
Copyright (C) 2001-2004
National Institute of Advanced Industrial Science and Technology (AIST)
This file is part of the m17n library documentation.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
Invariant Section, Front-Cover Texts "The m17n library documentation",
and no Back-Cover Texts. A copy of the license is included in the
appendix entitled "GNU Free Documentation License".
-->
|