From: jhmeyers@miu.edu (John H Meyers)
Subject: Library install/uninstall/backup utility
Date: 12 Oct 1996 00:00:00 GMT
Message-ID: <53o0ed$b2i@news.iastate.edu>
organization: MIU Computer Services,  Fairfield, IA 52557.  Not Approved.
reply-to: jhmeyers@miu.edu
newsgroups: comp.sys.hp48


Questions about installing and removing libraries appear frequently;
questions about backing up libraries along with user memory are also common.

There are many answers; here is yet another one!

I made a small directory named LIBRS to help with installing, uninstalling,
and backing up libraries (either along with user memory or directly from port).

Whenever I want to download a library to be installed, I read it into
this directory, press a couple of keys, and presto!  Library is installed.
(Oh, well, you still get to turn your HP48 OFF and then back ON yourself).

Library size may be nearly as large as available memory, since we observe
the correct procedure as outlined in the manual for storing it in a port.

Whenever I want to remove library nnn, I type nnn and press NGET; the
library gets detached and moved into this directory.  Function GETP does
this automatically for *all* the libraries found in the specified port;
whereas function PUTD moves them all back to the specified port again.

When the detached libraries have been moved into user memory, they *will*
subsequently be backed up by the ARCHIVE command.  You may, if you wish,
move all libraries into this directory, make a backup, and then move all
libraries back into the designated port, all with just a few keystrokes.

Of course, you probably downloaded libraries from separate files in the
first place, and you could always restore them separately, but every
now and then someone feels it to be more convenient to back them up
right along with user memory.

Libraries you have created (or hacked) yourself can also be sent
directly from the port, for backup, using our NSND function.

This little directory helps solve the problems of the memory-challenged,
who need to constantly swap libraries because there isn't enough memory
to store them all at the same time.

You can specify the port number to be used, in case you're lucky enough
to have any ports other than port 0.

This User-RPL method requires enough free space to duplicate the library
when *de-installing* it, but not when installing it or backing it up.

The rather obvious directions are contained in the program listing below.

For S/SX, if you want to use PUTD and GETP, then you'll need a
DOLIST or DOSUBS replacement; how come nobody ever published programs
which actually do exactly the same things as DOLIST and DOSUBS?
(LISP from GD#2 is NOT the same!)  Do I have to do that, too?  

Yes, that's just *one* tick mark in the string "'L" (which prefixes
library numbers with the letter "L" to make names for them).

Here's your directory, ready to snip and download with your homemade cable
(or type it, it's all User RPL):

%%HP: T(3); @ \<< and \-> and \>> represent single characters (guess which?:)
DIR @ Install and De-Install libraries from/to this directory
  PORT  0 @ port number (change as desired, by storing new value)
  LPUT  @ 'name' -> (named library object is moved to specified port)
    \<< DUP VTYPE 16 == { DUP DUP RCL SWAP PURGE PORT STO } IFT DROP \>>
  NGET  @ nnn -> (library nnn is moved from port to this directory)
    \<< DTAG PORT \->TAG DUP VTYPE 16 == {
        DUP DUP RCL NEWOB OVER { HOME DETACH } PATH + EVAL
        OVER PURGE "'L" ROT DTAG + OBJ\-> STO } IFT DROP \>>
  PUTD  @ move all libraries found in this directory to specified port
    \<< VARS 1 'LPUT' DOLIST \>>
  GETP  @ move all libraries found in port to this directory
    \<< PORT PVARS DROP IF DUP SIZE THEN 1 'NGET' DOLIST ELSE DROP END \>>
  NSND  @ nnn -> (library nnn, currently in the port, is sent)
    \<< DTAG DUP PORT \->TAG RCL SWAP "\-> L" OVER +
        " \<< 'L" + SWAP + "' SEND CLOSEIO \>>" + OBJ\-> \>>
END

-----------------------------------------------------------
With best wishes from:  John H Meyers  ( jhmeyers@mum.edu )
