[comp.sys.handhelds] Recursive VARS

" Warburton) (12/24/90)

Here is a program I whipped up which will hunt through the VAR directories
of your HP-48sx and will return a list containing every "name" which it finds.
Like the built-in VARS command, it returns everything which would show up in
the var menu.  Unlike the VARS command, it is not limited to the names in
the current directory.  Instead, it finds the names in ALL directories.

Since the program uses recursion to traverse the tree structure of the 
directories, it is important that it be named with the same name it uses
to "call itself".  I called it TREE, but if you have a more meaningful name
for it, be sure to change the TREE command within the program itself.

The program may not seem very useful, but it is interesting to see just how
many vars you have in your little wonder-box.  The program can be easily
modified to do some handy housekeeping tasks, such as PURGEing all of the
PPARS in all directories of the calculator. (I plan to set an alarm, so my
HP turns on at 4:00 am each morning, erases all PPARS, and then quietly turns
itself off again...)  If you don't know how to modify this program to do this,
just send me mail, and I will send you the slightly modified version.

				Mark Warburton
				Electrical Engineering
				University of Victoria, BC, Canada.

P.S.	Has anybody figured out a way to use the HP-48sx as an infra-red
	remote-controller?  I am very interested in that.

Well, here's the program:

TREE:  # 671h    178.5 bytes
-------------------------------------------------------------------------------
%%HP: T(3)A(D)F(.);	@ This program will return a list of ALL variables
\<< VARS 1		@ in your HP-48sx.  It does so by recursively
  DO GETI DUP DEPTH	@ searching each directory.  The list it returns
ROLLD			@ is in the same format as the list returned by the
    IF DUP RCL DUP	@ "VARS" command.
TYPE 15 == SWAP		@
BYTES SWAP DROP 6.5	@ Be sure to put this program in the HOME directory.
> AND
    THEN EVAL TREE	@ Change TREE to whatever you name this program.
UPDIR
    ELSE DROP
    END
  UNTIL DUP 1 ==
  END DROP DROP
  IF PATH { HOME }
==
  THEN { }
    WHILE DEPTH 1 \=/
    REPEAT SWAP +
    END
  END
\>>