issue-#118 commander does not show error message

Post Reply
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

issue-#118 commander does not show error message

Post 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
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

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

Post 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.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

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

Post 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
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

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

Post 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.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

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

Post 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
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

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

Post 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
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

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

Post by DGDanforth »

Small unimportant comment.
I prefer "rd" for a reader and "wr" for a writer.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

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

Post 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
Post Reply