HP49G+. How to erase a directory that contains lots of stuff?
#1

I have 2 HP49G+ calculators....one for use and one for "backup" (for exams). You know, just in case one of the keys breaks or something (hasn't happened after 3 years of tough use, but still...)

anyway, I periodically say all my stuff onto an SD card, and then use the SD card in HP #2 and use the RESTORE command to bring #2 up to date.

Well, now I get a message when I try to RESTORE "insufficient memory". So I just cleared a bunch of variables, then cleared some more, then cleared some more. CLUSR isn't too convenient, because I have lists of variables and folders with stuff in them (all mixed up together), and the CLUSR always stops when it comes to a full directory and says something like "I can't do that".

And NOW I have even MORE stuff on the SD card from my last ARCHIVE command. It will take even MORE manual erasing of stuff until there is enough memory on HP#2 for me to do a RESTORE command.

Is there a way to purge a Directory, even if the directory has gobs of stuff in it? I figure all I have to do is purge just one directory (Thermo or Fluids or Statics), any folder with big hunky equations will do. Then I can just do the RESTORE thing.

Any ideas?

#2

Use TVARS with your wanted var type(s) as argument, then PURGE.

HTH

Raymond

#3

Quote:
Is there a way to purge a Directory, even if the directory has
gobs of stuff in it? I figure all I have to do is purge just one
directory (Thermo or Fluids or Statics), any folder with big hunky
equations will do. Then I can just do the RESTORE thing.

Any ideas?


Of course, to do a RESTORE, you do have to have enough free memory
to put the backup object on the stack first.

As you've noted, CLUSR (synonym for CLVAR) and, for that matter,
PURGE won't purge non-empty subdirectories.

To purge non-empty subdirectories (including any "descendent"
subdirectories), you can use the PGDIR command. PGDIR, depending
on the structure of the subdirectory, can be rather slow, as it
"crawls" the branch into the lowest subdirectories, and after all
subdirectories at that level have been emptied, moves up the path
to the next higher directory and does the same thing, until it's
finished purging the target subdirectory.

Note that both PURGE and PGDIR can take either a name or a list of
names for their argument.

A program to purge everything (except the hidden subdirectory)
would be:

%%HP: T(3)A(D)F(.);
\<<
HOME @ Make home directory current.
15 TVARS @ Get the list of subdirectories.
PGDIR @ Purge the subdirectories (empty or not).
CLVAR @ Purge everything else.
\>>
But if you intend to do a RESTORE, it may be faster to clear all
memory first. RESTORE starts out by doing what amounts to a PGDIR
on the home directory, so will purge all variables (and
subdirectories).

To clear all user memory more quickly, hold down the ON key while
pressing the A and F keys, then release first the F key, and then
the A and ON keys. This gets you to the TTRM (Try To Recovery
Memory?) display. If you respond YES, then it will check for
memory corruption and recover as much as it can (which may take a
lot of time), and if you respond NO, then it will clear all user
memory.

A possible disadvantage to clearing all memory is that all modes
will be restored to their default states. For the modes that are
controlled by flags, you can have a list of flags (retrieved by
the RCLF command) included in a variable within the archive and,
after doing a RESTORE, restore the flags with the STOF command.
But some modes aren't controlled by flags, and those you'd have to
take care of yourself.

For the 49 series, the PUSH command will store the current path
and flags lists in the reserved variable ENVSTACK (in the CASDIR
subdirectory), which would be included in an archive, and the POP
command will retrieve the most recent path and flags list and
restore them.

Note that the RESTORE ends with a warmstart, which clears flag -62
(forcing USER keyboard mode off), but doesn't affect any other
mode.

Regards,
James

Edited: 15 Dec 2007, 6:56 p.m. after one or more responses were posted

#4

PS:

On the 49 series, the filer's PURGE operation will purge non-empty directories. It's like a combination of PURGE and PGDIR.

Regards,
James

#5

PPS:

Of course, for a program that purges everything (including non-empty
subdirectories) in just the current directory and any subdirectories, but
leaves parent directories in place, you could use:

%%HP: T(3)A(D)F(.);
\<<
15 TVARS @ Get the list of subdirectories.
PGDIR @ Purge the subdirectories (empty or not).
CLVAR @ Purge everything else.
\>>
For a program that takes either a global name or list of global names, and
purges subdirectories (empty or not) as well as other variable types, try the
following:
%%HP: T(3)A(D)F(.);
\<<
DUP @ Copy the argument.
IF
TYPE 6. == @ Global name?
THEN
1. \->LIST @ Put the name into a list.
END
1. OVER SIZE @ For each element of the list...
FOR n
DUP @ Copy the list.
n GET @ Get the name.
DUP @ Copy the name.
IF
VTYPE 15 == @ Subdirectory?
THEN
PGDIR @ Purge the subdirectory.
ELSE
PURGE @ Purge any other type of variable.
END
NEXT
DROP @ Discard the list.
\>>
Regards,
James
#6

Hi James,



I was inspired by your post to look up the Type command in the AUR, and the type number (15) that you use for subdirectories is not listed, and neither is 13. Where else might I find this information, and what (if anything) is type 13??

#7

Quote:
I was inspired by your post to look up the Type command in the
AUR, and the type number (15) that you use for subdirectories
is not listed, and neither is 13.

Well, to verify that a subdirectory really is type 15, I simply
put a subdirectory on the stack and used it as the argument for
the TYPE command, without bothering to look it up in any reference
material.

I probably should've written "directory object", as the home
directory and subdirectories use the same prologue and are both
user type 15, the differences being in the object bodies.

Yes, the 48gII/49g+ AUR seems to have left out types 13 and 15; I
have no idea why.

Quote:
Where else might I find this information,

The 49G AUG lists object types 0-31.

Type 31 should be "External object", not "Extended object".

The 48G series AUR lists types 0-31, but in the 48 series, 27-31
are all "External object".

Quote:
and what (if anything) is type 13??

Type 13 is a unit object.

Regards,
James

Edited: 17 Dec 2007, 12:30 p.m.



Possibly Related Threads...
Thread Author Replies Views Last Post
  Directory Structure,if any, on the Prime Harold A Climer 9 981 10-07-2013, 11:08 PM
Last Post: Helge Gabert
  More Slide Rule Stuff... . .... Thomas Chrapkiewicz 1 524 09-25-2012, 03:41 PM
Last Post: Kiyoshi Akima
  2K==A lot of place for (HP-28C) stuff Matt Agajanian 4 719 05-21-2012, 09:59 PM
Last Post: Dominic Richens
  Hard or wanted CAS stuff Oliver Unter Ecker 9 1,215 04-16-2012, 04:32 AM
Last Post: Mike (Stgt)
  New stuff Matt Agajanian 8 1,063 03-17-2012, 02:22 PM
Last Post: Ángel Martin
  Dave has posted lots of new programs in the software library Don Shepherd 1 459 03-05-2012, 04:09 PM
Last Post: Dave Britten
  Entering 34s SAM-BA bootloader without Erase button. Harald 4 717 03-04-2012, 03:03 PM
Last Post: Harald
  Interesting Book with lots of HP info Dave F 2 575 02-17-2012, 03:09 AM
Last Post: Nick_S
  What is that white stuff in the battery compartment? Kees Bouw 4 697 02-01-2012, 12:06 PM
Last Post: Ed Look
  HP 71B, lurking, thanks and other stuff Geoff Quickfall 2 483 03-23-2011, 04:30 PM
Last Post: Karl-Ludwig Butte

Forum Jump: