#! /bin/sh

#############################################################################
# generate tables of characters with specific width properties from Unicode data

#############################################################################
# extend path to find mkwidthA and mkwide scripts
PATH=$PATH:.:..:../..

#############################################################################

# generate table of assigned characters
assigned () {
	echo generate table of assigned characters

	# C table of assigned characters
	uniset +0000-10FFFF clean c > u_assigned.t

	# listing of assigned BMP characters
#	uniset +0000-FFFF clean table > u_assigned.list
}

# generate table of combining characters
combining () {
	echo generate table of combining characters

	# C table of combining characters
	uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c > u_comb.t
	# 1-col C table of combining characters
#	ctab1 u_comb.t > u_comb.t1
}

# generate table of assigned combining characters
combiningassigned () {
	echo generate table of assigned combining characters

	# 1-col C table of combining characters
	uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B clean c |
	ctab1 > u_combass.t1
}

# generate table of unassigned combining characters
combiningunassigned () {
	echo generate table of unassigned combining characters

	# 1-col C table of combining characters
	uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B unknown c |
	ctab1 > u_combunk.t1
#	{ 0x11A3, 0x11A7 },
#	{ 0x11FA, 0x11FF }
}

# generate table of spacing combining characters
spacingcombining () {
	echo generate table of spacing combining characters

	# C table of spacing combining characters
	uniset +cat=Mc c > u_spaccomb.t
}

# generate table of ambiguous width characters
ambiguous () {
	echo generate table of ambiguous width characters

	# C table of ambiguous characters
	mkwidthA
	uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c > u_ambig.t
	# 1-col C table of ambiguous characters
#	ctab1 u_ambig.t > u_ambig.t1
}

# generate table of wide characters
wide () {
	echo generate table of wide characters

	# C table of wide characters (East Asian categories F and W)
	mkwide
	# 1-col C table of wide characters
#	ctab1 u_wide.t > u_wide.t1
}


#############################################################################

# generate all tables needed for width.t width properties

assigned
combining
spacingcombining

# generate ambiguous character table (currently included in width.c)
# should be checked, no update since Unicode 4.0
ambiguous

# generate other tables
#combiningassigned
#combiningunassigned

# generate wide character table (currently coded in width.c)
#wide

#############################################################################
# end
