blair@en.ecn.purdue.edu (Marc E Blair) (06/11/91)
Hello everyone! This program is designed so users can enjoy the added feature of hidden variables without accidently causing "Try to recover memory?" errors. Here is a description of what each program does: NORMAL - restores a directory to its natural state, i.e. no hidden variables HIDE - takes an argument from level one, a variable name or list, and hides it. ALL - returns a list of all variables, including the '' variable and others hidden behind it. HIDEN - returns a list of only hidden variables. NULL - creates '' on the stack SPACE - creates ' ' on the stack (I use it to create directories with no name - I set up my home menu to have only a no-name directory, and then use my no-name directory as my home diectory. This way I can hide "personalized commands" and other variables (like PRTPAR) since no variables may be hidden in the home directory (due to system use)) DELIT - takes a list from level 2 and an object from level one and deletes that object in the list if it exists. Used by HIDE program KEYS - redefines user keys for PURGE and CLVAR so one does not accidently delete a non-empty directory that looks empty. DISCLAIMER: I am not repsonsible for memory problems that may result from cosmic rays while you are using this program or anything else. enjoy! ----------------------------------------------------------->8 %%HP: T(3)A(D)F(.); DIR NORMAL \<< IF PATH { HOME } \=/ THEN NULL PURGE END \>> HIDE \<< IF DUP TYPE 6 == THEN 1 \->LIST END \-> L \<< VARS L SIZE 1 SWAP FOR A L A GET DELIT NEXT IF PATH { HOME } \=/ THEN 5 NULL STO NULL 1 \->LIST + ORDER ELSE DROP "NOT ALLOWED AT HOME" DOERR END \>> \>> ALL \<< VARS DUP SIZE NULL RCL \-> S A \<< NULL IFERR PURGE THEN DROP ELSE A NULL RCL IF SAME NOT THEN VARS A NULL STO SWAP IFERR ORDER THEN DROP END DUP 1 S SUB SWAP DUP SIZE S 1 + SWAP SUB NULL SWAP + + END END \>> \>> HIDEN \<< ALL DUP DUP NULL POS IF DUP 0 \=/ THEN 1 + SWAP SIZE SUB IFERR NULL RCL DROP THEN DROP { } ELSE IF PATH { HOME } \=/ THEN NULL SWAP + ELSE DROP { } END END ELSE 3 DROPN { } END \>> NULL \<< "" # 5B15h SYSEVAL \>> SPACE \<< " " # 5B15h SYSEVAL \>> DELIT \<< OVER SIZE \-> S \<< DUP2 POS \-> A \<< IF A 0 \=/ THEN IF S 1 == THEN DROP2 { } ELSE IF A 1 == THEN SWAP 2 S SUB SWAP DROP ELSE IF A S == THEN SWAP 1 S 1 - SUB SWAP DROP ELSE SWAP DUP 1 A 1 - SUB SWAP A 1 + S SUB + SWAP DROP END END END ELSE DROP END \>> \>> \>> KEYSTO \<< { S \<< IFERR { } SWAP DUP IF TYPE 5 == THEN DUP SIZE ELSE 1 \->LIST 1 END 1 SWAP FOR A DUP A GET RCL IF TYPE 15 == THEN IF DUP A GET RCL BYTES SWAP DROP 6.5 == THEN 1 ELSE 0 END ELSE 1 END IF THEN DUP A GET PURGE ELSE DUP A GET ROT SWAP + SWAP END NEXT DROP IF DUP { } \=/ THEN \->STR " Non-empty directory" + DOERR ELSE DROP END THEN IF { } == THEN "Too Few Arguements" ELSE DROP2 "Not Purgable" END DOERR END \>> 54.2 \<< IF PATH { HOME } \=/ THEN "" # 5B15h SYSEVAL PURGE END VARS "HIT PURGE" 1 DISP 1 FREEZE \>> 54.3 } STOKEYS \>> END --------------8<---------- Marc Blair blair@en.ecn.purdue.edu "The HP48: But, can it cook?"
blair@en.ecn.purdue.edu (Marc E Blair) (06/12/91)
It seems you can't find all the bugs in a program until after you post it! It turns out that the null variable must contain something different for each directory in order for the program to work properly. So I just changed 5 NULL STO to PATH NULL STO. Here is the correct 'HIDE' program, and sorry for the inconvenience. -------------------->8 %%HP: T(3)A(D)F(.); \<< IF DUP TYPE 6 == THEN 1 \->LIST END \-> L \<< VARS L SIZE 1 SWAP FOR A L A GET DELIT NEXT IF PATH { HOME } \=/ THEN PATH NULL STO NULL 1 \->LIST + ORDER ELSE DROP "NOT ALLOWED AT HOME" DOERR END \>> \>> --------------------->8 blair@en.ecn.purdue.edu