intl/uconv/util/umap.h

branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
equal deleted inserted replaced
-1:000000000000 0:702278290424
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef __UMAP__
6 #define __UMAP__
7
8 #define NOMAPPING 0xfffd
9
10 enum {
11 uFormat0Tag = 0,
12 uFormat1Tag,
13 uFormat2Tag,
14 uNumFormatTag
15 };
16
17 typedef struct {
18 uint16_t srcBegin; /* 2 byte */
19 uint16_t srcEnd; /* 2 byte */
20 uint16_t destBegin; /* 2 byte */
21 } uFormat0;
22
23 typedef struct {
24 uint16_t srcBegin; /* 2 byte */
25 uint16_t srcEnd; /* 2 byte */
26 uint16_t mappingOffset; /* 2 byte */
27 } uFormat1;
28
29 typedef struct {
30 uint16_t srcBegin; /* 2 byte */
31 uint16_t srcEnd; /* 2 byte -waste */
32 uint16_t destBegin; /* 2 byte */
33 } uFormat2;
34
35 typedef struct {
36 union {
37 uFormat0 format0;
38 uFormat1 format1;
39 uFormat2 format2;
40 } fmt;
41 } uMapCell;
42
43 #define UMAPCELL_SIZE (3*sizeof(uint16_t))
44
45 typedef struct {
46 uint16_t itemOfList;
47 uint16_t offsetToFormatArray;
48 uint16_t offsetToMapCellArray;
49 uint16_t offsetToMappingTable;
50 uint16_t data[1];
51 } uTable;
52
53 #endif

mercurial