1 /* $Id: common.h,v 2.2 1993/09/21 14:31:39 nao Exp $ */ 2 /* 3 * Copyright 1991 Sony Corporation 4 * 5 * Permission to use, copy, modify, distribute, and sell this software and its 6 * documentation for any purpose is hereby granted without fee, provided that 7 * the above copyright notice appear in all copies and that both that 8 * copyright notice and this permission notice appear in supporting 9 * documentation, and that the name of Sony not be used in advertising or 10 * publicity pertaining to distribution of the software without specific, 11 * written prior permission. Sony makes no representations about the 12 * suitability of this software for any purpose. It is provided "as is" 13 * without express or implied warranty. 14 * 15 * SONY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SONY 17 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 18 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 19 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 20 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 21 */ 22 /* 23 * Author: Naoshi Suzuki, SONY Corporation. (nao@sm.sony.co.jp) 24 */ 25 26 #include "Xsj3clib.h" 27 #include <X11/Xlib.h> 28 #if defined(XlibSpecificationRelease) && XlibSpecificationRelease > 4 29 #include <X11/Xfuncs.h> 30 #endif 31 32 /* 33 * define for conversion server 34 */ 35 #define SERVER_SJ3 0 36 #define SERVER_NUM 1 37 38 /* 39 * define for conversion mode 40 */ 41 #define NoInputModeMask (1<<16) 42 #define InputModeMask (1<<17) 43 #define ConvedModeMask (1<<18) 44 #define SelectModeMask (1<<19) 45 #define DictModeMask (1<<20) 46 #define AllModeMask (InputModeMask|ConvedModeMask|SelectModeMask \ 47 |DictModeMask|NoInputModeMask) 48 #define OutputModeMask (ConvedModeMask|SelectModeMask) 49 #define FlushModeMask (InputModeMask|ConvedModeMask) 50 51 /* 52 * Define for segment status InputMode/ConvedMode 53 */ 54 #define SEG_NOCONV (1L<<0) 55 #define SEG_CONVED (1L<<1) 56 57 /* 58 * Define for permittion to edit(input) 59 */ 60 #define SEG_EDIT (1L<<0) 61 #define SEG_NOEDIT (1L<<1) 62 63 /* 64 * define for maximum size 65 */ 66 #define INPUT_YOMI_MAX 255 67 #define DICT_YOMI_MAX 31 68 69 /* 70 * define for result of conversion 71 */ 72 #define CONV_FAILED -1 73 #define CONV_UNFIXED 0 74 #define CONV_FIXED 1 75 76 /* 77 * define for flags on/off 78 */ 79 #undef OFF 80 #define OFF 0L 81 #undef ON 82 #define ON (1L<<0) 83 #define ONE (1L<<0) 84 #define THROUGH (1L<<0) 85 #define ALL (1L<<1) 86 #define NONE (1L<<1) 87 #define QUOTE (1L<<1) 88 #define AFTER (1L<<2) 89 #define EDIT (1L<<2) 90 91 /* 92 * define for mode of dictionary handling 93 */ 94 #define REG_STATE (1L<<0) 95 #define CLR_STATE (1L<<1) 96 97 /* 98 * define for message in DictMode(sj3) 99 */ 100 #define SJ3_DICT_INPUT 128 101 #define SJ3_DICT_YOMI 129 102 #define SJ3_DICT_HINSI 130 103 #define SJ3_DICT_CONFIRM 131 104 #define SJ3_TOUROKU_SUCCESSED 132 105 #define SJ3_SYOUKYO_SUCCESSED 133 106 #define SJ3_NO_YOMI_STR 134 107 #define SJ3_LONG_YOMI_STR 135 108 109 /* 110 * Define for SelectMode status 111 */ 112 #define SELECT_CAND 0 113 #define SELECT_SYMBOL 1 114 #define SELECT_HINSI 2 115 116 /* 117 * Define for status of dictionary handling 118 */ 119 #define DICT_INPUT 0 120 #define DICT_HINSI 1 121 #define DICT_CONFIRM 2 122 #define DICT_END 3 123 124 /* 125 * Define for DictMode messages 126 */ 127 #define DICT_STR_MODE 0 128 #define DICT_STR_MSG1 1 129 #define DICT_STR_YOMI 2 130 #define DICT_STR_MSG2 3 131 #define DICT_STR_HINSI 4 132 #define DICT_STR_MSG3 5 133 #define DICT_STR_NUM 6 134 135 /* 136 * Define for NULL 137 */ 138 #ifndef NULL 139 #define NULL 0 140 #endif 141 142 /* 143 * define for reading set-up file. 144 */ 145 #define OPEN_FAILED 1 146 #define READ_FAILED -1 147 #define ALLOC_FAILED -2 148 #define OK 0 149 150 #define SKIP(p) { while (*p == '\t' || *p == ' ') p++; } 151 #define CHECK_END(p) { if (*p == '\n' || *p == '#') return (READ_FAILED); } 152 153 /* 154 * define for reading set-up files. 155 */ 156 #define SO 0x0e 157 #define SI 0x0f 158 #define ESC 0x1b 159 #define SS2 0x8e 160 #define SS3 0x8f 161 #define MASK 0x7f 162 #define MSB 0x80 163 164 /* 165 * define for conversion interface function. 166 */ 167 #define FUNC_OPEN 0 168 #define FUNC_CLOSE 1 169 #define FUNC_CONV 2 170 #define FUNC_CANDNUM 3 171 #define FUNC_CANDIDATE 4 172 #define FUNC_REGISTER 5 173 #define FUNC_CLEAR 6 174 #define FUNC_STUDY 7 175 #define FUNC_STUDY2 8 176 #define FUNC_LOCK 9 177 #define FUNC_UNLOCK 10 178 179 #define FUNC_NUM 11 180 181 typedef struct _sjrctable { 182 unsigned char *key[2]; 183 unsigned char *value[10]; 184 } SjrcRec, *Sjrctable; 185 186 typedef struct _Xsj3cCVServerIF { 187 int lang; 188 int (*func[FUNC_NUM])(); 189 } Xsj3cCVServerIF; 190