HP Forums
Special HP50G Program for replacing " or other signs - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: Special HP50G Program for replacing " or other signs (/thread-13941.html)



Special HP50G Program for replacing " or other signs - Gil - 11-05-2019 01:34 PM

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?

I thank you in advance for your valuable contribution.

Regards,
Gil


RE: Special HP50G Program for replacing " or other signs - BruceH - 11-06-2019 08:19 PM

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


RE: Special HP50G Program for replacing " or other signs - John Keith - 11-15-2019 11:47 PM

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.


RE: Special HP50G Program for replacing " or other signs - grsbanks - 11-16-2019 09:12 AM

(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 Smile

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.


RE: Special HP50G Program for replacing " or other signs - ramon_ea1gth - 09-02-2021 07:20 PM

INOUT: Very nice little and useful program! (I ended in this post from a previous reference from John Keith).