strk wrote:
> You need to call the boolean_class_init(), see Boolean.h.
> That function should register the required methods.
> Note that tostring and valueof should be *inherited* by the Object
> class, so shouldn't really need to be defined unless you want
> to change the default behaviour (still, != undefined shoudl succeed
> as methods lookup should descend in the objects hierarchy).
I have the line
boolean_class_init(*this);
just beside all the other class init functions.
boolean_class_init in Boolean.cpp looks like:
void boolean_class_init(as_object& global)
{
// This is going to be the global Number "class"/"function"
static boost::intrusive_ptr<builtin_function> cl;
if ( cl == NULL )
{
cl=new builtin_function(&boolean_ctor, getBooleanInterface());
// replicate all interface to class, to be able to access
// all methods as static functions
attachBooleanInterface(*cl);
}
// Register _global.Boolean
global.set_member("Boolean", cl.get());
}
(nothing changed from template except changing attachNumberInterface to
attachBooleanInterface) and attachBooleanInterface looks like:
static void
attachBooleanInterface(as_object& o)
{
o.set_member("tostring", &boolean_tostring);
o.set_member("valueof", &boolean_valueof);
}
That's all I did, because I don't know what to do anymore. This code
compiles, but the Boolean.as test fails:
[EMAIL PROTECTED]:~/software/gnash/gnash/testsuite/actionscript.all$
../../gui/gnash -1 -r 0 -v Boolean.swf
12:04:34: Verbose output turned on
12:04:34: Base url set to:
file:///home/maiden/software/gnash/gnash/testsuite/actionscript.all/Boolean.swf
12:04:34: Movie
file:///home/maiden/software/gnash/gnash/testsuite/actionscript.all/Boolean.swf
added to library
12:04:34: [$Id: Boolean.as,v 1.8 2006/11/05 00:45:27 rsavoye Exp $]
12:04:34: SWF - Gnash-cvs-20061117
12:04:34: PASSED: boolObj [30]
12:04:34: FAILED: boolObj.tostring != undefined [33]
12:04:34: FAILED: boolObj.valueof != undefined [36]
12:04:34: XFAILED: expected: "false" obtained: [39]
12:04:34: XFAILED: expected: false obtained: [40]
12:04:34: XFAILED: expected: "true" obtained: [43]
12:04:34: XFAILED: expected: true obtained: [44]
12:04:34: XFAILED: expected: "false" obtained: [47]
12:04:34: XFAILED: expected: false obtained: [48]
... to be a bit verbose.
Why aren't the valueof and tostring methods registered?
cheers,
Michael
_______________________________________________
Gnash-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnash-dev