1RKMAPPHONOGRAM(3) Library Functions Manual RKMAPPHONOGRAM(3)
2
3
4
6 RkMapPhonogram - perform Romaji-kana conversion by using a specified
7 Romaji-kana conversion table
8
10 #include <canna/RK.h>
11 int RkMapPhonogram(romaji, dst, maxdst, src, srclen, flags, ulen,
12 dlen, tlen, rule)
13 struct RkRxDic *romaji;
14 unsigned char *dst;
15 int maxdst;
16 unsigned char *src;
17 int srclen;
18 int flags;
19 int *ulen;
20 int *dlen;
21 int *tlen;
22 int *rule;
23
25 RkMapPhonogram performs Romaji-kana conversion by using a specified
26 Romaji-kana conversion table. romaji specifies a pointer to the
27 Romaji-kana conversion table that has been returned by RkOpenRoma(3).
28 RkMapPhonogram interprets the srclen bytes of contiguous data starting
29 at the area src as a Romaji character string and searches through the
30 Romaji-kana conversion table for the rule of Romaji-kana conversion
31 that matches the beginning of the Romaji character string. If the cor‐
32 responding conversion rule is found, the area dst is loaded with the
33 corresponding kana character string, with dlen being set to its byte
34 length. The resulting character string is truncated when its byte
35 length exceeds maxdst -1.
36
37 flags is a combination of the following Romaji-kana conversion flags
38 connected by or:
39
40 RK_SOKUON Enables gemination, in which a sequence of two
41 occurrences of the same character, xx, is con‐
42 verted to small kana character "tsu" only if it
43 is not defined in the Romaji-kana conversion ta‐
44 ble file. This process provides for situations
45 in which an obsolete Romaji-kana conversion table
46 is used.
47
48 RK_FLUSH Converts all Romaji characters compulsorily.
49 Useful for handling n appearing at the end of a
50 character string.
51
52 ulen, dlen, and tlen are used to manage the progress of Romaji-kana
53 conversion.
54
55 For example, if the character string "tt" is given to RkMapPhonogram,
56 the first "t" is submitted to Romaji-kana conversion, with dst being
57 set to small kana character "tsu". The remaining "t" is put to reuse
58 for Romaji-kana conversion. When "a" is entered subsequently, it is
59 combined with the "t" left from the previous run of RkMapPhonogram to
60 generate kana character "ta".
61
62 ulen is set to the byte length of the characters from src used for
63 Romaji-kana conversion.
64
65 dlen is set to the byte length of the kana characters derived from
66 Romaji-kana conversion.
67
68 tlen is set to the byte length of the character string to be used in
69 the next run of Romaji-kana conversion. The character string led by
70 tlen is placed after the character string resulting from Romaji-kana
71 conversion in the dst buffers.
72
73 If null pointers are specified in ulen, dlen, and tlen, these parame‐
74 ters do not return any values and are simply ignored.
75
76 rule is used to exchange information about the rule of Romaji-kana con‐
77 version. When calling RkMapPhonogram for the first time, specify a
78 pointer to a variable loaded with 0. Upon return from the first call
79 to RkMapPhonogram, that variable is loaded with internal information
80 about the rule of Romaji-kana conversion, in place of 0. To continue
81 Romaji-kana conversion, specify the same pointer to the variable to
82 RkMapPhonogram.
83
85 This function returns information about whether the character string
86 set in dst has been converted by using a rule existing in the Romaji-
87 kana conversion table or not. The function returns 1 if a rule exist‐
88 ing in the Romaji-kana conversion table has been used; otherwise, it
89 returns 0.
90
91
92
93 RKMAPPHONOGRAM(3)