ff664ec953721e6d207b09e78e2eec7b3b30b2d5
   1#!/bin/sh
   2#See http://www.unicode.org/reports/tr44/
   3#
   4#Me Enclosing_Mark  an enclosing combining mark
   5#Mn Nonspacing_Mark a nonspacing combining mark (zero advance width)
   6#Cf Format          a format control character
   7#
   8cd "$(dirname "$0")"
   9UNICODEWIDTH_H=$(git rev-parse --show-toplevel)/unicode_width.h
  10
  11if ! test -f UnicodeData.txt; then
  12        wget http://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt
  13fi &&
  14if ! test -f EastAsianWidth.txt; then
  15        wget http://www.unicode.org/Public/UCD/latest/ucd/EastAsianWidth.txt
  16fi &&
  17if ! test -d uniset; then
  18        git clone https://github.com/depp/uniset.git
  19fi &&
  20(
  21        cd uniset &&
  22        if ! test -x uniset; then
  23                autoreconf -i &&
  24                ./configure --enable-warnings=-Werror CFLAGS='-O0 -ggdb'
  25        fi &&
  26        make
  27) &&
  28UNICODE_DIR=. && export UNICODE_DIR &&
  29cat >$UNICODEWIDTH_H <<-EOF
  30static const struct interval zero_width[] = {
  31        $(uniset/uniset --32 cat:Me,Mn,Cf + U+1160..U+11FF - U+00AD |
  32          grep -v plane)
  33};
  34static const struct interval double_width[] = {
  35        $(uniset/uniset --32 eaw:F,W)
  36};
  37EOF