The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
(50g) FNINVARS: Object finder for couch hackers
10-11-2017, 05:36 AM
Post: #1
(50g) FNINVARS: Object finder for couch hackers
SCENARIO #1: Ever write a nifty program, then try to find it in your 50g a few weeks later, but you forgot what you named it? (This happens to me all the time, and I bet it happens to all inveterate couch hackers, especially those of us with aging memories.)

SCENARIO #2: Ever want to purge a program that you don't THINK you need any more, but you're afraid that something ELSE in memory might need it? (This happens to me a lot too, resulting in VARS getting bloated with unneeded programs).

This program, FNINVARS (Find In VARS), helps in these situations. Just put any object on the stack, either by itself or in a list, and then run FNINVARS. A list will be returned containing the names of all the programs in HOME which contain that object. If FNINVARS is in a subdirectory, it will search the VARS of that subdirectory.

You can search for any object, such as a command, or a global name, or a number... anything that you remember putting in that program you're looking for. Just like a Google search, the more unique the object is, the more useful the search result will be.

While FNINVARS is running, the object it is searching for is displayed at the top of the screen, as well as a countdown as it searches through VARS. Making it run faster by rewriting it in System RPL is left as an exercise for couch hackers. ;-)

Example 1: I recently wrote a program that uses the →Q function, but I can't remember what I called it.
{→Q} FNINVARS --> list of all programs in HOME which call the →Q function.

Example 2: Can I safely purge my old 'BOOFAR' program?
'BOOFAR' FNINVARS --> list of all the programs which call 'BOOFAR'.

Note: FNINVARS does not search for specific compound objects. For example, if you input { { 1 2 3 } } as the search object, FNINVARS will return a list of all programs which contain ANY list, regardless of its contents. The same is true for any compound object.

N.B. This program uses the →S2 command from Library 256, which is built into your HP 50g but by default is not attached. If you don't keep Library 256 attached, then be sure to do 256 ATTACH before compiling this program. Once it's properly compiled and stored, it will continue to work even if Library 256 is not attached.

Code:
%%HP: T(3)A(R)F(.);
\<<
  IF DUP TYPE 5. SAME
  THEN HEAD
  END -92. CF \->S2
  WHILE "\010  " "\010" SREPL
  REPEAT
  END SREV 3. OVER SIZE SUB 1. OVER "\010"
  POS SUB SREV "\010" + "Searching for:"
  OVER + 1. DISP \-> S2
  \<< VARS 1
    \<< ENDSUB NSUB - R\->I 3. DISP
      IF DUP VTYPE 8. SAME
      THEN
        IF DUP RCL \->S2
          WHILE "\010  " "\010" SREPL
          REPEAT
          END S2 POS NOT
        THEN DROP
        END
      ELSE DROP
      END
    \>> DOSUBS
  \>>
\>>
BYTES: 305.5 #6E26h

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(50g) FNINVARS: Object finder for couch hackers - Joe Horn - 10-11-2017 05:36 AM



User(s) browsing this thread: 1 Guest(s)