Post Reply 
Emulator program whitespace
12-19-2013, 09:58 PM
Post: #1
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.

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
Find all posts by this user
Quote this message in a reply
12-20-2013, 04:36 AM
Post: #2
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
Visit this user's website Find all posts by this user
Quote this message in a reply
12-20-2013, 09:32 AM
Post: #3
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
Find all posts by this user
Quote this message in a reply
12-22-2013, 04:18 AM
Post: #4
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
Visit this user's website Find all posts by this user
Quote this message in a reply
12-22-2013, 04:23 AM (This post was last modified: 12-22-2013 04:24 AM by Michael de Estrada.)
Post: #5
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.
Find all posts by this user
Quote this message in a reply
12-24-2013, 04:24 AM
Post: #6
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
Find all posts by this user
Quote this message in a reply
12-24-2013, 07:01 AM
Post: #7
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: ried.cl
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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