1 /* 2 Copyright (c) 2008-2013 uim Project https://github.com/uim/uim 3 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions 8 are met: 9 10 1. Redistributions of source code must retain the above copyright 11 notice, this list of conditions and the following disclaimer. 12 2. Redistributions in binary form must reproduce the above copyright 13 notice, this list of conditions and the following disclaimer in the 14 documentation and/or other materials provided with the distribution. 15 3. Neither the name of authors nor the names of its contributors 16 may be used to endorse or promote products derived from this software 17 without specific prior written permission. 18 19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND 20 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE 23 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 SUCH DAMAGE. 30 31 */ 32 /* $Id: wnnlib.h,v 10.8 1999/05/25 06:21:10 ishisone Exp $ */ 33 34 /* 35 * wnnlib.h -- wnnlib $BMQ%X%C%@%U%!%$%k(B (Wnn Version4/6 $BBP1~HG(B) 36 * version 5.0 37 * ishisone@sra.co.jp 38 */ 39 40 /* 41 * Copyright (c) 1989 Software Research Associates, Inc. 42 * Copyright (c) 1998 MORIBE, Hideyuki 43 * 44 * Permission to use, copy, modify, and distribute this software and its 45 * documentation for any purpose and without fee is hereby granted, provided 46 * that the above copyright notice appear in all copies and that both that 47 * copyright notice and this permission notice appear in supporting 48 * documentation, and that the name of Software Research Associates not be 49 * used in advertising or publicity pertaining to distribution of the 50 * software without specific, written prior permission. Software Research 51 * Associates makes no representations about the suitability of this software 52 * for any purpose. It is provided "as is" without express or implied 53 * warranty. 54 * 55 * Author: Makoto Ishisone, Software Research Associates, Inc., Japan 56 * MORIBE, Hideyuki 57 */ 58 59 #ifndef _wnnlib_h 60 #define _wnnlib_h 61 62 #include <config.h> 63 64 #include <commonhd.h> 65 #include <jllib.h> 66 #include <wnnerror.h> 67 68 #include "uim.h" 69 #include "uim-scm.h" 70 71 #ifndef WCHAR_DEFINED 72 #define WCHAR_DEFINED 73 #undef wchar 74 typedef unsigned short wchar; 75 #endif 76 77 78 /* $BDj?t(B */ 79 #define JC_FORWARD 1 80 #define JC_BACKWARD 0 81 #define JC_NEXT 0 82 #define JC_PREV 1 83 #define JC_HIRAGANA 0 84 #define JC_KATAKANA 1 85 86 /* $B%(%i!<HV9f(B */ 87 #define JE_NOERROR 0 88 #define JE_WNNERROR 1 /* jllib $B$N%(%i!<(B */ 89 #define JE_NOCORE 2 /* $B%a%b%j$,3NJ]$G$-$J$$(B */ 90 #define JE_NOTCONVERTED 3 /* $BBP>]J8@a$,$^$@JQ49$5$l$F$$$J$$(B */ 91 #define JE_CANTDELETE 4 /* $B%P%C%U%!$N@hF,$NA0!"$"$k$$$O(B 92 * $B:G8e$N<!$NJ8;z$r:o=|$7$h$&$H$7$?(B */ 93 #define JE_NOSUCHCLAUSE 5 /* $B;XDj$5$l$?HV9f$NJ8@a$,B8:_$7$J$$(B */ 94 #define JE_CANTSHRINK 6 /* 1 $BJ8;z$NJ8@a$r=L$a$h$&$H$7$?(B */ 95 #define JE_CANTEXPAND 7 /* $B:G8e$NJ8@a$r?-$P$=$&$H$7$?(B */ 96 #define JE_NOCANDIDATE 8 /* $B<!8uJd$,$J$$(B */ 97 #define JE_NOSUCHCANDIDATE 9 /* $B;XDj$5$l$?HV9f$N8uJd$,B8:_$7$J$$(B */ 98 #define JE_CANTMOVE 10 /* $B%P%C%U%!$N@hF,$NA0!"$"$k$$$O(B 99 * $B:G8e$N<!$K0\F0$7$h$&$H$7$?(B */ 100 #define JE_CLAUSEEMPTY 11 /* $B6u$NJ8$rJQ49$7$h$&$H$7$?(B */ 101 #define JE_ALREADYFIXED 12 /* $B$9$G$K3NDj$5$l$F$$$kJ8$KBP$7$F(B 102 * $BA`:n$r9T$J$C$?(B */ 103 104 /* $B%(%i!<HV9f(B */ 105 extern int jcErrno; /* $B%(%i!<HV9f(B */ 106 107 /* $B%G!<%?%?%$%W(B */ 108 109 /* $B3F>.J8@a$N>pJs(B */ 110 typedef struct { 111 wchar *kanap; /* $BFI$_J8;zNs(B */ 112 wchar *dispp; /* $BI=<(J8;zNs(B */ 113 char conv; /* $BJQ49:Q$_$+(B */ 114 /* 0: $BL$JQ49(B 1: $BJQ49:Q(B -1: $B$G5?;wJQ49(B */ 115 char ltop; /* $BBgJ8@a$N@hF,$+(B? */ 116 } jcClause; 117 118 119 /* $B:n6H0h(B */ 120 typedef struct { 121 /* public member */ 122 int nClause; /* $BJ8@a?t(B */ 123 int curClause; /* $B%+%l%s%HJ8@aHV9f(B */ 124 int curLCStart; /* $B%+%l%s%HBgJ8@a3+;OJ8@aHV9f(B */ 125 int curLCEnd; /* $B%+%l%s%HBgJ8@a=*N;J8@aHV9f(B */ 126 wchar *kanaBuf; /* $B$+$J%P%C%U%!(B */ 127 wchar *kanaEnd; 128 wchar *displayBuf; /* $B%G%#%9%W%l%$%P%C%U%!(B */ 129 wchar *displayEnd; 130 jcClause *clauseInfo; /* $BJ8@a>pJs(B */ 131 struct wnn_buf *wnn; 132 /* private member */ 133 int fixed; /* $B3NDj$5$l$?$+$I$&$+(B */ 134 wchar *dot; /* $B%I%C%H$N0LCV(B */ 135 int candKind; /* $BBgJ8@a$NA48uJd$+>.J8@a$N8uJd$+$r(B 136 $BI=$9%U%i%0(B */ 137 int candClause; /* $BA48uJd$r$H$C$F$$$kJ8@aHV9f(B */ 138 int candClauseEnd; /* $BBgJ8@a$NA48uJd$N;~!"=*N;J8@aHV9f(B */ 139 int bufferSize; /* kanaBuf/displayBuf $B$NBg$-$5(B */ 140 int clauseSize; /* clauseInfo $B$NBg$-$5(B */ 141 } jcConvBuf; 142 143 struct wnn_buf *jcOpen(char *, char *, int, char *, void (*)(), int (*)(), int); 144 struct wnn_buf *jcOpen2(char *, char *, int, char *, char *, void (*)(), int (*)(), int); 145 void jcClose(struct wnn_buf *); 146 int jcIsConnect(struct wnn_buf *); 147 jcConvBuf *jcCreateBuffer(struct wnn_buf *, int, int); 148 int jcDestroyBuffer(jcConvBuf *, int); 149 int jcClear(jcConvBuf *); 150 int jcInsertChar(jcConvBuf *, int); 151 int jcDeleteChar(jcConvBuf *, int); 152 int jcKillLine(jcConvBuf *); 153 int jcConvert(jcConvBuf *, int, int, int); 154 int jcUnconvert(jcConvBuf *); 155 int jcCancel(jcConvBuf *); 156 int jcExpand(jcConvBuf *, int, int); 157 int jcShrink(jcConvBuf *, int, int); 158 int jcKana(jcConvBuf *, int, int); 159 int jcFix(jcConvBuf *); 160 int jcFix1(jcConvBuf *); 161 int jcNext(jcConvBuf *, int, int); 162 int jcCandidateInfo(jcConvBuf *, int, int *, int *); 163 int jcGetCandidate(jcConvBuf *, int, wchar *, int); 164 int jcSelect(jcConvBuf *, int); 165 int jcDotOffset(jcConvBuf *); 166 int jcIsConverted(jcConvBuf *, int); 167 int jcMove(jcConvBuf *, int, int); 168 int jcTop(jcConvBuf *); 169 int jcBottom(jcConvBuf *); 170 int jcChangeClause(jcConvBuf *, wchar *); 171 int jcSaveDic(jcConvBuf *); 172 173 #endif /* _wnnlib_h */ 174