From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 25947 invoked from network); 21 Jul 2023 11:35:14 -0000 Received: from 9front.inri.net (168.235.81.73) by inbox.vuxu.org with ESMTPUTF8; 21 Jul 2023 11:35:14 -0000 Received: from chrisfroeschl.de ([185.183.157.17]) by 9front; Fri Jul 21 07:30:02 -0400 2023 Message-ID: <44375B3152F8533B488D4A9F3DCF7104@chrisfroeschl.de> Date: Fri, 21 Jul 2023 13:10:49 +0200 From: chris@chrisfroeschl.de To: 9front@9front.org MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: generic asynchronous realtime-java-based enhancement-oriented self-signing-aware content-driven controller Subject: [9front] [PATCH] ktrans: add implicit chinese punctuation conversion Reply-To: 9front@9front.org Precedence: bulk Add implicit conversion to chinese ktrans mode. This was actually done by moody, I just tested and forgot about it... Manpage update incoming diff bd2ef36d976db0a842e31af309f0ef1439f30a89 uncommitted --- /dev/null +++ b//lib/ktrans/judou.map @@ -1,0 +1,28 @@ +   +, , +. 。 +< 《 +> 》 +/ / +? ? +; ; +: : +\ 、 +| ・ +` ` +~ 〜 +! ! +@ @ +# # +$ ¥ +& & +* * +( ( +) ) +- - ++ + += = +[ 「 +] 」 +{ 『 +} 』 --- a/sys/src/cmd/ktrans/hash.c +++ b/sys/src/cmd/ktrans/hash.c @@ -34,7 +34,7 @@ nsz = Tagsize + size; store = mallocz(sizeof(*h) + (nbuckets * nsz), 1); if(store == nil) - return nil; + sysfatal("hmapalloc: out of memory"); h = store; h->nbs = nbuckets; @@ -82,6 +82,8 @@ h->cap *= 2; *store = realloc(*store, sizeof(*h) + h->cap*h->nsz); + if(*store == nil) + sysfatal("hmaprepl: out of memory"); h = *store; h->nodes = (uchar*)*store + sizeof(*h); memset(h->nodes + h->len*h->nsz, 0, h->nsz); --- a/sys/src/cmd/ktrans/main.c +++ b/sys/src/cmd/ktrans/main.c @@ -212,7 +212,7 @@ Hmap *cyril; Hmap *greek; Hmap *hangul; -Hmap *hanzi, *zidian; +Hmap *judou, *zidian; Hmap *telex; Hmap **langtab[] = { @@ -222,7 +222,7 @@ [LangRU] &cyril, [LangEL] &greek, [LangKO] &hangul, - [LangZH] &hanzi, + [LangZH] &judou, [LangVN] &telex, }; @@ -652,7 +652,7 @@ switch(lang){ case LangZH: emitutf(dictch, p, 1); - continue; + break; case LangJP: emitutf(dictch, p, 1); if(isupper(*p)) @@ -849,7 +849,8 @@ zidianname = "/lib/ktrans/wubi.dict"; zidian = opendict(nil, zidianname); - natural = hanzi = nil; + natural = nil; + judou = openmap("/lib/ktrans/judou.map"); hira = openmap("/lib/ktrans/hira.map"); kata = openmap("/lib/ktrans/kata.map"); greek = openmap("/lib/ktrans/greek.map");