client.c: New print queue query code from Jeff C. Foster " <jfoste@wgc.woodward...
[Samba/gbeck.git] / source / include / kanji.h
blobee3ba7e09a68c70a1cccab7ac0c03a37d4d8b97e
1 /*
2 Unix SMB/Netbios implementation.
3 Version 1.9.
4 Kanji Extensions
5 Copyright (C) Andrew Tridgell 1992-1997
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 Adding for Japanese language by <fujita@ainix.isac.co.jp> 1994.9.5
22 and extend coding system to EUC/SJIS/JIS/HEX at 1994.10.11
23 and add all jis codes sequence at 1995.8.16
24 Notes: Hexadecimal code by <ohki@gssm.otuka.tsukuba.ac.jp>
26 #ifndef _KANJI_H_
27 #define _KANJI_H_
29 #ifdef KANJI
31 /* FOR SHIFT JIS CODE */
32 #define is_shift_jis(c) \
33 ((0x81 <= ((unsigned char) (c)) && ((unsigned char) (c)) <= 0x9f) \
34 || (0xe0 <= ((unsigned char) (c)) && ((unsigned char) (c)) <= 0xef))
35 #define is_shift_jis2(c) \
36 (0x40 <= ((unsigned char) (c)) && ((unsigned char) (c)) <= 0xfc \
37 && ((unsigned char) (c)) != 0x7f)
38 #define is_kana(c) ((0xa0 <= ((unsigned char) (c)) && ((unsigned char) (c)) <= 0xdf))
40 #ifdef _KANJI_C_
41 /* FOR EUC CODE */
42 #define euc_kana (0x8e)
43 #define is_euc_kana(c) (((unsigned char) (c)) == euc_kana)
44 #define is_euc(c) (0xa0 < ((unsigned char) (c)) && ((unsigned char) (c)) < 0xff)
46 /* FOR JIS CODE */
47 /* default jis third shift code, use for output */
48 #ifndef JIS_KSO
49 #define JIS_KSO 'B'
50 #endif
51 #ifndef JIS_KSI
52 #define JIS_KSI 'J'
53 #endif
54 /* in: \E$B or \E$@ */
55 /* out: \E(J or \E(B or \E(H */
56 #define jis_esc (0x1b)
57 #define jis_so (0x0e)
58 #define jis_so1 ('$')
59 #define jis_so2 ('B')
60 #define jis_si (0x0f)
61 #define jis_si1 ('(')
62 #define jis_si2 ('J')
63 #define is_esc(c) (((unsigned char) (c)) == jis_esc)
64 #define is_so1(c) (((unsigned char) (c)) == jis_so1)
65 #define is_so2(c) (((unsigned char) (c)) == jis_so2 || ((unsigned char) (c)) == '@')
66 #define is_si1(c) (((unsigned char) (c)) == jis_si1)
67 #define is_si2(c) (((unsigned char) (c)) == jis_si2 || ((unsigned char) (c)) == 'B' \
68 || ((unsigned char) (c)) == 'H')
69 #define is_so(c) (((unsigned char) (c)) == jis_so)
70 #define is_si(c) (((unsigned char) (c)) == jis_si)
71 #define junet_kana1 ('(')
72 #define junet_kana2 ('I')
73 #define is_juk1(c) (((unsigned char) (c)) == junet_kana1)
74 #define is_juk2(c) (((unsigned char) (c)) == junet_kana2)
76 #define _KJ_ROMAN (0)
77 #define _KJ_KANJI (1)
78 #define _KJ_KANA (2)
80 /* FOR HEX */
81 #define HEXTAG ':'
82 #define hex2bin(x) \
83 ( ((int) '0' <= ((int) (x)) && ((int) (x)) <= (int)'9')? \
84 (((int) (x))-(int)'0'): \
85 ((int) 'a'<= ((int) (x)) && ((int) (x))<= (int) 'f')? \
86 (((int) (x)) - (int)'a'+10): \
87 (((int) (x)) - (int)'A'+10) )
88 #define bin2hex(x) \
89 ( (((int) (x)) >= 10)? (((int) (x))-10 + (int) 'a'): (((int) (x)) + (int) '0') )
91 #else /* not _KANJI_C_ */
93 extern char* (*_dos_to_unix) (const char *str, BOOL overwrite);
94 extern char* (*_unix_to_dos) (const char *str, BOOL overwrite);
96 #define unix_to_dos (*_unix_to_dos)
97 #define dos_to_unix (*_dos_to_unix)
99 extern char *sj_strtok (char *s1, const char *s2);
100 extern char *sj_strchr (const char *s, int c);
101 extern char *sj_strrchr (const char *s, int c);
102 extern char *sj_strstr (const char *s1, const char *s2);
104 #define strchr sj_strchr
105 #define strrchr sj_strrchr
106 #define strstr sj_strstr
107 #define strtok sj_strtok
109 #endif /* _KANJI_C_ */
111 #define UNKNOWN_CODE (-1)
112 #define SJIS_CODE (0)
113 #define EUC_CODE (1)
114 #define JIS7_CODE (2)
115 #define JIS8_CODE (3)
116 #define JUNET_CODE (4)
117 #define HEX_CODE (5)
118 #define CAP_CODE (6)
119 #define DOSV_CODE SJIS_CODE
121 int interpret_coding_system (char *str, int def);
123 #else
125 #define unix_to_dos(x,y) unix2dos_format(x,y)
126 #define dos_to_unix(x,y) dos2unix_format(x,y)
128 #endif /* not KANJI */
130 #endif /* _KANJI_H_ */