| 1 | #cxx . . $ `<file>/melder/melder_textencoding.h`/ifndef _melder_textencoding_h_ |
| 2 | #define _melder_textencoding_h_cxx . . $ `melder/melder_textencoding.h:2:9`! |
| 3 | /* melder_textencoding.h |
| 4 | * |
| 5 | * Copyright (C) 1992-2020,2022,2024-2026 Paul Boersma |
| 6 | * |
| 7 | * This code is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 3 of the License, or (at |
| 10 | * your option) any later version. |
| 11 | * |
| 12 | * This code is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 15 | * See the GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | /** |
| 22 | * Text encodings. |
| 23 | */ |
| 24 | void Melder_textEncoding_prefscxx . . $ Melder_textEncoding_prefs(49f6e7a06ebc5aa8). (); |
| 25 | void Melder_setInputEncodingcxx . . $ Melder_setInputEncoding(e7da480bd5829302). (kMelder_textInputEncodingcxx . . $ kMelder_textInputEncoding# encoding); |
| 26 | kMelder_textInputEncodingcxx . . $ kMelder_textInputEncoding# Melder_getInputEncodingcxx . . $ Melder_getInputEncoding(d1f14111e3b730d4). (); |
| 27 | void Melder_setOutputEncodingcxx . . $ Melder_setOutputEncoding(96a7a35765e6164e). (kMelder_textOutputEncodingcxx . . $ kMelder_textOutputEncoding# encoding); |
| 28 | kMelder_textOutputEncodingcxx . . $ kMelder_textOutputEncoding# Melder_getOutputEncodingcxx . . $ Melder_getOutputEncoding(581d0d572cba43d7). (); |
| 29 | |
| 30 | /* |
| 31 | * Some other encodings. Although not used in the above set/get functions, |
| 32 | * these constants should stay separate from the above encoding constants |
| 33 | * because they occur in the same fields of struct MelderFile. |
| 34 | */ |
| 35 | constexpr uint32cxx . . $ uint32# kMelder_textOutputEncoding_ASCIIcxx . . $ kMelder_textOutputEncoding_ASCII. = 0x4153'4349; |
| 36 | constexpr uint32cxx . . $ uint32# kMelder_textOutputEncoding_ISO_LATIN1cxx . . $ kMelder_textOutputEncoding_ISO_LATIN1. = 0x4C41'5401; |
| 37 | constexpr uint32cxx . . $ uint32# kMelder_textOutputEncoding_FLACcxx . . $ kMelder_textOutputEncoding_FLAC. = 0x464C'4143; |
| 38 | |
| 39 | bool Melder_isValidAsciicxx . . $ Melder_isValidAscii(2df281243f91fe91). (conststring32cxx . . $ conststring32# string); |
| 40 | bool Melder_str8IsValidAsciicxx . . $ Melder_str8IsValidAscii(c5f7da30cbc0f4e9). (conststring8cxx . . $ conststring8# string); |
| 41 | bool Melder_str8IsValidUtf8cxx . . $ Melder_str8IsValidUtf8(c5f7da30cbc0f4e9). (conststring8cxx . . $ conststring8# string); |
| 42 | bool Melder_isEncodablecxx . . $ Melder_isEncodable(8f54aa54c3f23562). (conststring32cxx . . $ conststring32# string, int outputEncoding); |
| 43 | extern char32cxx . . $ char32# Melder_decodeMacRomancxx . . $ Melder_decodeMacRoman. [256]; |
| 44 | extern char32cxx . . $ char32# Melder_decodeWindowsLatin1cxx . . $ Melder_decodeWindowsLatin1. [256]; |
| 45 | |
| 46 | /** |
| 47 | Replace all bare returns (old Mac) or return-plus-linefeed sequences (Win) with bare linefeeds |
| 48 | (generic: Unix and modern Mac). |
| 49 | Return new length of string (equal to or less than old length). |
| 50 | */ |
| 51 | integercxx . . $ integer# Melder_killReturns_inplacecxx . . $ Melder_killReturns_inplace(9c47b7d7d51fe2c1). (mutablestring32cxx . . $ mutablestring32# text); |
| 52 | integercxx . . $ integer# Melder_killReturns_inplacecxx . . $ Melder_killReturns_inplace(d2cd1729a8aa36c). (mutablestring8cxx . . $ mutablestring8# text); |
| 53 | |
| 54 | int64cxx . . $ int64# Melder_length_utf8cxx . . $ Melder_length_utf8(4ef573ca2b27f34b). (conststring32cxx . . $ conststring32# string, bool nativizeNewlines); |
| 55 | int64cxx . . $ int64# Melder_length_utf16cxx . . $ Melder_length_utf16(4ef573ca2b27f34b). (conststring32cxx . . $ conststring32# string, bool nativizeNewlines); |
| 56 | |
| 57 | void MelderString_8to32cxx . . $ MelderString_8to32(908334b4533925d1). (MelderStringcxx . . $ MelderString# *me, conststring8cxx . . $ conststring8# textA); |
| 58 | extern "C" conststring32cxx . . $ conststring32# Melder_peek8to32_u (conststring8cxx . . $ conststring8# string); |
| 59 | void Melder_8to32_inplace_ecxx . . $ Melder_8to32_inplace_e(b9d82cb7d165907c). (conststring8cxx . . $ conststring8# source, mutablestring32cxx . . $ mutablestring32# target, kMelder_textInputEncodingcxx . . $ kMelder_textInputEncoding# inputEncoding); |
| 60 | // errors: Text is not valid UTF-8. |
| 61 | autostring32cxx . . $ autostring32# Melder_8to32_ecxx . . $ Melder_8to32_e(aa783ea934c735af). (conststring8cxx . . $ conststring8# string, kMelder_textInputEncodingcxx . . $ kMelder_textInputEncoding# inputEncoding); |
| 62 | // errors: Out of memory; Text is not valid UTF-8. |
| 63 | autostring32cxx . . $ autostring32# Melder_8to32_ecxx . . $ Melder_8to32_e(f01fe69d6ed2498b). (conststring8cxx . . $ conststring8# string); |
| 64 | // errors: Out of memory; Text is not valid UTF-8. |
| 65 | |
| 66 | conststring32cxx . . $ conststring32# Melder_peek16to32cxx . . $ Melder_peek16to32(997cc7cc32ad29b). (conststring16cxx . . $ conststring16# text); |
| 67 | autostring32cxx . . $ autostring32# Melder_16to32cxx . . $ Melder_16to32(9cb2d799b2dc7015). (conststring16cxx . . $ conststring16# text); |
| 68 | |
| 69 | extern "C" conststring8cxx . . $ conststring8# Melder_peek32to8 (conststring32cxx . . $ conststring32# string); |
| 70 | void Melder_32to8_inplacecxx . . $ Melder_32to8_inplace(d86258d5722a82b2). (conststring32cxx . . $ conststring32# string, mutablestring8cxx . . $ mutablestring8# utf8); |
| 71 | autostring8cxx . . $ autostring8# Melder_32to8cxx . . $ Melder_32to8(d0484fb546b1094e). (conststring32cxx . . $ conststring32# string); |
| 72 | autostring16cxx . . $ autostring16# Melder_32to16cxx . . $ Melder_32to16(7ff9f4a4972d16cf). (conststring32cxx . . $ conststring32# string); |
| 73 | // errors: Out of memory. |
| 74 | |
| 75 | conststring16cxx . . $ conststring16# Melder_peek32to16cxx . . $ Melder_peek32to16(52b763102d02933b). (conststring32cxx . . $ conststring32# text, bool nativizeNewlines); |
| 76 | extern "C" conststring16cxx . . $ conststring16# Melder_peek32to16 (conststring32cxx . . $ conststring32# string); |
| 77 | |
| 78 | #ifdef _WIN32 |
| 79 | inline conststringW Melder_peek32toW (conststring32 string) { return (conststringW) Melder_peek32to16 (string); } |
| 80 | conststringW Melder_peek32toW_fileSystem (conststring32 string); |
| 81 | autostringW Melder_32toW (conststring32 string); |
| 82 | autostringW Melder_32toW_fileSystem (conststring32 string); |
| 83 | inline conststring32 Melder_peekWto32 (conststringW string) { return Melder_peek16to32 ((conststring16) string); } |
| 84 | inline autostring32 Melder_Wto32 (conststringW string) { return Melder_16to32 ((conststring16) string); } |
| 85 | #endif |
| 86 | |
| 87 | void Melder_32to8_fileSystem_inplacecxx . . $ Melder_32to8_fileSystem_inplace(d86258d5722a82b2). (conststring32cxx . . $ conststring32# string, mutablestring8cxx . . $ mutablestring8# utf8); |
| 88 | conststring8cxx . . $ conststring8# Melder_peek32to8_fileSystemcxx . . $ Melder_peek32to8_fileSystem(c6a971952cbb8e31). (conststring32cxx . . $ conststring32# string); |
| 89 | |
| 90 | void Melder_8bitFileRepresentationToStr32_inplacecxx . . $ Melder_8bitFileRepresentationToStr32_inplace(9a630526fa4dddfe). (conststring8cxx . . $ conststring8# utf8, mutablestring32cxx . . $ mutablestring32# string); |
| 91 | const void * Melder_peek32toCfstringcxx . . $ Melder_peek32toCfstring(4b547028db3a54bb). (conststring32cxx . . $ conststring32# string); |
| 92 | const void * Melder_peek32toCfstring_fileSystemcxx . . $ Melder_peek32toCfstring_fileSystem(4b547028db3a54bb). (conststring32cxx . . $ conststring32# text); |
| 93 | |
| 94 | /* End of file melder_textencoding.h */ |
| 95 | #endif |