Newer
Older
scim-wnn / scim-wnn / src / wnnproto.h
/***************************************************************************
 *   Copyright (C) 2004 by TAM(Teppei Tamra)                               *
 *   tam-t@par.odn.ne.jp                                                   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program 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 General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

/* う ぜ ぇ */

extern "C" {

    /* 基礎的なん */
    #define w_char unsigned short
    struct wnn_buf *jl_open_lang(char *,char *,char *,char *,int (*)(char *),int(*)(char *),int);
    int jl_isconnect(struct wnn_buf*);

    /* 変換に関するそれ */
    int jl_ren_conv(struct wnn_buf*,w_char*,int,int,int); /*jl_fi_ren_convとかもあったなぁ */
    int wnn_get_area(struct wnn_buf*,int,int,w_char*,int);
    #define jl_get_kanji(buf,bun1,bun2,area) wnn_get_area(buf,bun1,bun2,area,1)
    #define jl_get_yomi(buf,bun1,bun2,area) wnn_get_area(buf,bun1,bun2,area,0)

    /* w_charからEUCに変換するアレ */
    void wstostr(char *e,w_char *u) {
        int x;
        for(;*u;) {
            x = *u ++;
            *e ++ = x >> 8;
            *e ++ = x;
        }
        *e ++ = 0;
    }
    /* EUCからw_charに変換するナニ */
    void strtows(w_char *u,char *e) {
        int x;
        for(;*e;) {
            x = *e ++;
            if(x & 0x80)
                x = (x << 8)  | *e ++;
            *u ++ = x;
        }
        *u = 0;
    }

}