* [9front] [PATCH] ktrans: add implicit chinese punctuation conversion
@ 2023-07-21 11:10 chris
0 siblings, 0 replies; only message in thread
From: chris @ 2023-07-21 11:10 UTC (permalink / raw)
To: 9front
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");
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-07-21 11:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-21 11:10 [9front] [PATCH] ktrans: add implicit chinese punctuation conversion chris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).