0
|
1 /*
|
|
2 * $Id: hinsi.c,v 1.4 2006/02/11 09:51:44 aonoto Exp $
|
|
3 */
|
|
4
|
|
5 /*
|
|
6 * FreeWnn is a network-extensible Kana-to-Kanji conversion system.
|
|
7 * This file is part of FreeWnn.
|
|
8 *
|
|
9 * Copyright Kyoto University Research Institute for Mathematical Sciences
|
|
10 * 1987, 1988, 1989, 1990, 1991, 1992
|
|
11 * Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1999
|
|
12 * Copyright ASTEC, Inc. 1987, 1988, 1989, 1990, 1991, 1992
|
|
13 * Copyright FreeWnn Project 1999, 2000, 2006
|
|
14 *
|
|
15 * Maintainer: FreeWnn Project
|
|
16 *
|
|
17 * This program is free software; you can redistribute it and/or modify
|
|
18 * it under the terms of the GNU General Public License as published by
|
|
19 * the Free Software Foundation; either version 2 of the License, or
|
|
20 * (at your option) any later version.
|
|
21 *
|
|
22 * This program is distributed in the hope that it will be useful,
|
|
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
25 * GNU General Public License for more details.
|
|
26 *
|
|
27 * You should have received a copy of the GNU General Public License
|
|
28 * along with this program; if not, write to the Free Software
|
|
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
30 */
|
|
31
|
|
32 #if HAVE_CONFIG_H
|
|
33 # include <config.h>
|
|
34 #endif
|
|
35
|
|
36 #include <stdio.h>
|
|
37 #if STDC_HEADERS
|
|
38 # include <string.h>
|
|
39 #else
|
|
40 # if HAVE_STRINGS_H
|
|
41 # include <strings.h>
|
|
42 # endif
|
|
43 #endif /* STDC_HEADERS */
|
|
44
|
|
45 #include "commonhd.h"
|
|
46 #include "sdefine.h"
|
|
47 #include "sheader.h"
|
|
48 #include "jllib.h"
|
|
49
|
|
50 /*#define ROOT "ÉÊ»ì/" */
|
|
51 #define ROOT "/"
|
|
52 /*
|
|
53 char *maeni = "Á°¤ËÌá¤ë";
|
|
54 */
|
|
55
|
|
56 #define MAXHINSI 256
|
|
57
|
|
58 static w_char *
|
|
59 bunpou_search (node)
|
|
60 w_char *node;
|
|
61 {
|
|
62 int cnt;
|
|
63 int k;
|
|
64 char *hbuf[MAXHINSI];
|
|
65 char buf[1024]; /* iikagen */
|
|
66 char *c;
|
|
67 w_char **whbuf;
|
|
68 w_char *ret;
|
|
69
|
|
70 if (node == NULL)
|
|
71 return (NULL);
|
|
72 cnt = jl_hinsi_list (bun_data_, -1, node, &whbuf);
|
|
73 if (cnt == -1)
|
|
74 {
|
|
75 errorkeyin ();
|
|
76 return (NULL);
|
|
77 }
|
|
78 if (cnt == 0)
|
|
79 return (node);
|
|
80 for (k = 0, c = buf; k < cnt; k++)
|
|
81 {
|
|
82 hbuf[k] = c;
|
|
83 sStrcpy (c, whbuf[k]);
|
|
84 c += strlen (c) + 1;
|
|
85 }
|
|
86 hbuf[cnt] = MSG_GET (15);
|
|
87 TOP:
|
|
88 k = select_one_element (hbuf, cnt + 1, 0, "", 0, 0, main_table[4]);
|
|
89 if (k == -1)
|
|
90 return (NULL);
|
|
91 if (strcmp (hbuf[k], MSG_GET (15)) == 0)
|
|
92 return ((w_char *) MSG_GET (15));
|
|
93 Sstrcpy (node, hbuf[k]);
|
|
94 ret = bunpou_search (node);
|
|
95 if (ret == NULL)
|
|
96 return (NULL);
|
|
97 if (strcmp ((char *) ret, MSG_GET (15)) == 0)
|
|
98 goto TOP;
|
|
99 return (ret);
|
|
100 }
|
|
101
|
|
102
|
|
103 int
|
|
104 hinsi_in ()
|
|
105 {
|
|
106 w_char *a;
|
|
107 w_char tmp[WNN_HINSI_NAME_LEN];
|
|
108
|
|
109 Sstrcpy (tmp, ROOT);
|
|
110 not_redraw = 1;
|
|
111 if ((a = bunpou_search (tmp)) == NULL || strcmp ((char *) a, MSG_GET (15)) == 0)
|
|
112 {
|
|
113 not_redraw = 0;
|
|
114 return (-1);
|
|
115 }
|
|
116 not_redraw = 0;
|
|
117 return (jl_hinsi_number (bun_data_, a));
|
|
118 }
|