src/antlr3convertutf.c(3)

πŸ“¦ version 3.4, in fedora 43

🌸 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