intl/icu/source/common/punycode.h

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

michael@0 1 /*
michael@0 2 *******************************************************************************
michael@0 3 *
michael@0 4 * Copyright (C) 2002-2003, International Business Machines
michael@0 5 * Corporation and others. All Rights Reserved.
michael@0 6 *
michael@0 7 *******************************************************************************
michael@0 8 * file name: punycode.h
michael@0 9 * encoding: US-ASCII
michael@0 10 * tab size: 8 (not used)
michael@0 11 * indentation:4
michael@0 12 *
michael@0 13 * created on: 2002jan31
michael@0 14 * created by: Markus W. Scherer
michael@0 15 */
michael@0 16
michael@0 17 /* This ICU code derived from: */
michael@0 18 /*
michael@0 19 punycode.c 0.4.0 (2001-Nov-17-Sat)
michael@0 20 http://www.cs.berkeley.edu/~amc/idn/
michael@0 21 Adam M. Costello
michael@0 22 http://www.nicemice.net/amc/
michael@0 23 */
michael@0 24
michael@0 25 #ifndef __PUNYCODE_H__
michael@0 26 #define __PUNYCODE_H__
michael@0 27
michael@0 28 #include "unicode/utypes.h"
michael@0 29
michael@0 30 #if !UCONFIG_NO_IDNA
michael@0 31
michael@0 32 /**
michael@0 33 * u_strToPunycode() converts Unicode to Punycode.
michael@0 34 *
michael@0 35 * The input string must not contain single, unpaired surrogates.
michael@0 36 * The output will be represented as an array of ASCII code points.
michael@0 37 *
michael@0 38 * The output string is NUL-terminated according to normal ICU
michael@0 39 * string output rules.
michael@0 40 *
michael@0 41 * @param src Input Unicode string.
michael@0 42 * This function handles a limited amount of code points
michael@0 43 * (the limit is >=64).
michael@0 44 * U_INDEX_OUTOFBOUNDS_ERROR is set if the limit is exceeded.
michael@0 45 * @param srcLength Number of UChars in src, or -1 if NUL-terminated.
michael@0 46 * @param dest Output Punycode array.
michael@0 47 * @param destCapacity Size of dest.
michael@0 48 * @param caseFlags Vector of boolean values, one per input UChar,
michael@0 49 * indicating that the corresponding character is to be
michael@0 50 * marked for the decoder optionally
michael@0 51 * uppercasing (TRUE) or lowercasing (FALSE)
michael@0 52 * the character.
michael@0 53 * ASCII characters are output directly in the case as marked.
michael@0 54 * Flags corresponding to trail surrogates are ignored.
michael@0 55 * If caseFlags==NULL then input characters are not
michael@0 56 * case-mapped.
michael@0 57 * @param pErrorCode ICU in/out error code parameter.
michael@0 58 * U_INVALID_CHAR_FOUND if src contains
michael@0 59 * unmatched single surrogates.
michael@0 60 * U_INDEX_OUTOFBOUNDS_ERROR if src contains
michael@0 61 * too many code points.
michael@0 62 * @return Number of ASCII characters in puny.
michael@0 63 *
michael@0 64 * @see u_strFromPunycode
michael@0 65 */
michael@0 66 U_CFUNC int32_t
michael@0 67 u_strToPunycode(const UChar *src, int32_t srcLength,
michael@0 68 UChar *dest, int32_t destCapacity,
michael@0 69 const UBool *caseFlags,
michael@0 70 UErrorCode *pErrorCode);
michael@0 71
michael@0 72 /**
michael@0 73 * u_strFromPunycode() converts Punycode to Unicode.
michael@0 74 * The Unicode string will be at most as long (in UChars)
michael@0 75 * than the Punycode string (in chars).
michael@0 76 *
michael@0 77 * @param src Input Punycode string.
michael@0 78 * @param srcLength Length of puny, or -1 if NUL-terminated
michael@0 79 * @param dest Output Unicode string buffer.
michael@0 80 * @param destCapacity Size of dest in number of UChars,
michael@0 81 * and of caseFlags in numbers of UBools.
michael@0 82 * @param caseFlags Output array for case flags as
michael@0 83 * defined by the Punycode string.
michael@0 84 * The caller should uppercase (TRUE) or lowercase (FASLE)
michael@0 85 * the corresponding character in dest.
michael@0 86 * For supplementary characters, only the lead surrogate
michael@0 87 * is marked, and FALSE is stored for the trail surrogate.
michael@0 88 * This is redundant and not necessary for ASCII characters
michael@0 89 * because they are already in the case indicated.
michael@0 90 * Can be NULL if the case flags are not needed.
michael@0 91 * @param pErrorCode ICU in/out error code parameter.
michael@0 92 * U_INVALID_CHAR_FOUND if a non-ASCII character
michael@0 93 * precedes the last delimiter ('-'),
michael@0 94 * or if an invalid character (not a-zA-Z0-9) is found
michael@0 95 * after the last delimiter.
michael@0 96 * U_ILLEGAL_CHAR_FOUND if the delta sequence is ill-formed.
michael@0 97 * @return Number of UChars written to dest.
michael@0 98 *
michael@0 99 * @see u_strToPunycode
michael@0 100 */
michael@0 101 U_CFUNC int32_t
michael@0 102 u_strFromPunycode(const UChar *src, int32_t srcLength,
michael@0 103 UChar *dest, int32_t destCapacity,
michael@0 104 UBool *caseFlags,
michael@0 105 UErrorCode *pErrorCode);
michael@0 106
michael@0 107 #endif /* #if !UCONFIG_NO_IDNA */
michael@0 108
michael@0 109 #endif
michael@0 110
michael@0 111 /*
michael@0 112 * Hey, Emacs, please set the following:
michael@0 113 *
michael@0 114 * Local Variables:
michael@0 115 * indent-tabs-mode: nil
michael@0 116 * End:
michael@0 117 *
michael@0 118 */

mercurial