1/* 2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * The contents of this file constitute Original Code as defined in and 7 * are subject to the Apple Public Source License Version 1.2 (the 8 * "License"). You may not use this file except in compliance with the 9 * License. Please obtain a copy of the License at 10 * http://www.apple.com/publicsource and read it before using this file. 11 * 12 * This Original Code and all software distributed under the License are 13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER 14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the 17 * License for the specific language governing rights and limitations 18 * under the License. 19 * 20 * @APPLE_LICENSE_HEADER_END@ 21 */ 22 23#include <sys/types.h> 24 25#if !defined(TRUE) 26 #define TRUE 1 27#endif 28 29#if !defined(FALSE) 30 #define FALSE 0 31#endif 32 33typedef u_int8_t UInt8; 34typedef u_int16_t UniChar; 35typedef u_int16_t UInt16; 36typedef u_int32_t UInt32; 37typedef u_int32_t UniCharCount; 38typedef unsigned char Boolean; 39typedef unsigned char Str31[32]; 40 41 42#define kCFStringEncodingMacJapanese 1 43 44/* Values for flags argument for the conversion functions below. These can be combined, but the three NonSpacing behavior flags are exclusive. 45*/ 46enum { 47 kCFStringEncodingAllowLossyConversion = 1, // Uses fallback functions to substitutes non mappable chars 48 kCFStringEncodingBasicDirectionLeftToRight = (1 << 1), // Converted with original direction left-to-right. 49 kCFStringEncodingBasicDirectionRightToLeft = (1 << 2), // Converted with original direction right-to-left. 50 kCFStringEncodingSubstituteCombinings = (1 << 3), // Uses fallback function to combining chars. 51 kCFStringEncodingComposeCombinings = (1 << 4), // Checks mappable precomposed equivalents for decomposed sequences. This is the default behavior. 52 kCFStringEncodingIgnoreCombinings = (1 << 5), // Ignores combining chars. 53 kCFStringEncodingUseCanonical = (1 << 6), // Always use canonical form 54 kCFStringEncodingUseHFSPlusCanonical = (1 << 7), // Always use canonical form but leaves 0x2000 ranges 55 kCFStringEncodingPrependBOM = (1 << 8), // Prepend BOM sequence (i.e. ISO2022KR) 56 kCFStringEncodingDisableCorporateArea = (1 << 9), // Disable the usage of 0xF8xx area for Apple proprietary chars in converting to UniChar, resulting loosely mapping. 57}; 58 59enum { 60 kCFStringEncodingConversionSuccess = 0, 61 kCFStringEncodingInvalidInputStream = 1, 62 kCFStringEncodingInsufficientOutputBufferLength = 2, 63 kCFStringEncodingConverterUnavailable = 3, 64}; 65 66 67extern UInt32 __CFToMacJapanese(UInt32 flags, const UniChar *characters, 68 UInt32 numChars, UInt8 *bytes, UInt32 maxByteLen, UInt32 *usedByteLen); 69 70extern UInt32 __CFFromMacJapanese(UInt32 flags, const UInt8 *bytes, UInt32 numBytes, 71 UniChar *characters, UInt32 maxCharLen, UInt32 *usedCharLen); 72 73