summaryrefslogtreecommitdiff
path: root/source/include/kanji.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/include/kanji.h')
-rw-r--r--source/include/kanji.h41
1 files changed, 22 insertions, 19 deletions
diff --git a/source/include/kanji.h b/source/include/kanji.h
index 4f18305c637..cf303659208 100644
--- a/source/include/kanji.h
+++ b/source/include/kanji.h
@@ -2,7 +2,7 @@
Unix SMB/Netbios implementation.
Version 1.9.
Kanji Extensions
- Copyright (C) Andrew Tridgell 1992-1994
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -22,12 +22,11 @@
and extend coding system to EUC/SJIS/JIS/HEX at 1994.10.11
and add all jis codes sequence at 1995.8.16
Notes: Hexadecimal code by <ohki@gssm.otuka.tsukuba.ac.jp>
+ and add upper/lower case conversion 1997.8.21
*/
#ifndef _KANJI_H_
#define _KANJI_H_
-#ifdef KANJI
-
/* FOR SHIFT JIS CODE */
#define is_shift_jis(c) \
((0x81 <= ((unsigned char) (c)) && ((unsigned char) (c)) <= 0x9f) \
@@ -37,6 +36,22 @@
&& ((unsigned char) (c)) != 0x7f)
#define is_kana(c) ((0xa0 <= ((unsigned char) (c)) && ((unsigned char) (c)) <= 0xdf))
+/* case conversion */
+#define is_sj_upper2(c) \
+ ((0x60 <= (unsigned char) (c)) && ((unsigned char) (c) <= 0x79))
+#define is_sj_lower2(c) \
+ ((0x81 <= (unsigned char) (c)) && ((unsigned char) (c) <= 0x9A))
+#define sjis_alph 0x82
+#define is_sj_alph(c) (sjis_alph == (unsigned char) (c))
+#define is_sj_upper(c1, c2) (is_sj_alph (c1) && is_sj_upper2 (c2))
+#define is_sj_lower(c1, c2) (is_sj_alph (c1) && is_sj_lower2 (c2))
+#define sj_toupper2(c) \
+ (is_sj_lower2 (c) ? ((int) ((unsigned char) (c) - 0x81 + 0x60)) : \
+ ((int) (unsigned char) (c)))
+#define sj_tolower2(c) \
+ (is_sj_upper2 (c) ? ((int) ((unsigned char) (c) - 0x60 + 0x81)) : \
+ ((int) (unsigned char) (c)))
+
#ifdef _KANJI_C_
/* FOR EUC CODE */
#define euc_kana (0x8e)
@@ -90,16 +105,8 @@
#else /* not _KANJI_C_ */
-extern char* (*_dos_to_unix) (const char *str, BOOL overwrite);
-extern char* (*_unix_to_dos) (const char *str, BOOL overwrite);
-
-#define unix_to_dos (*_unix_to_dos)
-#define dos_to_unix (*_dos_to_unix)
-
-extern char *sj_strtok (char *s1, const char *s2);
-extern char *sj_strchr (const char *s, int c);
-extern char *sj_strrchr (const char *s, int c);
-extern char *sj_strstr (const char *s1, const char *s2);
+extern char *(*_dos_to_unix)(char *str, BOOL overwrite);
+extern char *(*_unix_to_dos)(char *str, BOOL overwrite);
#define strchr sj_strchr
#define strrchr sj_strrchr
@@ -120,11 +127,7 @@ extern char *sj_strstr (const char *s1, const char *s2);
int interpret_coding_system (char *str, int def);
-#else
-
-#define unix_to_dos(x,y) (x)
-#define dos_to_unix(x,y) (x)
-
-#endif /* not KANJI */
+#define unix_to_dos(x,y) unix2dos_format(x,y)
+#define dos_to_unix(x,y) dos2unix_format(x,y)
#endif /* _KANJI_H_ */