HP Forums
Emulator program whitespace - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Emulator program whitespace (/thread-171.html)



Emulator program whitespace - Bob Frazee - 12-19-2013 09:58 PM

I encountered an anomoly with the Prime emulator that after I edited a couple of emulator programs and then edited them back to their original state, they would not run in the emulator, but would run in the physical calculator. Examining the emulator and calculator programs in the connectivity kit, showed no differences in, at least, the text in the programs.

The emulator programs showed no errors when the programs were checked. When I tried to run them, it would popup an error "unmatch control word", when it tried to call a subroutine. I experimented with it, and it appeared it was not even seeing the subroutine it was attempting to call, even though the subroutine was there.

I erased the contents of the emulator file programs in the connectivity kit, and then copied the physical calculator files directly from the calculator to the connectivity kit emulator file window. They still wouldn't run.

Reading through the Prime threads, there was a thread "Invalid Input during local variable declaring", and Han had commented about whitespace being different.

I went back to the emulator files and started checking the whitespace. I eventually found that what ever I had done in the original editing of the file, had added an extra,what appeared to be, a blank line after the END; like this:
BEGIN
Program lines...
END;
(blank line)

When I removed the "blank line", I was able to get the programs to run again in the emulator. I attempted to recreate the anomoly, but have been unable to do so, either in the emulator or physical calculator.
rcf


RE: Emulator program whitespace - Jacob Wall - 12-20-2013 04:36 AM

I have noticed this also. It appears that a check is performed to confirmed that

END;

is the very last sequence of characters in the source string. This is also consistent with what happens on the 50g when compiling a SysRPL program with the ASM command which requires a @ character to be the very last character in the source string. Even a space character after @ symbol on the 50g will result in a "Error: Invalid File" warning on the 50g.

On the Prime it seems that the program still runs (most of the times anyways) but returns an Invalid Input error upon exit!

Jacob


RE: Emulator program whitespace - cyrille de brébisson - 12-20-2013 09:32 AM

hello,

there is no check for END; to be the end of the program... you can add as many extra lines (or comments) as you want...

I imagine that a bad unicode character was there...

cyrille


RE: Emulator program whitespace - Jacob Wall - 12-22-2013 04:18 AM

Quote:there is no check for END; to be the end of the program... you can add as many extra lines (or comments) as you want...

Just tried to recreate the error again and am unable to do so, not sure what happened, will keep trying to isolate

Quote:I imagine that a bad unicode character was there...

Could have been, although not sure how that would have occurred


RE: Emulator program whitespace - Michael de Estrada - 12-22-2013 04:23 AM

You don't even need END; to be the last statement in a program. You can follow it with other statements such as declarations that are not executed, provided you end with a semi-colon.


RE: Emulator program whitespace - Han - 12-24-2013 04:24 AM

(12-20-2013 09:32 AM)cyrille de brĂ©bisson Wrote:  hello,

there is no check for END; to be the end of the program... you can add as many extra lines (or comments) as you want...

I imagine that a bad unicode character was there...

cyrille

This needs some major clarification because people have different notions of what "program" means. It is true that there is no check for END; to be the end of a source file (which, on the HP Prime, is called a "program"). The problem with calling the source file a "program" is that a source file can generate many new "commands" of the form:
Code:

EXPORT COMMAND()
BEGIN
  // code for COMMAND()
END;
and a lot of people consider these "commands" as individual programs -- especially if each is coded to perform different tasks.

On the other hand, each "command" block (what I personally would have called a "program") MUST NECESSARILY end with END; -- otherwise a syntax error will be generated.


RE: Emulator program whitespace - eried - 12-24-2013 07:01 AM

I also noticed this problem. If you forget to add 00 00 to the end of the file when making an .hpprgm, probably the device expects a null char sometimes?