Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / string / mkunidata
blob7b6135f8d29f62ca628fda33dbb598b9403795eb
1 #! /bin/sh
3 echo Generating Unicode width data for newlib/libc/string/wcwidth.c
5 cd `dirname $0`
6 PATH="$PATH":. # ensure access to uniset tool
8 #############################################################################
9 # checks and (with option -u) downloads
11 case "$1" in
12 -h) echo "Usage: $0 [-h|-u|-i]"
13 echo "Generate width data tables ambiguous.t, combining.t, wide.t"
14 echo "from local Unicode files UnicodeData.txt, Blocks.txt, EastAsianWidth.txt."
15 echo ""
16 echo "Options:"
17 echo " -u download files from unicode.org first, download uniset tool"
18 echo " -i copy files from /usr/share/unicode/ucd first"
19 echo " -h show this"
20 exit
22 -u)
23 wget () {
24 ref=`basename $1`
25 ref=`ls "$ref" 2> /dev/null || echo 01-Jan-1970`
26 curl -R -O --connect-timeout 55 -z "$ref" "$1"
29 echo downloading uniset tool
30 wget https://www.cl.cam.ac.uk/~mgk25/download/uniset.tar.gz
31 gzip -dc uniset.tar.gz | tar xvf - uniset
33 echo downloading data from unicode.org
34 for data in UnicodeData.txt Blocks.txt EastAsianWidth.txt
35 do wget http://unicode.org/Public/UNIDATA/$data
36 done
38 -i)
39 echo copying data from /usr/share/unicode/ucd
40 for data in UnicodeData.txt Blocks.txt EastAsianWidth.txt
41 do cp /usr/share/unicode/ucd/$data .
42 done
44 esac
46 echo checking uniset tool
47 type uniset || exit 9
49 echo checking Unicode data files
50 for data in UnicodeData.txt Blocks.txt EastAsianWidth.txt
51 do if [ -r $data ]
52 then true
53 else echo $data not available, skipping table generation
54 exit
56 done
58 echo generating from Unicode version `sed -e 's,[^.0-9],,g' -e 1q Blocks.txt`
60 #############################################################################
61 # table generation
63 echo generating combining characters table
64 uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B +D7B0-D7C6 +D7CB-D7FB c > combining.t
66 echo generating ambiguous width characters table
67 sh ./mkwidthA && uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c > ambiguous.t
69 echo generating wide characters table
70 sh ./mkwide
72 #############################################################################
73 # end