[comp.sys.handhelds] directories as objects

alonzo@microsoft.UUCP (Alonzo GARIEPY) (02/09/90)

Directories are just objects.  A directory object contains all its
variables and their contents (including any subdirectories).  The
hard trick is getting it on the stack.

RCLD [6D4E]
<< DUP DEPTH -> d 
   << # 1E737h SYSEVAL DROP 
	IF DEPTH d == THEN 
	SWAP DROP
	ELSE RCL 
	END
   >>
>>

RCLD works just like RCL except that it will also RCL directories.
Directories on the stack display as  System Object.

		*	*	*

DO's

Once you have a directory on the stack, you can store it somewhere
else with STO.  This is very useful for moving entire directories
to another part of the tree.

DON'Ts

When a directory is on the stack you can also evaluate it with EVAL, 
or even PUT it into a list.  DON'T.  The problem with this is that
you will orphan the directory from the main tree.  If you ever try
to store a variable in an orphaned directory, Mr. HP28 will take a
trip to la-la land.  It is very difficult to tell whether a directory 
on the stack points to a real or orphaned directory.  I can think of 
some twisted uses for orphaned directories, but you have been warned.

		*	*	*

Let's say you have a directory tree that looks like this:

	        HOME
 	_________|_________
	|	          |
      UTILS	        PROGS
  ______|______
  |           |
GAMES       BABEL


To copy the UTILS directory into the PROGS directory.  Just type:
	'UTILS' RCLD PROGS 'UTILS' STO 
This will copy UTILS and all its variables and subdirectories.

If you want to move (as oppose to copy), you'll have to delete 
the old directories by hand or write a recursive purge program.  
The end result is looks like this:

	        HOME
	         |
               PROGS
	         |
               UTILS
           ______|______
           |           |
         GAMES       BABEL

Alonzo Gariepy
alonzo@microsoft