#include "onew.h"
/*
* KANA to KANJI CONVERSION MODE
*/
#define CONT ONEW_CONT
#define EXIT ONEW_EXIT
#define LOOP ONEW_LOOP
int ONEW_select_mode;
int ONEW_kanakan_mode;
static int Nkanakancom;
Onew_kanakancom( ctx,comch,bunsetux,bunsetun, kouhof,kouhox,kouhon,alts )
int *bunsetux;
int (*kouhof)();
int *kouhox;
{ int rc = CONT;
int bi,ai,sai;
bi = *bunsetux; ai = *kouhox;
if( comch == ONEW_ROMKAN_TOGGLE ){
romkan_toggle(); rc=EXIT;
}else
if( comch == ONEW_KK_OPDICT ){
clr_keyinQ(); rc=EXIT;
}else
switch( comch ){
case Cntl('J'):
case Cntl('M'): rc=EXIT;break;
default: enq_keyinQ(comch); rc=EXIT;break;
case DEL_CH:
case BS_CH:
if( 0 < Nkanakancom )
if( 1 < bunsetun )
if( ai != kouhon - 1 )
{ ai = kouhon - 1; rc=CONT;break; }
case 'Q':
case 'q':
case ESC_CH: clr_keyinQ(); rc=EXIT;break;
case ' ':
case Cntl('N'): ai = ai + 1; rc=CONT;break;
case Cntl('P'): ai = ai - 1; rc=CONT;break;
case Cntl('T'): ai = 0; rc=CONT;break;
case Cntl('W'):
case Cntl('G'):
/* the message will be overwritten soon by the ONEW_DIPS_ROMKANMODE */
Onew_putmode(ONEW_mode_ichiran,"");
ONEW_select_mode = 1;
sai = Onew_list_sentaku(0,0,kouhof,alts,kouhon,10,0);
if( 0 <= sai )
ai = sai;
ONEW_select_mode = 0;
rc=CONT;break;
case Cntl('F'): bi = oeiBunsetu_next(ctx,bi, 1);rc=LOOP;break;
case Cntl('B'): bi = oeiBunsetu_next(ctx,bi,-1);rc=LOOP;break;
case Cntl('A'): bi = oeiBunsetu_next(ctx,-1, 1);rc=LOOP;break;
case Cntl('E'): bi = oeiBunsetu_next(ctx, 0,-1);rc=LOOP;break;
case Cntl('I'): oeiBunsetu_shrink(ctx,bi); rc=LOOP;break;
case Cntl('O'): oeiBunsetu_expand(ctx,bi); rc=LOOP;break;
/*
case Cntl('D'): oeiBunsetu_delete(ctx,bi); rc=LOOP;break;
case Cntl('X'): ONEWexternal_henkan(ctx,alts); rc=CONT;break;
*/
}
*bunsetux = bi; *kouhox = ai;
Nkanakancom++;
return rc;
}
OM_kanakan(kc){
Nkanakancom = 0;
ONEW_kanakan_mode = 1;
kc = ouiKANAKAN(kc);
ONEW_kanakan_mode = 0;
return kc;
}
syntax highlighted by Code2HTML, v. 0.9.1