/************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 * only, as published by the Free Software Foundation. * * OpenOffice.org is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License version 3 for more details * (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU Lesser General Public License * version 3 along with OpenOffice.org. If not, see * * for a copy of the LGPLv3 License. * ************************************************************************/ #include "sal/config.h" #include #include "rtl/tencinfo.h" #include "sal/types.h" #include "convertsimple.hxx" #include "tenchelp.hxx" /* Conversion tables for the Devanagari version of ISCII (IS 13194:1991). * * They do not map the ISCII characters INV (0xD9), ATR (0xEF), and EXT (0xF0). * They do not map U+0958--095E to sequences of two ISCII characters, of which * the second would be the combining nukta (0xE9). */ /* The following table is based on LGPL code by Sandeep Patnaik * (patnaik@students.iiit.net) and Sunil Mohan Adapa * (sunilmohanadapa@postmark.net). */ #define RTL_TEXTENC_ISCII_DEVANAGARI_START 0xA1 #define RTL_TEXTENC_ISCII_DEVANAGARI_END 0xFA static sal_uInt16 const aImplIsciiDevanagariToUniTab[RTL_TEXTENC_ISCII_DEVANAGARI_END - RTL_TEXTENC_ISCII_DEVANAGARI_START + 1] = { 0x0901, 0x0902, 0x0903, 0x0905, 0x0906, 0x0907, 0x0908, /* A0 */ 0x0909, 0x090A, 0x090B, 0x090E, 0x090F, 0x0910, 0x090D, 0x0912, 0x0913, 0x0914, 0x0911, 0x0915, 0x0916, 0x0917, 0x0918, 0x0919, /* B0 */ 0x091A, 0x091B, 0x091C, 0x091D, 0x091E, 0x091F, 0x0920, 0x0921, 0x0922, 0x0923, 0x0924, 0x0925, 0x0926, 0x0927, 0x0928, 0x0929, /* C0 */ 0x092A, 0x092B, 0x092C, 0x092D, 0x092E, 0x092F, 0x095F, 0x0930, 0x0931, 0x0932, 0x0933, 0x0934, 0x0935, 0x0936, 0x0937, 0x0938, /* D0 */ 0x0939, 0, 0x093E, 0x093F, 0x0940, 0x0941, 0x0942, 0x0943, 0x0946, 0x0947, 0x0948, 0x0945, 0x094A, 0x094B, 0x094C, 0x0949, /* E0 */ 0x094D, 0x093C, 0x0964, 0, 0, 0, 0, 0, 0, 0x0966, 0x0967, 0x0968, 0x0969, 0x096A, 0x096B, 0x096C, /* F0 */ 0x096D, 0x096E, 0x096F }; #define RTL_TEXTENC_UNICODE_DEVANAGARI_START 0x0901 #define RTL_TEXTENC_UNICODE_DEVANAGARI_END 0x096F static sal_uChar const aImplUniToIsciiDevanagariTab[RTL_TEXTENC_UNICODE_DEVANAGARI_END - RTL_TEXTENC_UNICODE_DEVANAGARI_START + 1] = { 0xA1, 0xA2, 0xA3, 0, 0xA4, 0xA5, 0xA6, /* U+0900 */ 0xA7, 0xA8, 0xA9, 0xAA, 0, 0xAE, 0xAB, 0xAC, 0xAD, 0xB2, 0xAF, 0xB0, 0xB1, 0xB3, 0xB4, 0xB5, /* U+0910 */ 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, /* U+0920 */ 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, /* U+0930 */ 0xD7, 0xD8, 0, 0, 0xE9, 0, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0, 0xE3, 0xE0, 0xE1, /* U+0940 */ 0xE2, 0xE7, 0xE4, 0xE5, 0xE6, 0xE8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* U+0950 */ 0, 0, 0, 0, 0, 0, 0, 0xCE, 0, 0, 0, 0, 0xEA, 0, 0xF1, 0xF2, /* U+0960 */ 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA }; static ImplByteConvertData const aImplIsciiDevanagariConvertData = { aImplIsciiDevanagariToUniTab, NULL, RTL_TEXTENC_ISCII_DEVANAGARI_START, RTL_TEXTENC_ISCII_DEVANAGARI_END, NOTABUNI_START, NOTABUNI_END, aImplUniToIsciiDevanagariTab, NULL, NULL, RTL_TEXTENC_UNICODE_DEVANAGARI_START, RTL_TEXTENC_UNICODE_DEVANAGARI_END, NOTABCHAR_START, NOTABCHAR_END, 0 }; static ImplTextEncodingData const aImplIsciiDevanagariTextEncodingData = { { &aImplIsciiDevanagariConvertData, &sal::detail::textenc::convertCharToUnicode, &sal::detail::textenc::convertUnicodeToChar, NULL, NULL, NULL, NULL, NULL, NULL }, 1, 1, 1, 1, NULL, "x-iscii-de", RTL_TEXTENCODING_INFO_ASCII };