HP Forums
How HP48 ASCII headers are supposed to work - 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: How HP48 ASCII headers are supposed to work (/thread-22295.html)



How HP48 ASCII headers are supposed to work - vcolella - 09-06-2024 07:00 PM

I'm kinda of a noob trying to understand some UserRPL bugs in order to fix them.

The bug in question happens in a program that stores equations as strings to later retrieve them.

The header used in the original program is :
Code:
%%HP: T(3)A(R)F(.);

The bug happens when evaluating an equation with arguments in a calculator set with
Code:
F(,)

Consider this program:

Code:

%%HP: T(3)A(R)F(.);
\<<
'\.S(-1, 1, x, x)'
\>>

If I transfer it to the calculator, I get a STR\-> Error because the argument separator doesn't match the expected ";".

However, if I manually type the program in the calculator and leave it in the stack, the argument separator correctly changes when the fraction mark changes (FLG 51):

[attachment=13913]
[attachment=13915]

[attachment=13914]
[attachment=13916]

As I understand, the calculator correctly changes the argument separator for program object types but not for strings, which is how programs are transferred to the calculator.

So what I want to know is: isn't that the whole point of the header ? Shouldn't it tell the calculator how to parse the incoming program in string form ? Otherwise, what's the point of it ?

Sorry for the long post and thank you in advance to anyone who can shed a light on this.


RE: How HP48 ASCII headers are supposed to work - BruceH - 09-06-2024 11:29 PM

I'm not quite sure what you're asking.

The header is for programs transferred into the calc and the translation is made as the program is received. Typing in a program with the wrong argument separator, for example, is just a typing error as far as the calc is concerned.


RE: How HP48 ASCII headers are supposed to work - vcolella - 09-07-2024 05:00 AM

Hi Bruce,

What I'm asking is how is the header used by the calculator (if at all). I thought it was a "how to parse this program" kind of information, but from my experiments it doesn't seem to work that way.


RE: How HP48 ASCII headers are supposed to work - Joe Horn - 09-08-2024 12:26 AM

(09-07-2024 05:00 AM)vcolella Wrote:  Hi Bruce,

What I'm asking is how is the header used by the calculator (if at all). I thought it was a "how to parse this program" kind of information, but from my experiments it doesn't seem to work that way.

It is only used by the calculator if the header is at the top of an ASCII program listing in a plain-text file on a computer, AND if that file is imported into the calculator via I/O (wire or IR) in ASCII mode. That "header" should never be keyed into the calculator directly. The calculator's command line doesn't use it. I hope that made sense!


RE: How HP48 ASCII headers are supposed to work - vcolella - 09-08-2024 11:56 PM

(09-08-2024 12:26 AM)Joe Horn Wrote:  
(09-07-2024 05:00 AM)vcolella Wrote:  Hi Bruce,

What I'm asking is how is the header used by the calculator (if at all). I thought it was a "how to parse this program" kind of information, but from my experiments it doesn't seem to work that way.

It is only used by the calculator if the header is at the top of an ASCII program listing in a plain-text file on a computer, AND if that file is imported into the calculator via I/O (wire or IR) in ASCII mode. That "header" should never be keyed into the calculator directly. The calculator's command line doesn't use it. I hope that made sense!

I guess it does make sense. I'm testing my programs through HPUserEdit and now that I'm thinking, its "send" function probably just inserts the whole program in the stack as a string to then call STR\-> on it.

I'll try to transfer some programs via serial to check if there's any difference, thanks !