0
|
1 /*
|
|
2 * $Id: rk_macros.h,v 1.2 2001/06/14 18:16:09 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 *
|
|
14 * Author: OMRON SOFTWARE Co., Ltd. <freewnn@rd.kyoto.omronsoft.co.jp>
|
|
15 *
|
|
16 * This program is free software; you can redistribute it and/or modify
|
|
17 * it under the terms of the GNU General Public License as published by
|
|
18 * the Free Software Foundation; either version 2, or (at your option)
|
|
19 * any later version.
|
|
20 *
|
|
21 * This program is distributed in the hope that it will be useful,
|
|
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
24 * GNU General Public License for more details.
|
|
25 *
|
|
26 * You should have received a copy of the GNU General Public License
|
|
27 * along with GNU Emacs; see the file COPYING. If not, write to the
|
|
28 * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
29 *
|
|
30 * Commentary:
|
|
31 *
|
|
32 * Change log:
|
|
33 *
|
|
34 * Last modified date: 8,Feb.1999
|
|
35 *
|
|
36 * Code:
|
|
37 *
|
|
38 */
|
|
39 /***********************************************************************
|
|
40 rk_macros.h
|
|
41 87.11.17 改 正
|
|
42
|
|
43 本変換で使っているマクロ関数群。rk_header.h にincludeされている。
|
|
44 これをincludeすると、自動的にrk_spclval.hもincludeされる。ユーザの
|
|
45 プログラムでこれをincludeすれば、to_upperなどのマクロが使える。
|
|
46 ***********************************************************************/
|
|
47 /* Version 3.0
|
|
48 */
|
|
49 #ifndef RKMCRO
|
|
50
|
|
51 #define RKMCRO
|
|
52 #include "rk_spclval.h" /* ctype.hを使わないマクロは、この中で定義してある */
|
|
53
|
|
54 #ifndef MVUX
|
|
55 # include <ctype.h>
|
|
56 #endif
|
|
57
|
|
58 /* マクロ関数群(引数を複数回評価するものも多いので注意) */
|
|
59
|
|
60 /* 7ビットコードchar用マクロ */
|
|
61 #define isoctal(c) (isdigit(c) && (c) < '8') /* 8進の数字か */
|
|
62 #define isnulsp(c) (isspace(c) || (c) == '\0') /* EOL又は空白文字であるか */
|
|
63
|
|
64 /* 大文字←→小文字変換。定義域は
|
|
65 SYSVR2定義時 toupdown 7ビットchar(isasciiの成り立つ範囲)
|
|
66 _toupdown 英文字(isalphaの成り立つ範囲)
|
|
67 その他の場合 toupdown 〃 */
|
|
68 #ifdef SYSVR2
|
|
69 # define _toupdown(c) (isupper(c) ? _tolower(c) : _toupper(c))
|
|
70 # define toupdown(c) (isupper(c) ? _tolower(c) : toupper(c))
|
|
71 #else
|
|
72 # define toupdown(c) (isupper(c) ? tolower(c) : toupper(c))
|
|
73 #endif
|
|
74
|
|
75 /* ctypeマクロの定義域を拡張したもの。letter型引き数にも適用可。
|
|
76 is_eolspだけは独自のもの。 */
|
|
77 /*
|
|
78 #ifdef OMRON
|
|
79 #define is_lower(l) (islower(l))
|
|
80 #define is_upper(l) (isupper(l))
|
|
81 #define is_alpha(l) (isalpha(l))
|
|
82 #define is_alnum(l) (isalnum(l))
|
|
83 #define is_digit(l) (isdigit(l))
|
|
84 #define is_octal(l) (isoctal(l))
|
|
85 #define is_xdigit(l) (isxdigit(l))
|
|
86 #define is_space(l) (isspace(l))
|
|
87 #define is_cntrl(l) (iscntrl(l))
|
|
88 #define is_nulsp(l) (isnulsp(l))
|
|
89 #else
|
|
90 */
|
|
91 #define is_lower(l) (isascii(l) && islower(l))
|
|
92 #define is_upper(l) (isascii(l) && isupper(l))
|
|
93 #define is_alpha(l) (isascii(l) && isalpha(l))
|
|
94 #define is_alnum(l) (isascii(l) && isalnum(l))
|
|
95 #define is_digit(l) (isascii(l) && isdigit(l))
|
|
96 #define is_octal(l) (isascii(l) && isoctal(l))
|
|
97 #define is_xdigit(l) (isascii(l) && isxdigit(l))
|
|
98 #define is_space(l) (isascii(l) && isspace(l))
|
|
99 #define is_cntrl(l) (isascii(l) && iscntrl(l))
|
|
100 #define is_nulsp(l) (isascii(l) && isnulsp(l))
|
|
101 /*
|
|
102 #endif
|
|
103 */
|
|
104 #define is_eolsp(l) (is_space(l) || (l) == EOLTTR)
|
|
105 #ifdef SYSVR2
|
|
106 # define to_upper(l) (is_lower(l) ? _toupper(l) : (l))
|
|
107 # define to_lower(l) (is_upper(l) ? _tolower(l) : (l))
|
|
108 # define to_updown(l) (is_alpha(l) ? _toupdown(l) : (l))
|
|
109 #else
|
|
110 # define to_upper(l) (is_lower(l) ? toupper(l) : (l))
|
|
111 # define to_lower(l) (is_upper(l) ? tolower(l) : (l))
|
|
112 # define to_updown(l) (is_alpha(l) ? toupdown(l) : (l))
|
|
113 #endif
|
|
114
|
|
115 #endif /* RKMCRO */
|