populate citrus xpg4dl locale definitions into /usr/share.

if there are any mistakes, please report (i only speak English/Japanese).
currently, only singlebyte locales are usable.

TODO: enable multibyte handler in libc - there still are few design
discussions, but we are almost ready.
This commit is contained in:
itojun 2000-12-22 01:31:47 +00:00
parent c2c9f31e53
commit d31d542a97
15 changed files with 2203 additions and 13 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.198 2000/12/19 14:28:40 kleink Exp $
# $NetBSD: mi,v 1.199 2000/12/22 01:31:49 itojun Exp $
.
./altroot
./bin
@ -284,6 +284,7 @@
./usr/bin/mk_cmds
./usr/bin/mkdep
./usr/bin/mkfifo
./usr/bin/mklocale
./usr/bin/mktemp
./usr/bin/modstat
./usr/bin/more
@ -350,8 +351,8 @@
./usr/bin/split
./usr/bin/ssh
./usr/bin/ssh-add
./usr/bin/ssh-keygen
./usr/bin/ssh-agent
./usr/bin/ssh-keygen
./usr/bin/string2key
./usr/bin/su
./usr/bin/sum
@ -888,50 +889,178 @@
./usr/share/keymaps/x68k
./usr/share/ldscripts
./usr/share/locale
./usr/share/locale/cs_CZ.ISO8859-2
./usr/share/locale/cs_CZ.ISO8859-2/LC_CTYPE
./usr/share/locale/da
./usr/share/locale/da/LC_MESSAGES
./usr/share/locale/da_DK.ISO8859-1
./usr/share/locale/da_DK.ISO8859-1/LC_CTYPE
./usr/share/locale/da_DK.ISO8859-15
./usr/share/locale/da_DK.ISO8859-15/LC_CTYPE
./usr/share/locale/de
./usr/share/locale/de/LC_MESSAGES
./usr/share/locale/de/LC_MESSAGES/grep.mo
./usr/share/locale/de/LC_MESSAGES/texinfo.mo
./usr/share/locale/de_AT.ISO8859-1
./usr/share/locale/de_AT.ISO8859-1/LC_CTYPE
./usr/share/locale/de_AT.ISO8859-15
./usr/share/locale/de_AT.ISO8859-15/LC_CTYPE
./usr/share/locale/de_CH.ISO8859-1
./usr/share/locale/de_CH.ISO8859-1/LC_CTYPE
./usr/share/locale/de_CH.ISO8859-15
./usr/share/locale/de_CH.ISO8859-15/LC_CTYPE
./usr/share/locale/de_DE.ISO8859-1
./usr/share/locale/de_DE.ISO8859-1/LC_CTYPE
./usr/share/locale/de_DE.ISO8859-15
./usr/share/locale/de_DE.ISO8859-15/LC_CTYPE
./usr/share/locale/el
./usr/share/locale/el/LC_MESSAGES
./usr/share/locale/el/LC_MESSAGES/grep.mo
./usr/share/locale/en_AU.ISO8859-1
./usr/share/locale/en_AU.ISO8859-1/LC_CTYPE
./usr/share/locale/en_AU.ISO8859-15
./usr/share/locale/en_AU.ISO8859-15/LC_CTYPE
./usr/share/locale/en_CA.ISO8859-1
./usr/share/locale/en_CA.ISO8859-1/LC_CTYPE
./usr/share/locale/en_CA.ISO8859-15
./usr/share/locale/en_CA.ISO8859-15/LC_CTYPE
./usr/share/locale/en_GB.ISO8859-1
./usr/share/locale/en_GB.ISO8859-1/LC_CTYPE
./usr/share/locale/en_GB.ISO8859-15
./usr/share/locale/en_GB.ISO8859-15/LC_CTYPE
./usr/share/locale/en_US.ISO8859-1
./usr/share/locale/en_US.ISO8859-1/LC_CTYPE
./usr/share/locale/en_US.ISO8859-15
./usr/share/locale/en_US.ISO8859-15/LC_CTYPE
./usr/share/locale/en_US.UTF-8
./usr/share/locale/en_US.UTF-8/LC_CTYPE
./usr/share/locale/es
./usr/share/locale/es/LC_MESSAGES
./usr/share/locale/es/LC_MESSAGES/grep.mo
./usr/share/locale/es_ES.ISO8859-1
./usr/share/locale/es_ES.ISO8859-1/LC_CTYPE
./usr/share/locale/es_ES.ISO8859-15
./usr/share/locale/es_ES.ISO8859-15/LC_CTYPE
./usr/share/locale/fi_FI.ISO8859-1
./usr/share/locale/fi_FI.ISO8859-1/LC_CTYPE
./usr/share/locale/fi_FI.ISO8859-15
./usr/share/locale/fi_FI.ISO8859-15/LC_CTYPE
./usr/share/locale/fr
./usr/share/locale/fr/LC_MESSAGES
./usr/share/locale/fr/LC_MESSAGES/grep.mo
./usr/share/locale/fr/LC_MESSAGES/texinfo.mo
./usr/share/locale/fr_BE.ISO8859-1
./usr/share/locale/fr_BE.ISO8859-1/LC_CTYPE
./usr/share/locale/fr_BE.ISO8859-15
./usr/share/locale/fr_BE.ISO8859-15/LC_CTYPE
./usr/share/locale/fr_CA.ISO8859-1
./usr/share/locale/fr_CA.ISO8859-1/LC_CTYPE
./usr/share/locale/fr_CA.ISO8859-15
./usr/share/locale/fr_CA.ISO8859-15/LC_CTYPE
./usr/share/locale/fr_CH.ISO8859-1
./usr/share/locale/fr_CH.ISO8859-1/LC_CTYPE
./usr/share/locale/fr_CH.ISO8859-15
./usr/share/locale/fr_CH.ISO8859-15/LC_CTYPE
./usr/share/locale/fr_FR.ISO8859-1
./usr/share/locale/fr_FR.ISO8859-1/LC_CTYPE
./usr/share/locale/fr_FR.ISO8859-15
./usr/share/locale/fr_FR.ISO8859-15/LC_CTYPE
./usr/share/locale/hr_HR.ISO8859-2
./usr/share/locale/hr_HR.ISO8859-2/LC_CTYPE
./usr/share/locale/hu_HU.ISO8859-2
./usr/share/locale/hu_HU.ISO8859-2/LC_CTYPE
./usr/share/locale/is_IS.ISO8859-1
./usr/share/locale/is_IS.ISO8859-1/LC_CTYPE
./usr/share/locale/is_IS.ISO8859-15
./usr/share/locale/is_IS.ISO8859-15/LC_CTYPE
./usr/share/locale/it_CH.ISO8859-1
./usr/share/locale/it_CH.ISO8859-1/LC_CTYPE
./usr/share/locale/it_CH.ISO8859-15
./usr/share/locale/it_CH.ISO8859-15/LC_CTYPE
./usr/share/locale/it_IT.ISO8859-1
./usr/share/locale/it_IT.ISO8859-1/LC_CTYPE
./usr/share/locale/it_IT.ISO8859-15
./usr/share/locale/it_IT.ISO8859-15/LC_CTYPE
./usr/share/locale/ja_JP.ISO2022-JP
./usr/share/locale/ja_JP.ISO2022-JP/LC_CTYPE
./usr/share/locale/ja_JP.ISO2022-JP2
./usr/share/locale/ja_JP.ISO2022-JP2/LC_CTYPE
./usr/share/locale/ja_JP.SJIS
./usr/share/locale/ja_JP.SJIS/LC_CTYPE
./usr/share/locale/ja_JP.ct
./usr/share/locale/ja_JP.ct/LC_CTYPE
./usr/share/locale/ja_JP.eucJP
./usr/share/locale/ja_JP.eucJP/LC_CTYPE
./usr/share/locale/ko
./usr/share/locale/ko/LC_MESSAGES
./usr/share/locale/ko/LC_MESSAGES/grep.mo
./usr/share/locale/ko_KR.eucKR
./usr/share/locale/ko_KR.eucKR/LC_CTYPE
./usr/share/locale/lt_LT.ISO8859-4
./usr/share/locale/lt_LT.ISO8859-4/LC_CTYPE
./usr/share/locale/nl
./usr/share/locale/nl/LC_MESSAGES
./usr/share/locale/nl/LC_MESSAGES/grep.mo
./usr/share/locale/nl_BE.ISO8859-1
./usr/share/locale/nl_BE.ISO8859-1/LC_CTYPE
./usr/share/locale/nl_BE.ISO8859-15
./usr/share/locale/nl_BE.ISO8859-15/LC_CTYPE
./usr/share/locale/nl_NL.ISO8859-1
./usr/share/locale/nl_NL.ISO8859-1/LC_CTYPE
./usr/share/locale/nl_NL.ISO8859-15
./usr/share/locale/nl_NL.ISO8859-15/LC_CTYPE
./usr/share/locale/no
./usr/share/locale/no/LC_MESSAGES
./usr/share/locale/no/LC_MESSAGES/grep.mo
./usr/share/locale/no@nynorsk
./usr/share/locale/no@nynorsk/LC_MESSAGES
./usr/share/locale/no_NO.ISO8859-1
./usr/share/locale/no_NO.ISO8859-1/LC_CTYPE
./usr/share/locale/no_NO.ISO8859-15
./usr/share/locale/no_NO.ISO8859-15/LC_CTYPE
./usr/share/locale/pl
./usr/share/locale/pl/LC_MESSAGES
./usr/share/locale/pl/LC_MESSAGES/grep.mo
./usr/share/locale/pl_PL.ISO8859-2
./usr/share/locale/pl_PL.ISO8859-2/LC_CTYPE
./usr/share/locale/pt
./usr/share/locale/pt/LC_MESSAGES
./usr/share/locale/pt_BR
./usr/share/locale/pt_BR/LC_MESSAGES
./usr/share/locale/pt_BR/LC_MESSAGES/grep.mo
./usr/share/locale/pt_PT.ISO8859-1
./usr/share/locale/pt_PT.ISO8859-1/LC_CTYPE
./usr/share/locale/pt_PT.ISO8859-15
./usr/share/locale/pt_PT.ISO8859-15/LC_CTYPE
./usr/share/locale/ru
./usr/share/locale/ru/LC_MESSAGES
./usr/share/locale/ru/LC_MESSAGES/grep.mo
./usr/share/locale/ru_SU.CP866
./usr/share/locale/ru_SU.CP866/LC_CTYPE
./usr/share/locale/ru_SU.ISO8859-5
./usr/share/locale/ru_SU.ISO8859-5/LC_CTYPE
./usr/share/locale/ru_SU.KOI8-R
./usr/share/locale/ru_SU.KOI8-R/LC_CTYPE
./usr/share/locale/sl
./usr/share/locale/sl/LC_MESSAGES
./usr/share/locale/sl/LC_MESSAGES/grep.mo
./usr/share/locale/sl_SI.ISO8859-2
./usr/share/locale/sl_SI.ISO8859-2/LC_CTYPE
./usr/share/locale/sv
./usr/share/locale/sv/LC_MESSAGES
./usr/share/locale/sv/LC_MESSAGES/grep.mo
./usr/share/locale/sv_SE.ISO8859-1
./usr/share/locale/sv_SE.ISO8859-1/LC_CTYPE
./usr/share/locale/sv_SE.ISO8859-15
./usr/share/locale/sv_SE.ISO8859-15/LC_CTYPE
./usr/share/locale/uk_UA.KOI8-U
./usr/share/locale/uk_UA.KOI8-U/LC_CTYPE
./usr/share/locale/zh_CN.eucCN
./usr/share/locale/zh_CN.eucCN/LC_CTYPE
./usr/share/locale/zh_TW.Big5
./usr/share/locale/zh_TW.Big5/LC_CTYPE
./usr/share/locale/zh_TW.eucTW
./usr/share/locale/zh_TW.eucTW/LC_CTYPE
./usr/share/man
./usr/share/man/COPYRIGHT
./usr/share/man/cat1
@ -1255,8 +1384,8 @@
./usr/share/zoneinfo/America/Detroit
./usr/share/zoneinfo/America/Dominica
./usr/share/zoneinfo/America/Edmonton
./usr/share/zoneinfo/America/El_Salvador
./usr/share/zoneinfo/America/Eirunepe
./usr/share/zoneinfo/America/El_Salvador
./usr/share/zoneinfo/America/Ensenada
./usr/share/zoneinfo/America/Fort_Wayne
./usr/share/zoneinfo/America/Fortaleza

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.294 2000/12/20 21:27:12 bjh21 Exp $
# $NetBSD: mi,v 1.295 2000/12/22 01:31:49 itojun Exp $
./usr/share/info/am-utils.info
./usr/share/info/as.info
./usr/share/info/awk.info
@ -203,6 +203,7 @@
./usr/share/man/cat1/mkdir.0
./usr/share/man/cat1/mkfifo.0
./usr/share/man/cat1/mkfilters.0
./usr/share/man/cat1/mklocale.0
./usr/share/man/cat1/mktemp.0
./usr/share/man/cat1/mopa.out.0
./usr/share/man/cat1/mopchk.0
@ -264,6 +265,7 @@
./usr/share/man/cat1/pkg_create.0
./usr/share/man/cat1/pkg_delete.0
./usr/share/man/cat1/pkg_info.0
./usr/share/man/cat1/pmc.0
./usr/share/man/cat1/popd.0
./usr/share/man/cat1/postalias.0
./usr/share/man/cat1/postcat.0
@ -276,7 +278,6 @@
./usr/share/man/cat1/postmap.0
./usr/share/man/cat1/postsuper.0
./usr/share/man/cat1/pr.0
./usr/share/man/cat1/pmc.0
./usr/share/man/cat1/printenv.0
./usr/share/man/cat1/printf.0
./usr/share/man/cat1/ps.0
@ -1024,7 +1025,6 @@
./usr/share/man/cat8/ac.0
./usr/share/man/cat8/accton.0
./usr/share/man/cat8/adduser.0
./usr/share/man/cat8/altqd.0
./usr/share/man/cat8/alpha/MAKEDEV.0
./usr/share/man/cat8/alpha/boot.0
./usr/share/man/cat8/alpha/installboot.0
@ -1032,6 +1032,7 @@
./usr/share/man/cat8/alpha/makedev.0
./usr/share/man/cat8/alpha/mkbootimage.0
./usr/share/man/cat8/alpha/setnetbootinfo.0
./usr/share/man/cat8/altqd.0
./usr/share/man/cat8/amd.0
./usr/share/man/cat8/amiga/MAKEDEV.0
./usr/share/man/cat8/amiga/binpatch.0
@ -1639,6 +1640,7 @@
./usr/share/man/man1/mkdir.1
./usr/share/man/man1/mkfifo.1
./usr/share/man/man1/mkfilters.1
./usr/share/man/man1/mklocale.1
./usr/share/man/man1/mktemp.1
./usr/share/man/man1/mopa.out.1
./usr/share/man/man1/mopchk.1
@ -1700,6 +1702,7 @@
./usr/share/man/man1/pkg_create.1
./usr/share/man/man1/pkg_delete.1
./usr/share/man/man1/pkg_info.1
./usr/share/man/man1/pmc.1
./usr/share/man/man1/popd.1
./usr/share/man/man1/postalias.1
./usr/share/man/man1/postcat.1
@ -1712,7 +1715,6 @@
./usr/share/man/man1/postmap.1
./usr/share/man/man1/postsuper.1
./usr/share/man/man1/pr.1
./usr/share/man/man1/pmc.1
./usr/share/man/man1/printenv.1
./usr/share/man/man1/printf.1
./usr/share/man/man1/ps.1
@ -2460,7 +2462,6 @@
./usr/share/man/man8/ac.8
./usr/share/man/man8/accton.8
./usr/share/man/man8/adduser.8
./usr/share/man/man8/altqd.8
./usr/share/man/man8/alpha/MAKEDEV.8
./usr/share/man/man8/alpha/boot.8
./usr/share/man/man8/alpha/installboot.8
@ -2468,6 +2469,7 @@
./usr/share/man/man8/alpha/makedev.8
./usr/share/man/man8/alpha/mkbootimage.8
./usr/share/man/man8/alpha/setnetbootinfo.8
./usr/share/man/man8/altqd.8
./usr/share/man/man8/amd.8
./usr/share/man/man8/amiga/MAKEDEV.8
./usr/share/man/man8/amiga/binpatch.8

View File

@ -1,4 +1,4 @@
# $NetBSD: NetBSD.dist,v 1.124 2000/12/11 13:44:01 jdolecek Exp $
# $NetBSD: NetBSD.dist,v 1.125 2000/12/22 01:31:50 itojun Exp $
# @(#)4.4BSD.dist 8.1 (Berkeley) 6/13/93
/set type=dir uname=root gname=wheel mode=0755
@ -1095,6 +1095,11 @@ ldscripts
# ./usr/share/locale
locale
# ./usr/share/locale/cs_CZ.ISO8859-2
cs_CZ.ISO8859-2
# ./usr/share/locale/cs_CZ.ISO8859-2
..
# ./usr/share/locale/da
da
@ -1106,6 +1111,16 @@ LC_MESSAGES
# ./usr/share/locale/da
..
# ./usr/share/locale/da_DK.ISO8859-1
da_DK.ISO8859-1
# ./usr/share/locale/da_DK.ISO8859-1
..
# ./usr/share/locale/da_DK.ISO8859-15
da_DK.ISO8859-15
# ./usr/share/locale/da_DK.ISO8859-15
..
# ./usr/share/locale/de
de
@ -1117,6 +1132,36 @@ LC_MESSAGES
# ./usr/share/locale/de
..
# ./usr/share/locale/de_AT.ISO8859-1
de_AT.ISO8859-1
# ./usr/share/locale/de_AT.ISO8859-1
..
# ./usr/share/locale/de_AT.ISO8859-15
de_AT.ISO8859-15
# ./usr/share/locale/de_AT.ISO8859-15
..
# ./usr/share/locale/de_CH.ISO8859-1
de_CH.ISO8859-1
# ./usr/share/locale/de_CH.ISO8859-1
..
# ./usr/share/locale/de_CH.ISO8859-15
de_CH.ISO8859-15
# ./usr/share/locale/de_CH.ISO8859-15
..
# ./usr/share/locale/de_DE.ISO8859-1
de_DE.ISO8859-1
# ./usr/share/locale/de_DE.ISO8859-1
..
# ./usr/share/locale/de_DE.ISO8859-15
de_DE.ISO8859-15
# ./usr/share/locale/de_DE.ISO8859-15
..
# ./usr/share/locale/el
el
@ -1128,6 +1173,51 @@ LC_MESSAGES
# ./usr/share/locale/el
..
# ./usr/share/locale/en_AU.ISO8859-1
en_AU.ISO8859-1
# ./usr/share/locale/en_AU.ISO8859-1
..
# ./usr/share/locale/en_AU.ISO8859-15
en_AU.ISO8859-15
# ./usr/share/locale/en_AU.ISO8859-15
..
# ./usr/share/locale/en_CA.ISO8859-1
en_CA.ISO8859-1
# ./usr/share/locale/en_CA.ISO8859-1
..
# ./usr/share/locale/en_CA.ISO8859-15
en_CA.ISO8859-15
# ./usr/share/locale/en_CA.ISO8859-15
..
# ./usr/share/locale/en_GB.ISO8859-1
en_GB.ISO8859-1
# ./usr/share/locale/en_GB.ISO8859-1
..
# ./usr/share/locale/en_GB.ISO8859-15
en_GB.ISO8859-15
# ./usr/share/locale/en_GB.ISO8859-15
..
# ./usr/share/locale/en_US.ISO8859-1
en_US.ISO8859-1
# ./usr/share/locale/en_US.ISO8859-1
..
# ./usr/share/locale/en_US.ISO8859-15
en_US.ISO8859-15
# ./usr/share/locale/en_US.ISO8859-15
..
# ./usr/share/locale/en_US.UTF-8
en_US.UTF-8
# ./usr/share/locale/en_US.UTF-8
..
# ./usr/share/locale/es
es
@ -1139,6 +1229,26 @@ LC_MESSAGES
# ./usr/share/locale/es
..
# ./usr/share/locale/es_ES.ISO8859-1
es_ES.ISO8859-1
# ./usr/share/locale/es_ES.ISO8859-1
..
# ./usr/share/locale/es_ES.ISO8859-15
es_ES.ISO8859-15
# ./usr/share/locale/es_ES.ISO8859-15
..
# ./usr/share/locale/fi_FI.ISO8859-1
fi_FI.ISO8859-1
# ./usr/share/locale/fi_FI.ISO8859-1
..
# ./usr/share/locale/fi_FI.ISO8859-15
fi_FI.ISO8859-15
# ./usr/share/locale/fi_FI.ISO8859-15
..
# ./usr/share/locale/fr
fr
@ -1150,6 +1260,111 @@ LC_MESSAGES
# ./usr/share/locale/fr
..
# ./usr/share/locale/fr_BE.ISO8859-1
fr_BE.ISO8859-1
# ./usr/share/locale/fr_BE.ISO8859-1
..
# ./usr/share/locale/fr_BE.ISO8859-15
fr_BE.ISO8859-15
# ./usr/share/locale/fr_BE.ISO8859-15
..
# ./usr/share/locale/fr_CA.ISO8859-1
fr_CA.ISO8859-1
# ./usr/share/locale/fr_CA.ISO8859-1
..
# ./usr/share/locale/fr_CA.ISO8859-15
fr_CA.ISO8859-15
# ./usr/share/locale/fr_CA.ISO8859-15
..
# ./usr/share/locale/fr_CH.ISO8859-1
fr_CH.ISO8859-1
# ./usr/share/locale/fr_CH.ISO8859-1
..
# ./usr/share/locale/fr_CH.ISO8859-15
fr_CH.ISO8859-15
# ./usr/share/locale/fr_CH.ISO8859-15
..
# ./usr/share/locale/fr_FR.ISO8859-1
fr_FR.ISO8859-1
# ./usr/share/locale/fr_FR.ISO8859-1
..
# ./usr/share/locale/fr_FR.ISO8859-15
fr_FR.ISO8859-15
# ./usr/share/locale/fr_FR.ISO8859-15
..
# ./usr/share/locale/hr_HR.ISO8859-2
hr_HR.ISO8859-2
# ./usr/share/locale/hr_HR.ISO8859-2
..
# ./usr/share/locale/hu_HU.ISO8859-2
hu_HU.ISO8859-2
# ./usr/share/locale/hu_HU.ISO8859-2
..
# ./usr/share/locale/is_IS.ISO8859-1
is_IS.ISO8859-1
# ./usr/share/locale/is_IS.ISO8859-1
..
# ./usr/share/locale/is_IS.ISO8859-15
is_IS.ISO8859-15
# ./usr/share/locale/is_IS.ISO8859-15
..
# ./usr/share/locale/it_CH.ISO8859-1
it_CH.ISO8859-1
# ./usr/share/locale/it_CH.ISO8859-1
..
# ./usr/share/locale/it_CH.ISO8859-15
it_CH.ISO8859-15
# ./usr/share/locale/it_CH.ISO8859-15
..
# ./usr/share/locale/it_IT.ISO8859-1
it_IT.ISO8859-1
# ./usr/share/locale/it_IT.ISO8859-1
..
# ./usr/share/locale/it_IT.ISO8859-15
it_IT.ISO8859-15
# ./usr/share/locale/it_IT.ISO8859-15
..
# ./usr/share/locale/ja_JP.ISO2022-JP
ja_JP.ISO2022-JP
# ./usr/share/locale/ja_JP.ISO2022-JP
..
# ./usr/share/locale/ja_JP.ISO2022-JP2
ja_JP.ISO2022-JP2
# ./usr/share/locale/ja_JP.ISO2022-JP2
..
# ./usr/share/locale/ja_JP.SJIS
ja_JP.SJIS
# ./usr/share/locale/ja_JP.SJIS
..
# ./usr/share/locale/ja_JP.ct
ja_JP.ct
# ./usr/share/locale/ja_JP.ct
..
# ./usr/share/locale/ja_JP.eucJP
ja_JP.eucJP
# ./usr/share/locale/ja_JP.eucJP
..
# ./usr/share/locale/ko
ko
@ -1161,6 +1376,16 @@ LC_MESSAGES
# ./usr/share/locale/ko
..
# ./usr/share/locale/ko_KR.eucKR
ko_KR.eucKR
# ./usr/share/locale/ko_KR.eucKR
..
# ./usr/share/locale/lt_LT.ISO8859-4
lt_LT.ISO8859-4
# ./usr/share/locale/lt_LT.ISO8859-4
..
# ./usr/share/locale/nl
nl
@ -1172,6 +1397,26 @@ LC_MESSAGES
# ./usr/share/locale/nl
..
# ./usr/share/locale/nl_BE.ISO8859-1
nl_BE.ISO8859-1
# ./usr/share/locale/nl_BE.ISO8859-1
..
# ./usr/share/locale/nl_BE.ISO8859-15
nl_BE.ISO8859-15
# ./usr/share/locale/nl_BE.ISO8859-15
..
# ./usr/share/locale/nl_NL.ISO8859-1
nl_NL.ISO8859-1
# ./usr/share/locale/nl_NL.ISO8859-1
..
# ./usr/share/locale/nl_NL.ISO8859-15
nl_NL.ISO8859-15
# ./usr/share/locale/nl_NL.ISO8859-15
..
# ./usr/share/locale/no
no
@ -1194,6 +1439,16 @@ LC_MESSAGES
# ./usr/share/locale/no@nynorsk
..
# ./usr/share/locale/no_NO.ISO8859-1
no_NO.ISO8859-1
# ./usr/share/locale/no_NO.ISO8859-1
..
# ./usr/share/locale/no_NO.ISO8859-15
no_NO.ISO8859-15
# ./usr/share/locale/no_NO.ISO8859-15
..
# ./usr/share/locale/pl
pl
@ -1205,6 +1460,11 @@ LC_MESSAGES
# ./usr/share/locale/pl
..
# ./usr/share/locale/pl_PL.ISO8859-2
pl_PL.ISO8859-2
# ./usr/share/locale/pl_PL.ISO8859-2
..
# ./usr/share/locale/pt
pt
@ -1227,6 +1487,16 @@ LC_MESSAGES
# ./usr/share/locale/pt_BR
..
# ./usr/share/locale/pt_PT.ISO8859-1
pt_PT.ISO8859-1
# ./usr/share/locale/pt_PT.ISO8859-1
..
# ./usr/share/locale/pt_PT.ISO8859-15
pt_PT.ISO8859-15
# ./usr/share/locale/pt_PT.ISO8859-15
..
# ./usr/share/locale/ru
ru
@ -1238,6 +1508,21 @@ LC_MESSAGES
# ./usr/share/locale/ru
..
# ./usr/share/locale/ru_SU.CP866
ru_SU.CP866
# ./usr/share/locale/ru_SU.CP866
..
# ./usr/share/locale/ru_SU.ISO8859-5
ru_SU.ISO8859-5
# ./usr/share/locale/ru_SU.ISO8859-5
..
# ./usr/share/locale/ru_SU.KOI8-R
ru_SU.KOI8-R
# ./usr/share/locale/ru_SU.KOI8-R
..
# ./usr/share/locale/sl
sl
@ -1249,6 +1534,11 @@ LC_MESSAGES
# ./usr/share/locale/sl
..
# ./usr/share/locale/sl_SI.ISO8859-2
sl_SI.ISO8859-2
# ./usr/share/locale/sl_SI.ISO8859-2
..
# ./usr/share/locale/sv
sv
@ -1260,6 +1550,36 @@ LC_MESSAGES
# ./usr/share/locale/sv
..
# ./usr/share/locale/sv_SE.ISO8859-1
sv_SE.ISO8859-1
# ./usr/share/locale/sv_SE.ISO8859-1
..
# ./usr/share/locale/sv_SE.ISO8859-15
sv_SE.ISO8859-15
# ./usr/share/locale/sv_SE.ISO8859-15
..
# ./usr/share/locale/uk_UA.KOI8-U
uk_UA.KOI8-U
# ./usr/share/locale/uk_UA.KOI8-U
..
# ./usr/share/locale/zh_CN.eucCN
zh_CN.eucCN
# ./usr/share/locale/zh_CN.eucCN
..
# ./usr/share/locale/zh_TW.Big5
zh_TW.Big5
# ./usr/share/locale/zh_TW.Big5
..
# ./usr/share/locale/zh_TW.eucTW
zh_TW.eucTW
# ./usr/share/locale/zh_TW.eucTW
..
# ./usr/share/locale
..

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.11 2000/12/11 19:39:33 augustss Exp $
# $NetBSD: Makefile,v 1.12 2000/12/22 01:31:47 itojun Exp $
# from @(#)Makefile 8.1 (Berkeley) 6/5/93
# Missing: ms
@ -7,7 +7,8 @@
.if ${MKSHARE} != "no" || \
make(clean) || make(cleandir) || make(distclean) || make(obj)
SUBDIR= dict doc examples man me misc mk tabset termcap tmac wscons zoneinfo
SUBDIR= dict doc examples man me misc mk mklocale \
tabset termcap tmac wscons zoneinfo
.endif
.include <bsd.subdir.mk>

View File

@ -0,0 +1,30 @@
/* $NetBSD: en_US.ASCII.src,v 1.1 2000/12/22 01:31:48 itojun Exp $ */
/*
* Standard LOCALE_CTYPE for the ASCII Locale
*/
ENCODING "NONE"
VARIABLE Strict 7bit ASCII locale
ALPHA 'A' - 'Z' 'a' - 'z'
CONTROL 0x00 - 0x1f 0x7f
DIGIT '0' - '9'
GRAPH 0x21 - 0x7e
LOWER 'a' - 'z'
PUNCT 0x21 - 0x2f 0x3a - 0x40 0x5b - 0x60 0x7b - 0x7e
SPACE 0x09 - 0x0d 0x20
UPPER 'A' - 'Z'
XDIGIT '0' - '9' 'a' - 'f' 'A' - 'F'
BLANK ' ' '\t'
PRINT 0x20 - 0x7e
# IDEOGRAM
# SPECIAL
# PHONEGRAM
MAPLOWER <'A' - 'Z' : 'a'>
MAPLOWER <'a' - 'z' : 'a'>
MAPUPPER <'A' - 'Z' : 'A'>
MAPUPPER <'a' - 'z' : 'A'>
TODIGIT <'0' - '9' : 0>
TODIGIT <'A' - 'F' : 10>
TODIGIT <'a' - 'f' : 10>

View File

@ -0,0 +1,49 @@
/* $NetBSD: en_US.DIS_8859-15.src,v 1.1 2000/12/22 01:31:48 itojun Exp $ */
/*
* Standard LOCALE_CTYPE for the dis_8859_15 Locale
*/
ENCODING "NONE"
VARIABLE DIS 8859-15 Latin-9 character set
#
# This is a comment
#
ALPHA 'A' - 'Z' 'a' - 'z' 0xa6 0xa8 0xb4 0xb8 0xbc - 0xbe 0xc0 - 0xd6 0xd8 - 0xf6 0xf8 - 0xff
CONTROL 0x00 - 0x1f 0x7f - 0x9f
DIGIT '0' - '9'
GRAPH 0x21 - 0x7e 0xa1 - 0xff
LOWER 'a' - 'z' 0xa8 0xb8 0xbd 0xdf - 0xf6 0xf8 - 0xff
PUNCT 0x21 - 0x2f 0x3a - 0x40 0x5b - 0x60 0x7b - 0x7e 0xa1 - 0xa5 0xa7 0xa9 - 0xb3 0xb5 - 0xb7 0xb9 - 0xbb 0xbf 0xd7 0xf7
SPACE 0x09 - 0x0d ' ' 0xa0
UPPER 'A' - 'Z' 0xa6 0xb4 0xbc 0xc0 - 0xd6 0xd8 - 0xde
XDIGIT '0' - '9' 'a' - 'f' 'A' - 'F'
BLANK ' ' '\t' 0xa0
PRINT 0x20 - 0x7e 0xa0 - 0xff
# IDEOGRAM
# SPECIAL
# PHONEGRAM
MAPLOWER <'A' - 'Z' : 'a'>
MAPLOWER <'a' - 'z' : 'a'>
MAPLOWER <0xa6 - 0xa6 : 0xa8>
MAPLOWER <0xb4 - 0xb4 : 0xb8>
MAPLOWER <0xbc - 0xbc : 0xbd>
MAPLOWER <0xbe - 0xbe : 0xff>
MAPLOWER <0xc0 - 0xd6 : 0xe0>
MAPLOWER <0xd8 - 0xde : 0xf8>
MAPLOWER <0xdf - 0xf6 : 0xdf>
MAPLOWER <0xf8 - 0xff : 0xf8>
MAPUPPER <'A' - 'Z' : 'A'>
MAPUPPER <'a' - 'z' : 'A'>
MAPUPPER <0xa8 - 0xa8 : 0xa6>
MAPUPPER <0xb8 - 0xb8 : 0xb4>
MAPUPPER <0xbd - 0xbd : 0xbc>
MAPUPPER <0xc0 - 0xd6 : 0xc0>
MAPUPPER <0xd8 - 0xde : 0xd8>
MAPUPPER <0xe0 - 0xf6 : 0xc0>
MAPUPPER <0xf8 - 0xfe : 0xd8>
MAPUPPER <0xff - 0xff : 0xbe>
TODIGIT <'0' - '9' : 0>
TODIGIT <'A' - 'F' : 10>
TODIGIT <'a' - 'f' : 10>

View File

@ -0,0 +1,41 @@
/* $NetBSD: en_US.ISO_8859-1.src,v 1.1 2000/12/22 01:31:48 itojun Exp $ */
/*
* Standard LOCALE_CTYPE for the iso_8859_1 Locale
*/
ENCODING "NONE"
VARIABLE ISO 8859-1 Latin-1 character set
#
# This is a comment
#
ALPHA 'A' - 'Z' 'a' - 'z' 0xc0 - 0xd6 0xd8 - 0xf6 0xf8 - 0xff
CONTROL 0x00 - 0x1f 0x7f - 0x9f
DIGIT '0' - '9'
GRAPH 0x21 - 0x7e 0xa1 - 0xff
LOWER 'a' - 'z' 0xdf - 0xf6 0xf8 - 0xff
PUNCT 0x21 - 0x2f 0x3a - 0x40 0x5b - 0x60 0x7b - 0x7e 0xa1 - 0xbf 0xd7 0xf7
SPACE 0x09 - 0x0d ' ' 0xa0
UPPER 'A' - 'Z' 0xc0 - 0xd6 0xd8 - 0xde
XDIGIT '0' - '9' 'a' - 'f' 'A' - 'F'
BLANK ' ' '\t' 0xa0
PRINT 0x20 - 0x7e 0xa0 - 0xff
# IDEOGRAM
# SPECIAL
# PHONEGRAM
MAPLOWER <'A' - 'Z' : 'a'>
MAPLOWER <'a' - 'z' : 'a'>
MAPLOWER <0xc0 - 0xd6 : 0xe0>
MAPLOWER <0xd8 - 0xde : 0xf8>
MAPLOWER <0xdf - 0xf6 : 0xdf>
MAPLOWER <0xf8 - 0xff : 0xf8>
MAPUPPER <'A' - 'Z' : 'A'>
MAPUPPER <'a' - 'z' : 'A'>
MAPUPPER <0xc0 - 0xd6 : 0xc0>
MAPUPPER <0xd8 - 0xde : 0xd8>
MAPUPPER <0xe0 - 0xf6 : 0xc0>
MAPUPPER <0xf8 - 0xfe : 0xd8>
TODIGIT <'0' - '9' : 0>
TODIGIT <'A' - 'F' : 10>
TODIGIT <'a' - 'f' : 10>

View File

@ -0,0 +1,79 @@
/* $NetBSD: en_US.ISO_8859-2.src,v 1.1 2000/12/22 01:31:48 itojun Exp $ */
/*
* LOCALE_CTYPE for the iso_8859_2 Locale
*/
ENCODING "NONE"
VARIABLE ISO 8859-2 Latin-2 character set
#
# This is a comment
#
ALPHA 'A' - 'Z' 'a' - 'z'
0xa1 0xa3 0xa5 0xa6 0xa9 - 0xac 0xae 0xaf
0xb1 0xb3 0xb5 0xb6 0xb9 - 0xbc 0xbe 0xbf
0xc0 - 0xd6 0xd8 - 0xf6 0xf8 - 0xfe
CONTROL 0x00 - 0x1f 0x7f - 0x9f
DIGIT '0' - '9'
GRAPH 0x21 - 0x7e 0xa0 - 0xff
LOWER 'a' - 'z'
0xb1 0xb3 0xb5 0xb6 0xb9 - 0xbc 0xbe 0xbf
0xdf - 0xf6 0xf8 - 0xfe
PUNCT 0x21 - 0x2f 0x3a - 0x40 0x5b - 0x60 0x7b - 0x7e
0xa2 0xa4 0xa7 0xa8 0xad 0xb0 0xb2 0xb4 0xb7 0xb8 0xbd
0xd7 0xf7 0xff
SPACE 0x09 - 0x0d 0x20 0xa0
UPPER 'A' - 'Z'
0xa1 0xa3 0xa5 0xa6 0xa9 - 0xac 0xae 0xaf
0xc0 - 0xd6 0xd8 - 0xde
XDIGIT 'a' - 'f' 'A' - 'F'
BLANK ' ' '\t' 0xa0
PRINT 0x20 - 0x7e 0xa0 - 0xff
# IDEOGRAM
# SPECIAL
# PHONEGRAM
MAPLOWER <'A' - 'Z' : 'a'>
MAPLOWER <'a' - 'z' : 'a'>
MAPLOWER <0xa1 0xb1>
MAPLOWER <0xa3 0xb3>
MAPLOWER <0xa5 0xb5>
MAPLOWER <0xa6 0xb6>
MAPLOWER <0xa9 - 0xac : 0xb9>
MAPLOWER <0xae 0xbe>
MAPLOWER <0xaf 0xbf>
MAPLOWER <0xb1 0xb1>
MAPLOWER <0xb3 0xb3>
MAPLOWER <0xb5 0xb5>
MAPLOWER <0xb6 0xb6>
MAPLOWER <0xb9 - 0xbc : 0xb9>
MAPLOWER <0xbe 0xbe>
MAPLOWER <0xbf 0xbf>
MAPLOWER <0xc0 - 0xd6 : 0xe0>
MAPLOWER <0xd8 - 0xde : 0xf8>
MAPLOWER <0xdf - 0xf6 : 0xdf>
MAPLOWER <0xf8 - 0xfe : 0xf8>
MAPUPPER <'A' - 'Z' : 'A'>
MAPUPPER <'a' - 'z' : 'A'>
MAPUPPER <0xa1 0xa1>
MAPUPPER <0xa3 0xa3>
MAPUPPER <0xa5 0xa5>
MAPUPPER <0xa6 0xa6>
MAPUPPER <0xa9 - 0xac : 0xa9>
MAPUPPER <0xae 0xae>
MAPUPPER <0xaf 0xaf>
MAPUPPER <0xb1 0xa1>
MAPUPPER <0xb3 0xa3>
MAPUPPER <0xb5 0xa5>
MAPUPPER <0xb6 0xa6>
MAPUPPER <0xb9 - 0xbc : 0xa9>
MAPUPPER <0xbe 0xae>
MAPUPPER <0xbf 0xaf>
MAPUPPER <0xc0 - 0xd6 : 0xc0>
MAPUPPER <0xd8 - 0xdf : 0xd8>
MAPUPPER <0xe0 - 0xf6 : 0xc0>
MAPUPPER <0xf8 - 0xfe : 0xd8>
TODIGIT <'0' - '9' : 0>
TODIGIT <'A' - 'F' : 10>
TODIGIT <'a' - 'f' : 10>

View File

@ -0,0 +1,79 @@
/* $NetBSD: en_US.ISO_8859-4.src,v 1.1 2000/12/22 01:31:48 itojun Exp $ */
/*
* LOCALE_CTYPE for the iso_8859_4 Locale
*/
ENCODING "NONE"
VARIABLE ISO 8859-4 Latin-4 character set
#
# This is a comment
#
ALPHA 'A' - 'Z' 'a' - 'z'
0xa1 - 0xa3 0xa5 0xa6 0xa9 - 0xac 0xae
0xb1 0xb3 0xb5 0xb6 0xb9 - 0xd6 0xd8 - 0xf6 0xf8 - 0xfe
CONTROL 0x00 - 0x1f 0x7f - 0x9f
DIGIT '0' - '9'
GRAPH 0x21 - 0x7e 0xa0 - 0xff
LOWER 'a' - 'z'
0xa2 0xb1 0xb3 0xb5 0xb6 0xb9 - 0xbc 0xbe 0xbf
0xdf - 0xf6 0xf8 - 0xfe
PUNCT 0x21 - 0x2f 0x3a - 0x40 0x5b - 0x60 0x7b - 0x7e
0xa4 0xa7 0xa8 0xad 0xaf 0xb0 0xb2 0xb4 0xb7 0xb8
0xd7 0xf7 0xff
SPACE 0x09 - 0x0d 0x20 0xa0
UPPER 'A' - 'Z'
0xa1 0xa3 0xa5 0xa6 0xa9 - 0xac 0xae
0xc0 - 0xd6 0xd8 - 0xde
XDIGIT 'a' - 'f' 'A' - 'F'
BLANK ' ' '\t' 0xa0
PRINT 0x20 - 0x7e 0xa0 - 0xff
# IDEOGRAM
# SPECIAL
# PHONEGRAM
MAPLOWER <'A' - 'Z' : 'a'>
MAPLOWER <'a' - 'z' : 'a'>
MAPLOWER <0xa1 0xb1>
MAPLOWER <0xa2 0xa2>
MAPLOWER <0xa3 0xb3>
MAPLOWER <0xa5 0xb5>
MAPLOWER <0xa6 0xb6>
MAPLOWER <0xa9 - 0xac : 0xb9>
MAPLOWER <0xae 0xbe>
MAPLOWER <0xb1 0xb1>
MAPLOWER <0xb3 0xb3>
MAPLOWER <0xb5 0xb5>
MAPLOWER <0xb6 0xb6>
MAPLOWER <0xb9 - 0xbc : 0xb9>
MAPLOWER <0xbd 0xbf>
MAPLOWER <0xbe 0xbe>
MAPLOWER <0xbf 0xbf>
MAPLOWER <0xc0 - 0xd6 : 0xe0>
MAPLOWER <0xd8 - 0xde : 0xf8>
MAPLOWER <0xdf - 0xf6 : 0xdf>
MAPLOWER <0xf8 - 0xfe : 0xf8>
MAPUPPER <'A' - 'Z' : 'A'>
MAPUPPER <'a' - 'z' : 'A'>
MAPUPPER <0xa1 0xa1>
MAPUPPER <0xa3 0xa3>
MAPUPPER <0xa5 0xa5>
MAPUPPER <0xa6 0xa6>
MAPUPPER <0xa9 - 0xac : 0xa9>
MAPUPPER <0xae 0xae>
MAPUPPER <0xb1 0xa1>
MAPUPPER <0xb3 0xa3>
MAPUPPER <0xb5 0xa5>
MAPUPPER <0xb6 0xa6>
MAPUPPER <0xb9 - 0xbc : 0xa9>
MAPUPPER <0xbd 0xbd>
MAPUPPER <0xbe 0xae>
MAPUPPER <0xbf 0xbd>
MAPUPPER <0xc0 - 0xd6 : 0xc0>
MAPUPPER <0xd8 - 0xde : 0xd8>
MAPUPPER <0xe0 - 0xf6 : 0xc0>
MAPUPPER <0xf8 - 0xfe : 0xd8>
TODIGIT <'0' - '9' : 0>
TODIGIT <'A' - 'F' : 10>
TODIGIT <'a' - 'f' : 10>

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.113 2000/10/24 23:59:00 thorpej Exp $
# $NetBSD: Makefile,v 1.114 2000/12/22 01:31:48 itojun Exp $
# from: @(#)Makefile 8.3 (Berkeley) 1/7/94
.include <bsd.own.mk>
@ -12,7 +12,8 @@ SUBDIR= apply apropos asa at audio banner basename biff \
hexdump id indent innetgr ipcrm ipcs join jot kdump ktrace ktruss \
lam last lastcomm ldd leave less lex locate lock \
logger login logname look lorder m4 machine mail \
make man menuc mesg midiplay mixerctl mkdep mkfifo mkstr mktemp \
make man menuc mesg midiplay mixerctl mkdep mkfifo \
mklocale mkstr mktemp \
modstat msgc msgs netgroup netstat newsyslog nfsstat nice nl nohup \
pagesize passwd paste patch pmc pr printenv printf quota rdist \
renice rev rlogin rpcgen rpcinfo rs rsh rup \

14
usr.bin/mklocale/Makefile Normal file
View File

@ -0,0 +1,14 @@
# @(#)Makefile 8.1 (Berkeley) 6/7/93
# $NetBSD: Makefile,v 1.2 2000/12/22 01:31:48 itojun Exp $
# $FreeBSD: src/usr.bin/mklocale/Makefile,v 1.19.2.1 1999/08/29 15:31:03 peter Exp $
WARNS?= 1
PROG= mklocale
SRCS= yacc.y lex.l #y.tab.h
CPPFLAGS+=-I${.OBJDIR} # for y.tab.h
CPPFLAGS+=-I${.CURDIR} -I${.CURDIR}/../../include -I${.CURDIR}/../../lib/libc/locale
MAN1= mklocale.1
CLEANFILES+= y.tab.c y.tab.h
YHEADER= yes
.include <bsd.prog.mk>

55
usr.bin/mklocale/ldef.h Normal file
View File

@ -0,0 +1,55 @@
/* $NetBSD: ldef.h,v 1.2 2000/12/22 01:31:48 itojun Exp $ */
/*-
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Paul Borman at Krystal Technologies.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ldef.h 8.1 (Berkeley) 6/6/93
*/
/*
* This should look a LOT like a _RuneEntry
*/
typedef struct rune_list {
rune_t min;
rune_t max;
rune_t map;
u_int32_t *types;
struct rune_list *next;
} rune_list;
typedef struct rune_map {
u_int32_t map[_CACHED_RUNES];
rune_list *root;
} rune_map;

192
usr.bin/mklocale/lex.l Normal file
View File

@ -0,0 +1,192 @@
/* $NetBSD: lex.l,v 1.2 2000/12/22 01:31:49 itojun Exp $ */
%{
/*-
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Paul Borman at Krystal Technologies.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lex.l 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lex.l,v 1.2 2000/12/22 01:31:49 itojun Exp $");
#endif
#endif /* not lint */
#if !defined(__FreeBSD__)
#define _BSD_RUNE_T_ int
#define _BSD_CT_RUNE_T_ rune_t
#include "runetype.h"
#else
#include <ctype.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include "ldef.h"
#ifdef __NetBSD__
#include "yacc.h"
#else
#include "y.tab.h"
#endif
int yylex __P((void));
%}
ODIGIT [0-7]
DIGIT [0-9]
XDIGIT [0-9a-fA-F]
W [\t\n\r ]
%%
\'.\' { yylval.rune = (unsigned char)yytext[1];
return(RUNE); }
'\\a' { yylval.rune = '\a';
return(RUNE); }
'\\b' { yylval.rune = '\b';
return(RUNE); }
'\\f' { yylval.rune = '\f';
return(RUNE); }
'\\n' { yylval.rune = '\n';
return(RUNE); }
'\\r' { yylval.rune = '\r';
return(RUNE); }
'\\t' { yylval.rune = '\t';
return(RUNE); }
'\\v' { yylval.rune = '\v';
return(RUNE); }
0x{XDIGIT}+ { yylval.rune = strtol(yytext, 0, 16);
return(RUNE); }
0{ODIGIT}+ { yylval.rune = strtol(yytext, 0, 8);
return(RUNE); }
{DIGIT}+ { yylval.rune = strtol(yytext, 0, 10);
return(RUNE); }
MAPLOWER { return(MAPLOWER); }
MAPUPPER { return(MAPUPPER); }
TODIGIT { return(DIGITMAP); }
INVALID { return(INVALID); }
ALPHA { yylval.i = _CTYPE_A|_CTYPE_R|_CTYPE_G;
return(LIST); }
CONTROL { yylval.i = _CTYPE_C;
return(LIST); }
DIGIT { yylval.i = _CTYPE_D|_CTYPE_R|_CTYPE_G;
return(LIST); }
GRAPH { yylval.i = _CTYPE_G|_CTYPE_R;
return(LIST); }
LOWER { yylval.i = _CTYPE_L|_CTYPE_R|_CTYPE_G;
return(LIST); }
PUNCT { yylval.i = _CTYPE_P|_CTYPE_R|_CTYPE_G;
return(LIST); }
SPACE { yylval.i = _CTYPE_S;
return(LIST); }
UPPER { yylval.i = _CTYPE_U|_CTYPE_R|_CTYPE_G;
return(LIST); }
XDIGIT { yylval.i = _CTYPE_X|_CTYPE_R|_CTYPE_G;
return(LIST); }
BLANK { yylval.i = _CTYPE_B;
return(LIST); }
PRINT { yylval.i = _CTYPE_R;
return(LIST); }
IDEOGRAM { yylval.i = _CTYPE_I|_CTYPE_R|_CTYPE_G;
return(LIST); }
SPECIAL { yylval.i = _CTYPE_T|_CTYPE_R|_CTYPE_G;
return(LIST); }
PHONOGRAM { yylval.i = _CTYPE_Q|_CTYPE_R|_CTYPE_G;
return(LIST); }
SWIDTH0 { yylval.i = _CTYPE_SW0; return(LIST); }
SWIDTH1 { yylval.i = _CTYPE_SW1; return(LIST); }
SWIDTH2 { yylval.i = _CTYPE_SW2; return(LIST); }
SWIDTH3 { yylval.i = _CTYPE_SW3; return(LIST); }
VARIABLE[\t ] { static char vbuf[1024];
char *v = vbuf;
while ((*v = input()) && *v != '\n')
++v;
if (*v) {
unput(*v);
*v = 0;
}
yylval.str = vbuf;
return(VARIABLE);
}
CHARSET { return(CHARSET); }
ENCODING { return(ENCODING); }
\".*\" { char *e = yytext + 1;
yylval.str = e;
while (*e && *e != '"')
++e;
*e = 0;
return(STRING); }
\<|\(|\[ { return(LBRK); }
\>|\)|\] { return(RBRK); }
\- { return(THRU); }
\.\.\. { return(THRU); }
\: { return(':'); }
{W}+ ;
^\#.*\n ;
\/\* { char lc = 0;
do {
while ((lc) != '*')
if ((lc = input()) == 0)
break;
} while((lc = input()) != '/');
}
\\$ ;
. { printf("Lex is skipping '%s'\n", yytext); }
%%
#if !defined(yywrap)
int
yywrap()
{
return(1);
}
#endif

284
usr.bin/mklocale/mklocale.1 Normal file
View File

@ -0,0 +1,284 @@
.\" $FreeBSD: src/usr.bin/mklocale/mklocale.1,v 1.6 1999/09/20 09:15:21 phantom Exp $
.\"
.\" Copyright (c) 1993, 1994
.\" The Regents of the University of California. All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" Paul Borman at Krystal Technologies.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)mklocale.1 8.2 (Berkeley) 4/18/94
.\"
.Dd April 18, 1994
.Dt MKLOCALE 1
.Os
.Sh NAME
.Nm mklocale
.Nd make LC_CTYPE locale files
.Sh SYNOPSIS
.Nm mklocale
.Op Fl d
.Ar "< src-file"
.Ar "> language/LC_CTYPE"
.Nm mklocale
.Op Fl d
.Fl o
.Ar language/LC_CTYPE
.Ar src-file
.Sh DESCRIPTION
The
.Nm mklocale
utility reads a
.Dv LC_CTYPE
source file from standard input and produces a
.Dv LC_CTYPE
binary file on standard output suitable for placement in
.Dv /usr/share/locale/\fIlanguage\fP/LC_CTYPE.
.Pp
The format of
.Ar src-file
is quite simple.
It consists of a series of lines which start with a keyword and have
associated data following. C style comments are used
to place comments in the file.
.Pp
Following options are available:
.Bl -tag -width indent
.It Fl d
Turns on debuging messages.
.It Fl o
Specify output file.
.El
.Pp
Besides the keywords which will be listed below,
the following are valid tokens in
.Ar src-file :
.Bl -tag -width literal
.It Dv RUNE
A
.Dv RUNE
may be any of the following:
.Bl -tag -width 0x[0-9a-z]*
.It Ar 'x'
The ASCII character
.Ar x .
.It Ar '\ex'
The ANSI C character
.Ar \ex
where
.Ar \ex
is one of
.Dv \ea ,
.Dv \eb ,
.Dv \ef ,
.Dv \en ,
.Dv \er ,
.Dv \et ,
or
.Dv \ev .
.It Ar 0x[0-9a-z]*
A hexadecimal number representing a rune code.
.It Ar 0[0-7]*
An octal number representing a rune code.
.It Ar [1-9][0-9]*
A decimal number representing a rune code.
.El
.It Dv STRING
A string enclosed in double quotes (").
.It Dv THRU
Either
.Dv ...
or
.Dv - .
Used to indicate ranges.
.It Ar literal
The follow characters are taken literally:
.Bl -tag -width "<\|\|(\|\|["
.It Dv "<\|(\|["
Used to start a mapping. All are equivalent.
.It Dv ">\|\^)\|]"
Used to end a mapping. All are equivalent.
.It Dv :
Used as a delimiter in mappings.
.El
.El
.sp
Key words which should only appear once are:
.Bl -tag -width PHONOGRAM
.It Dv ENCODING
Followed by a
.Dv STRING
which indicates the encoding mechanism to be used for this locale.
The current encodings are:
.Bl -tag -width NONE
.It Dv NONE
No translation and the default.
.It Dv UTF2
.Dv "Universal character set Transformation Format"
adopted from
.Nm "Plan 9 from Bell Labs" .
This is the preferred encoding.
.It Dv EUC
.Dv EUC
encoding as used by several
vendors of
.Ux
systems.
.El
.It Dv VARIABLE
This keyword must be followed by a single tab or space character,
after which encoding specific data is placed.
Currently only the
.Dv "EUC"
encoding requires variable data.
See
.Xr euc 4
for further details.
.It Dv INVALID
A single
.Dv RUNE
follows and is used as the invalid rune for this locale.
.El
.sp
The following keywords may appear multiple times and have the following
format for data:
.in +.5i
.Bl -tag -width "<RUNE1 THRU RUNEn : RUNE2>"
.It Dv <RUNE1 RUNE2>
.Dv RUNE1
is mapped to
.Dv RUNE2 .
.It Dv <RUNE1 THRU RUNEn : RUNE2>
Runes
.Dv RUNE1
through
.Dv RUNEn
are mapped to
.Dv RUNE2
through
.Dv RUNE2
+ n-1.
.El
.in -.5i
.Bl -tag -width PHONOGRAM
.It Dv MAPLOWER
Defines the tolower mappings.
.Dv RUNE2
is the lower case representation of
.Dv RUNE1.
.It Dv MAPUPPER
Defines the toupper mappings.
.Dv RUNE2
is the upper case representation of
.Dv RUNE1.
.It Dv TODIGIT
Defines a map from runes to their digit value.
.Dv RUNE2
is the integer value represented by
.Dv RUNE1 .
For example, the ASCII character
.Nm '0'
would map to the decimal value
.Nm 0 .
Only values up to
.Nm 255
are allowed.
.El
.sp
The following keywords may appear multiple times and have the following
format for data:
.in +.5i
.Bl -tag -width "RUNE1 THRU RUNEn"
.It Dv RUNE
This rune has the property defined by the keyword.
.It Dv "RUNE1 THRU RUNEn"
All the runes between and including
.Dv RUNE1
and
.Dv RUNEn
have the property defined by the keyword.
.El
.in -.5i
.Bl -tag -width PHONOGRAM
.It Dv ALPHA
Defines runes which are alphabetic, printable and graphic.
.It Dv CONTROL
Defines runes which are control characters.
.It Dv DIGIT
Defines runes which are decimal digits, printable and graphic.
.It Dv GRAPH
Defines runes which are graphic and printable.
.It Dv LOWER
Defines runes which are lower case, printable and graphic.
.It Dv PUNCT
Defines runes which are punctuation, printable and graphic.
.It Dv SPACE
Defines runes which are spaces.
.It Dv UPPER
Defines runes which are upper case, printable and graphic.
.It Dv XDIGIT
Defines runes which are hexadecimal digits, printable and graphic.
.It Dv BLANK
Defines runes which are blank.
.It Dv PRINT
Defines runes which are printable.
.It Dv IDEOGRAM
Defines runes which are ideograms, printable and graphic.
.It Dv SPECIAL
Defines runes which are special characters, printable and graphic.
.It Dv PHONOGRAM
Defines runes which are phonograms, printable and graphic.
.It Dv SWIDTHn
Defines runes with specific glyph width.
.Ar n
takes 0 to 3.
.It Dv CHARSET
Controls character set for subsequent runes.
To support
.Xr iso2022 4
locale definitions.
.El
.Sh SEE ALSO
.Xr colldef 1 ,
.Xr mbrune 3 ,
.Xr rune 3 ,
.Xr setlocale 3 ,
.Xr euc 4 ,
.Xr utf2 4 ,
.Xr utf8 4
.Sh BUGS
The
.Nm mklocale
utility is overly simplistic.
.Sh HISTORY
The
.Nm mklocale
utility first appeared in
.Bx 4.4 .

914
usr.bin/mklocale/yacc.y Normal file
View File

@ -0,0 +1,914 @@
/* $NetBSD: yacc.y,v 1.2 2000/12/22 01:31:49 itojun Exp $ */
%{
/*-
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Paul Borman at Krystal Technologies.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)yacc.y 8.1 (Berkeley) 6/6/93";
static char rcsid[] = "$FreeBSD$";
#else
__RCSID("$NetBSD: yacc.y,v 1.2 2000/12/22 01:31:49 itojun Exp $");
#endif
#endif /* not lint */
#include <ctype.h>
#if !defined(__FreeBSD__)
#define _BSD_RUNE_T_ int
#define _BSD_CT_RUNE_T_ rune_t
#include "rune.h"
#else
#include <rune.h>
#endif
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "ldef.h"
char *locale_file = "<stdout>";
rune_map maplower = { { 0, }, };
rune_map mapupper = { { 0, }, };
rune_map types = { { 0, }, };
_RuneLocale new_locale = { { 0, }, };
rune_t charsetbits = (rune_t)0x00000000;
#if 0
rune_t charsetmask = (rune_t)0x0000007f;
#endif
rune_t charsetmask = (rune_t)0xffffffff;
void set_map __P((rune_map *, rune_list *, u_int32_t));
void set_digitmap __P((rune_map *, rune_list *));
void add_map __P((rune_map *, rune_list *, u_int32_t));
int main __P((int, char *[]));
int yyerror __P((const char *s));
void *xmalloc __P((unsigned int sz));
u_int32_t *xlalloc __P((unsigned int sz));
u_int32_t *xrelalloc __P((u_int32_t *old, unsigned int sz));
void dump_tables __P((void));
int yyparse __P((void));
extern int yylex __P((void));
%}
%union {
rune_t rune;
int i;
char *str;
rune_list *list;
}
%token <rune> RUNE
%token LBRK
%token RBRK
%token THRU
%token MAPLOWER
%token MAPUPPER
%token DIGITMAP
%token <i> LIST
%token <str> VARIABLE
%token CHARSET
%token ENCODING
%token INVALID
%token <str> STRING
%type <list> list
%type <list> map
%%
locale : /* empty */
| table
{ dump_tables(); }
;
table : entry
| table entry
;
entry : ENCODING STRING
{ strncpy(new_locale.__encoding, $2, sizeof(new_locale.__encoding)); }
| VARIABLE
{ new_locale.__variable_len = strlen($1) + 1;
new_locale.__rune_variable =
malloc(new_locale.__variable_len);
strcpy((char *)new_locale.__rune_variable, $1);
}
| CHARSET RUNE
{ charsetbits = $2; charsetmask = 0x0000007f; }
| CHARSET RUNE RUNE
{ charsetbits = $2; charsetmask = $3; }
| CHARSET STRING
{ int final = $2[strlen($2) - 1] & 0x7f;
charsetbits = final << 24;
if ($2[0] == '$') {
charsetmask = 0x00007f7f;
if (strchr(",-./", $2[1]))
charsetbits |= 0x80;
if (0xd0 <= final && final <= 0xdf)
charsetmask |= 0x007f0000;
} else {
charsetmask = 0x0000007f;
if (strchr(",-./", $2[0]))
charsetbits |= 0x80;
if (strlen($2) == 2 && $2[0] == '!')
charsetbits |= ((0x80 | $2[0]) << 16);
}
/*
* special rules
*/
if (charsetbits == ('B' << 24)
&& charsetmask == 0x0000007f) {
/*ASCII: 94B*/
charsetbits = 0;
charsetmask = 0x0000007f;
} else if (charsetbits == (('A' << 24) | 0x80)
&& charsetmask == 0x0000007f) {
/*Latin1: 96A*/
charsetbits = 0x80;
charsetmask = 0x0000007f;
}
}
| INVALID RUNE
{ new_locale.__invalid_rune = $2; }
| LIST list
{ set_map(&types, $2, $1); }
| MAPLOWER map
{ set_map(&maplower, $2, 0); }
| MAPUPPER map
{ set_map(&mapupper, $2, 0); }
| DIGITMAP map
{ set_digitmap(&types, $2); }
;
list : RUNE
{
$$ = (rune_list *)malloc(sizeof(rune_list));
$$->min = ($1 & charsetmask) | charsetbits;
$$->max = ($1 & charsetmask) | charsetbits;
$$->next = 0;
}
| RUNE THRU RUNE
{
$$ = (rune_list *)malloc(sizeof(rune_list));
$$->min = ($1 & charsetmask) | charsetbits;
$$->max = ($3 & charsetmask) | charsetbits;
$$->next = 0;
}
| list RUNE
{
$$ = (rune_list *)malloc(sizeof(rune_list));
$$->min = ($2 & charsetmask) | charsetbits;
$$->max = ($2 & charsetmask) | charsetbits;
$$->next = $1;
}
| list RUNE THRU RUNE
{
$$ = (rune_list *)malloc(sizeof(rune_list));
$$->min = ($2 & charsetmask) | charsetbits;
$$->max = ($4 & charsetmask) | charsetbits;
$$->next = $1;
}
;
map : LBRK RUNE RUNE RBRK
{
$$ = (rune_list *)malloc(sizeof(rune_list));
$$->min = ($2 & charsetmask) | charsetbits;
$$->max = ($2 & charsetmask) | charsetbits;
$$->map = $3;
$$->next = 0;
}
| map LBRK RUNE RUNE RBRK
{
$$ = (rune_list *)malloc(sizeof(rune_list));
$$->min = ($3 & charsetmask) | charsetbits;
$$->max = ($3 & charsetmask) | charsetbits;
$$->map = $4;
$$->next = $1;
}
| LBRK RUNE THRU RUNE ':' RUNE RBRK
{
$$ = (rune_list *)malloc(sizeof(rune_list));
$$->min = ($2 & charsetmask) | charsetbits;
$$->max = ($4 & charsetmask) | charsetbits;
$$->map = $6;
$$->next = 0;
}
| map LBRK RUNE THRU RUNE ':' RUNE RBRK
{
$$ = (rune_list *)malloc(sizeof(rune_list));
$$->min = ($3 & charsetmask) | charsetbits;
$$->max = ($5 & charsetmask) | charsetbits;
$$->map = $7;
$$->next = $1;
}
;
%%
int debug = 0;
FILE *fp = stdout;
int
main(ac, av)
int ac;
char *av[];
{
int x;
extern char *optarg;
extern int optind;
while ((x = getopt(ac, av, "do:")) != EOF) {
switch(x) {
case 'd':
debug = 1;
break;
case 'o':
locale_file = optarg;
if ((fp = fopen(locale_file, "w")) == 0) {
perror(locale_file);
exit(1);
}
break;
default:
usage:
fprintf(stderr, "Usage: mklocale [-d] [-o output] [source]\n");
exit(1);
}
}
switch (ac - optind) {
case 0:
break;
case 1:
if (freopen(av[optind], "r", stdin) == 0) {
perror(av[optind]);
exit(1);
}
break;
default:
goto usage;
}
for (x = 0; x < _CACHED_RUNES; ++x) {
mapupper.map[x] = x;
maplower.map[x] = x;
}
new_locale.__invalid_rune = _INVALID_RUNE;
memcpy(new_locale.__magic, _RUNE_MAGIC_1, sizeof(new_locale.__magic));
yyparse();
return 0;
}
int
yyerror(s)
const char *s;
{
fprintf(stderr, "%s\n", s);
return 0;
}
void *
xmalloc(sz)
unsigned int sz;
{
void *r = malloc(sz);
if (!r) {
perror("xmalloc");
abort();
}
return(r);
}
u_int32_t *
xlalloc(sz)
unsigned int sz;
{
u_int32_t *r = (u_int32_t *)malloc(sz * sizeof(u_int32_t));
if (!r) {
perror("xlalloc");
abort();
}
return(r);
}
u_int32_t *
xrelalloc(old, sz)
u_int32_t *old;
unsigned int sz;
{
u_int32_t *r = (u_int32_t *)realloc((char *)old,
sz * sizeof(u_int32_t));
if (!r) {
perror("xrelalloc");
abort();
}
return(r);
}
void
set_map(map, list, flag)
rune_map *map;
rune_list *list;
u_int32_t flag;
{
list->map &= charsetmask;
list->map |= charsetbits;
while (list) {
rune_list *nlist = list->next;
add_map(map, list, flag);
list = nlist;
}
}
void
set_digitmap(map, list)
rune_map *map;
rune_list *list;
{
rune_t i;
while (list) {
rune_list *nlist = list->next;
for (i = list->min; i <= list->max; ++i) {
if (list->map + (i - list->min)) {
rune_list *tmp = (rune_list *)xmalloc(sizeof(rune_list));
tmp->min = i;
tmp->max = i;
add_map(map, tmp, list->map + (i - list->min));
}
}
free(list);
list = nlist;
}
}
void
add_map(map, list, flag)
rune_map *map;
rune_list *list;
u_int32_t flag;
{
rune_t i;
rune_list *lr = 0;
rune_list *r;
rune_t run;
while (list->min < _CACHED_RUNES && list->min <= list->max) {
if (flag)
map->map[list->min++] |= flag;
else
map->map[list->min++] = list->map++;
}
if (list->min > list->max) {
free(list);
return;
}
run = list->max - list->min + 1;
if (!(r = map->root) || (list->max < r->min - 1)
|| (!flag && list->max == r->min - 1)) {
if (flag) {
list->types = xlalloc(run);
for (i = 0; i < run; ++i)
list->types[i] = flag;
}
list->next = map->root;
map->root = list;
return;
}
for (r = map->root; r && r->max + 1 < list->min; r = r->next)
lr = r;
if (!r) {
/*
* We are off the end.
*/
if (flag) {
list->types = xlalloc(run);
for (i = 0; i < run; ++i)
list->types[i] = flag;
}
list->next = 0;
lr->next = list;
return;
}
if (list->max < r->min - 1) {
/*
* We come before this range and we do not intersect it.
* We are not before the root node, it was checked before the loop
*/
if (flag) {
list->types = xlalloc(run);
for (i = 0; i < run; ++i)
list->types[i] = flag;
}
list->next = lr->next;
lr->next = list;
return;
}
/*
* At this point we have found that we at least intersect with
* the range pointed to by `r', we might intersect with one or
* more ranges beyond `r' as well.
*/
if (!flag && list->map - list->min != r->map - r->min) {
/*
* There are only two cases when we are doing case maps and
* our maps needn't have the same offset. When we are adjoining
* but not intersecting.
*/
if (list->max + 1 == r->min) {
lr->next = list;
list->next = r;
return;
}
if (list->min - 1 == r->max) {
list->next = r->next;
r->next = list;
return;
}
fprintf(stderr, "Error: conflicting map entries\n");
exit(1);
}
if (list->min >= r->min && list->max <= r->max) {
/*
* Subset case.
*/
if (flag) {
for (i = list->min; i <= list->max; ++i)
r->types[i - r->min] |= flag;
}
free(list);
return;
}
if (list->min <= r->min && list->max >= r->max) {
/*
* Superset case. Make him big enough to hold us.
* We might need to merge with the guy after him.
*/
if (flag) {
list->types = xlalloc(list->max - list->min + 1);
for (i = list->min; i <= list->max; ++i)
list->types[i - list->min] = flag;
for (i = r->min; i <= r->max; ++i)
list->types[i - list->min] |= r->types[i - r->min];
free(r->types);
r->types = list->types;
} else {
r->map = list->map;
}
r->min = list->min;
r->max = list->max;
free(list);
} else if (list->min < r->min) {
/*
* Our tail intersects his head.
*/
if (flag) {
list->types = xlalloc(r->max - list->min + 1);
for (i = r->min; i <= r->max; ++i)
list->types[i - list->min] = r->types[i - r->min];
for (i = list->min; i < r->min; ++i)
list->types[i - list->min] = flag;
for (i = r->min; i <= list->max; ++i)
list->types[i - list->min] |= flag;
free(r->types);
r->types = list->types;
} else {
r->map = list->map;
}
r->min = list->min;
free(list);
return;
} else {
/*
* Our head intersects his tail.
* We might need to merge with the guy after him.
*/
if (flag) {
r->types = xrelalloc(r->types, list->max - r->min + 1);
for (i = list->min; i <= r->max; ++i)
r->types[i - r->min] |= flag;
for (i = r->max+1; i <= list->max; ++i)
r->types[i - r->min] = flag;
}
r->max = list->max;
free(list);
}
/*
* Okay, check to see if we grew into the next guy(s)
*/
while ((lr = r->next) && r->max >= lr->min) {
if (flag) {
if (r->max >= lr->max) {
/*
* Good, we consumed all of him.
*/
for (i = lr->min; i <= lr->max; ++i)
r->types[i - r->min] |= lr->types[i - lr->min];
} else {
/*
* "append" him on to the end of us.
*/
r->types = xrelalloc(r->types, lr->max - r->min + 1);
for (i = lr->min; i <= r->max; ++i)
r->types[i - r->min] |= lr->types[i - lr->min];
for (i = r->max+1; i <= lr->max; ++i)
r->types[i - r->min] = lr->types[i - lr->min];
r->max = lr->max;
}
} else {
if (lr->max > r->max)
r->max = lr->max;
}
r->next = lr->next;
if (flag)
free(lr->types);
free(lr);
}
}
void
dump_tables()
{
int x;
rune_list *list;
_FileRuneLocale file_new_locale;
memset(&file_new_locale, 0, sizeof(file_new_locale));
/*
* See if we can compress some of the istype arrays
*/
for(list = types.root; list; list = list->next) {
list->map = list->types[0];
for (x = 1; x < list->max - list->min + 1; ++x) {
if (list->types[x] != list->map) {
list->map = 0;
break;
}
}
}
memcpy(&file_new_locale.__magic, new_locale.__magic,
sizeof(file_new_locale.__magic));
memcpy(&file_new_locale.__encoding, new_locale.__encoding,
sizeof(file_new_locale.__encoding));
file_new_locale.__invalid_rune = htonl(new_locale.__invalid_rune);
/*
* Fill in our tables. Do this in network order so that
* diverse machines have a chance of sharing data.
* (Machines like Crays cannot share with little machines due to
* word size. Sigh. We tried.)
*/
for (x = 0; x < _CACHED_RUNES; ++x) {
file_new_locale.__runetype[x] = htonl(types.map[x]);
file_new_locale.__maplower[x] = htonl(maplower.map[x]);
file_new_locale.__mapupper[x] = htonl(mapupper.map[x]);
}
/*
* Count up how many ranges we will need for each of the extents.
*/
list = types.root;
while (list) {
new_locale.__runetype_ext.__nranges++;
list = list->next;
}
file_new_locale.__runetype_ext.__nranges =
htonl(new_locale.__runetype_ext.__nranges);
list = maplower.root;
while (list) {
new_locale.__maplower_ext.__nranges++;
list = list->next;
}
file_new_locale.__maplower_ext.__nranges =
htonl(new_locale.__maplower_ext.__nranges);
list = mapupper.root;
while (list) {
new_locale.__mapupper_ext.__nranges++;
list = list->next;
}
file_new_locale.__mapupper_ext.__nranges =
htonl(new_locale.__mapupper_ext.__nranges);
file_new_locale.__variable_len = htonl(new_locale.__variable_len);
/*
* Okay, we are now ready to write the new locale file.
*/
/*
* PART 1: The _RuneLocale structure
*/
if (fwrite((char *)&file_new_locale, sizeof(file_new_locale), 1, fp) != 1) {
perror(locale_file);
exit(1);
}
/*
* PART 2: The runetype_ext structures (not the actual tables)
*/
list = types.root;
while (list) {
_FileRuneEntry re;
re.__min = htonl(list->min);
re.__max = htonl(list->max);
re.__map = htonl(list->map);
if (fwrite((char *)&re, sizeof(re), 1, fp) != 1) {
perror(locale_file);
exit(1);
}
list = list->next;
}
/*
* PART 3: The maplower_ext structures
*/
list = maplower.root;
while (list) {
_FileRuneEntry re;
re.__min = htonl(list->min);
re.__max = htonl(list->max);
re.__map = htonl(list->map);
if (fwrite((char *)&re, sizeof(re), 1, fp) != 1) {
perror(locale_file);
exit(1);
}
list = list->next;
}
/*
* PART 4: The mapupper_ext structures
*/
list = mapupper.root;
while (list) {
_FileRuneEntry re;
re.__min = htonl(list->min);
re.__max = htonl(list->max);
re.__map = htonl(list->map);
if (fwrite((char *)&re, sizeof(re), 1, fp) != 1) {
perror(locale_file);
exit(1);
}
list = list->next;
}
/*
* PART 5: The runetype_ext tables
*/
list = types.root;
while (list) {
for (x = 0; x < list->max - list->min + 1; ++x)
list->types[x] = htonl(list->types[x]);
if (!list->map) {
if (fwrite((char *)list->types,
(list->max - list->min + 1) * sizeof(u_int32_t),
1, fp) != 1) {
perror(locale_file);
exit(1);
}
}
list = list->next;
}
/*
* PART 5: And finally the variable data
*/
if (fwrite((char *)new_locale.__rune_variable,
new_locale.__variable_len, 1, fp) != 1) {
perror(locale_file);
exit(1);
}
fclose(fp);
if (!debug)
return;
if (new_locale.__encoding[0])
fprintf(stderr, "ENCODING %s\n", new_locale.__encoding);
if (new_locale.__rune_variable)
fprintf(stderr, "VARIABLE %s\n",
(char *)new_locale.__rune_variable);
fprintf(stderr, "\nMAPLOWER:\n\n");
for (x = 0; x < _CACHED_RUNES; ++x) {
if (isprint(maplower.map[x]))
fprintf(stderr, " '%c'", (int)maplower.map[x]);
else if (maplower.map[x])
fprintf(stderr, "%04x", maplower.map[x]);
else
fprintf(stderr, "%4x", 0);
if ((x & 0xf) == 0xf)
fprintf(stderr, "\n");
else
fprintf(stderr, " ");
}
fprintf(stderr, "\n");
for (list = maplower.root; list; list = list->next)
fprintf(stderr, "\t%04x - %04x : %04x\n", list->min, list->max, list->map);
fprintf(stderr, "\nMAPUPPER:\n\n");
for (x = 0; x < _CACHED_RUNES; ++x) {
if (isprint(mapupper.map[x]))
fprintf(stderr, " '%c'", (int)mapupper.map[x]);
else if (mapupper.map[x])
fprintf(stderr, "%04x", mapupper.map[x]);
else
fprintf(stderr, "%4x", 0);
if ((x & 0xf) == 0xf)
fprintf(stderr, "\n");
else
fprintf(stderr, " ");
}
fprintf(stderr, "\n");
for (list = mapupper.root; list; list = list->next)
fprintf(stderr, "\t%04x - %04x : %04x\n", list->min, list->max, list->map);
fprintf(stderr, "\nTYPES:\n\n");
for (x = 0; x < _CACHED_RUNES; ++x) {
u_int32_t r = types.map[x];
if (r) {
if (isprint(x))
fprintf(stderr, " '%c':%2d", x, (int)(r & 0xff));
else
fprintf(stderr, "%04x:%2d", x, (int)(r & 0xff));
fprintf(stderr, " %4s", (r & _CTYPE_A) ? "alph" : "");
fprintf(stderr, " %4s", (r & _CTYPE_C) ? "ctrl" : "");
fprintf(stderr, " %4s", (r & _CTYPE_D) ? "dig" : "");
fprintf(stderr, " %4s", (r & _CTYPE_G) ? "graf" : "");
fprintf(stderr, " %4s", (r & _CTYPE_L) ? "low" : "");
fprintf(stderr, " %4s", (r & _CTYPE_P) ? "punc" : "");
fprintf(stderr, " %4s", (r & _CTYPE_S) ? "spac" : "");
fprintf(stderr, " %4s", (r & _CTYPE_U) ? "upp" : "");
fprintf(stderr, " %4s", (r & _CTYPE_X) ? "xdig" : "");
fprintf(stderr, " %4s", (r & _CTYPE_B) ? "blnk" : "");
fprintf(stderr, " %4s", (r & _CTYPE_R) ? "prnt" : "");
fprintf(stderr, " %4s", (r & _CTYPE_I) ? "ideo" : "");
fprintf(stderr, " %4s", (r & _CTYPE_T) ? "spec" : "");
fprintf(stderr, " %4s", (r & _CTYPE_Q) ? "phon" : "");
fprintf(stderr, "\n");
}
}
for (list = types.root; list; list = list->next) {
if (list->map && list->min + 3 < list->max) {
u_int32_t r = list->map;
fprintf(stderr, "%04x:%2d", list->min, r & 0xff);
fprintf(stderr, " %4s", (r & _CTYPE_A) ? "alph" : "");
fprintf(stderr, " %4s", (r & _CTYPE_C) ? "ctrl" : "");
fprintf(stderr, " %4s", (r & _CTYPE_D) ? "dig" : "");
fprintf(stderr, " %4s", (r & _CTYPE_G) ? "graf" : "");
fprintf(stderr, " %4s", (r & _CTYPE_L) ? "low" : "");
fprintf(stderr, " %4s", (r & _CTYPE_P) ? "punc" : "");
fprintf(stderr, " %4s", (r & _CTYPE_S) ? "spac" : "");
fprintf(stderr, " %4s", (r & _CTYPE_U) ? "upp" : "");
fprintf(stderr, " %4s", (r & _CTYPE_X) ? "xdig" : "");
fprintf(stderr, " %4s", (r & _CTYPE_B) ? "blnk" : "");
fprintf(stderr, " %4s", (r & _CTYPE_R) ? "prnt" : "");
fprintf(stderr, " %4s", (r & _CTYPE_I) ? "ideo" : "");
fprintf(stderr, " %4s", (r & _CTYPE_T) ? "spec" : "");
fprintf(stderr, " %4s", (r & _CTYPE_Q) ? "phon" : "");
fprintf(stderr, "\n...\n");
fprintf(stderr, "%04x:%2d", list->max, r & 0xff);
fprintf(stderr, " %4s", (r & _CTYPE_A) ? "alph" : "");
fprintf(stderr, " %4s", (r & _CTYPE_C) ? "ctrl" : "");
fprintf(stderr, " %4s", (r & _CTYPE_D) ? "dig" : "");
fprintf(stderr, " %4s", (r & _CTYPE_G) ? "graf" : "");
fprintf(stderr, " %4s", (r & _CTYPE_L) ? "low" : "");
fprintf(stderr, " %4s", (r & _CTYPE_P) ? "punc" : "");
fprintf(stderr, " %4s", (r & _CTYPE_S) ? "spac" : "");
fprintf(stderr, " %4s", (r & _CTYPE_U) ? "upp" : "");
fprintf(stderr, " %4s", (r & _CTYPE_X) ? "xdig" : "");
fprintf(stderr, " %4s", (r & _CTYPE_B) ? "blnk" : "");
fprintf(stderr, " %4s", (r & _CTYPE_R) ? "prnt" : "");
fprintf(stderr, " %4s", (r & _CTYPE_I) ? "ideo" : "");
fprintf(stderr, " %4s", (r & _CTYPE_T) ? "spec" : "");
fprintf(stderr, " %4s", (r & _CTYPE_Q) ? "phon" : "");
fprintf(stderr, " %1ld", ((unsigned)r&_CTYPE_SWM)>>_CTYPE_SWS);
fprintf(stderr, "\n");
} else
for (x = list->min; x <= list->max; ++x) {
u_int32_t r = ntohl(list->types[x - list->min]);
if (r) {
fprintf(stderr, "%04x:%2d", x, (int)(r & 0xff));
fprintf(stderr, " %4s", (r & _CTYPE_A) ? "alph" : "");
fprintf(stderr, " %4s", (r & _CTYPE_C) ? "ctrl" : "");
fprintf(stderr, " %4s", (r & _CTYPE_D) ? "dig" : "");
fprintf(stderr, " %4s", (r & _CTYPE_G) ? "graf" : "");
fprintf(stderr, " %4s", (r & _CTYPE_L) ? "low" : "");
fprintf(stderr, " %4s", (r & _CTYPE_P) ? "punc" : "");
fprintf(stderr, " %4s", (r & _CTYPE_S) ? "spac" : "");
fprintf(stderr, " %4s", (r & _CTYPE_U) ? "upp" : "");
fprintf(stderr, " %4s", (r & _CTYPE_X) ? "xdig" : "");
fprintf(stderr, " %4s", (r & _CTYPE_B) ? "blnk" : "");
fprintf(stderr, " %4s", (r & _CTYPE_R) ? "prnt" : "");
fprintf(stderr, " %4s", (r & _CTYPE_I) ? "ideo" : "");
fprintf(stderr, " %4s", (r & _CTYPE_T) ? "spec" : "");
fprintf(stderr, " %4s", (r & _CTYPE_Q) ? "phon" : "");
fprintf(stderr, " %1ld", ((unsigned)r&_CTYPE_SWM)>>_CTYPE_SWS);
fprintf(stderr, "\n");
}
}
}
}