Angelscript on Raspberry Pi
That gives me an idea of the problem. When you check if a parameter is a float or double, do you also check to make sure it is not a reference? I.e. !descr->parameterTypes[n].IsReference()?
If the argument is a reference, it should be treated as a integer as it is the address that is being passed to the function, not the float value.
I think this was my mistake, I forgot to tell you about checking for references earlier.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
The tests that are still failling are:
TestScriptString
TestRegisterType
TestVector3
TestStdString
Can you see anything in common between these tests?
The TestCompiler is also crashing - what´s more, this one even crashes the app but I have a very good idea of what´s wrong and how ti fix it.
I´ll begin by looking at the TestScriptString. It fails here:
ExecuteString(engine, "print(1.2 + \"a\")");
if( printOutput != "1.2a")
{
printf("Get '%s'\n", printOutput.c_str());
TEST_FAILED;
}
The test will call the following registered function:
static CScriptString *AddFloatString(float f, const CScriptString &str)
{
char buf[100];
sprintf(buf, "%g", f);
return new CScriptString(buf + str.buffer);
}
So it should pass the float f in s0, the string pointer str in r0, and then return the new string pointer in r0. Is this what is happening?
The function is registered with asCALL_CDECL_OBJLAST, so perhaps that may be the reason for the failure.
All of the tests that fail actually test a lot of different functionality, so I need to know on which particular test that they fail on. The best would be if you can tell me the line number where the test is reporting that it is failing. Then I can have a look at the code and try to think of what can be wrong.
Regards,
Andreas
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
string@ _string_factory_(const int, const uint8&)
Returns an object, and the calls (ICC_CDECL_OBJLAST)
string@ string::opAdd_r(double) const
This also returns an object. Then it prints:
Get '11.8998a'
Failed on line 254... (which is the last line of the code I copied in my previous post)
It would appear that armFuncObjLast is not working properly. It's setting the string pointer in the r0 register as it should, but it is not setting s0 with the float value as it should.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
It should be a double, and it should be d0. The function that will be called is the AddDoubleString() and not the AddFloatString() as I said before.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
armFuncObjLast:
stmfd sp!, {r4-r8, r10, lr}
// Magic begins....
.......
blx r4
fstmiad r10, {d0-d7} // Copy contents of registers d0-d10 to the address stored in r10
add sp, sp, r8 // sp += r8 sets sp to its original value
str sp, [r10, #68] // store final sp value - for checks only, should be taken out in finalcode
ldmfd sp!, {r4-r8, r10, pc}
This doesn´t work for the TestScriptString test. But if I change:
armFuncObjLast:
stmfd sp!, {r4-r8, r10, lr}
To this:
armFuncObjLast:
stmfd sp!, {r4-r8, r10, r11, lr}
(With the corresponding change to the epilog) then the test passes! Is this some kind of alignment problem?
Does this change break anything else? Otherwise I'd suggest you leave it like this (just put a comment so we can remember why r11 is being backed up too).
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game