intl/icu/source/tools/genrb/rle.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /*
michael@0 2 *******************************************************************************
michael@0 3 *
michael@0 4 * Copyright (C) 2000, International Business Machines
michael@0 5 * Corporation and others. All Rights Reserved.
michael@0 6 *
michael@0 7 *******************************************************************************
michael@0 8 *
michael@0 9 * File writejava.c
michael@0 10 *
michael@0 11 * Modification History:
michael@0 12 *
michael@0 13 * Date Name Description
michael@0 14 * 01/11/02 Ram Creation.
michael@0 15 *******************************************************************************
michael@0 16 */
michael@0 17
michael@0 18 #ifndef RLE_H
michael@0 19 #define RLE_H 1
michael@0 20
michael@0 21 #include "unicode/utypes.h"
michael@0 22 #include "unicode/ustring.h"
michael@0 23
michael@0 24 U_CDECL_BEGIN
michael@0 25 /**
michael@0 26 * Construct a string representing a byte array. Use run-length encoding.
michael@0 27 * Two bytes are packed into a single char, with a single extra zero byte at
michael@0 28 * the end if needed. A byte represents itself, unless it is the
michael@0 29 * ESCAPE_BYTE. Then the following notations are possible:
michael@0 30 * ESCAPE_BYTE ESCAPE_BYTE ESCAPE_BYTE literal
michael@0 31 * ESCAPE_BYTE n b n instances of byte b
michael@0 32 * Since an encoded run occupies 3 bytes, we only encode runs of 4 or
michael@0 33 * more bytes. Thus we have n > 0 and n != ESCAPE_BYTE and n <= 0xFF.
michael@0 34 * If we encounter a run where n == ESCAPE_BYTE, we represent this as:
michael@0 35 * b ESCAPE_BYTE n-1 b
michael@0 36 * The ESCAPE_BYTE value is chosen so as not to collide with commonly
michael@0 37 * seen values.
michael@0 38 */
michael@0 39 int32_t
michael@0 40 byteArrayToRLEString(const uint8_t* src,int32_t srcLen, uint16_t* buffer,int32_t bufLen, UErrorCode* status);
michael@0 41
michael@0 42
michael@0 43 /**
michael@0 44 * Construct a string representing a char array. Use run-length encoding.
michael@0 45 * A character represents itself, unless it is the ESCAPE character. Then
michael@0 46 * the following notations are possible:
michael@0 47 * ESCAPE ESCAPE ESCAPE literal
michael@0 48 * ESCAPE n c n instances of character c
michael@0 49 * Since an encoded run occupies 3 characters, we only encode runs of 4 or
michael@0 50 * more characters. Thus we have n > 0 and n != ESCAPE and n <= 0xFFFF.
michael@0 51 * If we encounter a run where n == ESCAPE, we represent this as:
michael@0 52 * c ESCAPE n-1 c
michael@0 53 * The ESCAPE value is chosen so as not to collide with commonly
michael@0 54 * seen values.
michael@0 55 */
michael@0 56 int32_t
michael@0 57 usArrayToRLEString(const uint16_t* src,int32_t srcLen,uint16_t* buffer, int32_t bufLen,UErrorCode* status);
michael@0 58
michael@0 59 /**
michael@0 60 * Construct an array of bytes from a run-length encoded string.
michael@0 61 */
michael@0 62 int32_t
michael@0 63 rleStringToByteArray(uint16_t* src, int32_t srcLen, uint8_t* target, int32_t tgtLen, UErrorCode* status);
michael@0 64 /**
michael@0 65 * Construct an array of shorts from a run-length encoded string.
michael@0 66 */
michael@0 67 int32_t
michael@0 68 rleStringToUCharArray(uint16_t* src, int32_t srcLen, uint16_t* target, int32_t tgtLen, UErrorCode* status);
michael@0 69
michael@0 70 U_CDECL_END
michael@0 71
michael@0 72 #endif

mercurial