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
01-11-2023, 08:49 AM
Post: #2
RE: HP49-HP50: string search in many programs
I think this programme does what you want:

Code:
Size: 78.00

CkSum: # 43572d

::
  CK1&Dispatch
  BINT3
  ::
    '
    LAM O
    BINT1
    DOBIND
    DOVARS
    '
    ::
      DUPDUP
      ID>$
      BIGDISPROW3
      XEQRCL
      FPTR 4 2
      LAM O
      BINT1
      POSCHR
      #0=case
      DROP
    ;
    ONEFALSE
    ROMPTR E8 10
    ABND
  ;
;

Store the programme in HOME, enter the directory of interest, type string of interest & actuate the programme to return list of items including the given string.
Find all posts by this user
Quote this message in a reply
01-11-2023, 10:19 AM (This post was last modified: 01-11-2023 03:44 PM by Gil.)
Post: #3
RE: HP49-HP50: string search in many programs
Interesting program, Gerald, but not at all "straightforward" for me as a simple user.
More for specialists who are at ease using such command as BINT, POSCHAR, etc.

Of course, it's most compact.

Congratulations!
Find all posts by this user
Quote this message in a reply
Post Reply 




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