Emulator program whitespace
12-19-2013, 09:58 PM
Post: #1
 Bob Frazee Member Posts: 76 Joined: Dec 2013
Emulator program whitespace
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.

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
12-20-2013, 04:36 AM
Post: #2
 Jacob Wall Member Posts: 157 Joined: Dec 2013
RE: Emulator program whitespace
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
12-20-2013, 09:32 AM
Post: #3
 cyrille de brébisson Senior Member Posts: 1,047 Joined: Dec 2013
RE: Emulator program whitespace
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
12-22-2013, 04:18 AM
Post: #4
 Jacob Wall Member Posts: 157 Joined: Dec 2013
RE: Emulator program whitespace
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
Post: #5
 Michael de Estrada Senior Member Posts: 368 Joined: Dec 2013
RE: Emulator program whitespace
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.
12-24-2013, 04:24 AM
Post: #6
 Han Senior Member Posts: 1,882 Joined: Dec 2013
RE: Emulator program whitespace
(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.

Graph 3D | QPI | SolveSys
12-24-2013, 07:01 AM
Post: #7
 eried Senior Member Posts: 744 Joined: Dec 2013
RE: Emulator program whitespace
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?

My website: erwin.ried.cl
 « Next Oldest | Next Newest »

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