Special HP50G Program for replacing " or other signs
11-05-2019, 01:34 PM
Post: #1
 Gil Member Posts: 170 Joined: Oct 2019
Special HP50G Program for replacing " or other signs
I use Android Emu 48,a great application.

I have the following HP50G program
« 100 "abc" 200 "->def"» 'P1' STO.

I want to see, in a doc like Word, the full steps of P1.
For that, I have to copy the content of P1 to (Word) doc.

Normally easily done if it were
« 100 200 » : I would change the prog into a string
"100 200" and use the Copy-to-stack of Emu48 and then Paste (Contr+V) in the (Word) doc.

With « 100 "abc" 200 "», however, the inner strings of P1 does not help and allow it ss it is.

1) First, I have to put P1 in the stack.
2) Edit it
3) Use the REPLACE command of Edit.
4) And replace all the " characters by, for example, $, to get « 100$abc$200$->def$». 5) Then I can convert this new program into the required string "« 100$abc$200$->def$»" to use the copy-stack command of Emu48 and copy the above string in my (Word) doc. I want a first program P.Prog->String of the kind « EDIT... search for sign " and replace by... search for sign - > and replace by... search for all special signs not taken into account during the transfer and replace them by... » (working as follows: « 100 "abc" 200 "->def"» ENTER P.Pring->String EVAL or ENTER « 100$abc$200$#def$») and a 2nd one, P. String->Prog. Bck, to convert back "« 100$abc$200$#def\$»" into
« 100 "abc" 200 "->def"».

Ideally, both programs should convert all the strange characters in one execution ; and better : use the prog once for all the variables in a directory.

Could somebody help me?

Regards,
Gil
11-06-2019, 08:19 PM
Post: #2
 BruceH Senior Member Posts: 354 Joined: Dec 2013
RE: Special HP50G Program for replacing " or other signs
Use these two programs originally by John H. Meyers.

'IN'
Code:
@ 7-bit ascii string -> calc object \<< \->STR 3 TRANSIO RCLF SIZE 3 > #2F34Dh #3016Bh IFTE SYSEVAL + STR\-> \>>

'OUT'
Code:
@ Calc object -> 7-bit ascii string \<< STD 64 STWS \->STR 3 TRANSIO RCLF SIZE 3 > #2F34Fh #2FEC9h IFTE SYSEVAL \>>

Usage: Put the object you want to export onto the stack and run OUT. This converts it to a fully-escaped string that you can cut and paste into a file on your PC. The program IN does the reverse: paste the converted string into the stack, run IN and it is converted back to an RPL object
11-15-2019, 11:47 PM
Post: #3
 John Keith Senior Member Posts: 704 Joined: Dec 2013
RE: Special HP50G Program for replacing " or other signs
Thanks, Bruce! I had tried versions of those programs from one of John H. Meyers' posts but they didn't work on the HP 50. The ones you posted here work fine.
11-16-2019, 09:12 AM
Post: #4
 grsbanks Senior Member Posts: 1,219 Joined: Jan 2017
RE: Special HP50G Program for replacing " or other signs
(11-06-2019 08:19 PM)BruceH Wrote:  Use these two programs originally by John H. Meyers.

I like the way this detects whether it's being used on a 48 or a 49/50 with the size of the list sent back by RCLF

If you squish the two programs together and preserve the flags and word size you get something like this:

'INOUT'
Code:
\<< RCWS RCLF \-> ws f   \<< 3 TRANSIO DUP TYPE 2 IF == THEN     \->STR f SIZE 3 > #2F34Dh #3016Bh IFTE SYSEVAL + STR\->     ELSE     STD 64 STWS \->STR f SIZE 3 > #2F34Fh #2FEC9h IFTE SYSEVAL     END     ws STWS f STOF   \>> \>>

Place the object to convert on level 1 of the stack and run 'INOUT'. If the object was a string then it'll convert it to an RPL object. If not, then it'll convert it to a string.

There are only 10 types of people in this world. Those who understand binary and those who don't.
09-02-2021, 07:20 PM
Post: #5
 ramon_ea1gth Member Posts: 50 Joined: Mar 2020
RE: Special HP50G Program for replacing " or other signs
INOUT: Very nice little and useful program! (I ended in this post from a previous reference from John Keith).

Ramón