Post Reply 
Programming Pad for RPL Programs
05-21-2014, 11:45 PM
Post: #21
RE: Programming Pad for RPL Programs
(05-21-2014 09:03 PM)Raymond Del Tondo Wrote:  Hi,

may I add my ideas related to programming aids?

All you need for structured RPL programming on a PC is a text editor which supports monospaced fonts, the HP RPL cmd line tools, Emu48, and some keyboard shortcuts;-)

There are several ways to "structure" a source text. I usually use tabs, or certain amounts of spaces for certain structures.

In this thread there are listings, partly with comments and stack diagrams.

You can see from the listings that multispaced fonts are not very suitable for text source listings.
In post #19 is a link to the ifft source in a zipped text file. This can be viewed best with monopaced fonts. Recommended editors are (in increasing flexibility): NotePad(++), UltraEdit, or my favourite: TSE Pro 32.

There are some IDEs which also help creating structured RPL code. Debug2x/Dbugx come to mind. 2x: Outdated and buggy as hell, but a step. One of the disadvantages of Debug2x was that the editor control they used always changed and reformatted my (the user's) source text without asking, which is a no-go.
I don't know if Debug4x (the extremely improved Debug2x, by Bill Graves) still has this issue,
but this was one of the reasons why I even made my few 49g projects using some custom scripts and the cmd line tools.

Thanks Ray! The pointer to your post in that thread is the sample code I have been looking for. I recalled the general format, but not when/who by/where I had seen it. Similar to the style Thomas also suggested, but I see you have the stack bottom to the left as well. Who knows, perhaps my instincts were really just partially recalling your example.

Anyhow thanks for these notes. I think I'm going to check out Debug4X as I have no current IDE or strong editor preference to drive any particular solution. If Debug4X is a fully integrated suite, I may as well learn that tool. I generally use TextPad and had given thought to creating language templates for RPL, but for SysRPL, the vocabulary is so large it's not practical.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
05-22-2014, 01:38 AM
Post: #22
RE: Programming Pad for RPL Programs
(05-21-2014 11:23 PM)rprosperi Wrote:  Thanks Thomas, interesting style. And I'm sure you're damned happy to see such excellent comments when you come back to look at this code months (even hours!) later.

In this particular case I've added the stack diagrams to analyze the program.

Quote:I think I might have had the stack reversed (left-to-right vs. your right-to-left), so that the 'bottom' level is at the left side near the current command, so you can always see the most immediate argument you are working with.

That's just the way stack-diagrams are written in FORTH.
Though I can see your point it would be tedious to reverse the stack and have it right-aligned. I think it's helpful when elements of the stack that aren't affected by a command stay at the same position.
You could write the stack-diagram on the left of your code but then you'll see the result before you see the action.
After a while you just get used to it.

Cheers
Thomas
Find all posts by this user
Quote this message in a reply
05-22-2014, 09:05 AM
Post: #23
RE: Programming Pad for RPL Programs
(05-22-2014 01:38 AM)Thomas Klemm Wrote:  Though I can see your point it would be tedious to reverse the stack and have it right-aligned.
The order of arguments and outputs in a stack diagram is a convention. All RPL related HP documents (manuals, external, internal) since the HP-28C use the right aligned order, and thus using this order simply avoids problems when reading stack diagrams from different sources.
Also all somewhat bigger projects, like RPL48, JAZZ, Java, and of course SpeedUI use the principal HP convention for stack diagrams.


(05-22-2014 01:38 AM)Thomas Klemm Wrote:  I think it's helpful when elements of the stack that aren't affected by a command stay at the same position.
But they don't stay at the same position. If a command takes four arguments and returns nothing, the elements above (or below) the 4 args are on top of the stack after the command.

-- Ray
Find all posts by this user
Quote this message in a reply
05-22-2014, 10:12 AM
Post: #24
RE: Programming Pad for RPL Programs
(05-22-2014 09:05 AM)Raymond Del Tondo Wrote:  
(05-22-2014 01:38 AM)Thomas Klemm Wrote:  Though I can see your point it would be tedious to reverse the stack and have it right-aligned.
The order of arguments and outputs in a stack diagram is a convention. All RPL related HP documents (manuals, external, internal) since the HP-28C use the right aligned order, and thus using this order simply avoids problems when reading stack diagrams from different sources.

Now I'm confused. This code snippet is from the source you mentioned:
Code:
    DUP ROT SWAP                        ( *A 2xDim B 2xDim* )
    ONE{}N                              ( *A 2xDim B 2xDim* )
    MATREDIM                            ( *A 2xDim B'* )

Do you agree that this stack diagram is left-aligned (linksbündig)?
And this stack diagram bellow is reversed and right-aligned:

Code:
    DUP ROT SWAP                        ( *2xDim B 2xDim A* )
    ONE{}N                              ( *2xDim B 2xDim A* )
    MATREDIM                                 ( *B' 2xDim A* )

This is the order that rprosperi prefers.

Quote:
(05-22-2014 01:38 AM)Thomas Klemm Wrote:  I think it's helpful when elements of the stack that aren't affected by a command stay at the same position.
But they don't stay at the same position. If a command takes four arguments and returns nothing, the elements above (or below) the 4 args are on top of the stack after the command.

Code:
                  ( a b c d e f )
2DROP             ( a b c d )
The top of the stack has moved from f to d, but the elements a, b, c and d stay at the same position.

Best regards
Thomas
Find all posts by this user
Quote this message in a reply
05-22-2014, 11:44 AM
Post: #25
RE: Programming Pad for RPL Programs
(05-22-2014 10:12 AM)Thomas Klemm Wrote:  Now I'm confused. This code snippet is from the source you mentioned:
Code:
    DUP ROT SWAP                        ( *A 2xDim B 2xDim* )
    ONE{}N                              ( *A 2xDim B 2xDim* )
    MATREDIM                            ( *A 2xDim B'* )

Do you agree that this stack diagram is left-aligned (linksbündig)?
And this stack diagram bellow is reversed and right-aligned:

Code:
    DUP ROT SWAP                        ( *2xDim B 2xDim A* )
    ONE{}N                              ( *2xDim B 2xDim A* )
    MATREDIM                                 ( *B' 2xDim A* )

This is the order that rprosperi prefers.
So maybe there was a misinterpretation on my side;-)
I set order synonymous to alignment. Actually the alignment (not the order) is _left_ in most cases.

And even in the 2nd example the comments are left-aligned, but due to the proportional font the alignments got lost.
This is why I strongly suggest using an editor/viewer with monospaced font.

Normally I use tabs to align the comments in my editor, but this doesn't work well in the MyBB editor.

Sorry for the confusion:-)

-- Ray
Find all posts by this user
Quote this message in a reply
05-22-2014, 01:14 PM
Post: #26
RE: Programming Pad for RPL Programs
In reply to the last several comments, I caused some confusion as I was not as precise as I should have been in my earlier post; sorry for that.

I prefer left-aligned stack elements containing stack bottom-to-top levels in left-to-right order. I beleive this is what Ray has been showing, and I must confess my bias is almost certainly influenced by the stuff in the HP manauls, though I frankly didn't recall they used that style.

I guess 20 years of exposure has had some impact, even if I don't recall it... And its damned odd that the same 20 years exposure to some comments from my wife had had far less effect, but I do recall those. Hmm....

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
05-22-2014, 01:30 PM
Post: #27
RE: Programming Pad for RPL Programs
Quote:manche meinen
lechts und rinks
kann man nicht
velwechsern.
werch ein illtum!
- Ernst Jandl, lichtung
Find all posts by this user
Quote this message in a reply
Post Reply 




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