* Anthy Input 饤֥λˡ *

 * 饢ץꥱ񤯾ˤuimѤᤷޤ

饤֥Υץ	-lanthyinput -lanthy -lanthydic
󥯥롼ɥե	anthy/anthy.h anthy/input.h
                          (anthy/anthy.h ˥󥯥롼ɤ뤳)

* ǡγ *
anthy_input_config  ޻ѴʤɤѤ롣
饤֥Υ桼ȤߤƤϤʤ
anthy_input_context ϤΥƥȤ̤뤿Ѥ롣
饤֥Υ桼ȤߤƤϤʤ
anthy_input_preedit 饤֥꤫ץꥨǥåȤȤѤ롣
ץꥨǥåΤɽ
anthy_input_segment 饤֥꤫ץꥨǥåȤȤѤ롣
ȤˤѤ롣ʸɽ

char * 󥳡ɤˤEUC-JPѤ롣

* ؿγ *
ؿʤ
 anthy_input_init		饤֥ν
 anthy_input_set_personality	ѡʥƥ
ƥȤδ
 anthy_input_create_context	ϥƥȤκ
 anthy_input_free_context	ϥƥȤβ

 anthy_input_create_config	ǥեȤκ
 anthy_input_free_config	ǥեȤβ
 anthy_input_edit_toggle_config	ѿȤΰŪȥ˻Ȥѹ
 anthy_input_edit_rk_config	ʸбѹ
 anthy_input_clear_rk_config	ʸбǥեȤ᤹
 anthy_input_change_config	ѹ
ƥȤ(ľŪ)
 anthy_input_str		ʸɲ
 anthy_input_next_candidate	θ(ʸŬ)
 anthy_input_prev_candidate	θ(ʸŬ)
 anthy_input_quit		Ѵ򥭥󥻥(1ʳ)
 anthy_input_erase_prev		ʸ
 anthy_input_erase_next		ʸ
 anthy_input_commit		
 anthy_input_move		롢ʸư
 anthy_input_resize		ʸĹѹ
 anthy_input_beginning_of_line  ץꥨǥåƬ˰ư
 anthy_input_end_of_line        ץꥨǥå˰ư
 anthy_input_cut                ʸڤ
ƥȤ(бư)
 anthy_input_key		1ʸɲ
 anthy_input_space		ڡޤѴ(ƥȰ¸)
ƥȤ(¾)
 anthy_input_get_state          ߤξ֤μ
 anthy_input_get_preedit	ץꥨǥåȤ
 anthy_input_map_select		޻̾Ѵޥåפؤ
 anthy_input_get_selected_map   ߤΥ޻̾Ѵޥåפμ
 anthy_input_get_candidate	ֹꤷƸ
 anthy_input_select_candidate	ֹꤷƸ
 anthy_input_free_preedit	ץꥨǥåȤβ
					(°ʸṽ¤ΤƱ˲)
 anthy_input_free_segment	ʸβ
ѹ
 anthy_input_map_edit		޻̾ѴޥåפԽ(̤б)

*  *
 Ե(1)     ץꥨǥåȤ¸ߤʤ
 Խ(2)   ޻ξ֡
                 ֤ʸʸ󤬤ʤ
                 ʸϥ֤ʸؤƤ롣
 Ѵ(3)   Ѵξ֡
 ʸ῭̾(4) ʸ῭ξ֡
                 ʸʹߤϤ٤ʿ̾ˤʤ롣
                 ʸƤޤȤưʸˤʤ롣

* ƴؿ *
 int anthy_input_init(void);
 : ̵
 ֤: 0 ʤ -1 ʤ鼺
 饤֥롣anthy饤֥롣

 struct anthy_input_config* anthy_input_create_config(void);
 : ̵
 ֤: 깽¤ΤΥݥ
 깽¤Τ롣깽¤ΤϥǥեͤǽƤ롣

 void anthy_input_free_config(struct anthy_input_config* cfg);
 : 깽¤ΤΥݥ
 ֤: ̵
 깽¤Τ롣ͭƤϥƥ
 Ȥ˲

 anthy_input_set_personality(char *personality);
 : personality ѡʥƥ̾
 ֤: ̵

 struct anthy_input_context* 
 anthy_input_create_context(struct anthy_input_config* cfg);
 : cfg 깽¤ΤΥݥ
 ֤: ϥƥȤΥݥ
 ϥƥȤΥݥ󥿤롣Ϳ깽¤Τ
 ŬѤϡϥƥȤäˤǤ⡢
 ϥƥȤȿǤ롣
 ƥȤԵ֤Ǻ롣

 void anthy_input_free_context(struct anthy_input_context* ictx);
 : ictx ϥƥ
 ֤: ʤ
 ϥƥȤ롣

 void anthy_input_str(struct anthy_input_context* ictx, char* str);
 : ictx ƥȹ¤
       str ɲäʸ
 ֤: ̵
 ɲäʸϥ޻(Ⱦ)Ϥ롣
 Ե֤Խ֤ǤϥץꥨǥåȤʸɲä롣
 Ѵ֤ʸ῭֤̾ǤϥץꥨǥåȤ򤽤ξ֤ǳꤷơ
 strĥץꥨǥåȤ롣
 ƽиԽ֤ˤʤ롣

 void anthy_input_next_candidate(struct anthy_input_context* ictx);
 : ictx ƥȹ¤
 ֤: ̵
 Խ֤ǤʸѴѴ֤ˤϤ롣
 Ѵ֤Ǥʸθ򼡤θˤ롣
 ʸ῭֤̾ǤʸʹߤѴѴ֤롣

 void anthy_input_prev_candidate(struct anthy_input_context* ictx);
 : ictx ƥȹ¤
 ֤: ̵
 Խ֤ǤʸѴѴ֤ˤϤ롣
 Ѵ֤Ǥʸθθˤ롣
 ʸ῭֤̾ǤʸʹߤѴѴ֤롣

 void anthy_input_quit(struct anthy_input_context* ictx);
 : ictx ƥȹ¤
 ֤: ̵
 Խ֤ǤԵ֤ˤʤ롣
 Խ֤ʸ῭֤̾ǤԽ֤ˤʤ롣

 void anthy_input_erase_prev(struct anthy_input_context* ictx);
 : ictx ƥȹ¤
 ֤: ̵
 Խ֤ͭ
 1ʸä
 ḁ̈ץꥨǥåȤʤʤСԵ֤ˤʤ롣

 void anthy_input_erase_next(struct anthy_input_context* ictx);
 : ictx ƥȹ¤
 ֤: ̵
 Խ֤ͭ
 θ1ʸä
 ḁ̈ץꥨǥåȤʤʤСԵ֤ˤʤ롣

 void anthy_input_commit(struct anthy_input_context* ictx);
 : ictx ƥȹ¤
 ֤: ̵
 ߤΥץꥨǥåȤξ֤ǳꤹ롣
 Ե֤롣

 void anthy_input_move(struct anthy_input_context* ictx, int lr);
 : ictx ƥȹ¤
       lr ư
 ֤: ̵
 Խ֤Ǥϥư롣
 Ѵ֤Ǥʸư롣
 ʸ῭֤̾ǤѴ֤ꡢʸư롣
 lr = -1 Ǻư lr = 1 Ǳư

 void anthy_input_resize(struct anthy_input_context* ictx, int lr);
 : ictx ƥȹ¤
       lr 
 ֤: ̵
 Ѵ֤Ǥʸ򿭽̤ʸ῭֤̾ˤʤ롣
 ʸ῭֤̾Ǥʸ򿭽̤롣
 lr = -1 ǽ̾ lr = 1 ǿĹ

 void anthy_input_beginning_of_line(struct anthy_input_context* ictx);
 : ictx ƥȹ¤
 ֤: ̵
 Խ֤ͭ
 ץꥨǥåȤƬ˰ư롣
 
 void anthy_input_end_of_line(struct anthy_input_context* ictx);
 : ictx ƥȹ¤
 ֤: ̵
 Խ֤ͭ
 ץꥨǥåȤ˰ư롣
 
 void anthy_input_cut(struct anthy_input_context* ictx);
 : ictx ƥȹ¤
 ֤: ̵
 Խ֤ͭ
 ʹߤʸääʸϵƤ롣

 void anthy_input_str(struct anthy_input_context* ictx, char c);
 : ictx ƥȹ¤
       c ɲäʸ
 ֤: ̵
 anthy_input_key ȤۤƱ 1 ʸɲä롣

 void anthy_input_space(struct anthy_input_context* ictx);
 : ictx ƥȹ¤
 ֤: ̵
 ƥȤ˱ƶɲáѴΤɤ餫ˤʤ롣

 struct anthy_input_preedit*
 anthy_input_get_preedit(struct anthy_input_context* ictx);
 : ictx ƥȹ¤
 ֤: ߤΥץꥨǥå
 ߤΥץꥨǥåȤ롣ץꥨǥåȤ񤭴ƤϤʤ
 ץꥨǥåȤȤϸҡ

 int anthy_input_map_select(struct anthy_input_context* ictx, int map);
 : ictx ƥȹ¤
       map ޥåֹ
 ֤:  0  ʳ
 ޻Ѵޥåפѹ롣 map ˻ǤΤϰʲ
   MAP_HIRAGANA  Ҥ餬
   MAP_KATAKANA  
   MAP_ALPHABET  ե٥å
   MAP_WALPHABET ѥե٥å

 struct anthy_input_segment* 
 anthy_input_get_candidate(struct anthy_input_context* ictx, int cand_no);
 : ictx ƥȹ¤
       cand_no ֹ
 ֤: Ūθޤʸṽ¤
 Ѵ֤Ǥͭ
 ʸλꤷֹθ롣
  anthy_input_get_candidate ǥץꥨǥåȤ׵ᤷϡ cand_no
 μθ䤬֤롣

 int anthy_input_select_candidate(struct anthy_input_context* ictx, int cand);
 : ictx ƥȹ¤
       cand_no ֹ
 ֤:  0  ʳ
 Ѵ֤Ǥͭ
 ʸλꤷֹθ򤷡ʸ򱦤ʸ˰ư롣

 void anthy_input_free_preedit(struct anthy_input_preedit* pedit);
 : pedit ץꥨǥåȹ¤
 ֤: ̵
 ץꥨǥåȹ¤Τ롣

 void anthy_input_free_segment(struct anthy_input_segment* cand);
 : cand ʸṽ¤Ρ
 ֤: ̵
 ʸṽ¤Τ롣

* ǡ *
struct anthy_input_preedit {
  int state;                                      /*  */

  char* commit;                                   /* ʸ */
  char* cut_buf;                                  /* ڤäʸ */

  struct anthy_input_segment* segment;            /* ʸꥹ */
  struct anthy_input_segment* cur_segment;        /* ʸ */
};

 state: ߤξ
             ST_NONE Ե
             ST_EDIT Խ
             ST_CONV Ѵ
             ST_CSEG ʸ῭̾
 commit: NULL ǤʤСꤵ줿ʸäƤ롣
         commit ϰ anthy_input_get_preedit Ⱦä롣
 cut_buf: NULL ǤʤС anthy_input_cut ˤä줿ʸäƤ롣
          cut_buf ϰ anthy_input_get_preedit Ⱦä롣
 segment: Ѵ桢ʸ῭֤̾ǤʸΥꥹ
          Խ֤Ǥϡʸ󡢥޻ʸ󡢶ʸᡢ
          ʸΥꥹ
 cur_segment: Τʸ

struct anthy_input_segment {
  char* str;                            /* ʸ */
  int cand_no;                          /* ֹ */
  int noconv_len;                       /* ̵Ѵ֤ǤΥХȿ */
  int nr_cand;                          /*  */
  int flag;                             /* ե饰 */

  struct anthy_input_segment* next;     /* ʸ */
};
 str: ߤθʸ
      (Խ֤ΡɽʸǤ NULL ˤʤäƤ)
 cand_no: ֹ (0  nr_cand - 1, 
                    γƤ줿ʸǤʤȤ̵ѴΤȤ -1)
 noconv_len: ̵Ѵ֤ǤʸʸĹ (Хȿ)
 nr_cand:  (γƤ줿ʸǤʤȤ -1)
 flag: ʸμɽե饰
           SF_CURSOR       ޤʸ
           SF_ENUM         Ϣ³ѴʤɤΤǡ
                           ɽ뤳Ȥ饤֥꤬ƤƤ롣
                           ȡ anthy_input_get_candidate
                           ȤäƸɽΤ˾ޤ
           SF_ENUM_REVERSE θɽ뤳Ȥ饤֥꤬
                           ƤƤ
           SF_EDITTING     Խ֤ʸ
           SF_PENDING      ޤ޻Τޤޤǡ̾ˤʤäƤʤʸ
           SF_FOLLOWING    ʸ῭֤̾ǡʸʸ
                            1 ʸˤʸ
