#! /bin/sh

# generate WIDTH-W file, listing Unicode characters with width property
# Wide or Fullwidth, from EastAsianWidth.txt

table=false

if make EastAsianWidth.txt >&2
then	true
else	echo Could not acquire Unicode data file EastAsianWidth.txt >&2
	exit 1
fi

sed -e "s,^\([^;]*\);[FW],\1," -e t -e d EastAsianWidth.txt > width-w
rm -f WIDTH-W

if $table
then	echo "# UAX #11: East Asian Wide/Fullwidth" > WIDTH-W
	uniset +width-w compact >> WIDTH-W
else
	(echo "static struct interval list_wide [] = " | tr -d '\012'
	uniset +width-w c
	) > wide.t
fi

rm -f width-w
