# hbytes - hex-stringrep efficient byteblocks for Tcl
# Copyright 2006-2012 Ian Jackson
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this library; if not, see <http://www.gnu.org/licenses/>.


Table *hbytestoplevel TopLevel_Command
	hbytes
		dispatch(HBytes/_SubCommand, "hbytes subcommand")
	ulong
		dispatch(ULong/_SubCommand, "ulong subcommand")

Table ulong ULong_SubCommand
	ul2int
		v	ulong
		=>	int
	int2ul
		v	int
		=>	ulong
	mask
		a	ulong
		b	ulong
		=>	ulong
	add
		a	ulong
		b	ulong
		=>	ulong
	multiply
		a	ulong
		b	ulong
		=>	ulong
	subtract
		a	ulong
		b	ulong
		=>	ulong
	compare
		a	ulong
		b	ulong
		=>	int
	shift
		right	charfrom("lr", "shift direction")
		v	ulong
		bits	int
		=>	ulong
	ul2bitfields
		value	ulong
		...	obj
		=>	int
	bitfields2ul
		base	ulong
		...	obj
		=>	ulong

Table hbytes HBytes_SubCommand
	raw2h
		binary	obj
		=>	hb
	h2raw
		hex	hb
		=>	obj
	ushort2h
		value	long
		=>	hb
	h2ushort
		hex	hb
		=>	long
	length
		v	hb
		=>	int
	compare
		a	hb
		b	hb
		=>	int
	range
		v	hb
		start	int
		size	int
		=>	hb
 	prepend
 		v	hbv
 		...	str
 	append
 		v	hbv
 		...	str
	rep-info
		v	obj
		=>	obj
 	concat
 		...	str
		=>	hb
 	unprepend
 		v	hbv
 		length	int
 		=>	hb
 	unappend
 		v	hbv
 		length	int
 		=>	hb
 	chopto
 		v	hbv
 		length	int
 		=>	hb
	overwrite
		v	hbv
		start	int
		sub	hb
	trimleft
		v	hbv
	zeroes
		length	int
		=>	hb
	repeat
		v	hb
		count	int
		=>	hb
	xor
		v	hbv
		d	hb
	random
		length	int
		=>	hb
