gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11565: Remove some ugly interfaces.


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11565: Remove some ugly interfaces.
Date: Thu, 15 Oct 2009 18:14:46 +0200
User-agent: Bazaar (1.16.1)

------------------------------------------------------------
revno: 11565 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2009-10-15 18:14:46 +0200
message:
  Remove some ugly interfaces.
modified:
  libcore/as_function.cpp
  libcore/as_function.h
  libcore/asobj/Globals.cpp
  libcore/builtin_function.h
  libcore/swf_function.cpp
=== modified file 'libcore/as_function.cpp'
--- a/libcore/as_function.cpp   2009-10-14 18:45:06 +0000
+++ b/libcore/as_function.cpp   2009-10-15 14:40:38 +0000
@@ -61,22 +61,6 @@
 // the Function class itself, which would be a member
 // of the _global object for each movie instance.
 
-as_function::as_function(Global_as& gl, as_object* iface)
-       :
-       as_object(gl)
-{
-       int flags = PropFlags::dontDelete |
-                   PropFlags::dontEnum |
-                   PropFlags::onlySWF6Up;
-
-    init_member(NSV::PROP_uuPROTOuu, as_value(getFunctionPrototype()), flags);
-
-       if (iface) {
-               iface->init_member(NSV::PROP_CONSTRUCTOR, this); 
-               init_member(NSV::PROP_PROTOTYPE, as_value(iface));
-       }
-}
-
 as_function::as_function(Global_as& gl)
        :
        as_object(gl)

=== modified file 'libcore/as_function.h'
--- a/libcore/as_function.h     2009-08-20 06:55:15 +0000
+++ b/libcore/as_function.h     2009-10-15 14:40:38 +0000
@@ -126,17 +126,6 @@
        ///
        as_function(Global_as& gl);
 
-       /// Construct a function with given interface (possibly none)
-       //
-       /// @param iface
-       ///     The interface exported by this class (its 'prototype' member).
-       ///     If NULL, no prototype will be set (this is used for some
-       ///     corner cases like TextField in SWF5 or below).
-       ///     If not NULL, a 'constructor' member will be added to the
-       ///     prototype, pointing to 'this'.
-       ///
-       as_function(Global_as& gl, as_object* iface);
-
 #ifdef GNASH_USE_GC
        /// Mark prototype (properties) as being reachable and invoke
        /// the as_object class marker.

=== modified file 'libcore/asobj/Globals.cpp'
--- a/libcore/asobj/Globals.cpp 2009-10-15 08:59:26 +0000
+++ b/libcore/asobj/Globals.cpp 2009-10-15 14:40:38 +0000
@@ -206,7 +206,11 @@
 AVM1Global::createFunction(Global_as::ASFunction function)
 {
     as_object* proto = createObject();
-    builtin_function* f = new builtin_function(*this, function, proto);
+    builtin_function* f = new builtin_function(*this, function);
+    
+    proto->init_member(NSV::PROP_CONSTRUCTOR, f); 
+    
+    f->init_member(NSV::PROP_PROTOTYPE, proto);
     f->init_member(NSV::PROP_CONSTRUCTOR,
             as_function::getFunctionConstructor());
     return f;
@@ -215,7 +219,12 @@
 as_object*
 AVM1Global::createClass(Global_as::ASFunction ctor, as_object* prototype)
 {
-    as_object* cl = new builtin_function(*this, ctor, prototype);
+    as_object* cl = new builtin_function(*this, ctor);
+    
+    if (prototype) {
+        prototype->init_member(NSV::PROP_CONSTRUCTOR, cl); 
+        cl->init_member(NSV::PROP_PROTOTYPE, prototype);
+    }
     cl->init_member(NSV::PROP_CONSTRUCTOR,
             as_function::getFunctionConstructor());
     return cl;
@@ -277,8 +286,12 @@
 AVM2Global::createClass(Global_as::ASFunction ctor, as_object* prototype)
 {
     // TODO: this should attach the function to the prototype as its
-    // constructor member.
-    as_object* cl = new builtin_function(*this, ctor, prototype);
+    as_object* cl = new builtin_function(*this, ctor);
+    
+    if (prototype) {
+        prototype->init_member(NSV::PROP_CONSTRUCTOR, cl); 
+        cl->init_member(NSV::PROP_PROTOTYPE, prototype);
+    }
     cl->init_member(NSV::PROP_CONSTRUCTOR,
             as_function::getFunctionConstructor());
     return cl;

=== modified file 'libcore/builtin_function.h'
--- a/libcore/builtin_function.h        2009-08-18 08:00:20 +0000
+++ b/libcore/builtin_function.h        2009-10-15 14:40:38 +0000
@@ -58,27 +58,6 @@
        {
        }
 
-       /// Construct a builtin function with the given interface (possibly 
none)
-       //
-       /// @param func
-       ///     The C function to call when this as_function is invoked.
-       ///     For classes, the function pointer is the constructor.
-       ///
-       /// @param iface
-       ///     The interface of this class (will be inherited by
-       ///     instances of this class)
-       ///     If the given interface is NULL no interface will be
-       ///     provided. Use the constructor taking a single argument
-       ///         to get a default interface instead.
-    /// @param useThisAsCtor
-    ///     Used only by getFunctionConstructor().
-       builtin_function(Global_as& gl, ASFunction func, as_object* iface)
-               :
-               as_function(gl, iface),
-               _func(func)
-       {
-       }
-
        /// Invoke this function or this Class constructor
        virtual as_value operator()(const fn_call& fn)
        {

=== modified file 'libcore/swf_function.cpp'
--- a/libcore/swf_function.cpp  2009-10-15 09:00:54 +0000
+++ b/libcore/swf_function.cpp  2009-10-15 14:40:38 +0000
@@ -59,7 +59,7 @@
 swf_function::swf_function(const action_buffer& ab, as_environment& env,
                        size_t start, const ScopeStack& scopeStack)
        :
-       as_function(*getGlobal(env), getGlobal(env)->createObject()),
+       as_function(*getGlobal(env)),
        m_action_buffer(ab),
        m_env(env),
        _scopeStack(scopeStack),
@@ -71,6 +71,10 @@
 {
        assert( m_start_pc < m_action_buffer.size() );
 
+    // We're stuck initializing our own prototype at the moment.
+    as_object* proto = getGlobal(env)->createObject();
+    proto->init_member(NSV::PROP_CONSTRUCTOR, this); 
+    init_member(NSV::PROP_PROTOTYPE, proto);
        init_member(NSV::PROP_CONSTRUCTOR, 
as_function::getFunctionConstructor());
 }
 


reply via email to

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