xref: /haiku/src/add-ons/kernel/file_systems/fat/encodings.h (revision 342a1b221b5bb385410f758df2c625b70cafdd03)
1 /*
2 	Copyright 1999-2001, Be Incorporated.   All Rights Reserved.
3 	This file may be used under the terms of the Be Sample Code License.
4 */
5 #ifndef _DOSFS_ENCODINGS_H_
6 #define _DOSFS_ENCODINGS_H_
7 
8 
9 #ifndef FS_SHELL
10 #include <ByteOrder.h>
11 #else // FS_SHELL
12 typedef unsigned char uchar;
13 
14 #include "fssh_api_wrapper.h"
15 #endif // FS_SHELL
16 
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 
is_unicode_japanese(uint16 c)23 static inline bool is_unicode_japanese(uint16 c)
24 {
25 	if (((c >= 0x3000) && (c <= 0x30ff)) ||
26 			((c >= 0x3200) && (c <= 0x3400)) ||
27 			((c >= 0x4e00) && (c <= 0x9fff)) ||
28 			((c >= 0xf900) && (c <= 0xfaff)) ||
29 			((c >= 0xfe30) && (c <= 0xfe6f)) ||
30 			((c >= 0xff00) && (c <= 0xffef)))
31 		return true;
32 
33 	return false;
34 }
35 
36 
37 status_t unicode_to_utf8(const uchar *uni, uint32 unilen, uint8 *utf8,
38 	uint32 utf8len);
39 
40 bool requires_munged_short_name(const uchar *utf8name,
41                const uchar nshort[11], int encoding);
42 
43 bool requires_long_name(const char *utf8, const uchar *unicode);
44 status_t utf8_to_unicode(const char *utf8, uchar *uni, uint32 unilen);
45 status_t munge_short_name2(uchar nshort[11], int encoding);
46 status_t munge_short_name1(uchar nshort[11], int iteration, int encoding);
47 status_t generate_short_name(const uchar *name, const uchar *uni,
48 		uint32 unilen, uchar nshort[11], int *encoding);
49 status_t generate_short_name_sjis(const uchar *utf8, const uint16 *uni,
50 		uint32 unilen, uchar nshort[11]);
51 
52 status_t msdos_to_utf8(uchar *msdos, uchar *utf8, uint32 utf8len,
53 		uint8 toLower);
54 
55 #ifdef __cplusplus
56 }
57 #endif
58 
59 #endif
60