This file is indexed.

/usr/include/m17n.h is in libm17n-dev 1.6.3-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
/* m17n.h -- header file for the SHELL API of the m17n library.
   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
     National Institute of Advanced Industrial Science and Technology (AIST)
     Registration Number H15PRO112

   This file is part of the m17n library.

   The m17n library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public License
   as published by the Free Software Foundation; either version 2.1 of
   the License, or (at your option) any later version.

   The m17n library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the m17n library; if not, write to the Free
   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   02111-1307, USA.  */

#ifndef _M17N_H_
#define _M17N_H_

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#ifndef _M17N_CORE_H_
#include <m17n-core.h>
#endif

M17N_BEGIN_HEADER

#if !defined (FOR_DOXYGEN) || defined (DOXYGEN_INTERNAL_MODULE)
extern void m17n_init (void);
#undef M17N_INIT
#ifdef _M17N_FLT_H_
#define M17N_INIT()	\
  do {			\
    m17n_init ();	\
    m17n_init_flt ();	\
  } while (0)
#else  /* not _M17N_FLT_H_ */
#define M17N_INIT() m17n_init ()
#endif	/* not _M17N_FLT_H_ */

extern void m17n_fini (void);
#undef M17N_FINI
#ifdef _M17N_FLT_H_
#define M17N_FINI()	\
  do {			\
    m17n_fini_flt ();	\
    m17n_fini ();	\
  } while (0)
#else  /* not _M17N_FLT_H_ */
#define M17N_FINI() m17n_fini ()
#endif	/* not _M17N_FLT_H_ */

#endif

/***en @defgroup m17nShell SHELL API
    @brief API provided by libm17n.so */
/***ja @defgroup m17nShell ¥·¥§¥ë API
    @brief libm17n.so ¤¬Ä󶡤¹¤ë API */
/*=*/

/*
 *  (11) Functions related to the m17n database
 */
/*=*/

/*=*/
/* (S2) Charset staffs */
/*=*/

/*** @ingroup m17nShell */
/***en @defgroup m17nCharset Charset */
/***ja @defgroup m17nCharset ʸ»ú¥»¥Ã¥È */
/*=*/

#if !defined (FOR_DOXYGEN) || defined (DOXYGEN_INTERNAL_MODULE)
#define MCHAR_INVALID_CODE 0xFFFFFFFF
#endif

/* Predefined charsets */ 
extern MSymbol Mcharset_ascii;
extern MSymbol Mcharset_iso_8859_1;
extern MSymbol Mcharset_unicode;
extern MSymbol Mcharset_m17n;
extern MSymbol Mcharset_binary;

/* Predefined keys for mchar_define_charset ().  */ 
extern MSymbol Mmethod;
extern MSymbol Mdimension;
extern MSymbol Mmin_range;
extern MSymbol Mmax_range;
extern MSymbol Mmin_code;
extern MSymbol Mmax_code;
extern MSymbol Mascii_compatible;
extern MSymbol Mfinal_byte;
extern MSymbol Mrevision;
extern MSymbol Mmin_char;
extern MSymbol Mmapfile;
extern MSymbol Mparents;
extern MSymbol Msubset_offset;
extern MSymbol Mdefine_coding;
extern MSymbol Maliases;

/* Methods of a charset.  */
extern MSymbol Moffset;
extern MSymbol Mmap;
extern MSymbol Munify;
extern MSymbol Msubset;
extern MSymbol Msuperset;

/* etc. */
extern MSymbol mchar_define_charset (const char *name, MPlist *plist);

extern MSymbol mchar_resolve_charset (MSymbol symbol);

extern int mchar_list_charset (MSymbol **symbols);

extern int mchar_decode (MSymbol charset_name, unsigned code);

extern unsigned mchar_encode (MSymbol charset_name, int c);

extern int mchar_map_charset (MSymbol charset_name,
			      void (*func) (int from, int to, void *arg),
			      void *func_arg);

/*=*/

/* (S3) code conversion */
/*=*/
/*** @ingroup m17nShell */
/***en @defgroup m17nConv Code Conversion */
/***ja @defgroup m17nConv ¥³¡¼¥ÉÊÑ´¹ */
/*=*/

/* Predefined coding systems */
extern MSymbol Mcoding_us_ascii;
extern MSymbol Mcoding_iso_8859_1;
extern MSymbol Mcoding_utf_8;
extern MSymbol Mcoding_utf_8_full;
extern MSymbol Mcoding_utf_16;
extern MSymbol Mcoding_utf_16be;
extern MSymbol Mcoding_utf_16le;
extern MSymbol Mcoding_utf_32;
extern MSymbol Mcoding_utf_32be;
extern MSymbol Mcoding_utf_32le;
extern MSymbol Mcoding_sjis;

/* Parameter keys for mconv_define_coding ().  */
extern MSymbol Mtype;
extern MSymbol Mcharsets;
extern MSymbol Mflags;
extern MSymbol Mdesignation;
extern MSymbol Minvocation;
extern MSymbol Mcode_unit;
extern MSymbol Mbom;
extern MSymbol Mlittle_endian;

/* Symbols representing coding system type.  */
extern MSymbol Mutf;
extern MSymbol Miso_2022;

/* Symbols appearing in the value of Mfrag parameter.  */
extern MSymbol Mreset_at_eol;
extern MSymbol Mreset_at_cntl;
extern MSymbol Meight_bit;
extern MSymbol Mlong_form;
extern MSymbol Mdesignation_g0;
extern MSymbol Mdesignation_g1;
extern MSymbol Mdesignation_ctext;
extern MSymbol Mdesignation_ctext_ext;
extern MSymbol Mlocking_shift;
extern MSymbol Msingle_shift;
extern MSymbol Msingle_shift_7;
extern MSymbol Meuc_tw_shift;
extern MSymbol Miso_6429;
extern MSymbol Mrevision_number;
extern MSymbol Mfull_support;

/* etc */
extern MSymbol Mcoding;
extern MSymbol Mmaybe;

/*** @ingroup m17nConv */
/***en
    @brief Codes that represent the result of code conversion.

    One of these values is set in @c MConverter-\>result.   */

/***ja
    @brief ¥³¡¼¥ÉÊÑ´¹¤Î·ë²Ì¤ò¼¨¤¹¥³¡¼¥É.

    ¤³¤ì¤é¤ÎÃͤΤ¦¤Á°ì¤Ä¤¬ @c MConverter-\>result ¤ËÀßÄꤵ¤ì¤ë¡£  */

enum MConversionResult
  {
    /***en Code conversion is successful. */
    /***ja ¥³¡¼¥ÉÊÑ´¹¤ÏÀ®¸ù. */
    MCONVERSION_RESULT_SUCCESS,

    /***en On decoding, the source contains an invalid byte. */
    /***ja ¥Ç¥³¡¼¥É»þ¡¢¥½¡¼¥¹¤ËÉÔÀµ¤Ê¥Ð¥¤¥È¤¬´Þ¤Þ¤ì¤Æ¤¤¤ë. */
    MCONVERSION_RESULT_INVALID_BYTE,

    /***en On encoding, the source contains a character that cannot be
	encoded by the specified coding system. */
    /***ja ¥¨¥ó¥³¡¼¥É»þ¡¢»ØÄê¤Î¥³¡¼¥É·Ï¤Ç¥¨¥ó¥³¡¼¥É¤Ç¤­¤Ê¤¤Ê¸»ú¤¬¥½¡¼¥¹¤Ë´Þ¤Þ¤ì¤Æ¤¤¤ë. */
    MCONVERSION_RESULT_INVALID_CHAR,

    /***en On decoding, the source ends with an incomplete byte sequence. */
    /***ja ¥Ç¥³¡¼¥É»þ¡¢ÉÔ´°Á´¤Ê¥Ð¥¤¥ÈÎó¤Ç¥½¡¼¥¹¤¬½ª¤ï¤Ã¤Æ¤¤¤ë¡£*/
    MCONVERSION_RESULT_INSUFFICIENT_SRC,

    /***en On encoding, the destination is too short to store the result. */
    /***ja ¥¨¥ó¥³¡¼¥É»þ¡¢·ë²Ì¤ò³ÊǼ¤¹¤ëÎΰ褬û¤«¤¹¤®¤ë¡£ */
    MCONVERSION_RESULT_INSUFFICIENT_DST,

    /***en An I/O error occurred in the conversion.  */
    /***ja ¥³¡¼¥ÉÊÑ´¹Ãæ¤Ë I/O ¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿¡£  */
    MCONVERSION_RESULT_IO_ERROR
  };
/*=*/

/*** @ingroup m17nConv */
/***en
    @brief Structure to be used in code conversion.

    Structure to be used in code conversion.  The first three members
    are to control the conversion.  */

/***ja
    @brief ¥³¡¼¥ÉÊÑ´¹¤ËÍѤ¤¤é¤ì¤ë¹½Â¤ÂÎ.

    ¥³¡¼¥ÉÊÑ´¹¤ËÍѤ¤¤é¤ì¤ë¹½Â¤ÂΡ£ºÇ½é¤Î£³¤Ä¤Î¥á¥ó¥Ð¤ÏÊÑ´¹¤òÀ©¸æ¤¹¤ë¡£

    @latexonly \IPAlabel{MConverter} @endlatexonly  
*/

typedef struct
{
  /***en
      Set the value to nonzero if the conversion should be lenient.
      By default, the conversion is strict (i.e. not lenient).

      If the conversion is strict, the converter stops at the first
      invalid byte (on decoding) or at the first character not
      supported by the coding system (on encoding).  If this happens,
      @c MConverter-\>result is set to @c
      MCONVERSION_RESULT_INVALID_BYTE or @c
      MCONVERSION_RESULT_INVALID_CHAR accordingly.

      If the conversion is lenient, on decoding, an invalid byte is
      kept per se, and on encoding, an invalid character is replaced
      with "<U+XXXX>" (if the character is a Unicode character) or
      with "<M+XXXXXX>" (otherwise).  */

  /***ja 
      ¸·Ì©¤ÊÊÑ´¹¤¬É¬ÍפǤʤ¤¾ì¹ç¤ËÃͤò 0 °Ê³°¤Ë¤¹¤ë¡£
      ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢ÊÑ´¹¤Ï¸·Ì©¤Ç¤¢¤ë¡£

      ÊÑ´¹¤¬¸·Ì©¤È¤Ï¡¢¥Ç¥³¡¼¥É¤ÎºÝ¤Ë¤ÏºÇ½é¤ÎÉÔÀµ¤Ê¥Ð¥¤¥È¤Ç¥³¥ó¥Ð¡¼¥¿¤¬»ß¤Þ¤ë¤³¤È¡¢
      ¥¨¥ó¥³¡¼¥É¤ÎºÝ¤Ë¤ÏÊÑ´¹¤µ¤ì¤ë¥³¡¼¥É·Ï¤Ç¥µ¥Ý¡¼¥È¤µ¤ì¤Ê¤¤ºÇ½é¤Îʸ»ú¤Ç¥³¥ó¥Ð¡¼¥¿¤¬»ß¤Þ¤ë¤³¤È¤ò»Ø¤¹¡£
      ¤³¤ì¤é¤Î¾ì¹ç¡¢@c MConverter-\>result ¤Ï¤½¤ì¤¾¤ì @c
      MCONVERSION_RESULT_INVALID_BYTE ¤«@c
      MCONVERSION_RESULT_INVALID_CHAR ¤È¤Ê¤ë¡£

      ÊÑ´¹¤¬¸·Ì©¤Ç¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢¥Ç¥³¡¼¥É¤ÎºÝ¤ÎÉÔÀµ¤Ê¥Ð¥¤¥È¤Ï¤½¤Î¥Ð¥¤¥È¤Î¤Þ¤Þ»Ä¤ë¡£
      ¤Þ¤¿¥¨¥ó¥³¡¼¥É¤ÎºÝ¤Ë¤Ï¡¢ÉÔÀµ¤Êʸ»ú¤¬ Unicode ʸ»ú¤Î¾ì¹ç¤Ë¤Ï "<U+XXXX>"
      ¤Ë¡¢¤½¤¦¤Ç¤Ê¤¤¾ì¹ç¤Ë¤Ï "<M+XXXXXX>" ¤ËÃÖ¤­´¹¤¨¤é¤ì¤ë¡£  */

  int lenient;

  /***en
      Set the value to nonzero before decoding or encoding the last
      block of the byte sequence or the character sequence
      respectively.  The value influences the conversion as below.

      On decoding, in the case that the last few bytes are too short
      to form a valid byte sequence:

	If the value is nonzero, the conversion terminates by error
	(MCONVERSION_RESULT_INVALID_BYTE) at the first byte of the
	sequence.

	If the value is zero, the conversion terminates successfully.
	Those bytes are stored in the converter as carryover and are
	prepended to the byte sequence of the further conversion.

      On encoding, in the case that the coding system is context
      dependent:

	If the value is nonzero, the conversion may produce a byte
	sequence at the end to reset the context to the initial state
	even if the source characters are zero.

	If the value is zero, the conversion never produce such a byte
	sequence at the end.  */

/***ja 

     ¥Ð¥¤¥ÈÎó¤Î½ªÃ¼¤Î¥Ö¥í¥Ã¥¯¤ò¥Ç¥³¡¼¥É¤¹¤ëºÝ¡¢¤Þ¤¿¤Ïʸ»úÎó¤Î½ªÃ¼¤Î¥Ö¥í¥Ã¥¯¤ò¥¨¥ó¥³¡¼¥É¤¹¤ëºÝ¤Ï¡¢Ãͤò
     0 °Ê³°¤Ë¤¹¤ë¡£¤³¤ÎÃͤϰʲ¼¤Î¤è¤¦¤ËÊÑ´¹¤Ë±Æ¶Á¤¹¤ë¡£

     ¥Ç¥³¡¼¥Ç¥£¥ó¥°¤ÎºÝ¤ËºÇ¸å¤Î¿ô¥Ð¥¤¥È¤¬Àµ¤·¤¤¥Ð¥¤¥È¥·¡¼¥¯¥¨¥ó¥¹¤ò·ÁÀ®¤¹¤ë¤Ë¤Ïû¤¹¤®¤ë¾ì¹ç¡§

       Ãͤ¬ 0 ¤Ç¤Ê¤±¤ì¤Ð¡¢ÊÑ´¹¤Ï¤½¤Î¥·¡¼¥¯¥¨¥ó¥¹¤ÎºÇ½é¤Î¥Ð¥¤¥È¤Ë¤ª¤¤¤Æ¡¢¥¨¥é¡¼
       (MCONVERSION_RESULT_INVALID_BYTE) ¤Ç½ª¤ë¡£

       Ãͤ¬ 0 ¤Ê¤é¤Ð¡¢ÊÑ´¹¤ÏÀ®¸ù¤·¤Æ½ª¤ë¡£
       ÌäÂê¤Î¿ô¥Ð¥¤¥È¤Ï¥­¥ã¥ê¡¼¥ª¡¼¥Ð¤È¤·¤Æ¥³¥ó¥Ð¡¼¥¿¤ËÊÝ»ý¤µ¤ì¡¢ÊÑ´¹¤Î³¤­¤ò¹Ô¤¦ºÝ¤ËÊÑ´¹¤¹¤ë¥Ð¥¤¥ÈÎó¤ÎÁ°¤ËÉÕ¤±¤é¤ì¤ë¡£

     ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤ÎºÝ¤Ë¥³¡¼¥É·Ï¤¬Ê¸Ì®°Í¸¤Î¾ì¹ç¡¢

       Ãͤ¬ 0 ¤Ç¤Ê¤±¤ì¤Ð¡¢¥³¥ó¥Æ¥­¥¹¥È¤òºÇ½é¤ËÌ᤹¤¿¤á¤Î¥Ð¥¤¥ÈÎ󤬥½¡¼¥¹¤Îʸ»ú¤È¤«¤«¤ï¤ê¤Ê¤¯ÊÑ´¹¤Î·ë²ÌÀ¸À®¤µ¤ì¤ë¤³¤È¤¬¤¢¤ë¡£

       Ãͤ¬ 0 ¤Ê¤é¤Ð¡¢¤½¤Î¤è¤¦¤Ê¥Ð¥¤¥ÈÎó¤ÏÀ¸À®¤µ¤ì¤Ê¤¤¡£

	 */

  int last_block;

  /***en
      If the value is nonzero, it specifies at most how many
      characters to convert.  */
  /***ja
      0 ¤Ç¤Ê¤±¤ì¤Ð¡¢ÊÑ´¹¤µ¤ì¤ëºÇÂç¤Îʸ»ú¿ô¤ò»ØÄꤹ¤ë¡£
      */

  unsigned at_most;

  /***en
      The following three members are to report the result of the
      conversion.  */
  /***ja
      °Ê²¼¤Î£³¤Ä¤Î¥á¥ó¥Ð¤ÏÊÑ´¹¤Î·ë²Ì¤òɽ¤¹¤¿¤á¤Î¤â¤Î¤Ç¤¢¤ë¡£  */

  /***en
      Number of characters most recently decoded or encoded. */
  /***ja
      ºÇ¶á¤Ë¥Ç¥³¡¼¥É/¥¨¥ó¥³¡¼¥É¤µ¤ì¤¿Ê¸»ú¿ô¡£ */

  int nchars;

  /***en
      Number of bytes recently decoded or encoded. */

  /***ja
      ºÇ¶á¤Ë¥Ç¥³¡¼¥É/¥¨¥ó¥³¡¼¥É¤µ¤ì¤¿¥Ð¥¤¥È¿ô¡£ */

  int nbytes;

  /***en
      Result code of the conversion. */

  /***ja
      ¥³¡¼¥ÉÊÑ´¹¤Î·ë²Ì¤ò¼¨¤¹¥³¡¼¥É¡£ */

  enum MConversionResult result;

  /***en
      Various information about the status of code conversion.  The
      contents depend on the type of coding system.  It is assured
      that @c status is aligned so that any type of casting is safe
      and at least 256 bytes of memory space can be used.  */

  /***ja
      ¥³¡¼¥ÉÊÑ´¹¤Î¾õ¶·¤Ë´Ø¤¹¤ë¼ï¡¹¤Î¾ðÊó¡£ÆâÍƤϥ³¡¼¥É·Ï¤Î¥¿¥¤¥×¤Ë¤è¤Ã¤Æ°Û¤Ê¤ë¡£
      @c status ¤Ï¤É¤Î¤è¤¦¤Ê·¿¤Ø¤Î¥­¥ã¥¹¥È¤ËÂФ·¤Æ¤â°ÂÁ´¤Ê¤è¤¦¤Ë¥á¥â¥ê¥¢¥é¥¤¥ó¤µ¤ì¤Æ¤ª¤ê¡¢¤Þ¤¿ºÇÄã256¥Ð¥¤¥È¤Î¥á¥â¥êÎΰ褬»È¤¨¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£  */

  union {
    void *ptr;
    double dbl;
    char c[256];
  } status;

  /***en
      This member is for internally use only.  An application program
      should never touch it.  */
  /***ja ¤³¤Î¥á¥ó¥Ð¤ÏÆâÉôŪ¤Ë»ÈÍѤµ¤ì¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤Ï¿¨¤ì¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ */
  void *internal_info;
} MConverter;
/*=*/

/*** @ingroup m17nConv */
/***en 
    @brief Types of coding system.  */
/***ja 
    @brief ¥³¡¼¥É·Ï¤Î¥¿¥¤¥×.  */

enum MCodingType
  {
    /***en
	A coding system of this type supports charsets directly.
	The dimension of each charset defines the length of bytes to
	represent a single character of the charset, and a byte
	sequence directly represents the code-point of a character.
	The m17n library provides the default decoding and encoding
	routines of this type.  */

    /***ja
	¤³¤Î¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤Ïʸ»ú¥»¥Ã¥È¤òľÀÜ¥µ¥Ý¡¼¥È¤¹¤ë¡£
	³Æʸ»ú¥»¥Ã¥È¤Î¼¡¸µ¤È¤Ï¡¢¤½¤Îʸ»ú¥»¥Ã¥È¤Ç°ìʸ»ú¤òɽ¸½¤¹¤ë¤¿¤á¤ËɬÍפʥХ¤¥È¿ô¤Ç¤¢¤ê¡¢¥Ð¥¤¥ÈÎó¤Ïʸ»ú¤Î¥³¡¼¥É¥Ý¥¤¥ó¥È¤òľÀÜɽ¤¹¡£
	m17n ¥é¥¤¥Ö¥é¥ê¤Ï¤³¤Î¥¿¥¤¥×ÍѤΥǥե©¥ë¥È¤Î¥¨¥ó¥³¡¼¥É¡¿¥Ç¥³¡¼¥É¥ë¡¼¥Æ¥£¥ó¤òÄ󶡤¹¤ë¡£  */

    MCODING_TYPE_CHARSET,

    /***en
	A coding system of this type supports byte sequences of a
	UTF (UTF-8, UTF-16, UTF-32) like structure.
	The m17n library provides the default decoding and encoding
	routines of this type.  */

    /***ja
	¤³¤Î¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤Ï¡¢UTF ·Ï (UTF-8, UTF-16, UTF-32) ¤Î¥Ð¥¤¥ÈÎó¤ò¥µ¥Ý¡¼¥È¤¹¤ë¡£
	m17n ¥é¥¤¥Ö¥é¥ê¤Ï¤³¤Î¥¿¥¤¥×ÍѤΥǥե©¥ë¥È¤Î¥¨¥ó¥³¡¼¥É¡¿¥Ç¥³¡¼¥É¥ë¡¼¥Æ¥£¥ó¤òÄ󶡤¹¤ë¡£  */

    MCODING_TYPE_UTF,

    /***en
	A coding system of this type supports byte sequences of an
	ISO-2022 like structure.  The details of each structure are
	specified by @c MCodingInfoISO2022 .
	The m17n library provides decoding and encoding routines of
	this type.  */

    /***ja 
        ¤³¤Î¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤Ï¡¢ISO-2022 ·Ï¤Î¥Ð¥¤¥ÈÎó¤ò¥µ¥Ý¡¼¥È¤¹¤ë¡£
	³Æ¥³¡¼¥É·Ï¤Î¹½Â¤¤Î¾ÜºÙ¤Ï @c MCodingInfoISO2022 ¤Ç»ØÄꤵ¤ì¤ë¡£
	m17n ¥é¥¤¥Ö¥é¥ê¤Ï¤³¤Î¥¿¥¤¥×ÍѤΥǥե©¥ë¥È¤Î¥¨¥ó¥³¡¼¥É¡¿¥Ç¥³¡¼¥É¥ë¡¼¥Æ¥£¥ó¤òÄ󶡤¹¤ë¡£  */

    MCODING_TYPE_ISO_2022,

    /***en
	A coding system of this type is for byte sequences of
	miscellaneous structures.
	The m17n library does not provide decoding and encoding
	routines of this type.  They must be provided by the
	application program.  */

    /***ja
	¤³¤Î¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤Ï¡¢¤½¤Î¾¤Î¹½Â¤¤Î¥Ð¥¤¥ÈÎó¤Î¤¿¤á¤Î¤â¤Î¤Ç¤¢¤ë¡£
	m17n ¥é¥¤¥Ö¥é¥ê¤Ï¤³¤Î¥¿¥¤¥×ÍѤΥ¨¥ó¥³¡¼¥É¡¿¥Ç¥³¡¼¥É¥ë¡¼¥Æ¥£¥ó¤òÄ󶡤·¤Ê¤¤¤Î¤Ç¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¦¤Ç½àÈ÷¤¹¤ëɬÍפ¬¤¢¤ë¡£  */

    MCODING_TYPE_MISC
  };
/*=*/

/*** @ingroup m17nConv */
/***en 
    @brief  Bit-masks to specify the detail of coding system whose type is MCODING_TYPE_ISO_2022.  */
/***ja 
    @brief MCODING_TYPE_ISO_2022 ¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤Î¾ÜºÙ¤òɽ¤ï¤¹¥Ó¥Ã¥È¥Þ¥¹¥¯.  */

enum MCodingFlagISO2022
  {
    /***en
	On encoding, reset the invocation and designation status to
	initial at end of line.  */
    /***ja ¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢¹ÔËö¤Ç¸Æ¤Ó½Ð¤· (invocation) ¤È»Ø¼¨
	(designation) ¤Î¾õÂÖ¤ò½é´üÃͤËÌ᤹¡£   */
    MCODING_ISO_RESET_AT_EOL =		0x1,

    /***en
	On encoding, reset the invocation and designation status to
	initial before any control codes.  */
    /***ja
	¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢¤¹¤Ù¤Æ¤ÎÀ©¸æʸ»ú¤ÎÁ°¤Ç¡¢¸Æ¤Ó½Ð¤·
	(invocation) ¤È»Ø¼¨ (designation) ¤Î¾õÂÖ¤ò½é´üÃͤËÌ᤹¡£        */
    MCODING_ISO_RESET_AT_CNTL =		0x2,

    /***en
	Use the right graphic plane.  */
    /***ja
	¿Þ·Áʸ»ú½¸¹ç¤Î±¦Â¦¤ò»È¤¦¡£  */
    MCODING_ISO_EIGHT_BIT =		0x4,

    /***en
	Use the non-standard 4 bytes format for designation sequence
	for charsets JISX0208-1978, GB2312, and JISX0208-1983.  */
    /***ja
	JISX0208-1978, GB2312, JISX0208-1983 
	¤Îʸ»ú½¸¹ç¤ËÂФ¹¤ë»Ø¼¨¥·¡¼¥¯¥¨¥ó¥¹¤È¤·¤Æ¡¢Èóɸ½à¤Î4¥Ð¥¤¥È·Á¼°¤òÍѤ¤¤ë¡£ */

    MCODING_ISO_LONG_FORM =		0x8,

    /***en
	On encoding, unless explicitly specified, designate charsets
	to G0.  */
    /***ja 
        ¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢Æä˻ØÄꤵ¤ì¤Ê¤¤¸Â¤ê¡¢Ê¸»ú½¸¹ç¤ò G0 
	¤Ë»Ø¼¨¤¹¤ë¡£*/
    MCODING_ISO_DESIGNATION_G0 =		0x10,

    /***en
	On encoding, unless explicitly specified, designate charsets
	except for ASCII to G1.  */
    /***ja
	¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢Æä˻ØÄꤵ¤ì¤Ê¤¤¸Â¤ê¡¢ASCII °Ê³°¤Îʸ»ú½¸¹ç¤ò 
	G1 ¤Ë»Ø¼¨¤¹¤ë¡£*/
    MCODING_ISO_DESIGNATION_G1 =		0x20,

    /***en
	On encoding, unless explicitly specified, designate 94-chars
	charsets to G0, 96-chars charsets to G1.  */
    /***ja
	¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢Æä˻ØÄꤵ¤ì¤Ê¤¤¸Â¤ê¡¢94ʸ»ú½¸¹ç¤ò G0 
	¤Ë¡¢96ʸ»ú½¸¹ç¤ò G1 ¤Ë»Ø¼¨¤¹¤ë¡£*/
    MCODING_ISO_DESIGNATION_CTEXT =	0x40,

    /***en
	On encoding, encode such charsets not conforming to ISO-2022
	by ESC % / ..., and encode non-supported Unicode characters by
	ESC % G ... ESC % @@ .  On decoding, handle those escape
	sequences.  */
    /***ja
	¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢ISO-2022 ¤Ë¹çÃפ·¤Ê¤¤Ê¸»ú½¸¹ç¤ò ESC % / ... 
	¤Ç¥¨¥ó¥³¡¼¥É¤¹¤ë¡£¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤ Unicode ʸ»ú¤Ï ESC % G ...
	ESC % @@ ¤Ç¥¨¥ó¥³¡¼¥É¤¹¤ë¡£
	¥Ç¥³¡¼¥É¤ÎºÝ¡¢¤³¤ì¤é¤Î¥¨¥¹¥±¡¼¥×¡¦¥·¡¼¥±¥ó¥¹¤ò²ò¼á¤¹¤ë¡£  */
    MCODING_ISO_DESIGNATION_CTEXT_EXT =	0x80,

    /***en
	Use locking shift.  */
    /***ja
	¥í¥Ã¥­¥ó¥°¥·¥Õ¥È¤ò»È¤¦¡£  */
    MCODING_ISO_LOCKING_SHIFT =	0x100,

    /***en
	Use single shift (SS2 (0x8E or ESC N), SS3 (0x8F or ESC O)).  */
    /***ja
	¥·¥ó¥°¥ë¥·¥Õ¥È (SS2 (0x8E or ESC N), SS3 (0x8F or ESC O)) ¤ò»È¤¦¡£  */
    MCODING_ISO_SINGLE_SHIFT =	0x200,

    /***en
	Use 7-bit single shift 2 (SS2 (0x19)).  */
    /***ja
	7¥Ó¥Ã¥È¥·¥ó¥°¥ë¥·¥Õ¥È 2 (SS2 (0x19)) ¤ò»È¤¦¡£  */
    MCODING_ISO_SINGLE_SHIFT_7 =	0x400,

    /***en
	Use EUC-TW like special shifting.  */
    /***ja
	EUC-TW É÷¤ÎÆÃÊ̤ʥ·¥Õ¥È¤ò»È¤¦¡£  */
    MCODING_ISO_EUC_TW_SHIFT =	0x800,

    /***en
	Use ISO-6429 escape sequences to indicate direction.
	Not yet implemented.  */
    /***ja
	ISO-6429 ¤Î¥¨¥¹¥±¡¼¥×¥·¡¼¥¯¥¨¥ó¥¹¤ÇÊý¸þ¤ò»Ø¼¨¤¹¤ë¡£Ì¤¼ÂÁõ¡£ */
    MCODING_ISO_ISO6429 =		0x1000,

    /***en
	On encoding, if a charset has revision number, produce escape
	sequences to specify the number.  */
    /***ja
	¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢Ê¸»ú¥»¥Ã¥È¤Ë revision number 
	¤¬¤¢¤ì¤Ð¤½¤ì¤òɽ¤ï¤¹¥¨¥¹¥±¡¼¥×¥·¡¼¥¯¥¨¥ó¥¹¤òÀ¸À®¤¹¤ë¡£        */
    MCODING_ISO_REVISION_NUMBER =	0x2000,

    /***en
	Support all ISO-2022 charsets.  */
    /***ja
	ISO-2022 ¤ÎÁ´Ê¸»ú½¸¹ç¤ò¥µ¥Ý¡¼¥È¤¹¤ë¡£  */
    MCODING_ISO_FULL_SUPPORT =		0x3000,

    MCODING_ISO_FLAG_MAX
  };
/*=*/

/*** @ingroup m17nConv */
/***en
    @brief Structure for a coding system of type #MCODING_TYPE_ISO_2022.

    Structure for extra information about a coding system of type
    MCODING_TYPE_ISO_2022.  */

/***ja 
    @brief #MCODING_TYPE_ISO_2022 ¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤ÇɬÍפÊÉղþðÊóÍѹ½Â¤ÂÎ.

    MCODING_TYPE_ISO_2022 ¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤ÇɬÍפÊÉղþðÊóÍѤòÊÝ»ý¤¹¤ë¤¿¤á¤Î¹½Â¤ÂΡ£

    @latexonly \IPAlabel{MCodingInfoISO2022} @endlatexonly  */

typedef struct
{
  /***en
      Table of numbers of an ISO2022 code extension element invoked
      to each graphic plane (Graphic Left and Graphic Right).  -1
      means no code extension element is invoked to that plane.  */

  /***ja
      ³Æ¿Þ·Áʸ»úÎΰè (Graphic Left ¤È Graphic Right) ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤Æ¤¤¤ë¡¢
      ISO2022 Éä¹ç³ÈÄ¥Í×ÁǤÎÈÖ¹æ¤Î¥Æ¡¼¥Ö¥ë¡£-1 
      ¤Ï¤½¤ÎÎΰè¤Ë¤É¤ÎÉä¹ç³ÈÄ¥Í×ÁǤâ¸Æ¤Ó½Ð¤µ¤ì¤Æ¤¤¤Ê¤¤¤³¤È¤ò¼¨¤¹¡£   */

  int initial_invocation[2];

  /***en
      Table of code extension elements.  The Nth element corresponds
      to the Nth charset in $CHARSET_NAMES, which is an argument given
      to the mconv_define_coding () function.

      If an element value is 0..3, it specifies a graphic register
      number to designate the corresponds charset.  In addition, the
      charset is initially designated to that graphic register.

      If the value is -4..-1, it specifies a graphic register number
      0..3 respectively to designate the corresponds charset.
      Initially, the charset is not designated to any graphic
      register.  */

  /***ja
      Éä¹ç³ÈÄ¥Í×ÁǤΥơ¼¥Ö¥ë¡£NÈÖÌܤÎÍ×ÁǤϡ¢$CHARSET_NAMES ¤Î N 
      ÈÖÌܤÎʸ»ú¥»¥Ã¥È¤ËÂбþ¤¹¤ë¡£$CHARSET_NAMES ¤Ï´Ø¿ô 
      mconv_define_coding () ¤Î°ú¿ô¤È¤Ê¤ë¡£

      Ãͤ¬ 0..3 ¤À¤Ã¤¿¤é¡¢Âбþ¤¹¤ëʸ»ú¥»¥Ã¥È¤ò G0..G3 
      ¤Î¤½¤ì¤¾¤ì¤Ë»Ø¼¨¤¹¤ë¤³¤È¡¢¤Þ¤¿½é´ü¾õÂ֤Ǥ¹¤Ç¤Ë G0..G3
      ¤Ë»Ø¼¨¤µ¤ì¤Æ¤¤¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£

      Ãͤ¬ -4..-1 ¤À¤Ã¤¿¤é¡¢Âбþ¤¹¤ëʸ»ú¥»¥Ã¥È¤ò G0..G3 
      ¤Î¤½¤ì¤¾¤ì¤Ë»Ø¼¨¤¹¤ë¤³¤È¡¢¤·¤«¤·½é´ü¾õÂ֤ǤϤɤ³¤Ë¤â»Ø¼¨¤µ¤ì¤Æ¤¤¤Ê¤¤¤³¤È¤ò°ÕÌ£¤¹¤ë¡£
        */

  char designations[32];

  /***en
      Bitwise OR of @c enum @c MCodingFlagISO2022 .  */

  /***ja
      @c enum @c MCodingFlagISO2022 ¤Î¥Ó¥Ã¥Èñ°Ì¤Ç¤ÎÏÀÍý OR  */

  unsigned flags;

} MCodingInfoISO2022;
/*=*/

/*** @ingroup m17nConv */
/***en
    @brief Structure for extra information about a coding system of type #MCODING_TYPE_UTF.
    */

/***ja
    @brief #MCODING_TYPE_UTF ¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤ÇɬÍפÊÉղþðÊóÍѤι½Â¤ÂÎ.

    @latexonly \IPApage{MCodingInfoUTF} @endlatexonly

    @latexonly \IPAlabel{MCodingInfoUTF} @endlatexonly  */

typedef struct
{
  /***en
      Specify bits of a code unit.  The value must be 8, 16, or 32.  */
  /***ja
      ¥³¡¼¥ÉĹ¡Ê¥Ó¥Ã¥È¿ô¡Ë¤Î»ØÄê¡£ÃÍ¤Ï 8, 16, 32 ¤Î¤¤¤º¤ì¤«¡£  */
  int code_unit_bits;

  /***en
      Specify how to handle the heading BOM (byte order mark).  The
      value must be 0, 1, or 2.  The meanings are as follows:

      0: On decoding, check the first two byte.  If they are BOM,
      decide endian by them. If not, decide endian by the member @c
      endian.  On encoding, produce byte sequence according to
      @c endian with heading BOM.

      1: On decoding, do not handle the first two bytes as BOM, and
      decide endian by @c endian.  On encoding, produce byte sequence
      according to @c endian without BOM.

      2: On decoding, handle the first two bytes as BOM and decide
      ending by them.  On encoding, produce byte sequence according to
      @c endian with heading BOM.

      If \<code_unit_bits\> is 8, the value has no meaning.  */

  /***ja
      ÀèƬ¤Î BOM (¥Ð¥¤¥È¥ª¡¼¥À¡¼¥Þ¡¼¥¯) ¤Î¼è¤ê°·¤¤¤ò»ØÄꤹ¤ë¡£ÃÍ¤Ï 0,
      1, 2 ¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ê¡¢¤½¤ì¤¾¤ì¤Î°ÕÌ£¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤ë¡£

      0: ¥Ç¥³¡¼¥É¤ÎºÝ¤ËºÇ½é¤Î 2 ¥Ð¥¤¥È¤òÄ´¤Ù¤ë¡£¤â¤·¤½¤ì¤¬ BOM 
      ¤Ç¤¢¤ì¤Ð¡¢¥¨¥ó¥Ç¥£¥¢¥ó¤ò¤½¤ì¤ÇȽÄꤹ¤ë¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð¡¢¥á¥ó¥Ð @c
      endian ¤Ë½¾¤Ã¤Æ¥¨¥ó¥Ç¥£¥¢¥ó¤ò·èÄꤹ¤ë¡£¥¨¥ó¥³¡¼¥É¤ÎºÝ¤Ë¤Ï @c
      endian ¤Ë½¾¤Ã¤¿¥Ð¥¤¥ÈÎó¤òÀèƬ¤Ë BOM ÉÕ¤ÇÀ¸À®¤¹¤ë¡£

      1: ¥Ç¥³¡¼¥É¤ÎºÝ¡¢ºÇ½é¤Î 2 ¥Ð¥¤¥È¤ò BOM ¤È¤·¤Æ°·¤ï¤º¡¢¥¨¥ó¥Ç¥£¥¢¥ó¤Ï
      @c endian ¤ÇȽÄꤹ¤ë¡£¥¨¥ó¥³¡¼¥É¤ÎºÝ¤Ë¤Ï¡¢BOM ¤ò½ÐÎϤ»¤º¡¢
      @c endian ¤Ë±þ¤¸¤¿¥Ð¥¤¥ÈÎó¤òÀ¸À®¤¹¤ë¡£

      2: ¥Ç¥³¡¼¥É¤ÎºÝ¤ËºÇ½é¤Î2¥Ð¥¤¥È¤ò BOM¤È¤·¤Æ°·¤¤¡¢¤½¤ì¤Ë½¾¤Ã¤Æ¥¨¥ó¥Ç¥£¥¢¥ó¤òȽÄꤹ¤ë¡£
      ¥¨¥ó¥³¡¼¥É¤ÎºÝ¤Ë¤Ï @c endian ¤Ë±þ¤¸¤¿¥Ð¥¤¥ÈÎó¤òÀèƬ¤Ë BOM ÉÕ¤­¤ÇÀ¸À®¤¹¤ë¡£  */
  int bom;

  /***en
      Specify the endian type.  The value must be 0 or 1.  0 means
      little endian, and 1 means big endian.

      If \<code_unit_bits\> is 8, the value has no meaning.  */
  /***ja
      ¥¨¥ó¥Ç¥£¥¢¥ó¤Î¥¿¥¤¥×¤ò»ØÄꤹ¤ë¡£ÃÍ¤Ï 0 ¤« 1 ¤Ç¤¢¤ê¡¢0 
      ¤Ê¤é¤Ð¥ê¥È¥ë¥¨¥ó¥Ç¥£¥¢¥ó¡¢1 ¤Ê¤é¤Ð¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó¤Ç¤¢¤ë¡£

      \<code_unit_bits\> ¤¬ 8 ¤Î¾ì¹ç¤Ë¤Ï¡¢¤³¤ÎÃͤϰÕÌ£¤ò»ý¤¿¤Ê¤¤¡£
  */
  int endian;
} MCodingInfoUTF;
/*=*/

extern MSymbol mconv_define_coding (const char *name, MPlist *plist,
				    int (*resetter) (MConverter *),
				    int (*decoder) (const unsigned char *, int,
						    MText *, MConverter *),
				    int (*encoder) (MText *, int, int,
						    unsigned char *, int,
						    MConverter *),
				    void *extra_info);

extern MSymbol mconv_resolve_coding (MSymbol symbol);

extern int mconv_list_codings (MSymbol **symbols);

extern MConverter *mconv_buffer_converter (MSymbol coding,
					   const unsigned char *buf,
					   int n);

extern MConverter *mconv_stream_converter (MSymbol coding, FILE *fp);

extern int mconv_reset_converter (MConverter *converter);

extern void mconv_free_converter (MConverter *converter);

extern MConverter *mconv_rebind_buffer (MConverter *converter,
					const unsigned char *buf, int n);

extern MConverter *mconv_rebind_stream (MConverter *converter, FILE *fp);

extern MText *mconv_decode (MConverter *converter, MText *mt);

MText *mconv_decode_buffer (MSymbol name, const unsigned char *buf, int n);

MText *mconv_decode_stream (MSymbol name, FILE *fp);   

extern int mconv_encode (MConverter *converter, MText *mt);

extern int mconv_encode_range (MConverter *converter, MText *mt,
			       int from, int to);

extern int mconv_encode_buffer (MSymbol name, MText *mt,
				unsigned char *buf, int n);

extern int mconv_encode_stream (MSymbol name, MText *mt, FILE *fp);

extern int mconv_getc (MConverter *converter);

extern int mconv_ungetc (MConverter *converter, int c);

extern int mconv_putc (MConverter *converter, int c);

extern MText *mconv_gets (MConverter *converter, MText *mt);

/* (S4) Locale related functions corresponding to libc functions */
/*=*/
/*** @ingroup m17nShell */
/***en @defgroup m17nLocale Locale */
/***ja @defgroup m17nLocale ¥í¥±¡¼¥ë */
/*=*/

/*** @ingroup m17nLocale */
/***en
    @brief @c struct @c MLocale.

    The structure @c MLocale is used to hold information about name,
    language, territory, modifier, codeset, and the corresponding
    coding system of locales.

    The contents of this structure are implementation dependent.  Its
    internal structure is concealed from application programs.  */

/***ja
    @brief @c MLocale ¹½Â¤ÂÎ.

    @c MLocale ¹½Â¤ÂΤϡ¢¥í¥±¡¼¥ë¤Î̾Á°¡¢¸À¸ì¡¢ÃÏ°è¡¢¥â¥Ç¥£¥Õ¥¡¥¤¥¢¡¢¥³¡¼¥É¥»¥Ã¥È¡¢¤ª¤è¤ÓÂбþ¤¹¤ë¥³¡¼¥É·Ï¤Ë´Ø¤¹¤ë¾ðÊó¤òÊÝ»ý¤¹¤ë¤¿¤á¤ËÍѤ¤¤é¤ì¤ë¡£

    ¤³¤Î¹½Â¤ÂΤÎÆâÍƤϼÂÁõ¤Ë°Í¸¤¹¤ë¡£ 
    ÆâÉô¹½Â¤¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤«¤é¤Ï¸«¤¨¤Ê¤¤¡£  */

/***
    @seealso
    mlocale_get_prop () */

typedef struct MLocale MLocale;

/*=*/

extern MSymbol Miso639_1, Miso639_2;
extern MSymbol Mterritory;
extern MSymbol Mmodifier;
extern MSymbol Mcodeset;

extern MPlist *mlanguage_list (void);

extern MSymbol mlanguage_code (MSymbol language, int len);

extern MPlist *mlanguage_name_list (MSymbol language, MSymbol target,
				    MSymbol script, MSymbol territory);

extern MText *mlanguage_text (MSymbol language);

extern MPlist *mscript_list (void);

extern MPlist *mscript_language_list (MSymbol script);

extern MSymbol mlanguage_name (MSymbol language);

extern MLocale *mlocale_set (int category, const char *locale);

extern MSymbol mlocale_get_prop (MLocale *locale, MSymbol key);

extern int mtext_ftime (MText *mt, const char *format, const struct tm *tm,
			MLocale *locale);

extern MText *mtext_getenv (const char *name);

extern int mtext_putenv (MText *mt);

extern int mtext_coll (MText *mt1, MText *mt2);

/*
 *  (9) Miscellaneous functions of libc level (not yet implemented)
 */

/*
extern int mtext_width (MText *mt, int n);
extern MText *mtext_tolower (MText *mt);
extern MText *mtext_toupper (MText *mt);
*/

/*
 *  (10) Input method
 */
/*=*/
/*** @ingroup m17nShell */
/***en @defgroup m17nInputMethod Input Method (basic) */
/***ja @defgroup m17nInputMethod ÆþÎϥ᥽¥Ã¥É (´ðËÜÉôʬ) */
/*=*/

/*** @addtogroup m17nInputMethod 
     @{ */
/*=*/
/* Struct forward declaration.  */
/***
    @brief See struct MInputMethod */
typedef struct MInputMethod MInputMethod;
/*=*/
/***
    @brief See struct MInputContext */
typedef struct MInputContext MInputContext;
/*=*/

/***en
    @brief Type of input method callback functions.

    This is the type of callback functions called from input method
    drivers.  $IC is a pointer to an input context, $COMMAND is a name
    of callback for which the function is called.   */
/***ja
    @brief ÆþÎϥ᥽¥Ã¥É¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤Î·¿Àë¸À.

    ÆþÎϥ᥽¥Ã¥É¤«¤é¸Æ¤Ð¤ì¤ë¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤Î·¿¤Ç¤¢¤ë¡£$IC 
    ¤ÏÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤Ø¤Î¥Ý¥¤¥ó¥¿¡¢$COMMAND ¤Ï´Ø¿ô¤¬¸Æ¤Ð¤ì¤ë¥³¡¼¥ë¥Ð¥Ã¥¯¤Î̾Á°¤Ç¤¢¤ë¡£  */

typedef void (*MInputCallbackFunc) (MInputContext *ic, MSymbol command);
/*=*/

/***en
    @brief Structure of input method driver.

    The type @c MInputDriver is the structure of an input method driver that
    contains several functions to handle an input method.  */

/***ja
    @brief ÆþÎϥɥ饤¥ÐÍѹ½Â¤ÂÎ.

    @c MInputDriver ¤Ï¡¢ÆþÎϥ᥽¥Ã¥É¤ò¼è¤ê°·¤¦´Ø¿ô¤ò´Þ¤àÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¤Î¹½Â¤ÂΤη¿¤Ç¤¢¤ë¡£  */

typedef struct MInputDriver
{
  /***en
      @brief Open an input method.

      This function opens the input method $IM.  It is called from the
      function minput_open_im () after all member of $IM but \<info\>
      set.  If opening $IM succeeds, it returns 0.  Otherwise, it
      returns -1.  The function can setup $IM->info to keep various
      information that is referred by the other driver functions.  */

  /***ja
      @brief ÆþÎϥ᥽¥Ã¥É¤ò¥ª¡¼¥×¥ó¤¹¤ë.

      ¤³¤Î´Ø¿ô¤Ï¡¢ÆþÎϥ᥽¥Ã¥É $IM ¤ò¥ª¡¼¥×¥ó¤¹¤ë¡£$IM ¤Î \<info\> 
      °Ê³°¤ÎÁ´¥á¥ó¥Ð¡¼¤¬¥»¥Ã¥È¤µ¤ì¤¿¸å¤Ç¡¢´Ø¿ô minput_open_im () 
      ¤«¤é¸Æ¤Ð¤ì¤ë¡£$IM ¤ò¥ª¡¼¥×¥ó¤Ç¤­¤ì¤Ð 0 ¤ò¡¢¤Ç¤­¤Ê¤±¤ì¤Ð -1¤òÊÖ¤¹¡£
      ¤³¤Î´Ø¿ô¤Ï $IM->info 
      ¤òÀßÄꤷ¤Æ¡¢Â¾¤Î¥É¥é¥¤¥Ð´Ø¿ô¤«¤é»²¾È¤µ¤ì¤ë¾ðÊó¤òÊÝ»ý¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
      */

  int (*open_im) (MInputMethod *im);

  /***en
      @brief Close an input method.

      This function closes the input method $IM.  It is called from
      the function minput_close_im ().  It frees all memory allocated
      for $IM->info (if any) after finishing all the tasks of closing
      the input method.  But, the other members of $IM should not be
      touched.  */

  /***ja
      @brief ÆþÎϥ᥽¥Ã¥É¤ò¥¯¥í¡¼¥º¤¹¤ë.

      ¤³¤Î´Ø¿ô¤Ï¡¢ÆþÎϥ᥽¥Ã¥É $IM ¤ò¥¯¥í¡¼¥º¤¹¤ë¡£´Ø¿ô 
      minput_close_im () ¤«¤é¸Æ¤Ð¤ì¤ë¡£
      ÆþÎϥ᥽¥Ã¥É¤Î¥¯¥í¡¼¥º¤¬¤¹¤Ù¤Æ½ªÎ»¤·¤¿»þÅÀ¤Ç¡¢¤³¤Î´Ø¿ô¤Ï$IM->info 
      ¤Ë³ä¤êÅö¤Æ¤é¤ì¤Æ¤¤¤ë¥á¥â¥ê¤ò(¤¢¤ì¤Ð)¤¹¤Ù¤Æ³«Êü¤¹¤ë¡£
      ¤¿¤À¤·¡¢$IM ¤Î¾¤Î¥á¥ó¥Ð¤Ë±Æ¶Á¤òÍ¿¤¨¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
        */

  void (*close_im) (MInputMethod *im);

  /***en
      @brief Create an input context.

      This function creates the input context $IC.  It is called from
      the function minput_create_ic () after all members of $IC but
      \<info\> are set.  If creating $IC succeeds, it returns 0.
      Otherwise, it returns -1.  The function can setup $IC->info to
      keep various information that is referred by the other driver
      functions.  */

  /***ja
      @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤òÀ¸À®¤¹¤ë.

      ¤³¤Î´Ø¿ô¤ÏÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È $IC ¤òÀ¸À®¤¹¤ë¡£
      $IC ¤Î \<info\> °Ê³°¤ÎÁ´¥á¥ó¥Ð¡¼¤¬¥»¥Ã¥È¤µ¤ì¤¿¸å¤Ç¡¢´Ø¿ô
      minput_create_ic () ¤«¤é¸Æ¤Ð¤ì¤ë¡£
      $IC ¤òÀ¸À®¤Ç¤­¤ì¤Ð 0 ¤ò¡¢¤Ç¤­¤Ê¤±¤ì¤Ð -1 ¤òÊÖ¤¹¡£
      ¤³¤Î´Ø¿ô¤Ï $IC->info ¤òÀßÄꤷ¤Æ¡¢Â¾¤Î¥É¥é¥¤¥Ð´Ø¿ô¤«¤é»²¾È¤µ¤ì¤ë¾ðÊó¤òÊÝ»ý¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£  */


  int (*create_ic) (MInputContext *ic);

  /***en
      @brief Destroy an input context.

      This function is called from the function minput_destroy_ic ()
      and destroys the input context $IC.  It frees all memory
      allocated for $IC->info (if any) after finishing all the tasks
      of destroying the input method.  But, the other members of $IC
      should not be touched.  */

  /***ja
      @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤òÇ˲õ¤¹¤ë.

      ´Ø¿ô minput_destroy_ic () ¤«¤é¸Æ¤Ð¤ì¡¢ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È $IC 
      ¤òÇ˲õ¤¹¤ë¡£ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤ÎÇ˲õ¤¬¤¹¤Ù¤Æ½ªÎ»¤·¤¿»þÅÀ¤Ç¡¢$IC->info 
      ¤Ë³ä¤êÅö¤Æ¤é¤ì¤Æ¤¤¤ë¥á¥â¥ê¤ò(¤¢¤ì¤Ð)¤¹¤Ù¤Æ³«Êü¤¹¤ë¡£¤¿¤À¤·¡¢$IC 
      ¤Î¾¤Î¥á¥ó¥Ð¤Ë±Æ¶Á¤òÍ¿¤¨¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£  */

  void (*destroy_ic) (MInputContext *ic);

  /***en
      @brief Filter an input key.

      This function is called from the function minput_filter () and
      filters an input key.  $KEY and $ARG are the same as what given
      to minput_filter ().

      The task of the function is to handle $KEY, update the internal
      state of $IC.  If $KEY is absorbed by the input method and no
      text is produced, it returns 1.  Otherwise, it returns 0.

      It may update $IC->status, $IC->preedit, $IC->cursor_pos,
      $IC->ncandidates, $IC->candidates, and $IC->produced if that is
      necessary for the member \<callback\>.

      The meaning of $ARG depends on the input method river.  See the
      documentation of @c minput_default_driver and @c
      minput_gui_driver for instance.  */

  /***ja
      @brief ÆþÎÏ¥­¡¼¤ò¥Õ¥£¥ë¥¿¤¹¤ë.

      ´Ø¿ô minput_filter () ¤«¤é¸Æ¤Ð¤ì¡¢ÆþÎÏ¥­¡¼¤ò¥Õ¥£¥ë¥¿¤¹¤ë¡£°ú¿ô 
      $KEY, $ARG ¤Ï´Ø¿ô minput_filter () ¤Î¤â¤Î¤ÈƱ¤¸¡£

      ¤³¤Î´Ø¿ô¤Ï $KEY ¤ò½èÍý¤·¡¢$IC ¤ÎÆâÉô¾õÂÖ¤ò¹¹¿·¤¹¤ë¡£ $KEY 
      ¤¬ÆþÎϥ᥽¥Ã¥É¤ËµÛ¼ý¤µ¤ì¤Æ¥Æ¥­¥¹¥È¤¬À¸À®¤µ¤ì¤Ê¤«¤Ã¤¿¾ì¹ç¤Ë¤Ï¡¢ 
      1 ¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð 0 ¤òÊÖ¤¹¡£

      ¥á¥ó¥Ð \<callback\> ¤ËɬÍפǤ¢¤ì¤Ð¡¢$IC->status, $IC->preedit,
      $IC->cursor_pos, $IC->ncandidates, $IC->candidates,
      $IC->produced ¤ò¹¹¿·¤Ç¤­¤ë¡£

      $ARG ¤Î°ÕÌ£¤ÏÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¤Ë°Í¸¤¹¤ë¡£Îã¤Ï @c
      minput_default_driver ¤Þ¤¿¤Ï @c minput_gui_driver 
      ¤ÎÀâÌÀ¤ò»²¾È¤Î¤³¤È¡£ */

  int (*filter) (MInputContext *ic, MSymbol key, void *arg);

  /***en
      @brief  Lookup a produced text in an input context.

      It is called from the function minput_lookup () and looks up a
      produced text in the input context $IC.  This function
      concatenate a text produced by the input key $KEY (if any) to
      M-text $MT.  If $KEY was correctly handled by the input method
      of $IC, it returns 0.  Otherwise, it returns 1.

      The meaning of $ARG depends on the input method driver.  See the
      documentation of @c minput_default_driver and @c
      minput_gui_driver for instance.  */

  /***ja
      @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤ÇÀ¸À®¤µ¤ì¤ë¥Æ¥­¥¹¥È¤Î³ÍÆÀ.

      ´Ø¿ô minput_lookup () ¤«¤é¸Æ¤Ð¤ì¡¢ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È $IC 
      ¤ÇÀ¸À®¤µ¤ì¤ë¥Æ¥­¥¹¥È¤ò¸¡º÷¤¹¤ë¡£ÆþÎÏ¥­¡¼ $KEY 
      ¤Ë¤è¤Ã¤ÆÀ¸À®¤µ¤ì¤ë¥Æ¥­¥¹¥È¤¬¤¢¤ì¤Ð¡¢M-text $MT ¤ËÄɲ乤롣 $KEY
      ¤¬ÆþÎϥ᥽¥Ã¥É $IC ¤Ë¤è¤Ã¤ÆÀµ¤·¤¯½èÍý¤µ¤ì¤ì¤Ð 0 ¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð 1 ¤òÊÖ¤¹¡£

      $ARG ¤Î°ÕÌ£¤ÏÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¤Ë°Í¸¤¹¤ë¡£Îã¤Ï @c
      minput_default_driver ¤Þ¤¿¤Ï @c minput_gui_driver ¤ÎÀâÌÀ¤ò»²¾È¤Î
      ¤³¤È¡£ */

  int (*lookup) (MInputContext *ic, MSymbol key, void *arg, MText *mt);

  /***en
      @brief List of callback functions.

      List of callback functions.  Keys are one of
      @b Minput_preedit_start, @b Minput_preedit_draw,
      @b Minput_preedit_done, @b Minput_status_start, @b Minput_status_draw,
      @b Minput_status_done, @b Minput_candidates_start,
      @b Minput_candidates_draw, @b Minput_candidates_done,
      @b Minput_set_spot, @b Minput_toggle, @b Minput_reset,
      @b Minput_get_surrounding_text, @b Minput_delete_surrounding_text.
      Values are functions of type #MInputCallbackFunc.  */
  /***ja
      @brief ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤Î¥ê¥¹¥È.

      ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤Î¥ê¥¹¥È¡£¥­¡¼¤Ï¼¡¤Î¤¤¤º¤ì¤«¡£
      @b Minput_preedit_start, @b Minput_preedit_draw,
      @b Minput_preedit_done, @b Minput_status_start, @b Minput_status_draw,
      @b Minput_status_done, @b Minput_candidates_start,
      @b Minput_candidates_draw, @b Minput_candidates_done,
      @b Minput_set_spot, @b Minput_toggle, @b Minput_reset,
      @b Minput_get_surrounding_text, @b Minput_delete_surrounding_text¡£
      ÃͤÏ#MInputCallbackFunc ·¿¤Î´Ø¿ô¡£  */
  MPlist *callback_list;

} MInputDriver;
/*=*/
/*** @} */
/*=*/

extern MInputDriver minput_default_driver;

extern MSymbol Minput_method;
extern MSymbol Minput_driver;

extern MInputDriver *minput_driver;

/** Symbols for callback commands.  */
extern MSymbol Minput_preedit_start;
extern MSymbol Minput_preedit_draw;
extern MSymbol Minput_preedit_done;
extern MSymbol Minput_status_start;
extern MSymbol Minput_status_draw;
extern MSymbol Minput_status_done;
extern MSymbol Minput_candidates_start;
extern MSymbol Minput_candidates_draw;
extern MSymbol Minput_candidates_done;
extern MSymbol Minput_set_spot;
extern MSymbol Minput_toggle;
extern MSymbol Minput_reset;
extern MSymbol Minput_get_surrounding_text;
extern MSymbol Minput_delete_surrounding_text;

/** Symbols for special input key event.  */
extern MSymbol Minput_focus_move;
extern MSymbol Minput_focus_in;
extern MSymbol Minput_focus_out;

/** Symbols describing input method command/variable.  */
extern MSymbol Minherited;
extern MSymbol Mcustomized;
extern MSymbol Mconfigured;

/*** @addtogroup m17nInputMethod 
     @{ */
/*=*/
/***en
    @brief Structure of input method.

    The type @c MInputMethod is the structure of input method
    objects.  */
/***ja
    @brief ÆþÎϥ᥽¥Ã¥É¤Î¹½Â¤ÂÎ.

    @c MInputMethod ¤Ï¡¢ÆþÎϥ᥽¥Ã¥É¥ª¥Ö¥¸¥§¥¯¥ÈÍѤι½Â¤ÂΤη¿¤Ç¤¢¤ë¡£  */

struct MInputMethod
{
  /***en Which language this input method is for.  The value is @c
      Mnil if the input method is foreign.  */
  /***ja ¤É¤Î¸À¸ìÍѤÎÆþÎϥ᥽¥Ã¥É¤«¡£
      ÆþÎϥ᥽¥Ã¥É¤¬³°Éô¤Î¤â¤Î¤Ç¤¢¤ë¾ì¹ç¤ÎÃÍ¤Ï @c Mnil ¡£  */
  MSymbol language;

  /***en Name of the input method.  If the input method is foreign, it
      must has a property of key @c Minput_driver and the value must be a
      pointer to a proper input method driver.  */
  /***ja ÆþÎϥ᥽¥Ã¥É¤Î̾Á°¡£³°Éô¥á¥½¥Ã¥É¤Ç¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢@c
      Minput_driver ¤ò¥­¡¼¤È¤¹¤ë¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Á¡¢¤½¤ÎÃͤÏŬÀÚ¤ÊÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£*/
  MSymbol name;

  /***en Input method driver of the input method.  */
  /***ja ¤½¤ÎÆþÎϥ᥽¥Ã¥ÉÍѤÎÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¡£  */
  MInputDriver driver;

  /***en The argument given to minput_open_im (). */
  /***ja minput_open_im () ¤ËÅϤµ¤ì¤ë°ú¿ô¡£  */
  void *arg;

  /***en Pointer to extra information that \<driver\>.open_im ()
      setups. */
  /***ja \<driver\>.open_im () ¤¬ÀßÄꤹ¤ëÄɲþðÊó¤Ø¤Î¥Ý¥¤¥ó¥¿¡£ */
  void *info;
};

/*=*/

/***en
    @brief Bit-masks to specify how candidates of input method is changed.  */

/***ja
    @brief ÆþÎϥ᥽¥Ã¥É¤ÎÆþÎϸõÊ䤬¤É¤¦Êѹ¹¤µ¤ì¤¿¤«¤ò¼¨¤¹¥Ó¥Ã¥È¥Þ¥¹¥¯.  */

enum MInputCandidatesChanged
  {
    MINPUT_CANDIDATES_LIST_CHANGED = 1,
    MINPUT_CANDIDATES_INDEX_CHANGED = 2,
    MINPUT_CANDIDATES_SHOW_CHANGED = 4,
    MINPUT_CANDIDATES_CHANGED_MAX
  };


/*=*/

/***en
    @brief Structure of input context.

    The type @c MInputContext is the structure of input context
    objects.  */

/***ja
    @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥ÈÍѹ½Â¤ÂÎ.

    @c MInputContext ¤Ï¡¢ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¥ª¥Ö¥¸¥§¥¯¥ÈÍѤι½Â¤ÂΤη¿¤Ç¤¢¤ë¡£  */

struct MInputContext
{
  /***en Backward pointer to the input method.  It is set up be the
      function minput_create_ic ().  */
  /***ja ÆþÎϥ᥽¥Ã¥É¤Ø¤ÎµÕ¥Ý¥¤¥ó¥¿¡£´Ø¿ô minput_create_ic () 
      ¤Ë¤è¤Ã¤ÆÀßÄꤵ¤ì¤ë¡£  */ 
  MInputMethod *im;

  /***en M-text produced by the input method.  It is set up by the
      function minput_lookup () .  */
  /***ja ÆþÎϥ᥽¥Ã¥É¤Ë¤è¤Ã¤ÆÀ¸À®¤µ¤ì¤ë M-text¡£´Ø¿ô minput_lookup () 
      ¤Ë¤è¤Ã¤ÆÀßÄꤵ¤ì¤ë¡£  */
  MText *produced;

  /***en Argument given to the function minput_create_ic (). */
  /***ja ´Ø¿ô minput_create_ic () ¤ËÅϤµ¤ì¤ë°ú¿ô¡£ */
  void *arg;

  /***en Flag telling whether the input context is currently active or
      inactive.  The value is set to 1 (active) when the input context
      is created.  It is toggled by the function minput_toggle ().  */
  /***ja ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤¬¥¢¥¯¥Æ¥£¥Ö¤«¤É¤¦¤«¤ò¼¨¤¹¥Õ¥é¥°¡£
      ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤¬À¸À®¤µ¤ì¤¿»þÅÀ¤Ç¤ÏÃÍ¤Ï 1 ¡Ê¥¢¥¯¥Æ¥£¥Ö¡Ë¤Ç¤¢¤ê¡¢´Ø¿ô 
      minput_toggle () ¤Ë¤è¤Ã¤Æ¥È¥°¥ë¤µ¤ì¤ë¡£  */
  int active;

  /***en Spot location and size of the input context.  */
  /***ja ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤Î¥¹¥Ý¥Ã¥È¤Î°ÌÃÖ¤ÈÂ礭¤µ.  */
  struct {
    /***en X and Y coordinate of the spot.  */
    /***ja ¥¹¥Ý¥Ã¥È¤Î X, Y ºÂɸ.  */
    int x, y;

    /***en Ascent and descent pixels of the line of the spot.  */
    /***ja ¥¹¥Ý¥Ã¥È¤Î¥¢¥»¥ó¥È¤È¥Ç¥£¥»¥ó¥È¤Î¥Ô¥¯¥»¥ë¿ô.  */
    int ascent, descent;

    /***en Font size for preedit text in 1/10 point.  */
    /***ja preedit ¥Æ¥­¥¹¥ÈÍѤΥե©¥ó¥È¥µ¥¤¥º (1/10 ¥Ý¥¤¥ó¥Èñ°Ì).  */
    int fontsize;

    /***en M-text at the spot, or NULL.  */
    /***ja ¥¹¥Ý¥Ã¥È¾å¤Î M-text¡¢¤Þ¤¿¤Ï NULL.  */
    MText *mt;

    /***en Character position in \<mt\> at the spot.  */
    /***ja \<mt\> ¤Ë¤ª¤±¤ë¥¹¥Ý¥Ã¥È¤Îʸ»ú°ÌÃÖ.  */
    int pos;
  } spot;

  /***en The usage of the following members depends on the input
      method driver.  The descriptions below are for the driver of an
      internal input method.  They are set by the function
      \<im\>->driver.filter ().  */
  /***ja °Ê²¼¤Î¥á¥ó¥Ð¤Î»ÈÍÑË¡¤ÏÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¤Ë¤è¤Ã¤Æ°Û¤Ê¤ë¡£
      °Ê²¼¤ÎÀâÌÀ¤Ï¡¢ÆâÉôÆþÎϥ᥽¥Ã¥ÉÍѤÎÆþÎϥɥ饤¥Ð¤ËÂФ¹¤ë¤â¤Î¤Ç¤¢¤ë¡£
      ¤³¤ì¤é¤Ï´Ø¿ô \<im\>->driver.filter () ¤Ë¤è¤Ã¤ÆÀßÄꤵ¤ì¤ë¡£  */

  /***en Pointer to extra information that \<im\>->driver.create_ic ()
      setups.  It is used to record the internal state of the input
      context.  */
  /***ja \<im\>->driver.create_ic () ¤¬ÀßÄꤹ¤ëÄɲþðÊó¤Ø¤Î¥Ý¥¤¥ó¥¿¡£
      ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤ÎÆâÉô¾õÂÖ¤òµ­Ï¿¤¹¤ë¤¿¤á¤ËÍѤ¤¤é¤ì¤ë¡£ */
  void *info;

  /***en M-text describing the current status of the input
      context.  */
  /***ja ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤Î¸½ºß¤Î¾õÂÖ¤òɽ¤¹ M-text  */
  MText *status;

  /***en The function \<im\>->driver.filter () sets the value to 1 when
      it changes \<status\>.  */
  /***ja ´Ø¿ô \<im\>->driver.filter () ¤Ï¡¢\<status\> ¤òÊѤ¨¤¿ºÝ¤Ë¤³¤ÎÃͤò 1 
      ¤ËÀßÄꤹ¤ë¡£  */
  int status_changed;

  /***en M-text containing the current preedit text.  The function
      \<im\>->driver.filter () sets the value.  */
  /***ja ¸½ºß¤Î preedit ¥Æ¥­¥¹¥È¤ò´Þ¤à M-text¡£´Ø¿ô 
      \<im\>->driver.filter () ¤Ë¤è¤Ã¤ÆÀßÄꤵ¤ì¤ë¡£  */ 
  MText *preedit;

  /***en The function \<im\>->driver.filter () sets the value to 1 when
      it changes \<preedit\>.  */
  /***ja ´Ø¿ô \<im\>->driver.filter () ¤Ï¡¢\<preedit\> ¤òÊѤ¨¤¿ºÝ¤Ë¤³¤ÎÃͤò 
      1 ¤ËÀßÄꤹ¤ë¡£  */
  int preedit_changed;

  /***en Cursor position of \<preedit\>.  */
  /***ja \<preedit\>¤Î¥«¡¼¥½¥ë°ÌÃÖ  */
  int cursor_pos;

  /***en The function \<im\>->driver.filter () sets the value to 1 when
      it changes \<cursor_pos\>.  */
  /***ja ´Ø¿ô \<im\>->driver.filter () ¤Ï¡¢\<cursor_pos\> ¤òÊѤ¨¤¿ºÝ¤Ë¤³¤ÎÃͤò 
      1 ¤ËÀßÄꤹ¤ë¡£  */
  int cursor_pos_changed;

  /***en Plist of the current candidate groups.  Each element is an
      M-text or a plist.  If an element is an M-text (i.e. the key is Mtext),
      candidates in that group are characters in the M-text.  If it is
      a plist (i.e. the key is Mplist), each element is an M-text, and
      candidates in that group are those M-texts.  */
  /***ja ¸½ºß¤Î¸õÊ䥰¥ë¡¼¥×¤Î Plist ¡£³ÆÍ×ÁÇ¤Ï M-text ¤« plist ¤Ç¤¢¤ë¡£
      Í×ÁǤ¬ M-text ¤Î¾ì¹ç¡Ê¥­¡¼¤¬ Mtext ¤Ç¤¢¤ë¾ì¹ç¡Ë¤Ë¤Ï¡¢¤½¤Î¥°¥ë¡¼¥×¤Î¸õÊä¤Ï¤½¤Î 
      M-text Ãæ¤Î³Æʸ»ú¤Ç¤¢¤ë¡£ Í×ÁǤ¬ plist ¤Î¾ì¹ç¡Ê¥­¡¼¤¬ Mplist
      ¤Ç¤¢¤ë¾ì¹ç¡Ë¤Ë¤Ï¡¢¤½¤Î¥ê¥¹¥È¤Î³ÆÍ×ÁÇ¤Ï M-text ¤Ç¤¢¤ê¡¢¤½¤ì¤é¤¬¤½¤Î¥°¥ë¡¼¥×¤Î¸õÊä¤È¤Ê¤ë¡£  */
  MPlist *candidate_list;

  /***en Index number of the currently selected candidate in all the
      candidates. The index of the first candidate is 0.  If the
      number is 8, and the first candidate group contains 7
      candidates, the currently selected candidate is the second element of the
      second candidate group.  */
  /***ja ¸½ºßÁªÂò¤µ¤ì¤Æ¤¤¤ë¸õÊ䤬Á´¸õÊäÃæ¤Ç²¿ÈÖÌܤ«¤ò¤ò¼¨¤¹¥¤¥ó¥Ç¥Ã¥¯¥¹¡£
      ºÇ½é¤Î¸õÊä¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¤Ï 0¡£ºÇ½é¤Î¸õÊ䥰¥ë¡¼¥×¤Ë¼·¤Ä¤Î¸õÊ䤬´Þ¤Þ¤ì¤Æ¤ª¤ê¡¢¤³¤ÎÃͤ¬
      8 ¤Ê¤é¤Ð¡¢¸½ºß¤Î¸õÊä¤ÏÆóÈÖÌܤθõÊ䥰¥ë¡¼¥×¤ÎÆóÈÖÌܤÎÍ×ÁǤȤ¤¤¦¤³¤È¤Ë¤Ê¤ë¡£
      */
  int candidate_index;

  /* @{ */
  /***en Start and the end positions of the preedit text where
       \<candidate_list\> corresponds to.  */
  /***ja preedit ¥Æ¥­¥¹¥ÈÃæ¤Ç¡¢\<candidate_list\>¤ËÂбþ¤¹¤ëºÇ½é¤ÈºÇ¸å¤Î°ÌÃÖ¡£
       */
  int candidate_from, candidate_to;
  /* @} */

  /***en Flag telling whether the current candidate group must be
      shown or not.  The function \<im\>->driver.filter () sets the
      value to 1 when an input method required to show candidates, and
      sets the value to 0 otherwise.  */
  /***ja ¸½ºß¤Î¸õÊ䥰¥ë¡¼¥×¤òɽ¼¨¤¹¤ë¤«¤É¤¦¤«¤ò¼¨¤¹¥Õ¥é¥°¡£
      ´Ø¿ô \<im\>->driver.filter () ¤Ï¡¢ÆþÎϥ᥽¥Ã¥É¤¬¸õÊä¤Îɽ¼¨¤òÍ׵ᤷ¤¿»þ¤³¤ÎÃͤò
      1 ¤Ë¡¢¤½¤ì°Ê³°¤Î»þ 0 ¤ËÀßÄꤹ¤ë¡£  */
  int candidate_show;

  /***en The function \<im\>->driver.filter () sets the value to bitwise
      OR of @c enum @c MInputCandidatesChanged when it changed any of
      the above members (\<candidate_XXX\>), and sets the value to 0
      otherwise.  */
  /***ja ´Ø¿ô \<im\>->driver.filter () ¤Ï¡¢¾åµ­¤Î¥á¥ó¥Ð \<candidate_XXX\>
      ¤Î£±¤Ä¤Ç¤âÊѹ¹¤·¤¿ºÝ¤Ë¤Ï¡¢¤³¤ÎÃͤò @c enum @c
      MInputCandidatesChanged ¤Î¥Ó¥Ã¥Èñ°Ì¤Ç¤ÎÏÀÍý OR ¤ËÀßÄꤹ¤ë¡£¤½¤¦
      ¤Ç¤Ê¤±¤ì¤Ð 0 ¤ËÀßÄꤹ¤ë¡£ */
  int candidates_changed;

  /***en Plist that can be freely used by \<im\>->driver functions.
      The driver of internal input method uses it to exchange extra
      arguments and result for callback functions.  The function
      \<im\>->driver.create_ic () sets this to an empty plist, and the
      function \<im\>->driver.destroy_ic () frees it by using
      m17n_object_unref ().  */
  /***ja \<im\>->driver ¤Î´Ø¿ô·²¤Ë¤è¤Ã¤Æ¼«Í³¤Ë»ÈÍѤǤ­¤ë plist¡£
      ÆâÉôÆþÎϥ᥽¥Ã¥ÉÍѥɥ饤¥Ð¤Ï¤³¤ì¤ò¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤È¤Î°ú¿ô¤äÊÖÃÍ
      ¤Î¼õÅϤ·¤Ë»ÈÍѤ¹¤ë¡£´Ø¿ô \<im\>->driver.create_ic () ¤Ï¤³¤Î plist
      ¤ò¶õ¤ËÀßÄꤹ¤ë¡£´Ø¿ô\<im\>->driver.destroy_ic () ¤Ï
      m17n_object_unref () ¤òÍѤ¤¤Æ¤³¤Î plist ¤ò²òÊü¤¹¤ë¡£  */
  MPlist *plist;
};

/*=*/
/*** @} */
/*=*/

extern MInputMethod *minput_open_im (MSymbol language, MSymbol name,
				     void *arg);

/*=*/

extern void minput_close_im (MInputMethod *im);

extern MInputContext *minput_create_ic (MInputMethod *im, void *arg);

extern void minput_destroy_ic (MInputContext *ic);

extern int minput_filter (MInputContext *ic, MSymbol key, void *arg);

extern int minput_lookup (MInputContext *ic, MSymbol key, void *arg,
			  MText *mt);
extern void minput_set_spot (MInputContext *ic, int x, int y, int ascent,
			     int descent, int fontsize, MText *mt, int pos);
extern void minput_toggle (MInputContext *ic);

extern void minput_reset_ic (MInputContext *ic);

extern MText *minput_get_description (MSymbol language, MSymbol name);

extern MPlist *minput_get_title_icon (MSymbol language, MSymbol name);

extern MPlist *minput_get_command (MSymbol language, MSymbol name,
				   MSymbol command);
extern int minput_config_command (MSymbol language, MSymbol name,
				  MSymbol command, MPlist *keyseq);
extern MPlist *minput_get_variable (MSymbol language, MSymbol name,
				    MSymbol variable);
extern int minput_config_variable (MSymbol language, MSymbol name,
				   MSymbol variable, MPlist *value);
extern char *minput_config_file (void);

extern int minput_save_config (void);

extern int minput_callback (MInputContext *ic, MSymbol command);

/* obsolete functions */
extern MPlist *minput_get_commands (MSymbol language, MSymbol name);

extern int minput_assign_command_keys (MSymbol language, MSymbol name,
				       MSymbol command, MPlist *keys);
extern MPlist *minput_get_variables (MSymbol language, MSymbol name);

extern int minput_set_variable (MSymbol language, MSymbol name,
				MSymbol variable, void *value);

extern MPlist *minput_list (MSymbol lang);

extern MInputMethod *mdebug_dump_im (MInputMethod *im, int indent);

M17N_END_HEADER

#endif /* _M17N_H_ */

/*
  Local Variables:
  coding: euc-japan
  End:
*/