From: Simone.Rapisarda@f612.n332.z2.fidonet.org (Simone Rapisarda) Newsgroups: comp.sys.hp48 Subject: HTRIM: a variables hider (!!!) Message-ID: <101871.2B5606CE@wolf.sublink.org> Date: 14 Jan 93 19:39:40 GMT Sender: ufgate@wolf.sublink.org (newsout1.26) Organization: FidoNet node 2:332/612 - WolfNet Line #1 [SD, Pisa I Lines: 113 Dear netters, I'm writing this article to present to you a program that I have written,I call it HTRIM. First of all I must say that till now I have been unable to read this newsgroup for a long time so I really don't know if a similar program has been already written. If so, I'm very sorry of bothering you. HTRIM is a sys-RPL program that I use to hide variables in the HOME directory so to keep it a clean and tidy (yes, you've read well: HOME directory, not Hidden directory!). It uses a feature that Bill Wickes, writing about it a long time ago, never called 'dangerous', so I assume that this program will work under every circumstance, but who knows? I really would like to receive a 'last word' from Mr. Wickes on this topic. The feature I'm talking about is the one that allows you to have in a directory different variables with the very same name (to do this you can use the sys-RPL command CREATE). Mr. Wickes wrote that only the first occurrence of the variable is used when you recall, eval or purge it. This is true but, as often happens,there is an exception: The Hidden dir in the HOME directory. Infact, as far as I know, it is always accessed using a special instruction (SetHiddenRes) and not by evaluating its name (the null name). So it's possible to create in the HOME directory other variables with a null name without causing problems to the operating system. This goes together with the fact that the VAR menu ends when it meets a null named variable, so does the command VARS too. Here are some notes on HTRIM: HTRIM is distributed in the hope that it will be useful; even if it has been tested (on a HP48 revision E) it makes use of undocumented features,so use it at your own risk: I take no responsibility for any damage caused by its use or misuse. HTRIM and this article are Copyright (C) 1993 by Simone A. Rapisarda. Non-commercial distribution is allowed and encouraged if this article, unchanged, accompanies the unmodified program. HTRIM has been validated on an HP48 revision E. It should work fine for HP48 revisions A through E. It may not work correctly for later HP48 revisions. HTRIM is also a command in the SmartKeys library [see SMTK.LIB on this disk. -jkh-]. You can use HTRIM in other libraries or programs only if these are Public Domain or Freeware. Anyway this should be done only with my consent and their use and origin must be reported in the documentation of the software. Here is what the SmartKeys manual says about HTRIM: +-------+ | HTRIM | (Homedir-TRIM) +-------+ Need one argument: (1:List) / (1:Real) It works only in the HOME directory. If the argument is a List HTRIM orders the variables specified in the List as the built-in command ORDER does (the smaller is the List, the smaller is the time required), the only difference is that all the remaining variables becames hidden: you can still use them as usual but they won't appear on the VAR menu and in the List created by the VARS command. To hide all the variables use an empty List. If the argument is the Real 0, HTRIM bring back to light all the hidden variables. This command is very useful to keep clean and tidy the VAR menu of the HOME directory. NOTE: HTRIM makes a complete error check and has worked well under every test I made but, as it deals with a very delicate part of the HP48 Operating System, in some particular case it can cause problems, expecially if you're not using well-written software. Finally here is the commented source code of the program. HTRIM :: @ CK1NOLASTWD @> need one argument CK&DISPATCH0 @> it can be a List or a Real FIVE @> List case :: @ CONTEXT@ @\ am I in the HOME directory? PTR 08DD4 @/ NOTcase @\ if not then exit with a PTR 11026 @/ "Directory not Allowed" error ' @\ SetHiddenRes @ > create a program (*) to enter the Hidden dir Ob>Seco @/ (done for the "not well-written software") PTR 15777 @\ DUPDUP @ > if already exists a variable with the null name @ @ | that is not the Hidden dir then purge it DROP @ | TYPERRP? @ | ITE_DROP @ | PURGE @/ CREATE @> store the program (*) in a null named variable DUPNULLCOMP? @\ if the argument is an empty list then exit: caseDROP @/ all the variables are already hidden ERRSET @\ order the variables XEQORDER @/ ERRTRAP @\ :: @ > if the order command cannot perform the PTR 15777 @ | operation and exits with an error then, PURGE @ | before exiting, purge the null named variable ERRJMP @ | ; @/ ; @ ONE @> Real case :: @ %0= @\ if it's not a 0 then exit with NcaseSIZEERR @/ a "Bad Argument Value" error PTR 15777 @> put a null Global Name on the stack SAFE@_HERE @\ NOT?SEMI @ > if a null named variable exists in the current TYPERRP? @ | directory and it does not contain a directory ?SEMI @ | object then purge it PTR 15777 @ | PURGE @/ ; @ ; @ I really would like to receive comments, suggestion and/or criticism on what I've written. I hope that my bad english has not caused problems to you. happy hiding! RAP -- WolfNet BBS Pisa (Italy) Tel. +39-50-589050 300-14.4K Baud Matrix 2:332/602.0 Simone Rapisarda - via FidoNet node 2:33/800 UUCP: ...!gear!wolf!332!612!Simone.Rapisarda ARPA: Simone.Rapisarda@f612.n332.z2.fidonet.org