]> git.saurik.com Git - apple/hfs.git/blame - hfs_encodings/hfs_encodings.h
hfs-366.30.3.tar.gz
[apple/hfs.git] / hfs_encodings / hfs_encodings.h
CommitLineData
558d2836
A
1/*
2 * Copyright (c) 2000-2015 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * Copyright (c) 1997-2000 Apple Inc. All Rights Reserved
30 */
31
32#ifndef _HFS_ENCODINGS_H_
33#define _HFS_ENCODINGS_H_
34
35#if !TARGET_OS_EMBEDDED
36
37#include <sys/appleapiopts.h>
38
39#ifdef __APPLE_API_UNSTABLE
40
41#define CTL_HFS_NAMES { \
42 { 0, 0 }, \
43 { "encodingbias", CTLTYPE_INT }, \
44}
45
46__BEGIN_DECLS
47
48/*
49 * HFS Filename Encoding Converters Interface
50 *
51 * Private Interface for adding hfs filename
52 * encoding converters. These are not needed
53 * for HFS Plus volumes (since they already
54 * have Unicode filenames).
55 *
56 * Used by HFS Encoding Converter Kernel Modules
57 * to register their encoding conversion routines.
58 */
59
60typedef int (* hfs_to_unicode_func_t)(const uint8_t hfs_str[32], uint16_t *uni_str,
61 u_int32_t maxCharLen, u_int32_t *usedCharLen);
62
63typedef int (* unicode_to_hfs_func_t)(uint16_t *uni_str, u_int32_t unicodeChars,
64 uint8_t hfs_str[32]);
65
66int hfs_relconverter (u_int32_t encoding);
67int hfs_getconverter(u_int32_t encoding, hfs_to_unicode_func_t *get_unicode,
68 unicode_to_hfs_func_t *get_hfsname);
69int hfs_addconverter(int kmod_id, u_int32_t encoding,
70 hfs_to_unicode_func_t get_unicode,
71 unicode_to_hfs_func_t get_hfsname);
72int hfs_remconverter(int kmod_id, u_int32_t encoding);
73
74u_int32_t hfs_pickencoding(const u_int16_t *src, int len);
75u_int32_t hfs_getencodingbias(void);
76void hfs_setencodingbias(u_int32_t bias);
77int mac_roman_to_utf8(const uint8_t hfs_str[32], uint32_t maxDstLen, uint32_t *actualDstLen,
78 unsigned char* dstStr);
79int utf8_to_mac_roman(uint32_t srcLen, const unsigned char* srcStr, uint8_t dstStr[32]);
80int mac_roman_to_unicode(const uint8_t hfs_str[32], uint16_t *uni_str, u_int32_t maxCharLen, u_int32_t *usedCharLen);
81int unicode_to_mac_roman(uint16_t *uni_str, u_int32_t unicodeChars, uint8_t hfs_str[32]);
82
83__END_DECLS
84
85#endif /* __APPLE_API_UNSTABLE */
86
87#endif // !TARGET_OS_EMBEDDED
88
89#endif /* ! _HFS_ENCODINGS_H_ */