issue-#36 support for long identifiers in StdInterpreter

Merged to the master branch
Post Reply
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

issue-#36 support for long identifiers in StdInterpreter

Post by Josef Templ »

This is a rather simple request from CPC 1.7 rc5.
The module StdInterpreter only supports identifiers up to 31 characters long, which
is not aligned with the CP compiler (255). In some rare situations longer
identifiers are needed as reported by Rainer Neubauer.

A proposal exists in CPC 1.7 rc5 but some changes seem to be needed.

1. The proposal uses ARRAY 64 OF CHAR. The correct solution would be to use
Kernel.Name, because this is what the CP compiler really uses and thereby
ALL valid CP identifiers are supported.

2. For scanning numbers there is no need to change the limit from 32 to 64
or something else. Numbers are not related with identifiers.
So I left this limit unchanged until somebody brings up a case where larger numbers are needed.

Please have a look at the changes in http://redmine.blackboxframework.org/pr ... 6c0b6dd519.

- Josef
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Re: issue-#36 support for long identifiers in StdInterpreter

Post by DGDanforth »

Seems reasonable.
Is there any conceivable case where longer can get one in trouble?
Zinn
Posts: 476
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main
Contact:

Re: issue-#36 support for long identifiers in StdInterpreter

Post by Zinn »

The support for long identifiers in StdInterpreter is incomplete.
We forgot to change the variable length in the procedure GetTrapMsg of module DevDebug & module StdDebug.

We should change
PROCEDURE GetTrapMsg(OUT msg: ARRAY OF CHAR);
VAR ...
head, tail, errstr: ARRAY 32 OF CHAR;
key: ARRAY 128 OF CHAR;
to
PROCEDURE GetTrapMsg(OUT msg: ARRAY OF CHAR);
VAR ...
head, tail, errstr: ARRAY 128 OF CHAR;
key: ARRAY 512 OF CHAR;

- Helmut
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#36 support for long identifiers in StdInterpreter

Post by Robert »

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

Re: issue-#36 support for long identifiers in StdInterpreter

Post by Josef Templ »

> head, tail, errstr: ARRAY 128 OF CHAR;
> key: ARRAY 512 OF CHAR;

for head, tail, and key the worst case is even worse, isn't it?

But it is hard to imagine that somebody uses such long names except
for testing the limits of the run-time system.
On the other side, errstr can be made smaller, I think.

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

Re: issue-#36 support for long identifiers in StdInterpreter

Post by Josef Templ »

For a possible fix see diffs at https://redmine.blackboxframework.org/p ... 31db1326a6.

I have tried to care for the worst case of variable 'key', but it is really bad.
About 1.5 KB needed on the stack. In exchange for that, I have removed variable modName,
but it is still a very large stack frame and not very pleasing.

Just by accident I have seen some small deviations between StdDebug and DevDebug that I have also tried to remove.

- Josef
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#36 support for long identifiers in StdInterpreter

Post by Robert »

Well, I'm confused for one. The diff above does not seem to mention either issue #36 or StdInterpreter.

Also, and this is probably the explanation, the "Forum topic" link in Redmine bug #195 is broken.
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#36 support for long identifiers in StdInterpreter

Post by Robert »

I have created topic viewtopic.php?f=40&t=742 for discussion of issue(Bug)#195.
Post Reply