# $Header: /home/cvsroot/tcldb/wisql/Tlib/deleteElem,v 1.1.1.1 1996/10/12 02:26:26 de Exp $
# tcl procs saved on Tue Sep 05 09:32:36 PDT 1995

proc deleteElem {c arrN size} {


	upvar #0 $arrN arr


#	delete one element containing c from any array
# 	as follows:  set movem when you find that one, and
#	for that one and all subsequent elems, copy the 
#	next element back into this one.  Then nuke the last one.

	set movem 0

	set al $size

	set rl [array size arr]


	set li [expr {$al - 1}]

	if {$li >= 1} {

	loop i 0 $li {

		set ac $arr($i)
		if {$ac == $c} {
#			this is the one to delete
			set movem 1
		}

		if {$movem} {
			set arr($i) $arr([expr {$i + 1}])

		}

	}
	if {$movem != 1} {
	}
	}

#	and blank out the last or only one

	set ac $arr($li)
	if {$ac == $c} {
	} else {
	}

	set arr($li) {} 

}

