RKMAPPHONOGRAM(3)
β¨ RKMAPPHONOGRAM(3) β Library Functions Manual β¨
okay bestie, sit down, hydrate, and let's talk about RkMapPhonogram π it's a lil function from the Library Functions Manual and it does the whole Romaji β kana glow-up using a conversion table you hand it. no cap.
π NAME π
RkMapPhonogram β perform Romaji-kana conversion by using a specified Romaji-kana conversion table
(yeah it's literally just that, it's giving "what it says on the tin" and honestly? iconic π)
πΈ SYNOPSIS πΈ
#include <canna/RK.h>
int RkMapPhonogram(romaji, dst, maxdst, src, srclen, flags, ulen,
dlen, tlen, rule)
struct RkRxDic *romaji;
unsigned char *dst;
int maxdst;
unsigned char *src;
int srclen;
int flags;
int *ulen;
int *dlen;
int *tlen;
int *rule;
π DESCRIPTION π
RkMapPhonogram performs Romaji-kana conversion by using a specified Romaji-kana conversion table. periodt. π«Ά
romaji is a pointer to the Romaji-kana conversion table that got handed back to you by RkOpenRoma(3) β that's where it comes from, don't be out here making one yourself.
So here's the vibe: RkMapPhonogram takes the srclen bytes of contiguous data starting at the area src, treats all of that as a Romaji character string, and then goes digging through the Romaji-kana conversion table looking for the rule of Romaji-kana conversion that matches the beginning of that Romaji string. start-of-string only, bestie, it's picky like that π
If it finds the corresponding conversion rule, the area dst gets loaded with the corresponding kana character string, and dlen gets set to its byte length. β¨
and then the truncation jumpscare: the resulting character string is truncated when its byte length exceeds maxdst -1. so mind your buffer, girl π
flags is a combination of the following Romaji-kana conversion flags, all connected by or:
RK_SOKUONβ Enables gemination, in which a sequence of two occurrences of the same character,xx, is converted to small kana character"tsu"only if it is not defined in the Romaji-kana conversion table file. This process provides for situations in which an obsolete Romaji-kana conversion table is used. πRK_FLUSHβ Converts all Romaji characters compulsorily. Useful for handlingnappearing at the end of a character string. π
ulen, dlen, and tlen are used to manage the progress of Romaji-kana conversion. they're the lil tracker trio keeping notes on where you're at π
π¦ the "tt" example (this one's a classic, iykyk) π¦
For example, if the character string "tt" is given to RkMapPhonogram, the first "t" is submitted to Romaji-kana conversion, with dst being set to small kana character "tsu". The remaining "t" is put to reuse for Romaji-kana conversion. When "a" is entered subsequently, it is combined with the "t" left from the previous run of RkMapPhonogram to generate kana character "ta". π₯
see?? the leftovers get recycled. sustainable queen behavior π
β¨ what the tracker trio actually reports β¨
ulenis set to the byte length of the characters fromsrcused for Romaji-kana conversion.dlenis set to the byte length of the kana characters derived from Romaji-kana conversion.tlenis set to the byte length of the character string to be used in the next run of Romaji-kana conversion. The character string led bytlenis placed after the character string resulting from Romaji-kana conversion in thedstbuffers. π
If null pointers are specified inulen,dlen, andtlen, these parameters do not return any values and are simply ignored. they're just like "ok bye then" π§
π rule β the memory keeper π
rule is used to exchange information about the rule of Romaji-kana conversion.
When calling RkMapPhonogram for the first time, specify a pointer to a variable loaded with 0. Upon return from the first call to RkMapPhonogram, that variable is loaded with internal information about the rule of Romaji-kana conversion, in place of 0. To continue Romaji-kana conversion, specify the same pointer to the variable to RkMapPhonogram.
so like. first call: pointer to a 0. after that: same pointer, now holding internal rule info. do NOT go swapping pointers mid-conversion, that's not the assignment bestie π
π RETURN VALUE π
This function returns information about whether the character string set in dst has been converted by using a rule existing in the Romaji-kana conversion table or not.
- The function returns
1if a rule existing in the Romaji-kana conversion table has been used. - Otherwise, it returns
0.
that's it. 1 or 0. no in-between, no drama, main character binary energy π
πΈ little recap so we're all on the same page:romaji= your table fromRkOpenRoma(3),src/srclen= the Romaji you're feeding in,dst/maxdst= where the kana lands (watch thatmaxdst -1truncation fr fr),flags=RK_SOKUONorRK_FLUSHor'd together,ulen/dlen/tlen= progress bookkeeping that's cool with being null, andrule= start it at0and then keep reusing the same pointer. got it? slay. π«Ά
π SEE ALSO π
RkOpenRoma(3) β the one that gives you the romaji table in the first place, go say hi to it π
and that's the whole page, bestie!! this came to you straight out of the Library Functions Manual as RKMAPPHONOGRAM(3), footer said RKMAPPHONOGRAM(3) again because the manual likes an encore π stay hydrated, mind your buffer sizes, and go convert some Romaji. bye babes πβ¨
π¦ where this page comes from
- debian bookworm: libcanna1g-dev 3.7p3-20 Β· ISC
- debian trixie: libcanna1g-dev 3.7p3-25 Β· ISC
- ubuntu jammy: libcanna1g-dev 3.7p3-17 Β· ISC
- ubuntu noble: libcanna1g-dev 3.7p3-20 Β· ISC
- ubuntu questing: libcanna1g-dev 3.7p3-26
- ubuntu resolute: libcanna1g-dev 3.7p3-26build1 Β· ISC
- ubuntu stonking: libcanna1g-dev 3.7p3-29 Β· ISC
- Copyright 1994 NEC Corporation, Tokyo, Japan
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms