Post Reply 
HP49-HP50: string search in many programs
01-10-2023, 03:51 PM (This post was last modified: 01-29-2023 01:01 AM by Gil.)
Post: #1
HP49-HP50: string search in many programs
A)
Supposing you are in a directory Dir
with many programs P1, P2,..., Pn.

Suppose that, for all of them, you want to check if you have the instruction/command DUP.

B)
Normal procedure:
'P1' RCL and look for DUP
'P2' RCL and look for DUP
'P3' RCL and look for DUP
'P...' RCL and look for DUP
'Pn' RCL and look for DUP.

C)
To avoid errors, here is a small program,
with 2 arguments to be entered:
- the list of the programs {P1, P2,..., Pn} to be searched
in your actual directory Dir
- the string "DUP" to be searched inside P1, P2,..., Pn.

The output:
A full list {P5, P7..., Pm} among the given programs
{P1, P2,..., Pn} where the given string "DUP" was found.

\<< "2 Arg:
- list of prog
to examine
- searched string" DROP SWAP DUP SIZE \-> str L L.s
\<< { } 1 L.s
FOR i L i GET RCL \->STR str DUP SREPL SWAP DROP 0 >
IF
THEN L i GET +
END
NEXT DUP SIZE R\->I "'" str + "' in
" + SWAP + " of " + L.s R\->I + " Prog/Var" + \->TAG
\>>
\>>

Or
« "2 Arg:
- list of prog
to examine
- searched string" DROP SWAP DUP SIZE  str L L.s
« { } 1 L.s
FOR i L i GET RCL —>STR str DUP SREPL SWAP DROP 0 >
IF
THEN L i GET +
END
NEXT DUP SIZE R—>I "'" str + "' in
" + SWAP + " of " + L.s R—>I + " Prog/Var" + TAG
»
»

D)
Save that small program, say in directory TOOLS (as it is the case for me), under name 'FIND'.

Assume that the above directory TOOLS is under directory HOME1.
Assume, further, that HOME1 directory is under main direct
HOME.

E)
Let's assign, now, the LS+F key to the above program in order to be able to use it whereever we are in a directory, say STZT.

Write then in your calculator (in bold the commands I forgot to copy in the original post, with my apologies):

\<< PATH \-> p

\<< HOME HOME1 TOOLS 'FIND' RCL p EVAL EVAL
\>>
\>>

not forgetting to finish by the following instruction:
16.2 ASN

By the way
It is s a good idea
to execute a RCLKEYS
and save, separately, the resulting list in your computer/phone (in case of EMU48 crash...).

Regards,
Gil Campart
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP49-HP50: string search in many programs - Gil - 01-10-2023 03:51 PM



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