[comp.sys.handhelds] Recursive traversal to count/find programs

robert@longs.LANCE.ColoState.Edu (Robert Thompson) (04/10/90)

Here is a coulple of programs I wrote to do traversals of my directories
and count or find programs/variables.  These are recursive programs so
watch out for out of memory problems.  Since I don't own a 48 (anyone want
to sell theirs yet :-) I don't know if this will work on one of them.

Robert Thompson
Center for Computer Assisted Engineering
Colorado State University

------ CUT HERE ------
FTRAV	[0A9C]
<< VARS DUP SIZE -> F P S
	<< 1 S FOR X 
		IFERR P X GET DUP DUP ->STR 3 DISP
			IF F SAME THEN
				ABORT
			END
			IFERR RCL DROP THEN
				EVAL F FTRAV UP
			END
		THEN
			DROP2
		END
	NEXT
	>>
>>
	
CTRAV	[4904]
<< VARS DUP SIZE -> P S
	<<0 1 S FOR X 
		IFERR P X GET DUP ->STR 3 DISP
			IFERR RCL DROP 1+ THEN
				EVAL CTRAV UP
			END
		THEN
			DROP2
		END
	NEXT
	>>
>>
	
----->	usage: 1_'name' FIND

FIND	[027E]
<< HOME CLLCD
	"Looking ..." 1 DISP FTRAV
>>

CNT	[7660]
<< DEPTH ->LIST RCLF -> S F
	<< STD HOME CLLCD
		"Counting ..." 1 DISP
		CTRAV 1 DEPTH 2 - START + NEXT
		->STR "    "				{ 4 spaces }
		+ 2 FIX MEM 1000 / ->STR +
		"K Avail." +
		3 DISP
		"Vars     Memory" 1 DISP		{ 5 spaces }
		DISP S LIST-> F STOF DROP
	>>
>>