src/antlr3convertutf.c(3)
πΈ src/antlr3convertutf.c β an ANTLR3C page, bestie π
okay so hi. you found the man page for src/antlr3convertutf.c, which lives under the ANTLR3C manual. it's giving "quiet little C file that does ALL the unicode heavy lifting" and honestly? iconic. no cap. let's get into it π«Ά
β¨ NAME β¨
src/antlr3convertutf.c β the file. that's it. that's the name. short, sweet, slays π
π SYNOPSIS π
#include 'antlr3convertutf.h'
π¦ Functions π¦
here's the whole squad of conversion besties β each one takes a ConversionFlags flags and each one returns a ConversionResult:
ConversionResult ConvertUTF16toUTF32 (const UTF16 **sourceStart, const UTF16 *sourceEnd, UTF32 **targetStart, UTF32 *targetEnd, ConversionFlags flags)ConversionResult ConvertUTF16toUTF8 (const UTF16 **sourceStart, const UTF16 *sourceEnd, UTF8 **targetStart, UTF8 *targetEnd, ConversionFlags flags)ConversionResult ConvertUTF32toUTF16 (const UTF32 **sourceStart, const UTF32 *sourceEnd, UTF16 **targetStart, UTF16 *targetEnd, ConversionFlags flags)ConversionResult ConvertUTF32toUTF8 (const UTF32 **sourceStart, const UTF32 *sourceEnd, UTF8 **targetStart, UTF8 *targetEnd, ConversionFlags flags)ConversionResult ConvertUTF8toUTF16 (const UTF8 **sourceStart, const UTF8 *sourceEnd, UTF16 **targetStart, UTF16 *targetEnd, ConversionFlags flags)ConversionResult ConvertUTF8toUTF32 (const UTF8 **sourceStart, const UTF8 *sourceEnd, UTF32 **targetStart, UTF32 *targetEnd, ConversionFlags flags)static ANTLR3_BOOLEAN isLegalUTF8 (const UTF8 *source, int length)ANTLR3_BOOLEAN isLegalUTF8Sequence (const UTF8 *source, const UTF8 *sourceEnd)
like. all the UTF permutations?? 16β32, 16β8, 32β16, 32β8, 8β16, 8β32. literally every glow-up route available. obsessed ππ
π Variables π
static const UTF8 firstByteMark [7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }static const UTF32 offsetsFromUTF8 [6]static const char trailingBytesForUTF8 [256]
three little static lookups carrying the whole operation on their backs. main character energy fr fr π
π Function Documentation π
π ConversionResult ConvertUTF16toUTF32 (const UTF16 ** sourceStart, const UTF16 * sourceEnd, UTF32 ** targetStart, UTF32 * targetEnd, ConversionFlags flags)
this one references: conversionOK, halfBase, halfShift, sourceExhausted, sourceIllegal, strictConversion, targetExhausted, UNI_SUR_HIGH_END, UNI_SUR_HIGH_START, UNI_SUR_LOW_END, and UNI_SUR_LOW_START.
π ConversionResult ConvertUTF16toUTF8 (const UTF16 ** sourceStart, const UTF16 * sourceEnd, UTF8 ** targetStart, UTF8 * targetEnd, ConversionFlags flags)
this one references: conversionOK, firstByteMark, halfBase, halfShift, sourceExhausted, sourceIllegal, strictConversion, targetExhausted, UNI_REPLACEMENT_CHAR, UNI_SUR_HIGH_END, UNI_SUR_HIGH_START, UNI_SUR_LOW_END, and UNI_SUR_LOW_START.
and guess what β it's referenced by toUTF8_UTF16(). the way it gets called up by its friends π₯Ή
π ConversionResult ConvertUTF32toUTF16 (const UTF32 ** sourceStart, const UTF32 * sourceEnd, UTF16 ** targetStart, UTF16 * targetEnd, ConversionFlags flags)
this one references: conversionOK, halfBase, halfMask, halfShift, sourceIllegal, strictConversion, targetExhausted, UNI_MAX_BMP, UNI_MAX_LEGAL_UTF32, UNI_REPLACEMENT_CHAR, UNI_SUR_HIGH_START, UNI_SUR_LOW_END, and UNI_SUR_LOW_START.
π ConversionResult ConvertUTF32toUTF8 (const UTF32 ** sourceStart, const UTF32 * sourceEnd, UTF8 ** targetStart, UTF8 * targetEnd, ConversionFlags flags)
this one references: conversionOK, firstByteMark, sourceIllegal, strictConversion, targetExhausted, UNI_MAX_LEGAL_UTF32, UNI_REPLACEMENT_CHAR, UNI_SUR_HIGH_START, and UNI_SUR_LOW_END.
π ConversionResult ConvertUTF8toUTF16 (const UTF8 ** sourceStart, const UTF8 * sourceEnd, UTF16 ** targetStart, UTF16 * targetEnd, ConversionFlags flags)
this one references: conversionOK, halfBase, halfMask, halfShift, isLegalUTF8(), offsetsFromUTF8, sourceExhausted, sourceIllegal, strictConversion, targetExhausted, trailingBytesForUTF8, UNI_MAX_BMP, UNI_MAX_UTF16, UNI_REPLACEMENT_CHAR, UNI_SUR_HIGH_START, UNI_SUR_LOW_END, and UNI_SUR_LOW_START.
look at that reference list. it knows EVERYBODY. π
π ConversionResult ConvertUTF8toUTF32 (const UTF8 ** sourceStart, const UTF8 * sourceEnd, UTF32 ** targetStart, UTF32 * targetEnd, ConversionFlags flags)
this one references: conversionOK, isLegalUTF8(), offsetsFromUTF8, sourceExhausted, sourceIllegal, strictConversion, targetExhausted, trailingBytesForUTF8, UNI_MAX_LEGAL_UTF32, UNI_REPLACEMENT_CHAR, UNI_SUR_HIGH_START, and UNI_SUR_LOW_END.
π ANTLR3_BOOLEAN isLegalUTF8 (const UTF8 * source, int length) [static]
the vibe check function!! it references ANTLR3_FALSE, and ANTLR3_TRUE.
and it's referenced by ConvertUTF8toUTF16(), ConvertUTF8toUTF32(), and isLegalUTF8Sequence(). so it's the popular one, lowkey.
π ANTLR3_BOOLEAN isLegalUTF8Sequence (const UTF8 * source, const UTF8 * sourceEnd)
this one references ANTLR3_FALSE, isLegalUTF8(), and trailingBytesForUTF8.
π Variable Documentation π
β const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC } [static]
Referenced by ConvertUTF16toUTF8(), and ConvertUTF32toUTF8().
β const UTF32 offsetsFromUTF8[6] [static]
Initial value:
= { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
0x03C82080UL, 0xFA082080UL, 0x82082080UL }
Referenced by antlr3UTF8Consume(), antlr3UTF8LA(), ConvertUTF8toUTF16(), and ConvertUTF8toUTF32().
β const char trailingBytesForUTF8[256] [static]
Initial value:
= {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
}
Referenced by antlr3UTF8Consume(), antlr3UTF8LA(), ConvertUTF8toUTF16(), ConvertUTF8toUTF32(), and isLegalUTF8Sequence().
256 whole entries. that's a LOT of typing and she did it anyway. respect. π§β¨
π Author π
Generated automatically by Doxygen for ANTLR3C from the source code. so like, a robot wrote this about a robot-adjacent C file. we love a meta moment ππ¦
no cap bestie, everything above is exactly what the page says β I didn't invent a single flag, value or reference, I just gave it the group-chat glow-up it deserved π
and that's the whole page!! thanks for reading, you ate that π
Version 3.3.1 β dated Tue Jul 29 2025 00:00:00 β and it's the src/antlr3convertutf.c(3) page. mwah, bye bestie, drink water ππΈβ¨
π¦ where this page comes from
- fedora 43: antlr3-C-devel 1:3.4-3.5.3.14.fc43 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms