Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!uunet!shelby!msi.umn.edu!noc.MR.NET!gacvx2.gac.edu!hhdist From: CW%APG.PH.UCL.AC.UK@pucc.PRINCETON.EDU Newsgroups: comp.sys.handhelds Subject: Message-ID: <35731B05C00007ED@gacvx2.gac.edu> Date: 11 Feb 91 21:51:07 GMT Lines: 144 Return-path: <@pucc.PRINCETON.EDU:CW@APG.PH.UCL.AC.UK> To: HANDHELDS@gac.edu Via: UK.AC.UCL.PH.APG; 11 FEB 91 17:32:50 GMT HP48sx****************+J.D's TOOLKIT*********************HP48sx Hi, This posting contains a few little routines, and ideas. The routines actually use Jim Donelly's toolkit. They could be written without using it but that was not my intention when I set about writing them. I have no idea how much larger they would be (or perhaps smaller) if written using standard RPL. I have no idea how many users have the toolkit but please let me know if they are useful and whether people actually will want stuff written using the tool library ( I personally am beginning to find meta-objects very useful ). Also This posting is to inspire people to do more of the same. It contains ideas and is by no means complete, and the routines may seem a little pointless. The first two routines create a variable called 'PATHS' in the current directory. 'PATHS' is a list of all the possible downwards paths from that directory. Two routines are required because the actual business is done by a recursive procedure called DOWN that searches downwards logging the paths!! DOWN looks like this..... %%HP: T(3)A(D)F(.); \<< 15 TVARS OBJ\-> @ Get the directories. IF DUP THEN @ Going downwards bit...... 1 OVER @ START @ MDT EVAL PATH MAH DOWN @ Here is where the path is 'logged' NEXT @ END @ IF DUP THEN @ Coming back up again....... 1 OVER START @ MDT MAH2 @ This saves all the paths that have been NEXT @ logged. END @ DROP UPDIR @ \>> The logic of this is rather complex but if you do 0 DOWN @ The 0 is necessary then you are left with a meta-object, containing all the possible downward paths from where you, are on the stack, plus anything else that was there beforehand (I would never use CLEAR or things that alter settings without changing them back again in a routine :-) ). The 0 is the empty meta-object that gets filled with the paths. Its quite nice to watch this routine in debug mode, it really gives the return stack a good bashing if you have a lot of directories. The only problem is that you are left one directory up from where you started (so much for my holier than thou attitude!) due to the recursive (how many times can I use that word without sounding corny?) nature of the routine. A second routine is used to keep the directory hopping in check. I call this MakePath since it makes the variable PATHS in the current directory and keeps you in the current directory. It also supplies the zero arguament and adds the path { HOME } to PATHS (a useful path to include in the list). It looks like this, %%HP: T(3)A(D)F(.); \<< PATH 0 DOWN { HOME } MAH \->LIST 'PATHS' STO \>> Thus executing MakePath leaves the variable PATHS in the current directory , and it contains all the possible downwards paths. Of what use are such things?? Well I supply a couple of routines:- GO is quite useful. If you MakePath in the home directory and nowhere else then executing GO (it doesn't matter which directory you are in) will give you a list of all the directories you have using the title browser You can then move about using the arrow keys and decide where you want to go Press ENTER and you are magically transported to that directory!! Or if you press attn it simply puts you back where you were. Try it its fun. This saves a lot of UP's and downs. GO looks like this %%HP: T(3)A(D)F(.); \<< PATHS OBJ\-> MZ2 1 OVER START MDT DUP SIZE GET MAH2 NEXT DROP \->LIST { } { 1 1 "Where to?" } TBR IF 1 == THEN PATHS SWAP GET EVAL DROP ELSE DROP2 END \>> Heres another routine. This is extremely rough and basic, but deserves a mention. I call it mem. It leaves a rundown of the memory used by each directory. To look at a lot at once I put the rundown in the small font and store it all in PICT. To use it type mem GRAPH It looks like this. %%HP: T(3)A(D)F(.); \<< ERASE PATHS OBJ\-> 1 OVER START MDT DUP DUP SIZE 1 - SPLIT EVAL OBJ\-> DROP BYTES SWAP DROP SWAP 1 SPLIT DROP \->STR DUP SIZE 3 - 3 SWAP SUB \->TAG 1 \->GROB OVER # 7d * # 1d SWAP 2 \->LIST PICT RCL SWAP ROT GOR PICT STO NEXT DROP \>> This routine is NOT well written and will probably not work if you have a lot of directories, but it can be nice. Anyway I throw these routines and ideas to the net to do with what it will. If anybody finds other uses for variables such as PATHS let us know. Experiment to your hearts content. Conard