Post Reply 
Load HP50 program to NewRPL machine?
01-27-2020, 01:52 PM
Post: #1
Load HP50 program to NewRPL machine?
Hello community,
I have written several extensive programs in UserRPL for the 50g. I want to take advantage of the higher speed and accuracy of NewRPL. Is there a way to transfer them to the NewRPL-HP50 after some necessary modifications? It would be a "slave labour" to type this manuel one.
Greeting Klaus
Find all posts by this user
Quote this message in a reply
01-27-2020, 06:11 PM
Post: #2
RE: Load HP50 program to NewRPL machine?
(01-27-2020 01:52 PM)Klaus Wrote:  Hello community,
I have written several extensive programs in UserRPL for the 50g. I want to take advantage of the higher speed and accuracy of NewRPL. Is there a way to transfer them to the NewRPL-HP50 after some necessary modifications? It would be a "slave labour" to type this manuel one.
Greeting Klaus
It's actually quite simple:
Use your favorite text editor. The trigraph characters are not supported, newRPL is full Unicode compliant so you need to do Search/Replace on all trigraphs to replace with proper Unicode symbols (your favorite text editor must be able to save the text as UTF-8).

Using newRPL Desktop simulator, you can simply copy the text from your text editor to the clipboard and paste it into the stack. There's 2 options in the menu: Paste (which would paste the text to the stack) and Paste&Compile which would attempt to immediately compile the code.

Once you have it working, a USB cable and you can easily send it to the real calc. Or you can also save the objects to a file and put it on an SD card, but I think USB is easier.
Find all posts by this user
Quote this message in a reply
02-01-2020, 09:12 AM
Post: #3
RE: HP50-Programm auf NewRPL-Maschine laden?
(01-27-2020 06:11 PM)Claudio L. Wrote:  
(01-27-2020 01:52 PM)Klaus Wrote:  Hello community,
I have written several extensive programs in UserRPL for the 50g. I want to take advantage of the higher speed and accuracy of NewRPL. Is there a way to transfer them to the NewRPL-HP50 after some necessary modifications? It would be a "slave labour" to type this manuel one.
Greeting Klaus
It's actually quite simple:
Use your favorite text editor. The trigraph characters are not supported, newRPL is full Unicode compliant so you need to do Search/Replace on all trigraphs to replace with proper Unicode symbols (your favorite text editor must be able to save the text as UTF-8).

Using newRPL Desktop simulator, you can simply copy the text from your text editor to the clipboard and paste it into the stack. There's 2 options in the menu: Paste (which would paste the text to the stack) and Paste&Compile which would attempt to immediately compile the code.

Once you have it working, a USB cable and you can easily send it to the real calc. Or you can also save the objects to a file and put it on an SD card, but I think USB is easier.


Perfect! Works wonderfully. Great job. I look forward to further development.
Greeting Klaus
Find all posts by this user
Quote this message in a reply
03-24-2020, 12:49 PM
Post: #4
RE: Load HP50 program to NewRPL machine?
Regarding the replacement of digraphs:

Users of Sublime Text can use my custom command:
Code:

import sublime
import sublime_plugin

class NewrplCommand(sublime_plugin.TextCommand):
    def replace_region(self, edit, region):
        if not region.empty():
            string = self.view.substr(region)
            string = string.replace('<<', '«')
            string = string.replace('>>', '»')
            string = string.replace('->', '→')
            self.view.replace(edit, region, string)

    def replace_selections(self, view, edit):
        for region in self.view.sel():
            self.replace_region(edit, region)

    def replace_buffer(self, view, edit):
        region = sublime.Region(0, self.view.size())
        self.replace_region(edit, region)

    def run(self, edit):
        # check if something is selected
        count = sum(1 for _ in self.view.sel())
        if count == 0: # Should not happen
            self.replace_buffer(self.view, edit)
        elif count == 1:
            # Check if first and only element is just cursor
            region = next(iter(self.view.sel()))
            if region.empty():
                self.replace_buffer(self.view, edit)
            else:
                self.replace_selections(self.view, edit)
        else:
            self.replace_selections(self.view, edit)
This code can be stored as "newrpl.py" in The Packages/User folder.

Activation can be done with a key binding like this one:
Code:
{"keys": ["ctrl+t"], "command": "newrpl"}

The command uses the whole buffer if no selections exist, else replacement is only made in selections.
An improvement would be to only replace outside of strings when using the whole buffer.
Hope this helps someone.
Find all posts by this user
Quote this message in a reply
Post Reply 




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