Subject: Re: bug#52918: 29.0.50; to make use of ucd/Unihan_Readings.txt for kDefinition entry

From: Van Ly <[email-masked]>
Date: Mon, 17 Jan 2022 18:25:26 +0000 (UTC)

On Mon, 3 Jan 2022, Eli Zaretskii wrote:

>
> Suggested implementation:
>
>  . add Makefile rules to produce a uni-unihan-readings.el file from
>    Unihan_Readings.txt, which defines a char-table where each
>    character has its kDefinition property value
>

A candidate for the Makefile rule to produce uni-unihan-readings.el 
is

'''
#!/bin/sh
X='/usr/X/Projects/emacs-28.0.91/admin/unidata/Unihan_Readings.txt'
fgrep 'kDefinition' "$X" | sed -e '/^#/d' -e 's/^../#x/' | head -n 3 
| awk '-F	' 'BEGIN {printf("(defvar 
readings-table\n\t(make-char-table '\'readings-table' nil)\n\t\"Char 
table of definitions for East Asian characters.\")\n")} 
{printf("(aset readings-table %s \"%s\")\n", $1, $3)}'
  '''

The result is

'''
(defvar readings-table
 	(make-char-table 'readings-table nil)
 	"Char table of definitions for East Asian characters.")
(aset readings-table #x3400 "(same as U+4E18 丘) hillock or mound")
(aset readings-table #x3401 "to lick; to taste, a mat, bamboo bark")
(aset readings-table #x3402 "(J) non-standard form of U+559C 喜, to 
like, love, enjoy; a joyful thing")
'''

-- 
vl