1b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*
2b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru**********************************************************************
31b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert*   Copyright (C) 2000-2015, International Business Machines
4b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   Corporation and others.  All Rights Reserved.
5b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru**********************************************************************
6b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   file name:  ucnvisci.c
7b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   encoding:   US-ASCII
8b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   tab size:   8 (not used)
9b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   indentation:4
10b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*
11b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   created on: 2001JUN26
12b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   created by: Ram Viswanadha
13b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*
14b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   Date        Name        Description
15b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   24/7/2001   Ram         Added support for EXT character handling
16b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*/
17b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
18b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/utypes.h"
19b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
201b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert#if !UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION
21b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
22103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#include "unicode/ucnv.h"
23103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#include "unicode/ucnv_cb.h"
24103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#include "unicode/utf16.h"
25b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "cmemory.h"
26b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "ucnv_bld.h"
27b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "ucnv_cnv.h"
28b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "cstring.h"
29103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#include "uassert.h"
30b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
31b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define UCNV_OPTIONS_VERSION_MASK 0xf
32b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define NUKTA               0x093c
33b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define HALANT              0x094d
34b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define ZWNJ                0x200c /* Zero Width Non Joiner */
35b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define ZWJ                 0x200d /* Zero width Joiner */
36b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define INVALID_CHAR        0xffff
37b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define ATR                 0xEF   /* Attribute code */
38b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define EXT                 0xF0   /* Extension code */
39b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define DANDA               0x0964
40b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define DOUBLE_DANDA        0x0965
41b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define ISCII_NUKTA         0xE9
42b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define ISCII_HALANT        0xE8
43b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define ISCII_DANDA         0xEA
44b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define ISCII_INV           0xD9
45b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define ISCII_VOWEL_SIGN_E  0xE0
46b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define INDIC_BLOCK_BEGIN   0x0900
47b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define INDIC_BLOCK_END     0x0D7F
48b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define INDIC_RANGE         (INDIC_BLOCK_END - INDIC_BLOCK_BEGIN)
49b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define VOCALLIC_RR         0x0931
50b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define LF                  0x0A
51b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define ASCII_END           0xA0
52b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define NO_CHAR_MARKER      0xFFFE
53b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define TELUGU_DELTA        DELTA * TELUGU
54b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define DEV_ABBR_SIGN       0x0970
55b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define DEV_ANUDATTA        0x0952
56b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define EXT_RANGE_BEGIN     0xA1
57b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define EXT_RANGE_END       0xEE
58b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
59b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru#define PNJ_DELTA           0x0100
60b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru#define PNJ_BINDI           0x0A02
61b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru#define PNJ_TIPPI           0x0A70
62b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru#define PNJ_SIGN_VIRAMA     0x0A4D
63b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru#define PNJ_ADHAK           0x0A71
64b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru#define PNJ_HA              0x0A39
65b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru#define PNJ_RRA             0x0A5C
66b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
67b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Querutypedef enum {
68b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    DEVANAGARI =0,
69b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    BENGALI,
70b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    GURMUKHI,
71b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    GUJARATI,
72b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    ORIYA,
73b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    TAMIL,
74b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    TELUGU,
75b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    KANNADA,
76b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    MALAYALAM,
77b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    DELTA=0x80
78b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}UniLang;
79b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
80b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
81b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Enumeration for switching code pages if <ATR>+<one of below values>
82b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is encountered
83b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
84b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querutypedef enum {
85b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    DEF = 0x40,
86b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    RMN = 0x41,
87b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    DEV = 0x42,
88b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    BNG = 0x43,
89b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    TML = 0x44,
90b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    TLG = 0x45,
91b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    ASM = 0x46,
92b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    ORI = 0x47,
93b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    KND = 0x48,
94b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    MLM = 0x49,
95b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    GJR = 0x4A,
96b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    PNJ = 0x4B,
97b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    ARB = 0x71,
98b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    PES = 0x72,
99b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    URD = 0x73,
100b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    SND = 0x74,
101b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    KSM = 0x75,
102b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    PST = 0x76
103b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}ISCIILang;
104b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
105b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Querutypedef enum {
106b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    DEV_MASK =0x80,
107b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    PNJ_MASK =0x40,
108b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    GJR_MASK =0x20,
109b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    ORI_MASK =0x10,
110b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    BNG_MASK =0x08,
111b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    KND_MASK =0x04,
112b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    MLM_MASK =0x02,
113b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    TML_MASK =0x01,
114b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    ZERO =0x00
115b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}MaskEnum;
116b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
117b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define ISCII_CNV_PREFIX "ISCII,version="
118b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
119b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Querutypedef struct {
120b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    UChar contextCharToUnicode;         /* previous Unicode codepoint for contextual analysis */
121b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    UChar contextCharFromUnicode;       /* previous Unicode codepoint for contextual analysis */
122b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    uint16_t defDeltaToUnicode;         /* delta for switching to default state when DEF is encountered  */
123b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    uint16_t currentDeltaFromUnicode;   /* current delta in Indic block */
124b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    uint16_t currentDeltaToUnicode;     /* current delta in Indic block */
125b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    MaskEnum currentMaskFromUnicode;    /* mask for current state in toUnicode */
126b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    MaskEnum currentMaskToUnicode;      /* mask for current state in toUnicode */
127b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    MaskEnum defMaskToUnicode;          /* mask for default state in toUnicode */
128b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    UBool isFirstBuffer;                /* boolean for fromUnicode to see if we need to announce the first script */
129b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    UBool resetToDefaultToUnicode;      /* boolean for reseting to default delta and mask when a newline is encountered*/
130b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    char name[sizeof(ISCII_CNV_PREFIX) + 1];
131b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    UChar32 prevToUnicodeStatus;        /* Hold the previous toUnicodeStatus. This is necessary because we may need to know the last two code points. */
132b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru} UConverterDataISCII;
133b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
134b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Querutypedef struct LookupDataStruct {
135b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UniLang uniLang;
136b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    MaskEnum maskEnum;
137b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    ISCIILang isciiLang;
138b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} LookupDataStruct;
139b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
140b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustatic const LookupDataStruct lookupInitialData[]={
141b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { DEVANAGARI, DEV_MASK,  DEV },
142b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { BENGALI,    BNG_MASK,  BNG },
143b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { GURMUKHI,   PNJ_MASK,  PNJ },
144b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { GUJARATI,   GJR_MASK,  GJR },
145b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { ORIYA,      ORI_MASK,  ORI },
146b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { TAMIL,      TML_MASK,  TML },
147b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { TELUGU,     KND_MASK,  TLG },
148b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { KANNADA,    KND_MASK,  KND },
149b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { MALAYALAM,  MLM_MASK,  MLM }
150b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru};
151b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
152103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius/*
153103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * For special handling of certain Gurmukhi characters.
154103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * Bit 0 (value 1): PNJ consonant
155103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * Bit 1 (value 2): PNJ Bindi Tippi
156103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius */
157103e9ffba2cba345d0078eb8b8db33249f81840aCraig Corneliusstatic const uint8_t pnjMap[80] = {
158103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    /* 0A00..0A0F */
159103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    0, 0, 0, 0, 0, 2, 0, 2,  0, 0, 0, 0, 0, 0, 0, 0,
160103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    /* 0A10..0A1F */
161103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    0, 0, 0, 0, 0, 3, 3, 3,  3, 3, 3, 3, 3, 3, 3, 3,
162103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    /* 0A20..0A2F */
163103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    3, 3, 3, 3, 3, 3, 3, 3,  3, 0, 3, 3, 3, 3, 3, 3,
164103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    /* 0A30..0A3F */
165103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    3, 0, 0, 0, 0, 3, 3, 0,  3, 3, 0, 0, 0, 0, 0, 2,
166103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    /* 0A40..0A4F */
167103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    0, 2, 2, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0
168103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius};
169103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
170103e9ffba2cba345d0078eb8b8db33249f81840aCraig Corneliusstatic UBool
171103e9ffba2cba345d0078eb8b8db33249f81840aCraig CorneliusisPNJConsonant(UChar32 c) {
172103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    if (c < 0xa00 || 0xa50 <= c) {
173103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius        return FALSE;
174103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    } else {
175103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius        return (UBool)(pnjMap[c - 0xa00] & 1);
176103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    }
177103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius}
178103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
179103e9ffba2cba345d0078eb8b8db33249f81840aCraig Corneliusstatic UBool
180103e9ffba2cba345d0078eb8b8db33249f81840aCraig CorneliusisPNJBindiTippi(UChar32 c) {
181103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    if (c < 0xa00 || 0xa50 <= c) {
182103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius        return FALSE;
183103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    } else {
184103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius        return (UBool)(pnjMap[c - 0xa00] >> 1);
185103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    }
186b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru}
187b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
188b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Querustatic void _ISCIIOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode) {
189b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    if(pArgs->onlyTestIsLoadable) {
190b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        return;
191b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    }
192b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru
193b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    cnv->extraInfo = uprv_malloc(sizeof(UConverterDataISCII));
194b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru
195b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    if (cnv->extraInfo != NULL) {
196b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        int32_t len=0;
197b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        UConverterDataISCII *converterData=
198b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                (UConverterDataISCII *) cnv->extraInfo;
199b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        converterData->contextCharToUnicode=NO_CHAR_MARKER;
200b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        cnv->toUnicodeStatus = missingCharMarker;
201b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        converterData->contextCharFromUnicode=0x0000;
202b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        converterData->resetToDefaultToUnicode=FALSE;
203b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        /* check if the version requested is supported */
204b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        if ((pArgs->options & UCNV_OPTIONS_VERSION_MASK) < 9) {
205b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            /* initialize state variables */
206b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            converterData->currentDeltaFromUnicode
207b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    = converterData->currentDeltaToUnicode
208b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                            = converterData->defDeltaToUnicode = (uint16_t)(lookupInitialData[pArgs->options & UCNV_OPTIONS_VERSION_MASK].uniLang * DELTA);
209b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru
210b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            converterData->currentMaskFromUnicode
211b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    = converterData->currentMaskToUnicode
212b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                            = converterData->defMaskToUnicode = lookupInitialData[pArgs->options & UCNV_OPTIONS_VERSION_MASK].maskEnum;
213b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru
214b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            converterData->isFirstBuffer=TRUE;
215b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            (void)uprv_strcpy(converterData->name, ISCII_CNV_PREFIX);
216b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            len = (int32_t)uprv_strlen(converterData->name);
217b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            converterData->name[len]= (char)((pArgs->options & UCNV_OPTIONS_VERSION_MASK) + '0');
218b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            converterData->name[len+1]=0;
219b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru
220b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            converterData->prevToUnicodeStatus = 0x0000;
221b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        } else {
222b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            uprv_free(cnv->extraInfo);
223b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            cnv->extraInfo = NULL;
224b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            *errorCode = U_ILLEGAL_ARGUMENT_ERROR;
225b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        }
226b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
227b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    } else {
228b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        *errorCode =U_MEMORY_ALLOCATION_ERROR;
229b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
230b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}
231b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru
232b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Querustatic void _ISCIIClose(UConverter *cnv) {
233b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    if (cnv->extraInfo!=NULL) {
234b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        if (!cnv->isExtraLocal) {
235b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            uprv_free(cnv->extraInfo);
236b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        }
237b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        cnv->extraInfo=NULL;
238b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
239b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}
240b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
241b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Querustatic const char* _ISCIIgetName(const UConverter* cnv) {
242b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    if (cnv->extraInfo) {
243b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        UConverterDataISCII* myData= (UConverterDataISCII*)cnv->extraInfo;
244b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        return myData->name;
245b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
246b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    return NULL;
247b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}
248b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
249b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Querustatic void _ISCIIReset(UConverter *cnv, UConverterResetChoice choice) {
250b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UConverterDataISCII* data =(UConverterDataISCII *) (cnv->extraInfo);
251b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    if (choice<=UCNV_RESET_TO_UNICODE) {
252b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        cnv->toUnicodeStatus = missingCharMarker;
253b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        cnv->mode=0;
254b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        data->currentDeltaToUnicode=data->defDeltaToUnicode;
255b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        data->currentMaskToUnicode = data->defMaskToUnicode;
256b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        data->contextCharToUnicode=NO_CHAR_MARKER;
257b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        data->prevToUnicodeStatus = 0x0000;
258b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
259b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    if (choice!=UCNV_RESET_TO_UNICODE) {
260b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        cnv->fromUChar32=0x0000;
261b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        data->contextCharFromUnicode=0x00;
262b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        data->currentMaskFromUnicode=data->defMaskToUnicode;
263b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        data->currentDeltaFromUnicode=data->defDeltaToUnicode;
264b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        data->isFirstBuffer=TRUE;
265b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        data->resetToDefaultToUnicode=FALSE;
266b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
267b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}
268b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
269b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
270b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The values in validity table are indexed by the lower bits of Unicode
271b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * range 0x0900 - 0x09ff. The values have a structure like:
272b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *       ---------------------------------------------------------------
273b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *      | DEV   | PNJ   | GJR   | ORI   | BNG   | TLG   | MLM   | TML   |
274b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *      |       |       |       |       | ASM   | KND   |       |       |
275b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *       ---------------------------------------------------------------
276b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If a code point is valid in a particular script
277b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * then that bit is turned on
278b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
279b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Unicode does not distinguish between Bengali and Assamese so we use 1 bit for
280b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * to represent these languages
281b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
282b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Telugu and Kannada have same codepoints except for Vocallic_RR which we special case
283b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and combine and use 1 bit to represent these languages.
284b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
285b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * TODO: It is probably easier to understand and maintain to change this
286b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * to use uint16_t and give each of the 9 Unicode/script blocks its own bit.
287b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
288b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
289b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustatic const uint8_t validityTable[128] = {
290b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/* This state table is tool generated please do not edit unless you know exactly what you are doing */
291b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/* Note: This table was edited to mirror the Windows XP implementation */
292b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*ISCII:Valid:Unicode */
293b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xa0 : 0x00: 0x900  */ ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
294b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xa1 : 0xb8: 0x901  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + ZERO     + ZERO     + ZERO     ,
295b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xa2 : 0xfe: 0x902  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
296b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xa3 : 0xbf: 0x903  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
297b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x904  */ DEV_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
298b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xa4 : 0xff: 0x905  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
299b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xa5 : 0xff: 0x906  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
300b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xa6 : 0xff: 0x907  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
301b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xa7 : 0xff: 0x908  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
302b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xa8 : 0xff: 0x909  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
303b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xa9 : 0xff: 0x90a  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
304b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xaa : 0xfe: 0x90b  */ DEV_MASK + ZERO     + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO     ,
305b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x90c  */ DEV_MASK + ZERO     + ZERO     + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO     ,
306b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xae : 0x80: 0x90d  */ DEV_MASK + ZERO     + GJR_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
307b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xab : 0x87: 0x90e  */ DEV_MASK + ZERO     + ZERO     + ZERO     + ZERO     + KND_MASK + MLM_MASK + TML_MASK ,
308b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xac : 0xff: 0x90f  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
309b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xad : 0xff: 0x910  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
310b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xb2 : 0x80: 0x911  */ DEV_MASK + ZERO     + GJR_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
311b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xaf : 0x87: 0x912  */ DEV_MASK + ZERO     + ZERO     + ZERO     + ZERO     + KND_MASK + MLM_MASK + TML_MASK ,
312b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xb0 : 0xff: 0x913  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
313b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xb1 : 0xff: 0x914  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
314b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xb3 : 0xff: 0x915  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
315b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xb4 : 0xfe: 0x916  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO     ,
316b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xb5 : 0xfe: 0x917  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO     ,
317b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xb6 : 0xfe: 0x918  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO     ,
318b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xb7 : 0xff: 0x919  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
319b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xb8 : 0xff: 0x91a  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
320b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xb9 : 0xfe: 0x91b  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO     ,
321b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xba : 0xff: 0x91c  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
322b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xbb : 0xfe: 0x91d  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO     ,
323b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xbc : 0xff: 0x91e  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
324b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xbd : 0xff: 0x91f  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
325b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xbe : 0xfe: 0x920  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO     ,
326b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xbf : 0xfe: 0x921  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO     ,
327b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xc0 : 0xfe: 0x922  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO     ,
328b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xc1 : 0xff: 0x923  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
329b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xc2 : 0xff: 0x924  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
330b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xc3 : 0xfe: 0x925  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO     ,
331b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xc4 : 0xfe: 0x926  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO     ,
332b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xc5 : 0xfe: 0x927  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO     ,
333b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xc6 : 0xff: 0x928  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
334b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xc7 : 0x81: 0x929  */ DEV_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + TML_MASK ,
335b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xc8 : 0xff: 0x92a  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
336b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xc9 : 0xfe: 0x92b  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO     ,
337b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xca : 0xfe: 0x92c  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO     ,
338b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xcb : 0xfe: 0x92d  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO     ,
339b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xcc : 0xfe: 0x92e  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
340b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xcd : 0xff: 0x92f  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
341b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xcf : 0xff: 0x930  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
342c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/*0xd0 : 0x87: 0x931  */ DEV_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + MLM_MASK + TML_MASK ,
343b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xd1 : 0xff: 0x932  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
344b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xd2 : 0xb7: 0x933  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + ZERO     + KND_MASK + MLM_MASK + TML_MASK ,
345b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xd3 : 0x83: 0x934  */ DEV_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + MLM_MASK + TML_MASK ,
346b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xd4 : 0xff: 0x935  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + ZERO     + KND_MASK + MLM_MASK + TML_MASK ,
347b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xd5 : 0xfe: 0x936  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO     ,
348b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xd6 : 0xbf: 0x937  */ DEV_MASK + ZERO     + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
349b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xd7 : 0xff: 0x938  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
350b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xd8 : 0xff: 0x939  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
351b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x93A  */ ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
352b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x93B  */ ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
353b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xe9 : 0xda: 0x93c  */ DEV_MASK + PNJ_MASK + ZERO     + ORI_MASK + BNG_MASK + ZERO     + ZERO     + ZERO     ,
354b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x93d  */ DEV_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
355b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xda : 0xff: 0x93e  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
356b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xdb : 0xff: 0x93f  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
357b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xdc : 0xff: 0x940  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
358b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xdd : 0xff: 0x941  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
359b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xde : 0xff: 0x942  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
360b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xdf : 0xbe: 0x943  */ DEV_MASK + ZERO     + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO     ,
361b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x944  */ DEV_MASK + ZERO     + GJR_MASK + ZERO     + BNG_MASK + KND_MASK + ZERO     + ZERO     ,
362b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xe3 : 0x80: 0x945  */ DEV_MASK + ZERO     + GJR_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
363b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xe0 : 0x87: 0x946  */ DEV_MASK + ZERO     + ZERO     + ZERO     + ZERO     + KND_MASK + MLM_MASK + TML_MASK ,
364b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xe1 : 0xff: 0x947  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
365b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xe2 : 0xff: 0x948  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
366b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xe7 : 0x80: 0x949  */ DEV_MASK + ZERO     + GJR_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
367b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xe4 : 0x87: 0x94a  */ DEV_MASK + ZERO     + ZERO     + ZERO     + ZERO     + KND_MASK + MLM_MASK + TML_MASK ,
368b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xe5 : 0xff: 0x94b  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
369b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xe6 : 0xff: 0x94c  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
370b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xe8 : 0xff: 0x94d  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
371b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xec : 0x00: 0x94e  */ ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
372b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xed : 0x00: 0x94f  */ ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
373b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x950  */ DEV_MASK + ZERO     + GJR_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
374b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x951  */ DEV_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
375b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x952  */ DEV_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
376b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x953  */ DEV_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
377b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x954  */ DEV_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
378b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x955  */ ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + KND_MASK + ZERO     + ZERO     ,
379b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x956  */ ZERO     + ZERO     + ZERO     + ORI_MASK + ZERO     + KND_MASK + ZERO     + ZERO     ,
380b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x957  */ ZERO     + ZERO     + ZERO     + ORI_MASK + BNG_MASK + ZERO     + MLM_MASK + ZERO     ,
381b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x958  */ DEV_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
382b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x959  */ DEV_MASK + PNJ_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
383b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x95a  */ DEV_MASK + PNJ_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
384b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x95b  */ DEV_MASK + PNJ_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
385b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x95c  */ DEV_MASK + PNJ_MASK + ZERO     + ZERO     + BNG_MASK + ZERO     + ZERO     + ZERO     ,
386b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x95d  */ DEV_MASK + ZERO     + ZERO     + ORI_MASK + BNG_MASK + ZERO     + ZERO     + ZERO     ,
387b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x95e  */ DEV_MASK + PNJ_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
388b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xce : 0x98: 0x95f  */ DEV_MASK + ZERO     + ZERO     + ORI_MASK + BNG_MASK + ZERO     + ZERO     + ZERO     ,
389b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x960  */ DEV_MASK + ZERO     + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO     ,
390b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x961  */ DEV_MASK + ZERO     + ZERO     + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO     ,
391b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x962  */ DEV_MASK + ZERO     + ZERO     + ZERO     + BNG_MASK + ZERO     + ZERO     + ZERO     ,
392b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x963  */ DEV_MASK + ZERO     + ZERO     + ZERO     + BNG_MASK + ZERO     + ZERO     + ZERO     ,
393b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xea : 0xf8: 0x964  */ DEV_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
394b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xeaea : 0x00: 0x965*/ DEV_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
395b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xf1 : 0xff: 0x966  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
396b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xf2 : 0xff: 0x967  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
397b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xf3 : 0xff: 0x968  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
398b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xf4 : 0xff: 0x969  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
399b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xf5 : 0xff: 0x96a  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
400b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xf6 : 0xff: 0x96b  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
401b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xf7 : 0xff: 0x96c  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
402b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xf8 : 0xff: 0x96d  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
403b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xf9 : 0xff: 0x96e  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
404b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0xfa : 0xff: 0x96f  */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
405b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x80: 0x970  */ DEV_MASK + PNJ_MASK + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     ,
406b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*
407b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The length of the array is 128 to provide values for 0x900..0x97f.
408b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The last 15 entries for 0x971..0x97f of the validity table are all zero
409b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * because no Indic script uses such Unicode code points.
410b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
411b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*0x00 : 0x00: 0x9yz  */ ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO     + ZERO
412b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru};
413b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
414b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustatic const uint16_t fromUnicodeTable[128]={
415b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00a0 ,/* 0x0900 */
416b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00a1 ,/* 0x0901 */
417b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00a2 ,/* 0x0902 */
418b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00a3 ,/* 0x0903 */
419b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xa4e0 ,/* 0x0904 */
420b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00a4 ,/* 0x0905 */
421b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00a5 ,/* 0x0906 */
422b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00a6 ,/* 0x0907 */
423b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00a7 ,/* 0x0908 */
424b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00a8 ,/* 0x0909 */
425b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00a9 ,/* 0x090a */
426b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00aa ,/* 0x090b */
427b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xA6E9 ,/* 0x090c */
428b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00ae ,/* 0x090d */
429b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00ab ,/* 0x090e */
430b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00ac ,/* 0x090f */
431b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00ad ,/* 0x0910 */
432b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00b2 ,/* 0x0911 */
433b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00af ,/* 0x0912 */
434b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00b0 ,/* 0x0913 */
435b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00b1 ,/* 0x0914 */
436b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00b3 ,/* 0x0915 */
437b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00b4 ,/* 0x0916 */
438b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00b5 ,/* 0x0917 */
439b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00b6 ,/* 0x0918 */
440b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00b7 ,/* 0x0919 */
441b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00b8 ,/* 0x091a */
442b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00b9 ,/* 0x091b */
443b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00ba ,/* 0x091c */
444b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00bb ,/* 0x091d */
445b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00bc ,/* 0x091e */
446b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00bd ,/* 0x091f */
447b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00be ,/* 0x0920 */
448b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00bf ,/* 0x0921 */
449b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00c0 ,/* 0x0922 */
450b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00c1 ,/* 0x0923 */
451b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00c2 ,/* 0x0924 */
452b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00c3 ,/* 0x0925 */
453b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00c4 ,/* 0x0926 */
454b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00c5 ,/* 0x0927 */
455b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00c6 ,/* 0x0928 */
456b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00c7 ,/* 0x0929 */
457b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00c8 ,/* 0x092a */
458b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00c9 ,/* 0x092b */
459b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00ca ,/* 0x092c */
460b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00cb ,/* 0x092d */
461b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00cc ,/* 0x092e */
462b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00cd ,/* 0x092f */
463b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00cf ,/* 0x0930 */
464b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00d0 ,/* 0x0931 */
465b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00d1 ,/* 0x0932 */
466b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00d2 ,/* 0x0933 */
467b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00d3 ,/* 0x0934 */
468b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00d4 ,/* 0x0935 */
469b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00d5 ,/* 0x0936 */
470b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00d6 ,/* 0x0937 */
471b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00d7 ,/* 0x0938 */
472b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00d8 ,/* 0x0939 */
473b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x093A */
474b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x093B */
475b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00e9 ,/* 0x093c */
476b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xEAE9 ,/* 0x093d */
477b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00da ,/* 0x093e */
478b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00db ,/* 0x093f */
479b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00dc ,/* 0x0940 */
480b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00dd ,/* 0x0941 */
481b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00de ,/* 0x0942 */
482b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00df ,/* 0x0943 */
483b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xDFE9 ,/* 0x0944 */
484b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00e3 ,/* 0x0945 */
485b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00e0 ,/* 0x0946 */
486b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00e1 ,/* 0x0947 */
487b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00e2 ,/* 0x0948 */
488b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00e7 ,/* 0x0949 */
489b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00e4 ,/* 0x094a */
490b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00e5 ,/* 0x094b */
491b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00e6 ,/* 0x094c */
492b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00e8 ,/* 0x094d */
493b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00ec ,/* 0x094e */
494b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00ed ,/* 0x094f */
495b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xA1E9 ,/* 0x0950 */ /* OM Symbol */
496b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x0951 */
497b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xF0B8 ,/* 0x0952 */
498b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x0953 */
499b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x0954 */
500b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x0955 */
501b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x0956 */
502b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x0957 */
503b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xb3e9 ,/* 0x0958 */
504b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xb4e9 ,/* 0x0959 */
505b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xb5e9 ,/* 0x095a */
506b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xbae9 ,/* 0x095b */
507b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xbfe9 ,/* 0x095c */
508b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xC0E9 ,/* 0x095d */
509b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xc9e9 ,/* 0x095e */
510b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00ce ,/* 0x095f */
511b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xAAe9 ,/* 0x0960 */
512b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xA7E9 ,/* 0x0961 */
513b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xDBE9 ,/* 0x0962 */
514b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xDCE9 ,/* 0x0963 */
515b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00ea ,/* 0x0964 */
516b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xeaea ,/* 0x0965 */
517b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00f1 ,/* 0x0966 */
518b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00f2 ,/* 0x0967 */
519b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00f3 ,/* 0x0968 */
520b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00f4 ,/* 0x0969 */
521b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00f5 ,/* 0x096a */
522b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00f6 ,/* 0x096b */
523b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00f7 ,/* 0x096c */
524b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00f8 ,/* 0x096d */
525b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00f9 ,/* 0x096e */
526b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00fa ,/* 0x096f */
527b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xF0BF ,/* 0x0970 */
528b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x0971 */
529b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x0972 */
530b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x0973 */
531b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x0974 */
532b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x0975 */
533b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x0976 */
534b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x0977 */
535b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x0978 */
536b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x0979 */
537b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x097a */
538b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x097b */
539b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x097c */
540b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x097d */
541b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x097e */
542b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF ,/* 0x097f */
543b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru};
544b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustatic const uint16_t toUnicodeTable[256]={
545b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0000,/* 0x00 */
546b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0001,/* 0x01 */
547b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0002,/* 0x02 */
548b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0003,/* 0x03 */
549b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0004,/* 0x04 */
550b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0005,/* 0x05 */
551b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0006,/* 0x06 */
552b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0007,/* 0x07 */
553b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0008,/* 0x08 */
554b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0009,/* 0x09 */
555b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x000a,/* 0x0a */
556b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x000b,/* 0x0b */
557b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x000c,/* 0x0c */
558b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x000d,/* 0x0d */
559b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x000e,/* 0x0e */
560b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x000f,/* 0x0f */
561b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0010,/* 0x10 */
562b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0011,/* 0x11 */
563b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0012,/* 0x12 */
564b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0013,/* 0x13 */
565b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0014,/* 0x14 */
566b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0015,/* 0x15 */
567b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0016,/* 0x16 */
568b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0017,/* 0x17 */
569b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0018,/* 0x18 */
570b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0019,/* 0x19 */
571b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x001a,/* 0x1a */
572b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x001b,/* 0x1b */
573b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x001c,/* 0x1c */
574b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x001d,/* 0x1d */
575b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x001e,/* 0x1e */
576b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x001f,/* 0x1f */
577b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0020,/* 0x20 */
578b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0021,/* 0x21 */
579b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0022,/* 0x22 */
580b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0023,/* 0x23 */
581b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0024,/* 0x24 */
582b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0025,/* 0x25 */
583b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0026,/* 0x26 */
584b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0027,/* 0x27 */
585b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0028,/* 0x28 */
586b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0029,/* 0x29 */
587b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x002a,/* 0x2a */
588b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x002b,/* 0x2b */
589b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x002c,/* 0x2c */
590b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x002d,/* 0x2d */
591b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x002e,/* 0x2e */
592b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x002f,/* 0x2f */
593b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0030,/* 0x30 */
594b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0031,/* 0x31 */
595b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0032,/* 0x32 */
596b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0033,/* 0x33 */
597b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0034,/* 0x34 */
598b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0035,/* 0x35 */
599b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0036,/* 0x36 */
600b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0037,/* 0x37 */
601b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0038,/* 0x38 */
602b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0039,/* 0x39 */
603b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x003A,/* 0x3A */
604b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x003B,/* 0x3B */
605b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x003c,/* 0x3c */
606b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x003d,/* 0x3d */
607b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x003e,/* 0x3e */
608b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x003f,/* 0x3f */
609b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0040,/* 0x40 */
610b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0041,/* 0x41 */
611b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0042,/* 0x42 */
612b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0043,/* 0x43 */
613b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0044,/* 0x44 */
614b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0045,/* 0x45 */
615b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0046,/* 0x46 */
616b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0047,/* 0x47 */
617b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0048,/* 0x48 */
618b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0049,/* 0x49 */
619b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x004a,/* 0x4a */
620b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x004b,/* 0x4b */
621b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x004c,/* 0x4c */
622b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x004d,/* 0x4d */
623b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x004e,/* 0x4e */
624b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x004f,/* 0x4f */
625b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0050,/* 0x50 */
626b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0051,/* 0x51 */
627b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0052,/* 0x52 */
628b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0053,/* 0x53 */
629b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0054,/* 0x54 */
630b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0055,/* 0x55 */
631b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0056,/* 0x56 */
632b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0057,/* 0x57 */
633b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0058,/* 0x58 */
634b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0059,/* 0x59 */
635b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x005a,/* 0x5a */
636b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x005b,/* 0x5b */
637b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x005c,/* 0x5c */
638b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x005d,/* 0x5d */
639b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x005e,/* 0x5e */
640b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x005f,/* 0x5f */
641b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0060,/* 0x60 */
642b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0061,/* 0x61 */
643b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0062,/* 0x62 */
644b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0063,/* 0x63 */
645b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0064,/* 0x64 */
646b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0065,/* 0x65 */
647b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0066,/* 0x66 */
648b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0067,/* 0x67 */
649b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0068,/* 0x68 */
650b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0069,/* 0x69 */
651b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x006a,/* 0x6a */
652b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x006b,/* 0x6b */
653b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x006c,/* 0x6c */
654b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x006d,/* 0x6d */
655b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x006e,/* 0x6e */
656b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x006f,/* 0x6f */
657b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0070,/* 0x70 */
658b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0071,/* 0x71 */
659b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0072,/* 0x72 */
660b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0073,/* 0x73 */
661b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0074,/* 0x74 */
662b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0075,/* 0x75 */
663b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0076,/* 0x76 */
664b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0077,/* 0x77 */
665b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0078,/* 0x78 */
666b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0079,/* 0x79 */
667b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x007a,/* 0x7a */
668b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x007b,/* 0x7b */
669b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x007c,/* 0x7c */
670b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x007d,/* 0x7d */
671b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x007e,/* 0x7e */
672b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x007f,/* 0x7f */
673b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0080,/* 0x80 */
674b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0081,/* 0x81 */
675b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0082,/* 0x82 */
676b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0083,/* 0x83 */
677b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0084,/* 0x84 */
678b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0085,/* 0x85 */
679b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0086,/* 0x86 */
680b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0087,/* 0x87 */
681b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0088,/* 0x88 */
682b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0089,/* 0x89 */
683b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x008a,/* 0x8a */
684b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x008b,/* 0x8b */
685b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x008c,/* 0x8c */
686b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x008d,/* 0x8d */
687b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x008e,/* 0x8e */
688b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x008f,/* 0x8f */
689b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0090,/* 0x90 */
690b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0091,/* 0x91 */
691b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0092,/* 0x92 */
692b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0093,/* 0x93 */
693b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0094,/* 0x94 */
694b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0095,/* 0x95 */
695b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0096,/* 0x96 */
696b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0097,/* 0x97 */
697b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0098,/* 0x98 */
698b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0099,/* 0x99 */
699b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x009a,/* 0x9a */
700b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x009b,/* 0x9b */
701b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x009c,/* 0x9c */
702b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x009d,/* 0x9d */
703b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x009e,/* 0x9e */
704b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x009f,/* 0x9f */
705b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x00A0,/* 0xa0 */
706b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0901,/* 0xa1 */
707b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0902,/* 0xa2 */
708b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0903,/* 0xa3 */
709b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0905,/* 0xa4 */
710b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0906,/* 0xa5 */
711b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0907,/* 0xa6 */
712b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0908,/* 0xa7 */
713b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0909,/* 0xa8 */
714b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x090a,/* 0xa9 */
715b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x090b,/* 0xaa */
716b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x090e,/* 0xab */
717b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x090f,/* 0xac */
718b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0910,/* 0xad */
719b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x090d,/* 0xae */
720b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0912,/* 0xaf */
721b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0913,/* 0xb0 */
722b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0914,/* 0xb1 */
723b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0911,/* 0xb2 */
724b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0915,/* 0xb3 */
725b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0916,/* 0xb4 */
726b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0917,/* 0xb5 */
727b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0918,/* 0xb6 */
728b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0919,/* 0xb7 */
729b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x091a,/* 0xb8 */
730b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x091b,/* 0xb9 */
731b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x091c,/* 0xba */
732b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x091d,/* 0xbb */
733b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x091e,/* 0xbc */
734b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x091f,/* 0xbd */
735b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0920,/* 0xbe */
736b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0921,/* 0xbf */
737b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0922,/* 0xc0 */
738b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0923,/* 0xc1 */
739b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0924,/* 0xc2 */
740b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0925,/* 0xc3 */
741b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0926,/* 0xc4 */
742b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0927,/* 0xc5 */
743b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0928,/* 0xc6 */
744b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0929,/* 0xc7 */
745b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x092a,/* 0xc8 */
746b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x092b,/* 0xc9 */
747b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x092c,/* 0xca */
748b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x092d,/* 0xcb */
749b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x092e,/* 0xcc */
750b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x092f,/* 0xcd */
751b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x095f,/* 0xce */
752b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0930,/* 0xcf */
753b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0931,/* 0xd0 */
754b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0932,/* 0xd1 */
755b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0933,/* 0xd2 */
756b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0934,/* 0xd3 */
757b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0935,/* 0xd4 */
758b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0936,/* 0xd5 */
759b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0937,/* 0xd6 */
760b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0938,/* 0xd7 */
761b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0939,/* 0xd8 */
762b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x200D,/* 0xd9 */
763b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x093e,/* 0xda */
764b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x093f,/* 0xdb */
765b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0940,/* 0xdc */
766b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0941,/* 0xdd */
767b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0942,/* 0xde */
768b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0943,/* 0xdf */
769b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0946,/* 0xe0 */
770b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0947,/* 0xe1 */
771b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0948,/* 0xe2 */
772b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0945,/* 0xe3 */
773b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x094a,/* 0xe4 */
774b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x094b,/* 0xe5 */
775b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x094c,/* 0xe6 */
776b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0949,/* 0xe7 */
777b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x094d,/* 0xe8 */
778b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x093c,/* 0xe9 */
779b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0964,/* 0xea */
780b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF,/* 0xeb */
781b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF,/* 0xec */
782b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF,/* 0xed */
783b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF,/* 0xee */
784b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF,/* 0xef */
785b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF,/* 0xf0 */
786b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0966,/* 0xf1 */
787b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0967,/* 0xf2 */
788b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0968,/* 0xf3 */
789b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x0969,/* 0xf4 */
790b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x096a,/* 0xf5 */
791b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x096b,/* 0xf6 */
792b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x096c,/* 0xf7 */
793b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x096d,/* 0xf8 */
794b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x096e,/* 0xf9 */
795b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0x096f,/* 0xfa */
796b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF,/* 0xfb */
797b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF,/* 0xfc */
798b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF,/* 0xfd */
799b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF,/* 0xfe */
800b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0xFFFF /* 0xff */
801b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru};
802b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
803b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustatic const uint16_t vowelSignESpecialCases[][2]={
804b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru	{ 2 /*length of array*/    , 0      },
805b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru	{ 0xA4 , 0x0904 },
806b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru};
807b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
808b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustatic const uint16_t nuktaSpecialCases[][2]={
809b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { 16 /*length of array*/   , 0      },
810b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { 0xA6 , 0x090c },
811b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { 0xEA , 0x093D },
812b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { 0xDF , 0x0944 },
813b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { 0xA1 , 0x0950 },
814b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { 0xb3 , 0x0958 },
815b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { 0xb4 , 0x0959 },
816b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { 0xb5 , 0x095a },
817b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { 0xba , 0x095b },
818b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { 0xbf , 0x095c },
819b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { 0xC0 , 0x095d },
820b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { 0xc9 , 0x095e },
821b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { 0xAA , 0x0960 },
822b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { 0xA7 , 0x0961 },
823b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { 0xDB , 0x0962 },
824b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { 0xDC , 0x0963 },
825b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru};
826b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
827b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru
828b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru#define WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,targetByteUnit,err){      \
829b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    int32_t offset = (int32_t)(source - args->source-1);                                        \
830b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      /* write the targetUniChar  to target */                                                  \
831b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    if(target < targetLimit){                                                                   \
832b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        if(targetByteUnit <= 0xFF){                                                             \
833b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            *(target)++ = (uint8_t)(targetByteUnit);                                            \
834b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            if(offsets){                                                                        \
835b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                *(offsets++) = offset;                                                          \
836b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            }                                                                                   \
837b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        }else{                                                                                  \
838b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            if (targetByteUnit > 0xFFFF) {                                                      \
839b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                *(target)++ = (uint8_t)(targetByteUnit>>16);                                    \
840b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                if (offsets) {                                                                  \
841b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    --offset;                                                                   \
842b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    *(offsets++) = offset;                                                      \
843b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                }                                                                               \
844b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            }                                                                                   \
845b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            if (!(target < targetLimit)) {                                                      \
846b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] =    \
847b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                                (uint8_t)(targetByteUnit >> 8);                                 \
848b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] =    \
849b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                                (uint8_t)targetByteUnit;                                        \
850b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                *err = U_BUFFER_OVERFLOW_ERROR;                                                 \
851b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            } else {                                                                            \
852b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                *(target)++ = (uint8_t)(targetByteUnit>>8);                                     \
853b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                if(offsets){                                                                    \
854b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    *(offsets++) = offset;                                                      \
855b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                }                                                                               \
856b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                if(target < targetLimit){                                                       \
857b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    *(target)++ = (uint8_t)  targetByteUnit;                                    \
858b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    if(offsets){                                                                \
859b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        *(offsets++) = offset                            ;                      \
860b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    }                                                                           \
861b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                }else{                                                                          \
862b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] =\
863b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                                (uint8_t) (targetByteUnit);                                     \
864b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    *err = U_BUFFER_OVERFLOW_ERROR;                                             \
865b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                }                                                                               \
866b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            }                                                                                   \
867b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        }                                                                                       \
868b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }else{                                                                                      \
869b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        if (targetByteUnit & 0xFF0000) {                                                        \
870b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] =        \
871b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        (uint8_t) (targetByteUnit >>16);                                        \
872b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        }                                                                                       \
873b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        if(targetByteUnit & 0xFF00){                                                            \
874b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] =        \
875b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        (uint8_t) (targetByteUnit >>8);                                         \
876b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        }                                                                                       \
877b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] =            \
878b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        (uint8_t) (targetByteUnit);                                             \
879b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        *err = U_BUFFER_OVERFLOW_ERROR;                                                         \
880b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }                                                                                           \
881b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}
882b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
883b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/* Rules:
884b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *    Explicit Halant :
885b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                      <HALANT> + <ZWNJ>
886b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *    Soft Halant :
887b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                      <HALANT> + <ZWJ>
888b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
889b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
890b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Querustatic void UConverter_fromUnicode_ISCII_OFFSETS_LOGIC(
891b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        UConverterFromUnicodeArgs * args, UErrorCode * err) {
892b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    const UChar *source = args->source;
893b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    const UChar *sourceLimit = args->sourceLimit;
894b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    unsigned char *target = (unsigned char *) args->target;
895b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    unsigned char *targetLimit = (unsigned char *) args->targetLimit;
896b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    int32_t* offsets = args->offsets;
897b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    uint32_t targetByteUnit = 0x0000;
898b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UChar32 sourceChar = 0x0000;
899b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    UChar32 tempContextFromUnicode = 0x0000;    /* For special handling of the Gurmukhi script. */
900b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UConverterDataISCII *converterData;
901b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    uint16_t newDelta=0;
902b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    uint16_t range = 0;
903b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UBool deltaChanged = FALSE;
904b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
905b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    if ((args->converter == NULL) || (args->targetLimit < args->target) || (args->sourceLimit < args->source)) {
906b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        *err = U_ILLEGAL_ARGUMENT_ERROR;
907b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        return;
908b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
909b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /* initialize data */
910b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    converterData=(UConverterDataISCII*)args->converter->extraInfo;
911b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    newDelta=converterData->currentDeltaFromUnicode;
912b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    range = (uint16_t)(newDelta/DELTA);
913b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
914b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    if ((sourceChar = args->converter->fromUChar32)!=0) {
915b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        goto getTrail;
916b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
917b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
918b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /*writing the char to the output stream */
919b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    while (source < sourceLimit) {
920b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        /* Write the language code following LF only if LF is not the last character. */
921b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        if (args->converter->fromUnicodeStatus == LF) {
922b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            targetByteUnit = ATR<<8;
923b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            targetByteUnit += (uint8_t) lookupInitialData[range].isciiLang;
924b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            args->converter->fromUnicodeStatus = 0x0000;
925b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            /* now append ATR and language code */
926b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,targetByteUnit,err);
927b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            if (U_FAILURE(*err)) {
928b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                break;
929b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            }
930b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        }
931b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru
932b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        sourceChar = *source++;
933b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        tempContextFromUnicode = converterData->contextCharFromUnicode;
934b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru
935b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        targetByteUnit = missingCharMarker;
936b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru
937b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        /*check if input is in ASCII and C0 control codes range*/
938b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        if (sourceChar <= ASCII_END) {
939b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            args->converter->fromUnicodeStatus = sourceChar;
940b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,sourceChar,err);
941b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            if (U_FAILURE(*err)) {
942b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                break;
943b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            }
944b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            continue;
945b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        }
946b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        switch (sourceChar) {
947b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        case ZWNJ:
948b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            /* contextChar has HALANT */
949b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            if (converterData->contextCharFromUnicode) {
950b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                converterData->contextCharFromUnicode = 0x00;
951b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                targetByteUnit = ISCII_HALANT;
952b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            } else {
953b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                /* consume ZWNJ and continue */
954b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                converterData->contextCharFromUnicode = 0x00;
955b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                continue;
956b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            }
957b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            break;
958b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        case ZWJ:
959b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            /* contextChar has HALANT */
960b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            if (converterData->contextCharFromUnicode) {
961b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                targetByteUnit = ISCII_NUKTA;
962b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            } else {
963b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                targetByteUnit =ISCII_INV;
964b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            }
965b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            converterData->contextCharFromUnicode = 0x00;
966b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            break;
967b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        default:
968b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            /* is the sourceChar in the INDIC_RANGE? */
969b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            if ((uint16_t)(INDIC_BLOCK_END-sourceChar) <= INDIC_RANGE) {
970b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                /* Danda and Double Danda are valid in Northern scripts.. since Unicode
971b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                 * does not include these codepoints in all Northern scrips we need to
972b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                 * filter them out
973b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                 */
974b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                if (sourceChar!= DANDA && sourceChar != DOUBLE_DANDA) {
975b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    /* find out to which block the souceChar belongs*/
976b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    range =(uint16_t)((sourceChar-INDIC_BLOCK_BEGIN)/DELTA);
977b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    newDelta =(uint16_t)(range*DELTA);
978b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
979b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    /* Now are we in the same block as the previous? */
980b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    if (newDelta!= converterData->currentDeltaFromUnicode || converterData->isFirstBuffer) {
981b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        converterData->currentDeltaFromUnicode = newDelta;
982b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        converterData->currentMaskFromUnicode = lookupInitialData[range].maskEnum;
983b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        deltaChanged =TRUE;
984b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        converterData->isFirstBuffer=FALSE;
985b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    }
986b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru
987b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    if (converterData->currentDeltaFromUnicode == PNJ_DELTA) {
988b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        if (sourceChar == PNJ_TIPPI) {
989b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                            /* Make sure Tippi is converterd to Bindi. */
990b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                            sourceChar = PNJ_BINDI;
991b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        } else if (sourceChar == PNJ_ADHAK) {
992b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                            /* This is for consonant cluster handling. */
993b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                            converterData->contextCharFromUnicode = PNJ_ADHAK;
994b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        }
995b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru
996b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    }
997b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    /* Normalize all Indic codepoints to Devanagari and map them to ISCII */
998b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    /* now subtract the new delta from sourceChar*/
999b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    sourceChar -= converterData->currentDeltaFromUnicode;
1000b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                }
1001b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1002b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                /* get the target byte unit */
1003b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                targetByteUnit=fromUnicodeTable[(uint8_t)sourceChar];
1004b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1005b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                /* is the code point valid in current script? */
1006b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                if ((validityTable[(uint8_t)sourceChar] & converterData->currentMaskFromUnicode)==0) {
1007c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                    /* Vocallic RR is assigned in ISCII Telugu and Unicode */
1008b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    if (converterData->currentDeltaFromUnicode!=(TELUGU_DELTA) || sourceChar!=VOCALLIC_RR) {
1009b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        targetByteUnit=missingCharMarker;
1010b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    }
1011b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                }
1012b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1013b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                if (deltaChanged) {
1014b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    /* we are in a script block which is different than
1015b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                     * previous sourceChar's script block write ATR and language codes
1016b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                     */
1017b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    uint32_t temp=0;
1018b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    temp =(uint16_t)(ATR<<8);
1019b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    temp += (uint16_t)((uint8_t) lookupInitialData[range].isciiLang);
1020b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    /* reset */
1021b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    deltaChanged=FALSE;
1022b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    /* now append ATR and language code */
1023b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,temp,err);
1024b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    if (U_FAILURE(*err)) {
1025b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        break;
1026b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    }
1027b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                }
1028b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru
1029b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                if (converterData->currentDeltaFromUnicode == PNJ_DELTA && (sourceChar + PNJ_DELTA) == PNJ_ADHAK) {
1030b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    continue;
1031b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                }
1032b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            }
1033b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            /* reset context char */
1034b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            converterData->contextCharFromUnicode = 0x00;
1035b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            break;
1036b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        }
1037103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius        if (converterData->currentDeltaFromUnicode == PNJ_DELTA && tempContextFromUnicode == PNJ_ADHAK && isPNJConsonant((sourceChar + PNJ_DELTA))) {
1038b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            /* If the previous codepoint is Adhak and the current codepoint is a consonant, the targetByteUnit should be C + Halant + C. */
1039b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            /* reset context char */
1040b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            converterData->contextCharFromUnicode = 0x0000;
1041b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            targetByteUnit = targetByteUnit << 16 | ISCII_HALANT << 8 | targetByteUnit;
1042b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            /* write targetByteUnit to target */
1043b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            WRITE_TO_TARGET_FROM_U(args, offsets, source, target, targetLimit, targetByteUnit,err);
1044b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            if (U_FAILURE(*err)) {
1045b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                break;
1046b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            }
1047b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        } else if (targetByteUnit != missingCharMarker) {
1048b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            if (targetByteUnit==ISCII_HALANT) {
1049b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                converterData->contextCharFromUnicode = (UChar)targetByteUnit;
1050b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            }
1051b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            /* write targetByteUnit to target*/
1052b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,targetByteUnit,err);
1053b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            if (U_FAILURE(*err)) {
1054b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                break;
1055b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            }
1056b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        } else {
1057b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            /* oops.. the code point is unassigned */
1058b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            /*check if the char is a First surrogate*/
1059103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius            if (U16_IS_SURROGATE(sourceChar)) {
1060103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius                if (U16_IS_SURROGATE_LEAD(sourceChar)) {
1061b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QuerugetTrail:
1062b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    /*look ahead to find the trail surrogate*/
1063b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    if (source < sourceLimit) {
1064b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        /* test the following code unit */
1065b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        UChar trail= (*source);
1066103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius                        if (U16_IS_TRAIL(trail)) {
1067b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                            source++;
1068103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius                            sourceChar=U16_GET_SUPPLEMENTARY(sourceChar, trail);
1069b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                            *err =U_INVALID_CHAR_FOUND;
1070b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                            /* convert this surrogate code point */
1071b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                            /* exit this condition tree */
1072b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        } else {
1073b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                            /* this is an unmatched lead code unit (1st surrogate) */
1074b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                            /* callback(illegal) */
1075b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                            *err=U_ILLEGAL_CHAR_FOUND;
1076b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        }
1077b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    } else {
1078b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        /* no more input */
1079b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        *err = U_ZERO_ERROR;
1080b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    }
1081b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                } else {
1082b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    /* this is an unmatched trail code unit (2nd surrogate) */
1083b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    /* callback(illegal) */
1084b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    *err=U_ILLEGAL_CHAR_FOUND;
1085b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                }
1086b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            } else {
1087b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                /* callback(unassigned) for a BMP code point */
1088b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                *err = U_INVALID_CHAR_FOUND;
1089b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            }
1090b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1091b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            args->converter->fromUChar32=sourceChar;
1092b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            break;
1093b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        }
1094b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }/* end while(mySourceIndex<mySourceLength) */
1095b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1096b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /*save the state and return */
1097b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    args->source = source;
1098b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    args->target = (char*)target;
1099b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}
1100b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1101c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Querustatic const uint16_t lookupTable[][2]={
1102b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { ZERO,       ZERO     },     /*DEFALT*/
1103b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { ZERO,       ZERO     },     /*ROMAN*/
1104b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { DEVANAGARI, DEV_MASK },
1105b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { BENGALI,    BNG_MASK },
1106b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { TAMIL,      TML_MASK },
1107b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { TELUGU,     KND_MASK },
1108b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { BENGALI,    BNG_MASK },
1109b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { ORIYA,      ORI_MASK },
1110b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { KANNADA,    KND_MASK },
1111b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { MALAYALAM,  MLM_MASK },
1112b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { GUJARATI,   GJR_MASK },
1113b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    { GURMUKHI,   PNJ_MASK }
1114b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru};
1115b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1116b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define WRITE_TO_TARGET_TO_U(args,source,target,offsets,offset,targetUniChar,delta, err){\
1117b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /* add offset to current Indic Block */                                              \
1118b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    if(targetUniChar>ASCII_END &&                                                        \
1119b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru           targetUniChar != ZWJ &&                                                       \
1120b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru           targetUniChar != ZWNJ &&                                                      \
1121b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru           targetUniChar != DANDA &&                                                     \
1122b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru           targetUniChar != DOUBLE_DANDA){                                               \
1123b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                                                                                         \
1124b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru           targetUniChar+=(uint16_t)(delta);                                             \
1125b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }                                                                                    \
1126b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /* now write the targetUniChar */                                                    \
1127b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    if(target<args->targetLimit){                                                        \
1128b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        *(target)++ = (UChar)targetUniChar;                                              \
1129b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        if(offsets){                                                                     \
1130b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            *(offsets)++ = (int32_t)(offset);                                            \
1131b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        }                                                                                \
1132b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }else{                                                                               \
1133b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        args->converter->UCharErrorBuffer[args->converter->UCharErrorBufferLength++] =   \
1134b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            (UChar)targetUniChar;                                                        \
1135b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        *err = U_BUFFER_OVERFLOW_ERROR;                                                  \
1136b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }                                                                                    \
1137b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}
1138b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1139b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define GET_MAPPING(sourceChar,targetUniChar,data){                                      \
1140b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    targetUniChar = toUnicodeTable[(sourceChar)] ;                                       \
1141b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /* is the code point valid in current script? */                                     \
1142b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    if(sourceChar> ASCII_END &&                                                          \
114354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius            (validityTable[(targetUniChar & 0x7F)] & data->currentMaskToUnicode)==0){    \
1144b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        /* Vocallic RR is assigne in ISCII Telugu and Unicode */                         \
1145c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru        if(data->currentDeltaToUnicode!=(TELUGU_DELTA) ||                                \
1146b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    targetUniChar!=VOCALLIC_RR){                                         \
1147b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            targetUniChar=missingCharMarker;                                             \
1148b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        }                                                                                \
1149b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }                                                                                    \
1150b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}
1151b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1152b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/***********
1153b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  Rules for ISCII to Unicode converter
1154b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  ISCII is stateful encoding. To convert ISCII bytes to Unicode,
1155b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  which has both precomposed and decomposed forms characters
1156b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  pre-context and post-context need to be considered.
1157b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
1158b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  Post context
1159b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  i)  ATR : Attribute code is used to declare the font and script switching.
1160b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *      Currently we only switch scripts and font codes consumed without generating an error
1161b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  ii) EXT : Extention code is used to declare switching to Sanskrit and for obscure,
1162b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *      obsolete characters
1163b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  Pre context
1164b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  i)  Halant: if preceeded by a halant then it is a explicit halant
1165b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  ii) Nukta :
1166b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *       a) if preceeded by a halant then it is a soft halant
1167b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *       b) if preceeded by specific consonants and the ligatures have pre-composed
1168b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *          characters in Unicode then convert to pre-composed characters
1169b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  iii) Danda: If Danda is preceeded by a Danda then convert to Double Danda
1170b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
1171b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1172b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1173b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Querustatic void UConverter_toUnicode_ISCII_OFFSETS_LOGIC(UConverterToUnicodeArgs *args, UErrorCode* err) {
1174b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    const char *source = ( char *) args->source;
1175b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UChar *target = args->target;
1176b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    const char *sourceLimit = args->sourceLimit;
1177b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    const UChar* targetLimit = args->targetLimit;
1178b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    uint32_t targetUniChar = 0x0000;
1179b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    uint8_t sourceChar = 0x0000;
1180b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UConverterDataISCII* data;
1181b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UChar32* toUnicodeStatus=NULL;
1182b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    UChar32 tempTargetUniChar = 0x0000;
1183b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    UChar* contextCharToUnicode= NULL;
1184b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UBool found;
1185b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    int i;
1186b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    int offset = 0;
1187b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1188b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    if ((args->converter == NULL) || (target < args->target) || (source < args->source)) {
1189b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        *err = U_ILLEGAL_ARGUMENT_ERROR;
1190b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        return;
1191b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
1192b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1193b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    data = (UConverterDataISCII*)(args->converter->extraInfo);
1194b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    contextCharToUnicode = &data->contextCharToUnicode; /* contains previous ISCII codepoint visited */
1195b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    toUnicodeStatus = (UChar32*)&args->converter->toUnicodeStatus;/* contains the mapping to Unicode of the above codepoint*/
1196b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1197b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    while (U_SUCCESS(*err) && source<sourceLimit) {
1198b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1199b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        targetUniChar = missingCharMarker;
1200b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1201b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        if (target < targetLimit) {
1202b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            sourceChar = (unsigned char)*(source)++;
1203b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1204b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            /* look at the post-context preform special processing */
1205b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            if (*contextCharToUnicode==ATR) {
1206b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1207b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                /* If we have ATR in *contextCharToUnicode then we need to change our
1208b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                 * state to the Indic Script specified by sourceChar
1209b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                 */
1210b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1211b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                /* check if the sourceChar is supported script range*/
1212b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                if ((uint8_t)(PNJ-sourceChar)<=PNJ-DEV) {
1213b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    data->currentDeltaToUnicode = (uint16_t)(lookupTable[sourceChar & 0x0F][0] * DELTA);
1214b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    data->currentMaskToUnicode = (MaskEnum)lookupTable[sourceChar & 0x0F][1];
1215b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                } else if (sourceChar==DEF) {
1216b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    /* switch back to default */
1217b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    data->currentDeltaToUnicode = data->defDeltaToUnicode;
1218b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    data->currentMaskToUnicode = data->defMaskToUnicode;
1219b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                } else {
1220b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    if ((sourceChar >= 0x21 && sourceChar <= 0x3F)) {
1221b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        /* these are display codes consume and continue */
1222b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    } else {
1223b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        *err =U_ILLEGAL_CHAR_FOUND;
1224b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        /* reset */
1225b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        *contextCharToUnicode=NO_CHAR_MARKER;
1226b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        goto CALLBACK;
1227b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    }
1228b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                }
1229b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1230b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                /* reset */
1231b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                *contextCharToUnicode=NO_CHAR_MARKER;
1232b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1233b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                continue;
1234b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1235b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            } else if (*contextCharToUnicode==EXT) {
1236b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                /* check if sourceChar is in 0xA1-0xEE range */
1237b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                if ((uint8_t) (EXT_RANGE_END - sourceChar) <= (EXT_RANGE_END - EXT_RANGE_BEGIN)) {
1238b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    /* We currently support only Anudatta and Devanagari abbreviation sign */
1239b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    if (sourceChar==0xBF || sourceChar == 0xB8) {
1240b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        targetUniChar = (sourceChar==0xBF) ? DEV_ABBR_SIGN : DEV_ANUDATTA;
1241b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru
1242b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        /* find out if the mapping is valid in this state */
1243b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        if (validityTable[(uint8_t)targetUniChar] & data->currentMaskToUnicode) {
1244b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                            *contextCharToUnicode= NO_CHAR_MARKER;
1245b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1246b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                            /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */
1247b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                            if (data->prevToUnicodeStatus) {
1248b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                                WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -1),data->prevToUnicodeStatus,0,err);
1249b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                                data->prevToUnicodeStatus = 0x0000;
1250b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                            }
1251b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                            /* write to target */
1252b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                            WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -2),targetUniChar,data->currentDeltaToUnicode,err);
1253b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1254b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                            continue;
1255b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        }
1256b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    }
1257b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    /* byte unit is unassigned */
1258b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    targetUniChar = missingCharMarker;
1259b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    *err= U_INVALID_CHAR_FOUND;
1260b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                } else {
1261b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    /* only 0xA1 - 0xEE are legal after EXT char */
1262b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    *contextCharToUnicode= NO_CHAR_MARKER;
1263b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    *err = U_ILLEGAL_CHAR_FOUND;
1264b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                }
1265b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                goto CALLBACK;
1266b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            } else if (*contextCharToUnicode==ISCII_INV) {
1267b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                if (sourceChar==ISCII_HALANT) {
1268b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    targetUniChar = 0x0020; /* replace with space accoding to Indic FAQ */
1269b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                } else {
1270b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    targetUniChar = ZWJ;
1271b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                }
1272b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1273b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */
1274b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                if (data->prevToUnicodeStatus) {
1275b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -1),data->prevToUnicodeStatus,0,err);
1276b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    data->prevToUnicodeStatus = 0x0000;
1277b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                }
1278b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                /* write to target */
1279b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -2),targetUniChar,data->currentDeltaToUnicode,err);
1280b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                /* reset */
1281b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                *contextCharToUnicode=NO_CHAR_MARKER;
1282b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            }
1283b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1284b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            /* look at the pre-context and perform special processing */
1285b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            switch (sourceChar) {
1286b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            case ISCII_INV:
1287b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            case EXT: /*falls through*/
1288b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            case ATR:
1289b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                *contextCharToUnicode = (UChar)sourceChar;
1290b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1291b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                if (*toUnicodeStatus != missingCharMarker) {
1292b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */
1293b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    if (data->prevToUnicodeStatus) {
1294b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -1),data->prevToUnicodeStatus,0,err);
1295b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        data->prevToUnicodeStatus = 0x0000;
1296b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    }
1297b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -2),*toUnicodeStatus,data->currentDeltaToUnicode,err);
1298b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    *toUnicodeStatus = missingCharMarker;
1299b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                }
1300b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                continue;
1301b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            case ISCII_DANDA:
1302b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                /* handle double danda*/
1303b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                if (*contextCharToUnicode== ISCII_DANDA) {
1304b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    targetUniChar = DOUBLE_DANDA;
1305b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    /* clear the context */
1306b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    *contextCharToUnicode = NO_CHAR_MARKER;
1307b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    *toUnicodeStatus = missingCharMarker;
1308b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                } else {
1309b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    GET_MAPPING(sourceChar,targetUniChar,data);
1310b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    *contextCharToUnicode = sourceChar;
1311b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                }
1312b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                break;
1313b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            case ISCII_HALANT:
1314b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                /* handle explicit halant */
1315b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                if (*contextCharToUnicode == ISCII_HALANT) {
1316b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    targetUniChar = ZWNJ;
1317b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    /* clear the context */
1318b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    *contextCharToUnicode = NO_CHAR_MARKER;
1319b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                } else {
1320b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    GET_MAPPING(sourceChar,targetUniChar,data);
1321b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    *contextCharToUnicode = sourceChar;
1322b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                }
1323b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                break;
1324b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            case 0x0A:
1325b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                /* fall through */
1326b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            case 0x0D:
1327b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                data->resetToDefaultToUnicode = TRUE;
1328b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                GET_MAPPING(sourceChar,targetUniChar,data)
1329b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                ;
1330b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                *contextCharToUnicode = sourceChar;
1331b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                break;
1332b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru
1333b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            case ISCII_VOWEL_SIGN_E:
1334b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                i=1;
1335b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                found=FALSE;
1336b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                for (; i<vowelSignESpecialCases[0][0]; i++) {
1337103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius                    U_ASSERT(i<sizeof(vowelSignESpecialCases)/sizeof(vowelSignESpecialCases[0]));
1338b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    if (vowelSignESpecialCases[i][0]==(uint8_t)*contextCharToUnicode) {
1339b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        targetUniChar=vowelSignESpecialCases[i][1];
1340b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        found=TRUE;
1341b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        break;
1342b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    }
1343b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                }
1344b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                if (found) {
1345b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    /* find out if the mapping is valid in this state */
1346b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    if (validityTable[(uint8_t)targetUniChar] & data->currentMaskToUnicode) {
1347b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        /*targetUniChar += data->currentDeltaToUnicode ;*/
1348b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        *contextCharToUnicode= NO_CHAR_MARKER;
1349b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        *toUnicodeStatus = missingCharMarker;
1350b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        break;
1351b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    }
1352b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                }
1353b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                GET_MAPPING(sourceChar,targetUniChar,data);
1354b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                *contextCharToUnicode = sourceChar;
1355b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                break;
1356b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru
1357b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            case ISCII_NUKTA:
1358b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                /* handle soft halant */
1359b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                if (*contextCharToUnicode == ISCII_HALANT) {
1360b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    targetUniChar = ZWJ;
1361b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    /* clear the context */
1362b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    *contextCharToUnicode = NO_CHAR_MARKER;
1363b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    break;
1364b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                } else if (data->currentDeltaToUnicode == PNJ_DELTA && data->contextCharToUnicode == 0xc0) {
1365b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */
1366b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    if (data->prevToUnicodeStatus) {
1367b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -1),data->prevToUnicodeStatus,0,err);
1368b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        data->prevToUnicodeStatus = 0x0000;
1369b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    }
1370b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    /* We got here because ISCII_NUKTA was preceded by 0xc0 and we are converting Gurmukhi.
1371b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                     * In that case we must convert (0xc0 0xe9) to (\u0a5c\u0a4d\u0a39).
1372b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                     */
1373b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    targetUniChar = PNJ_RRA;
1374b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    WRITE_TO_TARGET_TO_U(args, source, target, args->offsets, (source-args->source)-2, targetUniChar, 0, err);
1375b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    if (U_SUCCESS(*err)) {
1376b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        targetUniChar = PNJ_SIGN_VIRAMA;
1377b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        WRITE_TO_TARGET_TO_U(args, source, target, args->offsets, (source-args->source)-2, targetUniChar, 0, err);
1378b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        if (U_SUCCESS(*err)) {
1379b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                            targetUniChar = PNJ_HA;
1380b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                            WRITE_TO_TARGET_TO_U(args, source, target, args->offsets, (source-args->source)-2, targetUniChar, 0, err);
1381b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        } else {
1382b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                            args->converter->UCharErrorBuffer[args->converter->UCharErrorBufferLength++]= PNJ_HA;
1383b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        }
1384b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    } else {
1385b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        args->converter->UCharErrorBuffer[args->converter->UCharErrorBufferLength++]= PNJ_SIGN_VIRAMA;
1386b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        args->converter->UCharErrorBuffer[args->converter->UCharErrorBufferLength++]= PNJ_HA;
1387b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    }
1388b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    *toUnicodeStatus = missingCharMarker;
1389b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    data->contextCharToUnicode = NO_CHAR_MARKER;
1390b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    continue;
1391b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                } else {
1392b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    /* try to handle <CHAR> + ISCII_NUKTA special mappings */
1393b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    i=1;
1394b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    found =FALSE;
1395b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    for (; i<nuktaSpecialCases[0][0]; i++) {
1396b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        if (nuktaSpecialCases[i][0]==(uint8_t)
1397b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                                *contextCharToUnicode) {
1398b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                            targetUniChar=nuktaSpecialCases[i][1];
1399b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                            found =TRUE;
1400b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                            break;
1401b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        }
1402b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    }
1403b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    if (found) {
1404b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        /* find out if the mapping is valid in this state */
1405b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        if (validityTable[(uint8_t)targetUniChar] & data->currentMaskToUnicode) {
1406b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                            /*targetUniChar += data->currentDeltaToUnicode ;*/
1407b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                            *contextCharToUnicode= NO_CHAR_MARKER;
1408b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                            *toUnicodeStatus = missingCharMarker;
1409b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                            if (data->currentDeltaToUnicode == PNJ_DELTA) {
1410b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                                /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */
1411b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                                if (data->prevToUnicodeStatus) {
1412b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                                    WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -1),data->prevToUnicodeStatus,0,err);
1413b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                                    data->prevToUnicodeStatus = 0x0000;
1414b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                                }
1415b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                                WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -2),targetUniChar,data->currentDeltaToUnicode,err);
1416b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                                continue;
1417b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                            }
1418b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                            break;
1419b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        }
1420b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                        /* else fall through to default */
1421b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    }
1422b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    /* else fall through to default */
1423b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                }
1424b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            default:GET_MAPPING(sourceChar,targetUniChar,data)
1425b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                ;
1426b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                *contextCharToUnicode = sourceChar;
1427b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                break;
1428b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            }
1429b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1430b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            if (*toUnicodeStatus != missingCharMarker) {
1431b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                /* Check to make sure that consonant clusters are handled correct for Gurmukhi script. */
1432103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius                if (data->currentDeltaToUnicode == PNJ_DELTA && data->prevToUnicodeStatus != 0 && isPNJConsonant(data->prevToUnicodeStatus) &&
1433b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        (*toUnicodeStatus + PNJ_DELTA) == PNJ_SIGN_VIRAMA && (targetUniChar + PNJ_DELTA) == data->prevToUnicodeStatus) {
1434b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    /* Consonant clusters C + HALANT + C should be encoded as ADHAK + C */
143550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                    offset = (int)(source-args->source - 3);
1436b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    tempTargetUniChar = PNJ_ADHAK; /* This is necessary to avoid some compiler warnings. */
1437b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,offset,tempTargetUniChar,0,err);
1438b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,offset,data->prevToUnicodeStatus,0,err);
1439b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    data->prevToUnicodeStatus = 0x0000; /* reset the previous unicode code point */
1440b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    *toUnicodeStatus = missingCharMarker;
1441b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    continue;
1442b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                } else {
1443b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */
1444b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    if (data->prevToUnicodeStatus) {
1445b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -1),data->prevToUnicodeStatus,0,err);
1446b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        data->prevToUnicodeStatus = 0x0000;
1447b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    }
1448b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    /* Check to make sure that Bindi and Tippi are handled correctly for Gurmukhi script.
1449b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                     * If 0xA2 is preceded by a codepoint in the PNJ_BINDI_TIPPI_SET then the target codepoint should be Tippi instead of Bindi.
1450b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                     */
1451103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius                    if (data->currentDeltaToUnicode == PNJ_DELTA && (targetUniChar + PNJ_DELTA) == PNJ_BINDI && isPNJBindiTippi((*toUnicodeStatus + PNJ_DELTA))) {
1452b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        targetUniChar = PNJ_TIPPI - PNJ_DELTA;
1453b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -2),*toUnicodeStatus,PNJ_DELTA,err);
1454103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius                    } else if (data->currentDeltaToUnicode == PNJ_DELTA && (targetUniChar + PNJ_DELTA) == PNJ_SIGN_VIRAMA && isPNJConsonant((*toUnicodeStatus + PNJ_DELTA))) {
1455b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        /* Store the current toUnicodeStatus code point for later handling of consonant cluster in Gurmukhi. */
1456b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        data->prevToUnicodeStatus = *toUnicodeStatus + PNJ_DELTA;
1457b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    } else {
1458b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        /* write the previously mapped codepoint */
1459b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                        WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -2),*toUnicodeStatus,data->currentDeltaToUnicode,err);
1460b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                    }
1461b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                }
1462b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                *toUnicodeStatus = missingCharMarker;
1463b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            }
1464b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1465b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            if (targetUniChar != missingCharMarker) {
1466b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                /* now save the targetUniChar for delayed write */
1467b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                *toUnicodeStatus = (UChar) targetUniChar;
1468b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                if (data->resetToDefaultToUnicode==TRUE) {
1469b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    data->currentDeltaToUnicode = data->defDeltaToUnicode;
1470b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    data->currentMaskToUnicode = data->defMaskToUnicode;
1471b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    data->resetToDefaultToUnicode=FALSE;
1472b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                }
1473b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            } else {
1474b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1475b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                /* we reach here only if targetUniChar == missingCharMarker
1476b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                 * so assign codes to reason and err
1477b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                 */
1478b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                *err = U_INVALID_CHAR_FOUND;
1479b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruCALLBACK:
1480b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                args->converter->toUBytes[0] = (uint8_t) sourceChar;
1481b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                args->converter->toULength = 1;
1482b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                break;
1483b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            }
1484b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1485b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        } else {
1486b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            *err =U_BUFFER_OVERFLOW_ERROR;
1487b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            break;
1488b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        }
1489b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
1490b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1491b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    if (U_SUCCESS(*err) && args->flush && source == sourceLimit) {
1492b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        /* end of the input stream */
1493b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        UConverter *cnv = args->converter;
1494b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1495b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        if (*contextCharToUnicode==ATR || *contextCharToUnicode==EXT || *contextCharToUnicode==ISCII_INV) {
1496b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            /* set toUBytes[] */
1497b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            cnv->toUBytes[0] = (uint8_t)*contextCharToUnicode;
1498b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            cnv->toULength = 1;
1499b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1500b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            /* avoid looping on truncated sequences */
1501b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            *contextCharToUnicode = NO_CHAR_MARKER;
1502b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        } else {
1503b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            cnv->toULength = 0;
1504b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        }
1505b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1506b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        if (*toUnicodeStatus != missingCharMarker) {
1507b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            /* output a remaining target character */
1508b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source - args->source -1),*toUnicodeStatus,data->currentDeltaToUnicode,err);
1509b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            *toUnicodeStatus = missingCharMarker;
1510b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        }
1511b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
1512b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1513b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    args->target = target;
1514b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    args->source = source;
1515b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}
1516b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1517b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/* structure for SafeClone calculations */
1518b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Querustruct cloneISCIIStruct {
1519b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UConverter cnv;
1520b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UConverterDataISCII mydata;
1521b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru};
1522b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1523b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustatic UConverter *
1524b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru_ISCII_SafeClone(const UConverter *cnv,
1525b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru              void *stackBuffer,
1526b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru              int32_t *pBufferSize,
1527b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru              UErrorCode *status)
1528b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru{
1529b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    struct cloneISCIIStruct * localClone;
1530b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    int32_t bufferSizeNeeded = sizeof(struct cloneISCIIStruct);
1531b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1532b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    if (U_FAILURE(*status)) {
1533b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        return 0;
1534b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
1535b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1536b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru    if (*pBufferSize == 0) { /* 'preflighting' request - set needed size into *pBufferSize */
1537b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        *pBufferSize = bufferSizeNeeded;
1538b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        return 0;
1539b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
1540b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1541b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    localClone = (struct cloneISCIIStruct *)stackBuffer;
1542b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /* ucnv.c/ucnv_safeClone() copied the main UConverter already */
1543b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1544b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    uprv_memcpy(&localClone->mydata, cnv->extraInfo, sizeof(UConverterDataISCII));
1545b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    localClone->cnv.extraInfo = &localClone->mydata;
1546b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    localClone->cnv.isExtraLocal = TRUE;
1547b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1548b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    return &localClone->cnv;
1549b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}
1550b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1551b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustatic void
1552b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru_ISCIIGetUnicodeSet(const UConverter *cnv,
1553b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    const USetAdder *sa,
1554b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    UConverterUnicodeSet which,
1555b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    UErrorCode *pErrorCode)
1556b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru{
1557b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    int32_t idx, script;
1558b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    uint8_t mask;
1559b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1560b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /* Since all ISCII versions allow switching to other ISCII
1561b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    scripts, we add all roundtrippable characters to this set. */
1562b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    sa->addRange(sa->set, 0, ASCII_END);
1563b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    for (script = DEVANAGARI; script <= MALAYALAM; script++) {
1564b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        mask = (uint8_t)(lookupInitialData[script].maskEnum);
1565b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        for (idx = 0; idx < DELTA; idx++) {
1566b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru            /* added check for TELUGU character */
1567c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru            if ((validityTable[idx] & mask) || (script==TELUGU && idx==0x31)) {
1568b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                sa->add(sa->set, idx + (script * DELTA) + INDIC_BLOCK_BEGIN);
1569b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            }
1570b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        }
1571b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
1572b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    sa->add(sa->set, DANDA);
1573b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    sa->add(sa->set, DOUBLE_DANDA);
1574b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    sa->add(sa->set, ZWNJ);
1575b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    sa->add(sa->set, ZWJ);
1576b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}
1577b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1578b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustatic const UConverterImpl _ISCIIImpl={
1579b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1580b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UCNV_ISCII,
1581b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1582b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    NULL,
1583b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    NULL,
1584b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1585b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    _ISCIIOpen,
1586b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    _ISCIIClose,
1587b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    _ISCIIReset,
1588b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1589b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UConverter_toUnicode_ISCII_OFFSETS_LOGIC,
1590b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UConverter_toUnicode_ISCII_OFFSETS_LOGIC,
1591b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UConverter_fromUnicode_ISCII_OFFSETS_LOGIC,
1592b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UConverter_fromUnicode_ISCII_OFFSETS_LOGIC,
1593b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    NULL,
1594b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1595b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    NULL,
1596b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    _ISCIIgetName,
1597b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    NULL,
1598b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    _ISCII_SafeClone,
1599b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    _ISCIIGetUnicodeSet
1600b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru};
1601b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1602b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustatic const UConverterStaticData _ISCIIStaticData={
1603b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    sizeof(UConverterStaticData),
1604b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        "ISCII",
1605b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru         0,
1606b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru         UCNV_IBM,
1607b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru         UCNV_ISCII,
1608b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru         1,
1609b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru         4,
1610b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        { 0x1a, 0, 0, 0 },
1611b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        0x1,
1612b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        FALSE,
1613b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        FALSE,
1614b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        0x0,
1615b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        0x0,
1616b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, /* reserved */
1617b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1618b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru};
1619b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1620c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubertconst UConverterSharedData _ISCIIData=
1621c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert        UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_ISCIIStaticData, &_ISCIIImpl);
1622b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1623b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_LEGACY_CONVERSION */
1624