Bug Report 2001/10/12-v1.0b26-br01


[MAIN]
[News]
[Intro]
[Features]
[Download]
[Installation]
[Support]
[Support+]
[Docu]
[Tutorial]
[Bugs]
[forum ]
[wiki]
[Mirror]
[Authors]
[Future]
[License]
[Win98 Setup Bug]
[Subscribe]
Bug Report id=2001/10/12-v1.0b26-br01
Affected versions:v1.0b26
Severity:Low

Bug Description

The program
for i = "0" to "10" step "1"
	print i
next

does not iterate through the cicle but prints 0 and stops.

Bug Reason, What Causes the Bug

The command implementing the stepping part of the loop ignores string values instead of converting it to numeric value.

Solution

The code in the file commands/while.c implementing the command named FORTO has to be changed. The lines:
  EndExpressionResult = EVALUATEEXPRESSION(PARAMETERNODE);
  ASSERTOKE;
  NEXTPARAMETER;

following the COMMAND(FORTO) declarations has to be altered to
  EndExpressionResult = EVALUATEEXPRESSION(PARAMETERNODE);
  ASSERTOKE;
  if( EndExpressionResult && TYPE(EndExpressionResult) == VTYPE_STRING ){
    if( ISSTRINGINTEGER(EndExpressionResult) )
      EndExpressionResult=CONVERT2LONG(EndExpressionResult);
    else
      EndExpressionResult=CONVERT2DOUBLE(EndExpressionResult);
    }
  NEXTPARAMETER;

The next release will deliver the corrected code.

Bug Workaround Until Solution is Available

In case you can not recompile the program from source code avoid using expressions resulting a string at the end value of a foor loop.

Acknowledgement

Mitchell Greess [m.greess@solutions-atlantic.com] has reported the bug. Thanks.

This page was generated January 28, 2010 9:58:42