1 /*
2  *  $Id: w_string.c,v 1.3 2001/06/14 18:16:08 ura 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
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 
32 #include <stdio.h>
33 #include "commonhd.h"
34 #include "sdefine.h"
35 #include "sheader.h"
36 #define CONTLINE '$'
37 
38 
39 void
w_printf(x,len)40 w_printf (x, len)
41      w_char *x;
42      int len;
43 {
44   for (; *x != 0 && len > 0; x++, len--)
45     {
46       w_putchar (*x);
47     }
48   flushw_buf ();
49   if (len <= 0)
50     putchar (CONTLINE);
51 }
52 
53 int
wchartochar(w,c)54 wchartochar (w, c)
55      w_char *w;
56      UCHAR *c;
57 {
58   int flg = 0;
59   w_char *w0 = w;
60 
61   for (; *w != 0; w++)
62     {
63       if ((*w) > 0xff)
64         flg = 1;
65     }
66   sStrcpy (c, w0);
67   return (flg);
68 }
69 
70 int
eu_columlen(c)71 eu_columlen (c)
72      unsigned char *c;
73 {
74   int len = 0;
75   w_char tmp;
76 
77   for (; *c;)
78     {
79       if ((*c & 0x80))
80         {
81           tmp = ((w_char) * c++) << 8;
82           tmp |= *c++;
83         }
84       else
85         {
86           tmp = *c++;
87         }
88       if (hankaku (tmp))
89         {
90           len += 1;
91         }
92       else
93         {
94           len += 2;
95         }
96     }
97   return (len);
98 }
99 
100 int
sStrcpy(c,w)101 sStrcpy (c, w)
102      register UCHAR *c;
103      register w_char *w;
104 {
105   return (wnn_sStrcpy (c, w));
106 }
107 
108 int
Sstrcpy(w,c)109 Sstrcpy (w, c)
110      register w_char *w;
111      register UCHAR *c;
112 {
113   return (wnn_Sstrcpy (w, c));
114 }
115 
116 char *
sStrncpy(c,w,n)117 sStrncpy (c, w, n)
118      register UCHAR *c;
119      register w_char *w;
120      register int n;
121 {
122   return (wnn_sStrncpy (c, w, n));
123 }
124 
125 w_char *
Strcat(w1,w2)126 Strcat (w1, w2)
127      register w_char *w1, *w2;
128 {
129   return (wnn_Strcat (w1, w2));
130 }
131 
132 w_char *
Strncat(w1,w2,n)133 Strncat (w1, w2, n)
134      register w_char *w1, *w2;
135      register int n;
136 {
137   return (wnn_Strncat (w1, w2, n));
138 }
139 
140 int
Strncmp(w1,w2,n)141 Strncmp (w1, w2, n)
142      register w_char *w1, *w2;
143      register int n;
144 {
145   return (wnn_Strncmp (w1, w2, n));
146 }
147 
148 w_char *
Strcpy(w1,w2)149 Strcpy (w1, w2)
150      register w_char *w1, *w2;
151 {
152   return (wnn_Strcpy (w1, w2));
153 }
154 
155 w_char *
Strncpy(w1,w2,n)156 Strncpy (w1, w2, n)
157      register w_char *w1, *w2;
158      register int n;
159 {
160   return (wnn_Strncpy (w1, w2, n));
161 }
162 
163 int
Strlen(w)164 Strlen (w)
165      register w_char *w;
166 {
167   return (wnn_Strlen (w));
168 }
169