[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnash-dev] Implementation: Doc vs. Code

From: Michael Meier
Subject: Re: [Gnash-dev] Implementation: Doc vs. Code
Date: Sat, 18 Nov 2006 12:09:00 +0100
User-agent: Debian Thunderbird 1.0.2 (X11/20060926)

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
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

        // 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 test fails:

../../gui/gnash -1 -r 0 -v Boolean.swf
12:04:34: Verbose output turned on
12:04:34: Base url set to:
12:04:34: Movie
added to library
12:04:34: [$Id:,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?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]