04-18-2010, 06:19 PM
I've found out the line that caused the compiling error:
In fact the same calculation is used in two functions, with the same effect.
The context is:
I isolated the function and the needed DIMs into another file, to debug it. Here you are the results, in chronological order. Every try is marked "!!!ERROR" or "!!!fine and then commented out:
I don't understand what's wrong in the code. I suspect it's a compiler issue. I think it has something to do with nesting, don't you think so?
Code:
let ending = genderEnding(val(genderTypes(thing-firstPortableThing+1)))
In fact the same calculation is used in two functions, with the same effect.
The context is:
Code:
dim genderEnding(1 to 3) as string
dim genderTypes as string
let genderTypes="12333131333" ' gender type for every portable thing
let genderEnding(1)="A" ' ending for gender type 1
let genderEnding(2)="AS" ' ending for gender type 2
let genderEnding(3)="" ' ending for gender type 3 (or "O", calculated in the function)
function undefinedArticleEnding(thing as ubyte) as string
dim ending as string
let ending = genderEnding(val(genderTypes(thing-firstPortableThing+1)))
return ending
end function
I isolated the function and the needed DIMs into another file, to debug it. Here you are the results, in chronological order. Every try is marked "!!!ERROR" or "!!!fine and then commented out:
Code:
dim genderEnding(1 to 3) as string
dim genderTypes as string
let genderTypes="12333131333" ' gender type for every portable thing
let genderEnding(1)="A" ' ending for gender type 1
let genderEnding(2)="AS" ' ending for gender type 2
let genderEnding(3)="" ' ending for gender type 3 (or "O", calculated in the function)
function undefinedArticleEnding(thing as ubyte) as string
dim ending as string
' let ending = genderEnding(val(genderTypes(thing-firstPortableThing+1))) ' !!!ERROR
' let ending = genderEnding(val(genderTypes(thing-firstPortableThing))) ' !!!ERROR
' let ending = "O" ' !!!fine
' let ending = genderEnding(val(genderTypes(thing))) ' !!!ERROR
' let ending = genderEnding(1) ' !!!fine
' let ending = genderEnding(val("1")) ' !!!fine
' let ending = genderEnding(val(genderTypes(1))) ' !!!ERROR
' let ending = genderEnding(val(genderTypes(0))) ' !!!ERROR
' let ending = genderEnding(val("0")) ' !!!fine, a different error: out of range
' In parts !!ERROR
' dim gt as ubyte
' let gt = val(genderTypes(1))
' let ending = genderEnding(gt)
' In parts !!!fine
' dim gt as ubyte
' let gt = val("1")
' let ending = genderEnding(gt)
' In parts !!!fine
' dim gt as ubyte
' dim gs as string
' let gs = "1"
' let gt = val(gs)
' let ending = genderEnding(gt)
' In parts !!!fine
' dim gt as ubyte
' dim gs as string
' let gs = genderTypes(1)
' let gt = val(gs)
' let ending = genderEnding(gt)
' In parts !!!fine
dim gs as string
let gs = genderTypes(1)
let ending = genderEnding(val(gs))
return ending
end function
I don't understand what's wrong in the code. I suspect it's a compiler issue. I think it has something to do with nesting, don't you think so?
Marcos Cruz
http://programandala.net
http://programandala.net