1#! /bin/sh 2 3# Copyright (c) 2018 Thomas Wolff <towo@towo.net> 4 5echo Generating Unicode character properties data for newlib/libc/ctype 6 7cd `dirname $0` 8 9############################################################################# 10# checks and (with option -u) download 11 12case "$1" in 13-h) echo "Usage: $0 [-h|-u|-i]" 14 echo "Generate case conversion table caseconv.t and character category table categories.t" 15 echo "from local Unicode file UnicodeData.txt." 16 echo "" 17 echo "Options:" 18 echo " -u download file from unicode.org first" 19 echo " -i copy file from /usr/share/unicode/ucd first" 20 echo " -h show this" 21 exit 22 ;; 23-u) 24 wget () { 25 ref=`basename $1` 26 ref=`ls "$ref" 2> /dev/null || echo 01-Jan-1970` 27 curl -R -O --connect-timeout 55 -z "$ref" "$1" 28 } 29 30 echo downloading data from unicode.org 31 for data in UnicodeData.txt 32 do wget http://unicode.org/Public/UNIDATA/$data 33 done 34 ;; 35-i) 36 echo copying data from /usr/share/unicode/ucd 37 for data in UnicodeData.txt 38 do cp /usr/share/unicode/ucd/$data . 39 done 40 ;; 41esac 42 43echo checking Unicode data file 44for data in UnicodeData.txt 45do if [ -r $data ] 46 then true 47 else echo $data not available, skipping table generation 48 exit 49 fi 50done 51 52############################################################################# 53# table generation 54 55echo generating character category table for "isw*.c" 56 sh ./mkcategories 57 58echo generating case conversion table for "tow*.c" 59 sh ./mkcaseconv 60 61############################################################################# 62# end 63