RKBGNBUN(3)

πŸ’– RKBGNBUN β€” bestie, it's giving "kanji conversion time" ✨

okay so this one is from the Library Functions Manual, page RKBGNBUN(3), and we're about to convert readings into kanji. buckle up πŸŽ€


🌸 NAME 🌸

RkBgnBun, RkwBgnBun β€” convert the reading of a specified length to kanji πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <canna/RK.h>
int RkBgnBun(cxnum, yomi, maxyomi, mode)
int cxnum;
unsigned char *yomi;
int maxyomi;
int mode;
int RkwBgnBun(cxnum, yomi, maxyomi, mode)
int cxnum;
wchar_t *yomi;
int maxyomi;
int mode;

✨ DESCRIPTION ✨

RkBgnBun takes your reading yomi β€” that's maxyomi bytes long, bestie β€” and turns it into kanji. no cap. 🫢

⚠️ tiny little detail that will absolutely wreck your day if you ignore it: the reading kana must be adjusted on character boundaries in the EUC code. so like, don't slice it mid-character. that's the vibe check. πŸ’€

when it runs, the context enters the conversion mode, and both the current clause and the current clause set get set to 0. iconic.

RkwBgnBun is the sibling function β€” same energy, but it takes a wchar_t argument as yomi instead. and for this one, maxyomi represents the length of yomi by characters instead of bytes. character girlies, this one's for you 🧚


πŸŽ€ the mode thing πŸŽ€

mode represents the code conversion candidate to be added to each clause. it's expressed in a bit field width, and you can set it to one of these with RK_XFERBITS:

  • RK_XFER β€” Hiragana
  • RK_HFER β€” Single-width character
  • RK_KFER β€” Katakana
  • RK_ZFER β€” Double-width character

🌈 how candidates get added (the lore) 🌈

so if the number of candidates available for the current clause is N, candidates get added through code conversion by reading the candidates in sequence β€” from candidate N to candidate N + 1, and so on β€” starting with the lowest-order bit field. πŸ“

candidate addition ends when the corresponding bit field equals 0. that's the periodt. πŸ™ˆ

the mapping is literally this:

  • RK_XFER β†’ Candidate: (KANJI) (HIRAGANA)
  • (RK_XFER << RK_XFERBITS) | RK_KFER β†’ Candidate: (KANJI) (KATAKANA) (HIRAGANA)
  • (RK_KFER << RK_XFERBITS) | RK_XFER β†’ Candidate: (KANJI) (HIRAGANA) (KATAKANA)

πŸ‘‘ one more thing, fr fr πŸ‘‘

the context enters the conversion mode, and it stays in it from RkBgnBun all the way to RkEndBun(3). πŸŽ€

🚨 conversion modes cannot be nested. not a suggestion. not a vibe. it's a rule, and the nesting will simply not happen. πŸ’…

⭐ RETURN VALUE ⭐

this function returns the number of clauses derived from conversion πŸ₯³ … or it returns -1 if the conversion fails. and yeah, -1 is the "we don't talk about it" number. 😭


πŸ’œ SEE ALSO πŸ’œ


that's the whole page, bestie β€” no notes, you ate πŸ’…βœ¨

anyway, this was RKBGNBUN(3) from the Library Functions Manual, and the page footer just says RKBGNBUN(3) right back at you πŸ¦‹ (no date, no version β€” the manual keeps it mysterious, and honestly? main character energy πŸ‘‘). mwah, go convert something πŸŽ€πŸ’–

πŸ“¦ where this page comes from