#!/bin/bash
# list the assigned names (and ranges) in my unicode blocks file,
# to compare to what is in the official Unicode Blocks.txt
#
# Copyright © 2016 Ken Moffat

# the blocks should be in the current directory
SCRIPTS=${0%/*}

# number of this block
BLOCK=0
# number of last block in current table - should get overwritten by the table
MAXBLOCK=249

if ! [ -r ${SCRIPTS}/unicode-blocks ]; then
	echo "cannot read ${SCRIPTS}/unicode-blocks, oh dear"
	error
fi
. ${SCRIPTS}/unicode-blocks

while [ $BLOCK -le $MAXBLOCK ]; do
	NAME="${blocknames[$BLOCK]}"
	echo $NAME | grep -q nassigned
	if [ $? -ne 0 ]; then
		NUMS=$(echo $NAME | sed 's/.*U+\(.*\)/\1/')
		TEXT=$(echo $NAME | cut -d ',' -f 1)
		RANGE=$(echo $NUMS | sed 's/-/../')
		echo $RANGE ": " $TEXT
	fi
	let BLOCK=$BLOCK+1
done

