From helens!shelby!rutgers!usc!hacgate!tcville.HAC.COM!ferris Mon Jun 18 11:37:05 PDT 1990
Status: RO

Article 1935 of comp.sys.handhelds:
Path: helens!shelby!rutgers!usc!hacgate!tcville.HAC.COM!ferris
>From: ferris@tcville.HAC.COM
Newsgroups: comp.sys.handhelds
Subject: HP48 Directory Traversal
Message-ID: <8949@hacgate.UUCP>
Date: 18 Jun 90 05:46:38 GMT
Sender: news@hacgate.UUCP
Reply-To: ferris@tcville.HAC.COM ()
Organization: Hughes Aircraft Co., El Segundo, CA
Lines: 58


I have vastly enjoyed programming with my HP48, and have been
aided immensely by the posts from this newsgroup. To start
what I hope will be the first of many contributing posts I
hope to make, here is a brief program to traverse the directories
in your HP48.

As written, it does nothing. However, I have indicated that point
to modify to slip in the action you wish to occur at each 
directory (such as purge all system created variables, add variables
you want in each directory, accumulate a system wide listing, etc).

Also, as written, it scans all directories from the current one on
down. Comments point out where to add a HOME command to make the
program always start at the HOME directory and scan down from there.

This program calls itself recursively, so must reside in the HOME
directory, with the same that it calls itself in the code, which
is TRAVERSE. If you change the name, also change the name in the
code.

%%HP: T(3)A(D)F(.);
@ Store as 'TRAVERSE' in the HOME directory
@ BYTES returns 1: 6E96h  2: 157.5
@
@ TRAVERSE is a directory traversal program
@ It must be stored in the HOME directory as it calls itself
@ recursively while visiting all RAM directories.
@
@ Mark Ferris		ferris@tcville.HAC.COM
@ version 1.0	6/14/90
\<<
 DEPTH
  IF 0 \=/			@ if stack is not empty, assume the current
  THEN DUP RCL TYPE		@ directory list is on the stack
    IF 15 ==
@ at this point, have located a directory. It's name
@ is on level 1 of the stack.
@ Replace the HALT instruction with whatever you want to do
@ in the directory
    THEN HALT EVAL VARS OBJ\-> 1 SWAP
      FOR x TRAVERSE
      NEXT
    ELSE DROP
    END
@ Add the command HOME prior to VARS if
@ you want TRAVERSE to always traverse your entire
@ directory, otherwise it will start at the
@ current directory
  ELSE VARS OBJ\-> 1 SWAP	@ else (if stack is empty)
    FOR x TRAVERSE		@ program just started execution
    NEXT HOME			@ begin traversal at the current
  END				@ directory
\>>

Mark Ferris                         smart:    ferris@tcville.edsg.hac.com
Image and Signal Processing Lab     dumb:     ferris%tcville@hac2arpa.hac.com
Hughes Aircraft Co., EDSG           uucp:     hacgate!tcville!ferris


