1 /*
2  *  $Id: get_kaiarea.c,v 1.7 2003/06/07 02:22:23 hiroo 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, 2002, 2003
14  *
15  * Maintainer:  FreeWnn Project   <freewnn@tomo.gr.jp>
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 #ifdef HAVE_CONFIG_H
32 #  include <config.h>
33 #endif
34 
35 #include <stdio.h>
36 #if STDC_HEADERS
37 #  include <stdlib.h>
38 #  include <sys/types.h>
39 #else
40 #  if HAVE_MALLOC_H
41 #    include <malloc.h>
42 #  endif
43 #endif /* STDC_HEADERS */
44 
45 #include "commonhd.h"
46 #include "de_header.h"
47 #include "jdata.h"
48 #define GLOBAL_VALUE_DEFINE 1
49 #include "kaiseki.h"
50 #undef  GLOBAL_VALUE_DEFINE
51 
52 /*
53  * get_kaiseki_area: take memory areas for analysing.
54  * return value: fail = NULL, success != NULL
55  */
56 int
get_kaiseki_area(size_t kana_len)57 get_kaiseki_area (size_t kana_len)
58 {
59   if (NULL == (maxj = (int *) calloc (kana_len, sizeof(int))))
60     {
61       wnn_errorno = WNN_MALLOC_INITIALIZE;
62       log_debug ("malloc failed in maxj.");
63       return (NULL);
64     }
65 
66   if (NULL == (jmtp = (struct jdata ***) calloc (kana_len, sizeof (struct jdata **))))
67     {
68       wnn_errorno = WNN_MALLOC_INITIALIZE;
69       log_debug ("malloc failed in jmtp.");
70       return (NULL);
71     }
72 
73   if (NULL == (jmt_ = (struct jdata **) calloc (SIZE_JISHOTABLE, sizeof (struct jdata *))))
74     {
75       wnn_errorno = WNN_MALLOC_INITIALIZE;
76       log_debug ("malloc failed in jmt_.");
77       return (NULL);
78     }
79 
80   if (NULL == (jmtw_ = (struct jdata *) calloc (SIZE_JISHOHEAP, sizeof (struct jdata))))
81     {
82       wnn_errorno = WNN_MALLOC_INITIALIZE;
83       log_debug ("malloc failed in jmtw_.");
84       return (NULL);
85     }
86 
87   jmt_end = jmt_ + SIZE_JISHOTABLE;
88   jmt_ptr = jmt_end;		/* H.T. To initialize all in jmt_init */
89   jmtw_end = jmtw_ + SIZE_JISHOHEAP;
90 
91   if (NULL == (bun = (w_char *) calloc ((kana_len + 1), sizeof (w_char))))
92     {
93       wnn_errorno = WNN_MALLOC_INITIALIZE;
94       log_debug ("malloc failed in bun.");
95       return (NULL);
96     }
97 
98   maxchg = kana_len;
99 
100   return (1);
101 }
102 
103 
104 /*
105  * �����С������������˸Ƥ�
106  * ���ϥ�����ꥢ���ꥢ����
107  * �Ѵ������顼�꥿���������ˤ�Ƥ�Ǥ͡�
108  */
109 
110 void
init_work_areas()111 init_work_areas ()
112 {
113   init_ichbnp ();
114   init_bzd ();
115   init_sbn ();
116   init_jktdbn ();
117   init_jktsbn ();
118   init_jktsone ();
119 }
120 
121