Page 1 of 1

issue-#118 commander does not show error message

Posted: Thu Jul 21, 2016 12:06 pm
by Josef Templ
If a commander (DevCommanders.View) executes a command it does not show an error
message when the text following the commander is neither a quoted string nor a
qualified identifier.
This appears in particular when a double-quoted string is used for executing a
sequence of commands and the string is longer than 256 characters.
The limit of 256 characters should be lifted and an error message should be displayed
if a command is not well-formed.

I have prepared and tested the required changes.For the diff see http://redmine.blackboxframework.org/pr ... a399ccfe4e.

- Josef

Re: issue-#118 commander does not show error message

Posted: Thu Jul 21, 2016 8:06 pm
by Robert

Code: Select all

PROCEDURE ScanLongString(R: TextModels.Reader; VAR cmd: POINTER TO ARRAY OF CHAR; VAR beg: INTEGER);
Please use 'r' not 'R'. I am so used to the convention that VARiables start with a small letter, and TYPEs and MODULEs with a capital, that I find this hard to read.

Re: issue-#118 commander does not show error message

Posted: Fri Jul 22, 2016 7:17 am
by Josef Templ
It is a widespread convention in the BlackBox sources to use
F for a file, V for a view, W for a writer and R for a reader.
I simply followed that convention and I would prefer not to change that now.

- Josef

Re: issue-#118 commander does not show error message

Posted: Fri Jul 22, 2016 7:22 am
by Ivan Denisov
In BlackBox rd is used in most places. I agree with Robert, that we should follow general convention and start all variables with small letters.

Re: issue-#118 commander does not show error message

Posted: Fri Jul 22, 2016 7:44 am
by Josef Templ
of course you are right.
I mixed it up with the conventions in the original Oberon system,
which I happened to get in touch with recently.

R changed to r as in GetParExtend.
The diffs are here:
http://redmine.blackboxframework.org/pr ... a399ccfe4e.

- Josef

Re: issue-#118 commander does not show error message

Posted: Mon Aug 01, 2016 7:28 am
by Josef Templ
Please review the changes.

From my point of view this is ready for voting.
R has been renamed to r as suggested by Robert.

FYI: this issue fixes a nasty bug in command interpretation of commanders.
It took me hours to figure out what went wrong.
As long as the total length of a command is below 256 it worked fine.
When I added one more procedure call, so that the total length is > 256,
it did nothing. Not even an error message. So I didn't know what was going on.
Technically, there is no reason for a length limitation here. It's only because of
an inappropriate usage of a text scanner for the total command sequence.
The scanner must only be used for parts of a command.

The issue fixes both problems.
1. it avoids the length limit of 256
2. it outputs an error message if the command syntax is wrong, e.g.
because it starts with an invalid symbol.

- Josef

Re: issue-#118 commander does not show error message

Posted: Tue Aug 02, 2016 2:23 am
by DGDanforth
Small unimportant comment.
I prefer "rd" for a reader and "wr" for a writer.

Re: issue-#118 commander does not show error message

Posted: Tue Aug 02, 2016 7:06 am
by Josef Templ
r renamed to rd.
I also noticed that the parameter 'beg' of ScanLongString is not used anymore so I removed it.

For the latest diff see: http://redmine.blackboxframework.org/pr ... 7da1bc976f.

- Josef