gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11600: Update extensions to conform


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11600: Update extensions to conform to Gnash's more correct design.
Date: Thu, 05 Nov 2009 12:01:04 +0100
User-agent: Bazaar (1.16.1)

------------------------------------------------------------
revno: 11600 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2009-11-05 12:01:04 +0100
message:
  Update extensions to conform to Gnash's more correct design.
  
  Drop metome extension; it wasn't loaded due to incorrect naming,
  did nothing anyway, and is trivial to re-add if necessary.
  
  Extensions that are never built (launcher, gtk2) are still not updated.
  
  Extensions now use Relays instead of subclasses. This should make no
  difference to existing code, but makes it possible to implement derived
  classes in ActionScript.
  
  Functions are no longer attached to the class. This means they cannot
  be used as static members. This was theoretically possible before, but
  most such usage was rejected in the functions themselves.
removed:
  extensions/metome/
  extensions/metome/Makefile.am
  extensions/metome/metome_ext.cpp
  extensions/metome/metome_ext.h
modified:
  configure.ac
  extensions/Makefile.am
  extensions/dbus/dbus_ext.cpp
  extensions/dbus/dbus_ext.h
  extensions/dejagnu/dejagnu.cpp
  extensions/dejagnu/dejagnu.h
  extensions/fileio/fileio.cpp
  extensions/fileio/fileio.h
  extensions/lirc/lirc_ext.cpp
  extensions/lirc/lirc_ext.h
  extensions/mysql/mysql_db.cpp
  extensions/mysql/mysql_db.h
  libbase/extension.cpp
  libbase/sharedlib.cpp
  libbase/sharedlib.h
  libcore/asobj/Array_as.h
=== modified file 'configure.ac'
--- a/configure.ac      2009-11-01 13:39:25 +0000
+++ b/configure.ac      2009-11-05 09:17:32 +0000
@@ -802,7 +802,6 @@
 ext_gtk=no
 ext_lirc=no
 ext_dbus=no
-ext_metome=no
 ext_all=no
 ext_launcher=no
 AC_ARG_ENABLE(extensions,
@@ -859,11 +858,6 @@
         ext_dbus=yes
         nextensions=$((nextensions+1))
         ;;
-      metome|METOME)
-        AC_DEFINE(USE_METOME_EXT, [1], [Build the METOME extension])
-        ext_metome=yes
-        nextensions=$((nextensions+1))
-        ;;
       all|ALL)
         AC_DEFINE(USE_GTK_EXT, [1], [Build all the extensions])
         ext_dejagnu=yes
@@ -872,7 +866,6 @@
         ext_gtk=yes
         ext_lirc=yes
         ext_dbus=yes
-        ext_metome=yes
         ext_launcher=yes
         ext_all=yes
         nextensions=9
@@ -896,7 +889,6 @@
 AM_CONDITIONAL(BUILD_GTK_EXT, [ test x$ext_gtk = xyes ])
 AM_CONDITIONAL(BUILD_LIRC_EXT, [ test x$ext_lirc = xyes ])
 AM_CONDITIONAL(BUILD_DBUS_EXT, [ test x$ext_dbus = xyes ])
-AM_CONDITIONAL(BUILD_METOME_EXT, [ test x$ext_metome = xyes ])
 AM_CONDITIONAL(BUILD_EXTENSIONS, [ test -n "$extensions_list"])
 
 AC_MSG_CHECKING([For the version of libtool])
@@ -2406,7 +2398,6 @@
 extensions/gtk2/Makefile
 extensions/lirc/Makefile
 extensions/dbus/Makefile
-extensions/metome/Makefile
 plugin/Makefile
 plugin/xpcom/Makefile
 plugin/klash/Makefile

=== modified file 'extensions/Makefile.am'
--- a/extensions/Makefile.am    2009-02-25 22:30:19 +0000
+++ b/extensions/Makefile.am    2009-11-05 09:15:55 +0000
@@ -41,14 +41,10 @@
 OTHER_DIRS += dbus
 endif
 
-if BUILD_METOME_EXT
-OTHER_DIRS += metome
-endif
-
 if BUILD_GTK_EXT
 if BUILD_GTK_GUI
 OTHER_DIRS += # gtk2
 endif
 endif
-DIST_SUBDIRS = dejagnu fileio mysql gtk2 lirc dbus metome
+DIST_SUBDIRS = dejagnu fileio mysql gtk2 lirc dbus 
 SUBDIRS = $(OTHER_DIRS)

=== modified file 'extensions/dbus/dbus_ext.cpp'
--- a/extensions/dbus/dbus_ext.cpp      2009-09-09 20:27:25 +0000
+++ b/extensions/dbus/dbus_ext.cpp      2009-11-05 08:40:39 +0000
@@ -41,8 +41,17 @@
 
 as_value dbus_ext_setsockname(const fn_call& fn);
 
+class Dbus : public Relay
+{
+public:
+    Dbus();
+    ~Dbus();
+    void setSocketName(const char *sock);
+private:
+    std::string _name;
+};
+
 Dbus::Dbus() 
-    : _name(0)
 {
     GNASH_REPORT_FUNCTION;
 }
@@ -60,81 +69,50 @@
     _name = sock;
 }
 
-class dbus_as_object : public as_object
-{
-public:
-    Dbus obj;
-};
-
 static void
-attachInterface(as_object *obj)
-{
-    GNASH_REPORT_FUNCTION;
-    Global_as* gl = getGlobal(*obj);
-    obj->init_member("setSocketName", 
gl->createFunction(dbus_ext_setsockname));
-}
-
-static as_object*
-getInterface()
-{
-    GNASH_REPORT_FUNCTION;
-    static boost::intrusive_ptr<as_object> o;
-    if (o == NULL) {
-       o = new as_object();
-    }
-    return o.get();
+attachInterface(as_object& obj)
+{
+    GNASH_REPORT_FUNCTION;
+    Global_as& gl = getGlobal(obj);
+    obj.init_member("setSocketName", gl.createFunction(dbus_ext_setsockname));
 }
 
 static as_value
-dbus_ctor(const fn_call& /* fn */)
+dbus_ctor(const fn_call& fn)
 {
-    GNASH_REPORT_FUNCTION;
-    dbus_as_object* obj = new dbus_as_object();
+    as_object* obj = ensure<ValidThis>(fn);
+    obj->setRelay(new Dbus());
 
-    attachInterface(obj);
-    return as_value(obj); // will keep alive
-//    printf ("Hello World from %s !!!\n", __PRETTY_FUNCTION__);
+    return as_value(); 
 }
 
 as_value
 dbus_ext_setsockname(const fn_call& fn)
 {
     GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<dbus_as_object> ptr = 
ensureType<dbus_as_object>(fn.this_ptr);
+    Dbus* ptr = ensure<ThisIsNative<Dbus> >(fn);
     
     if (fn.nargs > 0) {
-       string text = fn.arg(0).to_string();
-       ptr->obj.setSocketName(text.c_str());
-       return as_value(true);
+        const std::string& text = fn.arg(0).to_string();
+        ptr->setSocketName(text.c_str());
+        return as_value(true);
     }
     return as_value(false);
 }
 
-std::auto_ptr<as_object>
-init_dbus_instance()
-{
-    return std::auto_ptr<as_object>(new dbus_as_object());
-}
-
 // const char *dbus_setmode(struct dbus_config *config, const char *mode);
 extern "C" {
-    void
-    dbus_class_init(as_object &obj)
-    {
-//     GNASH_REPORT_FUNCTION;
-       // This is going to be the global "class"/"function"
-       as_object *cl;
-       if (cl == NULL) {
-        Global_as* gl = getGlobal(obj);
-        as_object* proto = getInterface();
-        cl = gl->createClass(&dbus_ctor, proto);
-//         // replicate all interface to class, to be able to access
-//         // all methods as static functions
-           attachInterface(cl);
-       }
+
+void
+dbus_class_init(as_object &obj)
+{
+    Global_as& gl = getGlobal(obj);
+    as_object* proto = gl.createObject();
+    attachInterface(*proto);
+    as_object* cl = gl.createClass(&dbus_ctor, proto);
        
        obj.init_member("Dbus", cl);
-    }
+}
 } // end of extern C
 
 

=== modified file 'extensions/dbus/dbus_ext.h'
--- a/extensions/dbus/dbus_ext.h        2008-06-09 19:53:46 +0000
+++ b/extensions/dbus/dbus_ext.h        2009-11-05 08:40:39 +0000
@@ -15,38 +15,26 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-#ifndef __DBUS_PLUGIN_H__
-#define __DBUS_PLUGIN_H__
+#ifndef GNASH_DBUS_PLUGIN_H
+#define GNASH_DBUS_PLUGIN_H
 
 #ifdef HAVE_CONFIG_H
 #include "gnashconfig.h"
 #endif
 
-#include <memory> // for auto_ptr
 #include "as_object.h"
 
 namespace gnash
 {
 
-class Dbus {
-public:
-    Dbus();
-    ~Dbus();
-    void setSocketName(const char *sock);
-private:
-    const char *_name;
-};
-
 extern "C" {
-    void dbus_class_init(as_object &obj);  
-    /// Return an  instance
+
+void dbus_class_init(as_object &obj);  
+
 }
 
-std::auto_ptr<as_object> init_dbus_instance();
-
 } // end of gnash namespace
 
-// __DBUS_PLUGIN_H__
 #endif
 
 // Local Variables:

=== modified file 'extensions/dejagnu/dejagnu.cpp'
--- a/extensions/dejagnu/dejagnu.cpp    2009-09-09 20:27:25 +0000
+++ b/extensions/dejagnu/dejagnu.cpp    2009-11-05 08:14:09 +0000
@@ -38,43 +38,39 @@
 as_value dejagnu_fail(const fn_call& fn);
 as_value dejagnu_totals(const fn_call& fn);
 
-class dejagnu_as_object : public as_object
+class DejaGnu : public Relay
 {
 public:
-    DejaGnu obj;
+    DejaGnu();
+    ~DejaGnu();
+    const char *pass (const char *msg);
+    const char *fail (const char *msg);
+    const char *xpass (const char *msg);
+    const char *xfail (const char *msg);
+    void totals ();
+private:
+    int passed;
+    int failed;
+    int xpassed;
+    int xfailed;
 };
 
 static void
-attachInterface(as_object *obj)
+attachInterface(as_object& obj)
 {
-//    GNASH_REPORT_FUNCTION;
-    Global_as* gl = getGlobal(*obj);
+    Global_as& gl = getGlobal(obj);
     
-    obj->init_member("pass", gl->createFunction(dejagnu_pass));
-    obj->init_member("fail", gl->createFunction(dejagnu_fail));
-    obj->init_member("totals", gl->createFunction(dejagnu_totals));
-}
-
-static as_object*
-getInterface()
-{
-//    GNASH_REPORT_FUNCTION;
-    static boost::intrusive_ptr<as_object> o;
-    if (o == NULL) {
-       o = new as_object();
-    }
-    return o.get();
+    obj.init_member("pass", gl.createFunction(dejagnu_pass));
+    obj.init_member("fail", gl.createFunction(dejagnu_fail));
+    obj.init_member("totals", gl.createFunction(dejagnu_totals));
 }
 
 static as_value
-dejagnu_ctor(const fn_call& /* fn */)
+dejagnu_ctor(const fn_call& fn)
 {
-//    GNASH_REPORT_FUNCTION;
-    dejagnu_as_object* obj = new dejagnu_as_object();
-
-    attachInterface(obj);
-    return as_value(obj); // will keep alive
-//    printf ("Hello World from %s !!!\n", __PRETTY_FUNCTION__);
+    as_object* obj = ensure<ValidThis>(fn);
+    obj->setRelay(new DejaGnu());
+    return as_value(); 
 }
 
 
@@ -92,8 +88,6 @@
 const char *
 DejaGnu::pass (const char *msg)
 {
-//    GNASH_REPORT_FUNCTION;
-
     passed++;
     log_debug("PASSED: %s\n", msg);
     return NULL;
@@ -102,8 +96,6 @@
 const char *
 DejaGnu::fail (const char *msg)
 {
-//    GNASH_REPORT_FUNCTION;
-
     failed++;
     log_debug("FAILED: %s\n", msg);
     return NULL;
@@ -113,11 +105,11 @@
 dejagnu_pass(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<dejagnu_as_object> ptr = 
ensureType<dejagnu_as_object>(fn.this_ptr);
+    DejaGnu* ptr = ensure<ThisIsNative<DejaGnu> >(fn);
     
     if (fn.nargs > 0) {
        string text = fn.arg(0).to_string();
-       return as_value(ptr->obj.pass(text.c_str()));
+       return as_value(ptr->pass(text.c_str()));
     }
 
     return as_value();
@@ -127,11 +119,11 @@
 dejagnu_fail(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<dejagnu_as_object> ptr = 
ensureType<dejagnu_as_object>(fn.this_ptr);
+    DejaGnu* ptr = ensure<ThisIsNative<DejaGnu> >(fn);
     
     if (fn.nargs > 0) {
-       string text = fn.arg(0).to_string();
-       return as_value(ptr->obj.fail(text.c_str()));
+        string text = fn.arg(0).to_string();
+        return as_value(ptr->fail(text.c_str()));
     }
 
     return as_value();
@@ -140,38 +132,25 @@
 as_value
 dejagnu_totals(const fn_call& fn)
 {
-//    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<dejagnu_as_object> ptr = 
ensureType<dejagnu_as_object>(fn.this_ptr);
+    DejaGnu* ptr = ensure<ThisIsNative<DejaGnu> >(fn);
     
-    ptr->obj.totals();
+    ptr->totals();
     return as_value(true);
 }
 
     
-std::auto_ptr<as_object>
-init_dejagnu_instance()
-{
-    return std::auto_ptr<as_object>(new dejagnu_as_object());
-}
-
 extern "C" {
-    void
-    dejagnu_class_init(as_object &obj)
-    {
-//     GNASH_REPORT_FUNCTION;
-       // This is going to be the global "class"/"function"
-       as_object *cl;
-       if (cl == NULL) {
-        as_object* proto = getInterface();
-        Global_as* gl = getGlobal(obj);
-        cl = gl->createClass(&dejagnu_ctor, proto);
-//         // replicate all interface to class, to be able to access
-//         // all methods as static functions
-           attachInterface(cl);
-       }
+void
+dejagnu_class_init(as_object &obj)
+{
+    Global_as& gl = getGlobal(obj);
+    as_object* proto = gl.createObject();
+    attachInterface(*proto);
+
+    as_object* cl = gl.createClass(&dejagnu_ctor, proto);
        
        obj.init_member("DejaGnu", cl);
-    }
+}
 } // end of extern C
 
 

=== modified file 'extensions/dejagnu/dejagnu.h'
--- a/extensions/dejagnu/dejagnu.h      2009-02-25 22:30:19 +0000
+++ b/extensions/dejagnu/dejagnu.h      2009-11-05 08:14:09 +0000
@@ -15,34 +15,18 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-#ifndef __DEJAGNU_PLUGIN_H__
-#define __DEJAGNU_PLUGIN_H__
+#ifndef GNASH_DEJAGNU_PLUGIN_H
+#define GNASH_DEJAGNU_PLUGIN_H
 
 #ifdef HAVE_CONFIG_H
 #include "gnashconfig.h"
 #endif
 
-#include <memory> // for auto_ptr
 #include "as_object.h"
 
 namespace gnash
 {
 
-class DejaGnu {
-public:
-    DejaGnu();
-    ~DejaGnu();
-    const char *pass (const char *msg);
-    const char *fail (const char *msg);
-    const char *xpass (const char *msg);
-    const char *xfail (const char *msg);
-    void totals ();
-private:
-    int passed;
-    int failed;
-    int xpassed;
-    int xfailed;
-};
 
 extern "C" {
     void dejagnu_class_init(as_object &obj);  

=== modified file 'extensions/fileio/fileio.cpp'
--- a/extensions/fileio/fileio.cpp      2009-10-16 17:18:58 +0000
+++ b/extensions/fileio/fileio.cpp      2009-11-05 08:27:44 +0000
@@ -74,84 +74,99 @@
 
 LogFile& dbglogfile = LogFile::getDefaultInstance();
 
+// TODO: Document this class !!
+class FileIO : public Relay
+{
+public:
+    FileIO();
+    ~FileIO();
+
+    bool fopen(const std::string &filespec, const std::string &mode);
+
+    int fread(std::string &str);
+    int fgetc();
+    std::string &fgets(std::string &str);
+    
+    int fwrite(const std::string &str);
+    bool fputc(int c);
+    bool fputs(const std::string &str);
+    int fclose();
+    int fflush();
+    void rewind();
+    int fseek(long offset);
+    int fseek(long offset, int whence);
+    long ftell();
+    bool asyncmode(bool async); 
+    bool feof();
+    bool unlink(const std::string &filespec);
+private:
+    FILE        *_stream;
+    std::string _filespec;
+};
+
 static void
 attachInterface(as_object& obj)
 {
-//    GNASH_REPORT_FUNCTION;
-
-    Global_as* gl = getGlobal(obj);
-    
-    obj.init_member("fopen", gl->createFunction(fileio_fopen));
-    obj.init_member("fread", gl->createFunction(fileio_fread));
-    obj.init_member("fgetc", gl->createFunction(fileio_fgetc));
-    obj.init_member("fgets", gl->createFunction(fileio_fgets));
-    obj.init_member("gets", gl->createFunction(fileio_fgets));
-    obj.init_member("getchar", gl->createFunction(fileio_getchar));
-
-    obj.init_member("fwrite", gl->createFunction(fileio_fwrite));
-    obj.init_member("fputc", gl->createFunction(fileio_fputc));
-    obj.init_member("fputs", gl->createFunction(fileio_fputs));
-    obj.init_member("puts", gl->createFunction(fileio_puts));
-    obj.init_member("putchar", gl->createFunction(fileio_putchar));
-    
-    obj.init_member("fflush", gl->createFunction(fileio_fflush));
-    obj.init_member("fseek", gl->createFunction(fileio_fseek));
-    obj.init_member("ftell", gl->createFunction(fileio_ftell));
-    obj.init_member("asyncmode", gl->createFunction(fileio_asyncmode));
-    obj.init_member("feof", gl->createFunction(fileio_feof));
-    obj.init_member("fclose", gl->createFunction(fileio_fclose));
-    
-    obj.init_member("unlink", gl->createFunction(fileio_unlink));
-    
-    obj.init_member("scandir", gl->createFunction(fileio_scandir));
-}
-
-static as_object*
-getInterface()
-{
-//    GNASH_REPORT_FUNCTION;
-    static boost::intrusive_ptr<as_object> o;
-    if (o == NULL) {
-       o = new as_object();
-       attachInterface(*o);
-    }
-    return o.get();
+
+    Global_as& gl = getGlobal(obj);
+    
+    obj.init_member("fopen", gl.createFunction(fileio_fopen));
+    obj.init_member("fread", gl.createFunction(fileio_fread));
+    obj.init_member("fgetc", gl.createFunction(fileio_fgetc));
+    obj.init_member("fgets", gl.createFunction(fileio_fgets));
+    obj.init_member("gets", gl.createFunction(fileio_fgets));
+    obj.init_member("getchar", gl.createFunction(fileio_getchar));
+
+    obj.init_member("fwrite", gl.createFunction(fileio_fwrite));
+    obj.init_member("fputc", gl.createFunction(fileio_fputc));
+    obj.init_member("fputs", gl.createFunction(fileio_fputs));
+    obj.init_member("puts", gl.createFunction(fileio_puts));
+    obj.init_member("putchar", gl.createFunction(fileio_putchar));
+    
+    obj.init_member("fflush", gl.createFunction(fileio_fflush));
+    obj.init_member("fseek", gl.createFunction(fileio_fseek));
+    obj.init_member("ftell", gl.createFunction(fileio_ftell));
+    obj.init_member("asyncmode", gl.createFunction(fileio_asyncmode));
+    obj.init_member("feof", gl.createFunction(fileio_feof));
+    obj.init_member("fclose", gl.createFunction(fileio_fclose));
+    
+    obj.init_member("unlink", gl.createFunction(fileio_unlink));
+    
+    obj.init_member("scandir", gl.createFunction(fileio_scandir));
 }
 
 static as_value
 fileio_ctor(const fn_call& fn)
 {
-//    GNASH_REPORT_FUNCTION;
-    Fileio * obj = new Fileio();
+    as_object* obj = ensure<ValidThis>(fn);
+    obj->setRelay(new FileIO());
 
-    if ( fn.nargs > 0 )
-    {
+    if (fn.nargs > 0) {
                IF_VERBOSE_ASCODING_ERRORS(
                std::stringstream ss; fn.dump_args(ss);
-               log_aserror("new FileIO(%s): all arguments discarded", 
ss.str().c_str());
+               log_aserror("new FileIO(%s): all arguments discarded",
+            ss.str().c_str());
                );
     }
 
-    return as_value(obj); // will keep alive
+    return as_value();
 }
 
 
-Fileio::Fileio()
+FileIO::FileIO()
     :
-    as_object(getInterface()),
     _stream(0)
 {
-//    GNASH_REPORT_FUNCTION;
 }
 
-Fileio::~Fileio()
+FileIO::~FileIO()
 {
 //    GNASH_REPORT_FUNCTION;
     fclose();
 }
 
 int
-Fileio::fflush()
+FileIO::fflush()
 {
 //    GNASH_REPORT_FUNCTION;
     if (_stream) {
@@ -161,7 +176,7 @@
 }
 
 void
-Fileio::rewind()
+FileIO::rewind()
 {
 //    GNASH_REPORT_FUNCTION;
     if (_stream) {
@@ -170,7 +185,7 @@
 }
 
 int
-Fileio::fseek(long offset)
+FileIO::fseek(long offset)
 {
 //    GNASH_REPORT_FUNCTION;
     if (_stream) {
@@ -180,7 +195,7 @@
 }
 
 int
-Fileio::fseek(long offset, int whence)
+FileIO::fseek(long offset, int whence)
 {
 //    GNASH_REPORT_FUNCTION;
     if (_stream) {
@@ -190,7 +205,7 @@
 }
 
 long
-Fileio::ftell()
+FileIO::ftell()
 {
 //    GNASH_REPORT_FUNCTION;
     if (_stream) {
@@ -200,7 +215,7 @@
 }
 
 bool
-Fileio::asyncmode(bool async)
+FileIO::asyncmode(bool async)
 {
 //    GNASH_REPORT_FUNCTION;
     if (_stream) {
@@ -222,7 +237,7 @@
 }
 
 bool
-Fileio::feof()
+FileIO::feof()
 {
 //    GNASH_REPORT_FUNCTION;
     if (_stream) {
@@ -232,7 +247,7 @@
 }
 
 bool
-Fileio::fopen(const string &filespec, const string &mode)
+FileIO::fopen(const string &filespec, const string &mode)
 {
 //    GNASH_REPORT_FUNCTION;
     _stream = ::fopen(filespec.c_str(), mode.c_str());
@@ -245,7 +260,7 @@
 
 
 int
-Fileio::fread(string &str)
+FileIO::fread(string &str)
 {
 //    GNASH_REPORT_FUNCTION;
     int ret = -1;
@@ -261,7 +276,7 @@
 }
 
 int
-Fileio::fgetc()
+FileIO::fgetc()
 {
 //    GNASH_REPORT_FUNCTION;
     if (_stream) {
@@ -271,7 +286,7 @@
 }
 
 string &
-Fileio::fgets(std::string &str)
+FileIO::fgets(std::string &str)
 {
 //    GNASH_REPORT_FUNCTION;
     if (_stream) {
@@ -288,7 +303,7 @@
 }
 
 int
-Fileio::fwrite(const string &str)
+FileIO::fwrite(const string &str)
 {
 //    GNASH_REPORT_FUNCTION;
     return ::fwrite(str.c_str(), str.size(), 1, _stream);
@@ -296,7 +311,7 @@
 
 
 bool
-Fileio::fputc(int c)
+FileIO::fputc(int c)
 {
 //    GNASH_REPORT_FUNCTION;
     if (_stream) {
@@ -308,7 +323,7 @@
 }
 
 bool
-Fileio::fputs(const string &str)
+FileIO::fputs(const string &str)
 {
 //    GNASH_REPORT_FUNCTION;
     if (_stream) {
@@ -320,7 +335,7 @@
 }
 
 int
-Fileio::fclose()
+FileIO::fclose()
 {
 //    GNASH_REPORT_FUNCTION;
     if (_stream) {
@@ -332,48 +347,18 @@
 }
 
 bool
-Fileio::unlink(const std::string &filespec)
+FileIO::unlink(const std::string &filespec)
 {
 //    GNASH_REPORT_FUNCTION;
                return ::unlink(filespec.c_str()) >= 0;         
 }
 
-void
-Fileio::scandir(const std::string& dir, as_value* result) 
-{
-//    GNASH_REPORT_FUNCTION;
-
-       struct dirent **namelist;
-       
-       int n = ::scandir(dir.c_str(), &namelist, 0, alphasort);
-       
-       if (n<0) {
-           result->set_bool(false);
-           return;
-       }
-       
-       Array_as* array = new Array_as();       
-       as_value item;
-       
-       //array->resize(n);
-       // TODO: Looks like I can't set an array item by index since
-       // array::at() returns not a reference.
-       
-       for (int idx=0; idx<n; idx++) {
-               item.set_string(namelist[idx]->d_name);
-               array->at(idx) = item;
-               free(namelist[idx]);
-       }
-       free(namelist);
-       
-       result->set_as_object(array);
-}
 
 as_value
 fileio_fopen(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<Fileio> ptr = ensureType<Fileio>(fn.this_ptr);
+    FileIO* ptr = ensure<ThisIsNative<FileIO> >(fn);
     assert(ptr);
     
     if (fn.nargs < 2)
@@ -395,7 +380,7 @@
 fileio_fclose(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<Fileio> ptr = ensureType<Fileio>(fn.this_ptr);
+    FileIO* ptr = ensure<ThisIsNative<FileIO> >(fn);
     assert(ptr);
     
     return as_value(ptr->fclose());
@@ -405,7 +390,7 @@
 fileio_fread(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<Fileio> ptr = ensureType<Fileio>(fn.this_ptr);
+    FileIO* ptr = ensure<ThisIsNative<FileIO> >(fn);
     assert(ptr);
                
                string str;
@@ -421,7 +406,7 @@
 fileio_fgetc(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<Fileio> ptr = ensureType<Fileio>(fn.this_ptr);
+    FileIO* ptr = ensure<ThisIsNative<FileIO> >(fn);
     assert(ptr);
     int i = ptr->fgetc();
     
@@ -439,7 +424,7 @@
 fileio_fgets(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<Fileio> ptr = ensureType<Fileio>(fn.this_ptr);
+    FileIO* ptr = ensure<ThisIsNative<FileIO> >(fn);
     assert(ptr);
     string str; 
     str = ptr->fgets(str);
@@ -450,7 +435,7 @@
 fileio_gets(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<Fileio> ptr = ensureType<Fileio>(fn.this_ptr);
+    FileIO* ptr = ensure<ThisIsNative<FileIO> >(fn);
     assert(ptr);    
     char buf[BUFSIZE];
     memset(buf, 0, BUFSIZE);
@@ -463,7 +448,7 @@
 fileio_getchar(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<Fileio> ptr = ensureType<Fileio>(fn.this_ptr);
+    FileIO* ptr = ensure<ThisIsNative<FileIO> >(fn);
     assert(ptr);
     int i = ::getchar();
     char *c = reinterpret_cast<char *>(&i);
@@ -474,7 +459,7 @@
 fileio_fwrite(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<Fileio> ptr = ensureType<Fileio>(fn.this_ptr);
+    FileIO* ptr = ensure<ThisIsNative<FileIO> >(fn);
     assert(ptr);
     string str = fn.arg(0).to_string();
     return as_value(ptr->fputs(str));
@@ -484,7 +469,7 @@
 fileio_fputc(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<Fileio> ptr = ensureType<Fileio>(fn.this_ptr);
+    FileIO* ptr = ensure<ThisIsNative<FileIO> >(fn);
     assert(ptr);    
     int c = (int) fn.arg(0).to_number();
     return as_value(ptr->fputc(c));
@@ -494,7 +479,7 @@
 fileio_fputs(const fn_call& fn)
 {
     //   GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<Fileio> ptr = ensureType<Fileio>(fn.this_ptr);
+    FileIO* ptr = ensure<ThisIsNative<FileIO> >(fn);
 
     string str = fn.arg(0).to_string();
     return as_value(ptr->fputs(str));
@@ -513,7 +498,7 @@
 fileio_putchar(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<Fileio> ptr = ensureType<Fileio>(fn.this_ptr);
+    FileIO* ptr = ensure<ThisIsNative<FileIO> >(fn);
     assert(ptr);    
     string x = fn.arg(0).to_string();
     return as_value(::putchar(x[0]));
@@ -523,7 +508,7 @@
 fileio_fflush(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<Fileio> ptr = ensureType<Fileio>(fn.this_ptr);
+    FileIO* ptr = ensure<ThisIsNative<FileIO> >(fn);
     assert(ptr);    
     return as_value(ptr->fflush());
 }
@@ -532,7 +517,7 @@
 fileio_fseek(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<Fileio> ptr = ensureType<Fileio>(fn.this_ptr);
+    FileIO* ptr = ensure<ThisIsNative<FileIO> >(fn);
     assert(ptr);    
     long c = static_cast<long>(fn.arg(0).to_number());
     return as_value(ptr->fseek(c));
@@ -542,7 +527,7 @@
 fileio_ftell(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<Fileio> ptr = ensureType<Fileio>(fn.this_ptr);
+    FileIO* ptr = ensure<ThisIsNative<FileIO> >(fn);
     assert(ptr);
     int i = ptr->ftell();
     return as_value(i);
@@ -552,7 +537,7 @@
 fileio_asyncmode(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<Fileio> ptr = ensureType<Fileio>(fn.this_ptr);
+    FileIO* ptr = ensure<ThisIsNative<FileIO> >(fn);
     assert(ptr);
     bool b = (bool) fn.arg(0).to_bool();
     return as_value(ptr->asyncmode(b));
@@ -562,7 +547,7 @@
 fileio_feof(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<Fileio> ptr = ensureType<Fileio>(fn.this_ptr);
+    FileIO* ptr = ensure<ThisIsNative<FileIO> >(fn);
     assert(ptr);
     bool b = ptr->feof();
     return as_value(b);
@@ -572,7 +557,7 @@
 fileio_unlink(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<Fileio> ptr = ensureType<Fileio>(fn.this_ptr);
+    FileIO* ptr = ensure<ThisIsNative<FileIO> >(fn);
     assert(ptr);
     string str = fn.arg(0).to_string();
     return as_value(ptr->unlink(str));
@@ -581,48 +566,49 @@
 as_value
 fileio_scandir(const fn_call& fn)
 {
-//    GNASH_REPORT_FUNCTION;
-
-               // TODO: Check optional second parameter and sort array if it's 
true
-               // or missing.
-    boost::intrusive_ptr<Fileio> ptr = ensureType<Fileio>(fn.this_ptr);
-
-    assert(ptr);    
-    string str = fn.arg(0).to_string();
-    as_value val;
-    ptr->scandir(str, &val);
-    return val;
-}
-
-std::auto_ptr<as_object>
-init_fileio_instance()
-{
-    return std::auto_ptr<as_object>(new Fileio());
+    //    GNASH_REPORT_FUNCTION;
+
+    // TODO: Check optional second parameter and sort array if it's true
+    // or missing.
+
+    if (!fn.nargs) return as_value(false);
+
+    const std::string& dir = fn.arg(0).to_string();
+       
+    struct dirent **namelist;
+       
+       const int n = ::scandir(dir.c_str(), &namelist, 0, alphasort);
+       
+       if (n < 0) {
+           return as_value(false);
+       }
+    
+    Global_as& gl = getGlobal(fn);
+    string_table& st = getStringTable(fn);
+       as_object* array = gl.createArray();    
+       
+       for (int idx = 0; idx < n; ++idx) {
+               array->set_member(arrayKey(st, idx), namelist[idx]->d_name);
+               free(namelist[idx]);
+       }
+       free(namelist);
+
+    return as_value(array);
 }
 
 extern "C" {
-    void
-    fileio_class_init(as_object& where, const ObjectURI& /* uri */)
-    {
-//     GNASH_REPORT_FUNCTION;
-       Global_as* gl = getGlobal(where);
-       
-       // This is going to be the global "class"/"function"
-       as_object *cl = 0;
-       if (cl == NULL) {
-        as_object* proto = getInterface();
-        cl = gl->createClass(&fileio_ctor, proto);
-//         // replicate all interface to class, to be able to access
-//         // all methods as static functions
-           //attachInterface(*cl);
-       }
-#if 0  
-       where.init_member(getName(uri), cl, as_object::DefaultFlags,
-                         getNamespace(uri));
-#else
-       where.init_member("FileIO", cl);
-#endif
-    }
+
+void
+fileio_class_init(as_object& where, const ObjectURI& /* uri */)
+{
+    // GNASH_REPORT_FUNCTION;
+    Global_as& gl = getGlobal(where);
+
+    as_object* proto = gl.createObject();
+    attachInterface(*proto);
+    as_object* cl = gl.createClass(&fileio_ctor, proto);
+    where.init_member("FileIO", cl);
+}
 } // end of extern C
 
 

=== modified file 'extensions/fileio/fileio.h'
--- a/extensions/fileio/fileio.h        2009-09-09 19:30:55 +0000
+++ b/extensions/fileio/fileio.h        2009-11-05 08:27:44 +0000
@@ -15,59 +15,26 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-#ifndef __FILEIO_PLUGIN_H__
-#define __FILEIO_PLUGIN_H__
+#ifndef GNASH_FILEIO_PLUGIN_H
+#define GNASH_FILEIO_PLUGIN_H
 
 #ifdef HAVE_CONFIG_H
 #include "gnashconfig.h"
 #endif
 
-#include <memory> // for auto_ptr
-#include "as_object.h"
-
-#include <cstdio>
-#include <string>
-
-namespace gnash
-{
-
-// TODO: Document this class !!
-class Fileio : public as_object {
-public:
-    Fileio();
-    ~Fileio();
-
-    bool fopen(const std::string &filespec, const std::string &mode);
-
-    int fread(std::string &str);
-    int fgetc();
-    std::string &fgets(std::string &str);
-    
-    int fwrite(const std::string &str);
-    bool fputc(int c);
-    bool fputs(const std::string &str);
-    int fclose();
-    int fflush();
-    void rewind();
-    int fseek(long offset);
-    int fseek(long offset, int whence);
-    long ftell();
-    bool asyncmode(bool async); 
-    bool feof();
-    bool unlink(const std::string &filespec);
-    void scandir(const std::string& dir, as_value* result);    
-private:
-    FILE        *_stream;
-    std::string _filespec;
-};
+
+namespace gnash {
+
+class ObjectURI;
+class as_object;
+
 
 extern "C" {
-    void fileio_class_init(as_object& global, const ObjectURI& uri);  
-    /// Return an  instance
+
+void fileio_class_init(as_object& global, const ObjectURI& uri);  
+
 }
 
-std::auto_ptr<as_object> init_fileio_instance();
-
 } // end of gnash namespace
 
 // __FILEIO_PLUGIN_H__

=== modified file 'extensions/lirc/lirc_ext.cpp'
--- a/extensions/lirc/lirc_ext.cpp      2009-09-09 20:27:25 +0000
+++ b/extensions/lirc/lirc_ext.cpp      2009-11-05 08:40:27 +0000
@@ -44,43 +44,31 @@
 as_value lirc_ext_getkey(const fn_call& fn);
 as_value lirc_ext_getbutton(const fn_call& fn);
 
-class lirc_as_object : public as_object
+class LircRelay : public Relay
 {
 public:
     Lirc obj;
 };
 
 static void
-attachInterface(as_object *obj)
-{
-    GNASH_REPORT_FUNCTION;
-    Global_as* gl = getGlobal(*obj);
-
-    obj->init_member("lirc_init", gl->createFunction(lirc_ext_init));
-    obj->init_member("lirc_getKey", gl->createFunction(lirc_ext_getkey));
-    obj->init_member("lirc_getButton", gl->createFunction(lirc_ext_getbutton));
-}
-
-static as_object*
-getInterface()
-{
-    GNASH_REPORT_FUNCTION;
-    static boost::intrusive_ptr<as_object> o;
-    if (o == NULL) {
-       o = new as_object();
-    }
-    return o.get();
+attachInterface(as_object& obj)
+{
+    GNASH_REPORT_FUNCTION;
+    Global_as& gl = getGlobal(obj);
+
+    obj.init_member("lirc_init", gl.createFunction(lirc_ext_init));
+    obj.init_member("lirc_getKey", gl.createFunction(lirc_ext_getkey));
+    obj.init_member("lirc_getButton", gl.createFunction(lirc_ext_getbutton));
 }
 
 static as_value
-lirc_ctor(const fn_call& /* fn */)
+lirc_ctor(const fn_call&  fn)
 {
-    GNASH_REPORT_FUNCTION;
-    lirc_as_object* obj = new lirc_as_object();
-
-    attachInterface(obj);
-    return as_value(obj); // will keep alive
-//    printf ("Hello World from %s !!!\n", __PRETTY_FUNCTION__);
+    as_object* obj = ensure<ValidThis>(fn);
+
+    obj->setRelay(new LircRelay());
+
+    return as_value();
 }
 
 
@@ -98,11 +86,11 @@
 lirc_ext_init(const fn_call& fn)
 {
     GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<lirc_as_object> ptr = 
ensureType<lirc_as_object>(fn.this_ptr);
+    LircRelay* ptr = ensure<ThisIsNative<LircRelay> >(fn);
     
     if (fn.nargs > 0) {
-       string text = fn.arg(0).to_string();
-       return as_value(ptr->obj.init(text.c_str()));
+        const std::string& text = fn.arg(0).to_string();
+        return as_value(ptr->obj.init(text.c_str()));
     }
     return as_value(false);
 }
@@ -111,11 +99,11 @@
 lirc_ext_getkey(const fn_call& fn)
 {
     GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<lirc_as_object> ptr = 
ensureType<lirc_as_object>(fn.this_ptr);
+    LircRelay* ptr = ensure<ThisIsNative<LircRelay> >(fn);
     
     if (fn.nargs == 0) {
-      key::code key = ptr->obj.getKey();
-      return as_value(key);
+        key::code key = ptr->obj.getKey();
+        return as_value(key);
     }
     return as_value(false);
 }
@@ -123,41 +111,21 @@
 as_value
 lirc_ext_getbutton(const fn_call& fn)
 {
-  //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<lirc_as_object> ptr = 
ensureType<lirc_as_object>(fn.this_ptr);
-    
-    if (fn.nargs == 0) {
-      const char *button = ptr->obj.getButton();
-      return as_value(button);
-    }
-    return as_value(false);
-}
-
-std::auto_ptr<as_object>
-init_lirc_instance()
-{
-    return std::auto_ptr<as_object>(new lirc_as_object());
-}
-
-// const char *lirc_setmode(struct lirc_config *config, const char *mode);
+    LircRelay* ptr = ensure<ThisIsNative<LircRelay> >(fn);
+    return as_value(ptr->obj.getButton());
+}
+
 extern "C" {
-    void
-    lirc_class_init(as_object &obj)
-    {
-//     GNASH_REPORT_FUNCTION;
-       // This is going to be the global "class"/"function"
-       as_object *cl;
-       if (cl == NULL) {
-        Global_as* gl = getGlobal(obj);
-        as_object* proto = getInterface();
-        cl = gl->createClass(&lirc_ctor, proto);
-//         // replicate all interface to class, to be able to access
-//         // all methods as static functions
-           attachInterface(cl);
-       }
-       
+void
+lirc_class_init(as_object &obj)
+{
+
+    Global_as& gl = getGlobal(obj);
+    as_object* proto = gl.createObject();
+    attachInterface(*proto);
+       as_object* cl = gl.createClass(&lirc_ctor, proto);
        obj.init_member("Lirc", cl);
-    }
+}
 } // end of extern C
 
 

=== modified file 'extensions/lirc/lirc_ext.h'
--- a/extensions/lirc/lirc_ext.h        2009-02-25 22:30:19 +0000
+++ b/extensions/lirc/lirc_ext.h        2009-11-05 08:40:27 +0000
@@ -15,14 +15,13 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-#ifndef __LIRC_PLUGIN_H__
-#define __LIRC_PLUGIN_H__
+#ifndef GNASH_LIRC_PLUGIN_H
+#define GNASH_LIRC_PLUGIN_H
 
 #ifdef HAVE_CONFIG_H
 #include "gnashconfig.h"
 #endif
 
-#include <memory> // for auto_ptr
 #include "as_object.h"
 
 namespace gnash
@@ -30,14 +29,10 @@
 
 extern "C" {
     void lirc_class_init(as_object &obj);  
-    /// Return an  instance
 }
 
-std::auto_ptr<as_object> init_lirc_instance();
-
 } // end of gnash namespace
 
-// __LIRC_PLUGIN_H__
 #endif
 
 // Local Variables:

=== removed directory 'extensions/metome'
=== removed file 'extensions/metome/Makefile.am'
--- a/extensions/metome/Makefile.am     2009-05-13 15:46:50 +0000
+++ b/extensions/metome/Makefile.am     1970-01-01 00:00:00 +0000
@@ -1,48 +0,0 @@
-## Process this file with automake to generate Makefile.in
-# 
-#   Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
-# 
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-AUTOMAKE_OPTIONS = 
-
-# this is where Gnash plugins get installed
-pluginsdir = $(libdir)/gnash/plugins
-
-plugins_LTLIBRARIES = metome_ext.la
-
-INCLUDES =  \
-            -I$(top_srcdir)/libbase \
-            -I$(top_srcdir)/libcore \
-            -I$(top_srcdir)/libcore/swf \
-            -I$(top_srcdir)/libcore/vm \
-           -I$(top_srcdir)/libcore/asobj \
-           $(INCLTDL)
-
-metome_ext_la_SOURCES = metome_ext.cpp metome_ext.h
-metome_ext_la_LDFLAGS = -module -avoid-version -no-undefined
-metome_ext_la_LIBDADD = $(LIBADD_DL) $(LIBLTDL) \
-       $(top_builddir)/libbase/libgnashbase.la \
-       $(top_builddir)/libcore/libgnashcore.la \
-       $(PTHREAD_LIBS) \
-       $(NULL)
-
-check_PROGRAMS = # SharedTest
-CLEANFILES = \
-      gnash-dbg.log
-
-install-pluginsLTLIBRARIES: $(plugins_LTLIBRARIES)
-       test -d "$(DESTDIR)$(pluginsdir)" || $(mkinstalldirs) 
"$(DESTDIR)$(pluginsdir)"
-       $(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) 
$(plugins_LTLIBRARIES) "$(DESTDIR)$(pluginsdir)/$(plugins_LTLIBRARIES)"
-       $(RM) $(DESTDIR)$(pluginsdir)/*.a 

=== removed file 'extensions/metome/metome_ext.cpp'
--- a/extensions/metome/metome_ext.cpp  2009-09-09 20:27:25 +0000
+++ b/extensions/metome/metome_ext.cpp  1970-01-01 00:00:00 +0000
@@ -1,146 +0,0 @@
-// 
-//   Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
-// 
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
-#include <iostream>
-
-#include <cstdarg>
-#include <cstdio>
-#include <cstdlib>
-
-#include <string>
-#include "log.h"
-#include "metome_ext.h"
-#include "fn_call.h"
-#include "as_object.h"
-#include "Globals.h"
-#include "builtin_function.h" // need builtin_function
-
-using namespace std;
-
-namespace gnash
-{
-
-as_value metome_ext_connect(const fn_call& fn);
-
-Metome::Metome() 
-    : _name(0)
-{
-    GNASH_REPORT_FUNCTION;
-}
-
-
-Metome::~Metome() 
-{
-    GNASH_REPORT_FUNCTION;
-}
-
-void
-Metome::connect(const char *sock)
-{
-    GNASH_REPORT_FUNCTION;
-    _name = sock;
-}
-
-class metome_as_object : public as_object
-{
-public:
-    Metome obj;
-};
-
-static void
-attachInterface(as_object *obj)
-{
-    GNASH_REPORT_FUNCTION;
-    Global_as* gl = getGlobal(*obj);
-    obj->init_member("connect", gl->createFunction(metome_ext_connect));
-}
-
-static as_object*
-getInterface()
-{
-    GNASH_REPORT_FUNCTION;
-    static boost::intrusive_ptr<as_object> o;
-    if (o == NULL) {
-       o = new as_object();
-    }
-    return o.get();
-}
-
-static as_value
-metome_ctor(const fn_call& /* fn */)
-{
-    GNASH_REPORT_FUNCTION;
-    metome_as_object* obj = new metome_as_object();
-
-    attachInterface(obj);
-    return as_value(obj); // will keep alive
-//    printf ("Hello World from %s !!!\n", __PRETTY_FUNCTION__);
-}
-
-as_value
-metome_ext_setsockname(const fn_call& fn)
-{
-    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<metome_as_object> ptr = 
ensureType<metome_as_object>(fn.this_ptr);
-    
-    if (fn.nargs > 0) {
-       string text = fn.arg(0).to_string();
-       ptr->obj.connect(text.c_str());
-       return as_value(true);
-    }
-    return as_value(false);
-}
-
-std::auto_ptr<as_object>
-init_metome_instance()
-{
-    return std::auto_ptr<as_object>(new metome_as_object());
-}
-
-// const char *metome_setmode(struct metome_config *config, const char *mode);
-extern "C" {
-    void
-    metome_class_init(as_object &obj)
-    {
-//     GNASH_REPORT_FUNCTION;
-       // This is going to be the global "class"/"function"
-       as_object *cl;
-       if (cl == NULL) {
-        Global_as* gl = getGlobal(obj);
-        as_object* proto = getInterface();
-        cl = gl->createClass(&metome_ctor, proto);
-//         // replicate all interface to class, to be able to access
-//         // all methods as static functions
-           attachInterface(cl);
-       }
-       
-       obj.init_member("Metome", cl);
-    }
-} // end of extern C
-
-
-} // end of gnash namespace
-
-// Local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:

=== removed file 'extensions/metome/metome_ext.h'
--- a/extensions/metome/metome_ext.h    2009-02-25 22:30:19 +0000
+++ b/extensions/metome/metome_ext.h    1970-01-01 00:00:00 +0000
@@ -1,55 +0,0 @@
-// 
-//   Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
-// 
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-#ifndef __METOME_PLUGIN_H__
-#define __METOME_PLUGIN_H__
-
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
-#include <memory> // for auto_ptr
-#include "as_object.h"
-
-namespace gnash
-{
-
-class Metome {
-public:
-    Metome();
-    ~Metome();
-    void connect(const char *sock);
-private:
-    const char *_name;
-};
-
-extern "C" {
-    void metome_class_init(as_object &obj);  
-    /// Return an  instance
-}
-
-std::auto_ptr<as_object> init_metome_instance();
-
-} // end of gnash namespace
-
-// __METOME_PLUGIN_H__
-#endif
-
-// Local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:

=== modified file 'extensions/mysql/mysql_db.cpp'
--- a/extensions/mysql/mysql_db.cpp     2009-09-09 20:27:25 +0000
+++ b/extensions/mysql/mysql_db.cpp     2009-11-05 08:06:43 +0000
@@ -53,70 +53,74 @@
 
 LogFile& dbglogfile = LogFile::getDefaultInstance();
 
-class mysql_as_object : public as_object
+static void
+attachInterface(as_object& obj)
+{
+    Global_as& gl = getGlobal(obj);
+
+    obj.init_member("connect", gl.createFunction(mysql_connect));
+    obj.init_member("qetData", gl.createFunction(mysql_qetData));
+    obj.init_member("disconnect", gl.createFunction(mysql_disconnect));
+    obj.init_member("query", gl.createFunction(mysql_query));
+    obj.init_member("fetch_row", gl.createFunction(mysql_fetch));
+    obj.init_member("num_fields", gl.createFunction(mysql_fields));
+    obj.init_member("free_result", gl.createFunction(mysql_free));
+    obj.init_member("store_results", gl.createFunction(mysql_store));
+}
+
+class MySQL : public Relay
 {
 public:
-    MySQL obj;
+    typedef std::vector< std::vector<const char *> > query_t;
+    MySQL();
+    ~MySQL();
+    bool connect(const char *host, const char *dbname, const char *user, const 
char *passwd);
+    int getData(const char *sql, query_t &result);
+    bool disconnect();
+
+    // These are wrappers for the regular MySQL API
+    bool guery(MYSQL *db, const char *sql);
+    bool guery(const char *sql);
+    int num_fields();
+    int num_fields(MYSQL_RES *result);
+    MYSQL_ROW fetch_row();
+    MYSQL_ROW fetch_row(MYSQL_RES *result);
+    void free_result();
+    void free_result(MYSQL_RES *result);
+    MYSQL_RES *store_result();
+    MYSQL_RES *store_result(MYSQL *db);
+private:    
+    MYSQL *_db;
+    MYSQL_RES *_result;
+    MYSQL_ROW _row;
 };
 
-static void
-attachInterface(as_object *obj)
-{
-//    GNASH_REPORT_FUNCTION;
-    Global_as* gl = getGlobal(*obj);
-
-    obj->init_member("connect", gl->createFunction(mysql_connect));
-    obj->init_member("qetData", gl->createFunction(mysql_qetData));
-    obj->init_member("disconnect", gl->createFunction(mysql_disconnect));
-    obj->init_member("query", gl->createFunction(mysql_query));
-    obj->init_member("fetch_row", gl->createFunction(mysql_fetch));
-    obj->init_member("num_fields", gl->createFunction(mysql_fields));
-    obj->init_member("free_result", gl->createFunction(mysql_free));
-    obj->init_member("store_results", gl->createFunction(mysql_store));
-}
-
-static as_object*
-getInterface()
-{
-//    GNASH_REPORT_FUNCTION;
-
-    static boost::intrusive_ptr<as_object> o;
-    if (o == NULL) {
-       o = new as_object();
-    }
-    return o.get();
-}
-
 static as_value
-mysql_ctor(const fn_call& /*fn*/)
+mysql_ctor(const fn_call& fn)
 {
-//    GNASH_REPORT_FUNCTION;
-
-    mysql_as_object* obj = new mysql_as_object();
-
-    attachInterface(obj);
-    return as_value(obj); // will keep alive
-//    printf ("Hello World from %s !!!\n", __PRETTY_FUNCTION__);
+    as_object* obj = ensure<ValidThis>(fn);
+    obj->setRelay(new MySQL());
+    return as_value(); 
 }
 
 
-MySQL::MySQL(): _db(NULL), _result(NULL), _row(NULL)
+MySQL::MySQL() :
+    _db(NULL),
+    _result(NULL),
+    _row(NULL)
 {
-//    GNASH_REPORT_FUNCTION;
 }
 
 MySQL::~MySQL()
 {
-//    GNASH_REPORT_FUNCTION;
     disconnect();
 }
 
 int
 MySQL::num_fields()
 {
-//    GNASH_REPORT_FUNCTION;
     if (_result) {
-       return num_fields(_result);
+        return num_fields(_result);
     }
     return -1;
 }
@@ -124,16 +128,14 @@
 int
 MySQL::num_fields(MYSQL_RES *result)
 {
-//    GNASH_REPORT_FUNCTION;
     return mysql_num_fields(result);
 }
 
 MYSQL_ROW
 MySQL::fetch_row()
 {
-//    GNASH_REPORT_FUNCTION;
     if (_result) {
-       return fetch_row(_result);
+        return fetch_row(_result);
     }
     return NULL;
 }
@@ -141,32 +143,28 @@
 MYSQL_ROW
 MySQL::fetch_row(MYSQL_RES *result)
 {
-//    GNASH_REPORT_FUNCTION;
     return mysql_fetch_row(result);
 }
 
 void
 MySQL::free_result()
 {
-//    GNASH_REPORT_FUNCTION;
     if (_result) {
-       free_result(_result);
+        free_result(_result);
     }
 }
 
 void
 MySQL::free_result(MYSQL_RES *result)
 {
-//    GNASH_REPORT_FUNCTION;
     mysql_free_result(result);
 }
 
 MYSQL_RES *
 MySQL::store_result()
 {
-//    GNASH_REPORT_FUNCTION;
     if (_db) {
-       return store_result(_db);
+        return store_result(_db);
     }
     return NULL;
 }
@@ -174,7 +172,6 @@
 MYSQL_RES *
 MySQL::store_result(MYSQL *db)
 {
-//    GNASH_REPORT_FUNCTION;
     _result = mysql_store_result(db);
     return _result;
 }
@@ -189,8 +186,8 @@
     disconnect();
     
     if ((_db = mysql_init(NULL)) == NULL ) {
-       log_error(_("Couldn't initialize database"));
-       return false;
+        log_error(_("Couldn't initialize database"));
+        return false;
     }
     
     if (mysql_real_connect(_db, host, user, passwd, dbname, 0, NULL, 0) == 
NULL) {
@@ -206,7 +203,7 @@
 {
 //    GNASH_REPORT_FUNCTION;
     if (_db) {
-       return guery(_db, sql);
+        return guery(_db, sql);
     }
     return -1;
 }
@@ -303,20 +300,19 @@
 as_value
 mysql_connect(const fn_call& fn)
 {
-//    GNASH_REPORT_FUNCTION;
 
-    boost::intrusive_ptr<mysql_as_object> ptr = 
ensureType<mysql_as_object>(fn.this_ptr);
+    MySQL* ptr = ensure<ThisIsNative<MySQL> >(fn);
 
     if (fn.nargs == 4) {
-       string host = fn.arg(0).to_string();
-       string db = fn.arg(1).to_string();
-       string user = fn.arg(2).to_string();
-       string passwd = fn.arg(3).to_string();  
-       return as_value(ptr->obj.connect(host.c_str(), db.c_str(),
-                                        user.c_str(), passwd.c_str()));
-    } else {
-       return as_value(false);
-    }
+        string host = fn.arg(0).to_string();
+        string db = fn.arg(1).to_string();
+        string user = fn.arg(2).to_string();
+        string passwd = fn.arg(3).to_string(); 
+        return as_value(ptr->connect(host.c_str(), db.c_str(),
+                         user.c_str(), passwd.c_str()));
+    } 
+
+    return as_value(false);
 }
 
 as_value
@@ -324,27 +320,21 @@
 {
 //    GNASH_REPORT_FUNCTION;
 
-    boost::intrusive_ptr<mysql_as_object> ptr = 
ensureType<mysql_as_object>(fn.this_ptr);
-
     if (fn.nargs > 0) {
-       string sql = fn.arg(0).to_string();
-       Array_as *arr = (Array_as *)fn.arg(1).to_object(*getGlobal(fn)).get();
-//     std::vector< std::vector<const char *> >
-       MySQL::query_t qresult;
-#if 0
-       // This clearly makes no sense...
-       return as_value(ptr->obj.getData(sql, qresult));
-#endif
-       for (size_t i=0; i<qresult.size(); i++) {
-           vector<const char *> row;
-           row = qresult[i];
-           for (size_t j=0; j< row.size(); j++) {
-//             cerr << "ARR: " << i << ":" << j << " " << row[j] << endl;
-               as_value entry = row[j];
-               arr->push(entry);
-           }
-       }
-       return as_value(true);
+        string sql = fn.arg(0).to_string();
+           as_object* arr = fn.arg(1).to_object(getGlobal(fn));
+
+        MySQL::query_t qresult;
+
+        for (size_t i=0; i<qresult.size(); i++) {
+            vector<const char *> row;
+            row = qresult[i];
+            for (size_t j=0; j< row.size(); j++) {
+                as_value entry = row[j];
+                arr->callMethod(NSV::PROP_PUSH, entry);
+            }
+        }
+        return as_value(true);
     }
     log_aserror("Mysql.getData(): missing arguments");
        return as_value(false);
@@ -354,8 +344,8 @@
 mysql_free(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<mysql_as_object> ptr = 
ensureType<mysql_as_object>(fn.this_ptr);
-    ptr->obj.free_result();
+    MySQL* ptr = ensure<ThisIsNative<MySQL> >(fn);
+    ptr->free_result();
     return as_value(true);
 }
 
@@ -363,22 +353,21 @@
 mysql_fields(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<mysql_as_object> ptr = 
ensureType<mysql_as_object>(fn.this_ptr);
-    return as_value(ptr->obj.num_fields());
+    MySQL* ptr = ensure<ThisIsNative<MySQL> >(fn);
+    return as_value(ptr->num_fields());
 }
 
 as_value
 mysql_fetch(const fn_call& fn)
 {
-//    GNASH_REPORT_FUNCTION;
+    MySQL* ptr = ensure<ThisIsNative<MySQL> >(fn);
     if (fn.nargs > 0) {
-       boost::intrusive_ptr<mysql_as_object> ptr = 
ensureType<mysql_as_object>(fn.this_ptr);
-       assert(ptr);
-       MYSQL_ROW res = ptr->obj.fetch_row();
-       as_value aaa = *res;       
-       Array_as *arr = new Array_as;
-       arr->push(aaa);
-       return as_value(arr);
+        MYSQL_ROW res = ptr->fetch_row();
+        as_value aaa = *res;       
+        Global_as& gl = getGlobal(fn);
+        as_object* arr = gl.createArray();
+        arr->callMethod(NSV::PROP_PUSH, aaa);
+        return as_value(arr);
     }
     log_aserror("Mysql.fetch(): missing arguments");
     return as_value();
@@ -388,8 +377,8 @@
 mysql_store(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<mysql_as_object> ptr = 
ensureType<mysql_as_object>(fn.this_ptr);
-    gnash::as_object *obj = reinterpret_cast<gnash::as_object  
*>(ptr->obj.store_result());
+    MySQL* ptr = ensure<ThisIsNative<MySQL> >(fn);
+    as_object* obj = reinterpret_cast<as_object*>(ptr->store_result());
     return as_value(obj);
 }
 
@@ -397,10 +386,10 @@
 mysql_query(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    boost::intrusive_ptr<mysql_as_object> ptr = 
ensureType<mysql_as_object>(fn.this_ptr);
+    MySQL* ptr = ensure<ThisIsNative<MySQL> >(fn);
     if (fn.nargs > 0) {
-       string sql = fn.arg(0).to_string();
-       return as_value(ptr->obj.guery(sql.c_str()));
+        string sql = fn.arg(0).to_string();
+        return as_value(ptr->guery(sql.c_str()));
     }
     log_aserror("Missing arguments to MySQL.query");
     return as_value();
@@ -409,31 +398,22 @@
 as_value
 mysql_disconnect(const fn_call& fn)
 {
-//    GNASH_REPORT_FUNCTION;
-
-    boost::intrusive_ptr<mysql_as_object> ptr = 
ensureType<mysql_as_object>(fn.this_ptr);
-    return as_value(ptr->obj.disconnect());
+    MySQL* ptr = ensure<ThisIsNative<MySQL> >(fn);
+    return as_value(ptr->disconnect());
 }
 
 extern "C" {
-    void
-    mysql_class_init(as_object &obj)
-    {
-//     GNASH_REPORT_FUNCTION;
-       // This is going to be the global "class"/"function"
-       as_object *cl;
-       if (cl == NULL) {
-        Global_as* gl = getGlobal(obj);
-        as_object* proto = getInterface();
-        cl = gl->createClass(&mysql_ctor, proto);
-//         // replicate all interface to class, to be able to access
-//         // all methods as static functions
-           attachInterface(cl);
-       }       
+
+void mysql_class_init(as_object &obj)
+{
+    Global_as& gl = getGlobal(obj);
+    as_object* proto = gl.createObject();
+       as_object *cl = gl.createClass(&mysql_ctor, proto);
+    attachInterface(*proto);
        obj.init_member("MySQL", cl);
-    }
-    
-} // end of extern C
+} 
+
+}
 
 } // end of gnash namespace
 

=== modified file 'extensions/mysql/mysql_db.h'
--- a/extensions/mysql/mysql_db.h       2009-02-25 22:30:19 +0000
+++ b/extensions/mysql/mysql_db.h       2009-11-05 08:06:43 +0000
@@ -15,8 +15,8 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-#ifndef __MYSQL_DB_H__
-#define __MYSQL_DB_H__
+#ifndef GNASH_MYSQL_DB_H
+#define GNASH_MYSQL_DB_H
 
 #ifdef HAVE_CONFIG_H
 #include "gnashconfig.h"
@@ -34,40 +34,10 @@
 namespace gnash
 {
 
-class MySQL
-{
-public:
-    typedef std::vector< std::vector<const char *> > query_t;
-    MySQL();
-    ~MySQL();
-    bool connect(const char *host, const char *dbname, const char *user, const 
char *passwd);
-    int getData(const char *sql, query_t &result);
-    bool disconnect();
-
-    // These are wrappers for the regular MySQL API
-    bool guery(MYSQL *db, const char *sql);
-    bool guery(const char *sql);
-    int num_fields();
-    int num_fields(MYSQL_RES *result);
-    MYSQL_ROW fetch_row();
-    MYSQL_ROW fetch_row(MYSQL_RES *result);
-    void free_result();
-    void free_result(MYSQL_RES *result);
-    MYSQL_RES *store_result();
-    MYSQL_RES *store_result(MYSQL *db);
-private:    
-    MYSQL *_db;
-    MYSQL_RES *_result;
-    MYSQL_ROW _row;
-};
-
 extern "C" {
     void mysql_class_init(as_object &obj);  
 }
 
-/// Return an  instance
-std::auto_ptr<as_object> init_mysql_instance();
-
 }
 
 // __MYSQL_DB_H__

=== modified file 'libbase/extension.cpp'
--- a/libbase/extension.cpp     2009-09-24 08:37:07 +0000
+++ b/libbase/extension.cpp     2009-11-05 09:17:23 +0000
@@ -142,7 +142,6 @@
 bool
 Extension::initModule(const std::string& module, as_object &where)
 {
-    GNASH_REPORT_FUNCTION;
 
     SharedLib *sl;
     std::string symbol(module);
@@ -171,8 +170,8 @@
 }
 
 bool
-Extension::initModuleWithFunc(const std::string& module, const std::string& 
func,
-    as_object &obj)
+Extension::initModuleWithFunc(const std::string& module,
+        const std::string& func, as_object &obj)
 {
     GNASH_REPORT_FUNCTION;
 

=== modified file 'libbase/sharedlib.cpp'
--- a/libbase/sharedlib.cpp     2009-09-24 08:36:52 +0000
+++ b/libbase/sharedlib.cpp     2009-11-05 09:16:59 +0000
@@ -63,27 +63,13 @@
 
 namespace gnash {
 
-SharedLib::SharedLib()
-{
-//    GNASH_REPORT_FUNCTION;
-#ifdef LT_DLMUTEX
-//     return lt_dlmutex_register (gnash_mutex_lock, gnash_mutex_unlock,
-//                                 gnash_mutex_seterror, gnash_mutex_geterror);
-#endif
-}
-
 SharedLib::SharedLib(const std::string& filespec)
 {
-    GNASH_REPORT_FUNCTION;
+    _filespec = filespec;
 }
 
-SharedLib::SharedLib(const std::string &filespec, const std::string &envvar)
+SharedLib::SharedLib(const std::string& filespec, const std::string& envvar)
 {
-    GNASH_REPORT_FUNCTION;
-#ifdef LT_DLMUTEX
-//     return lt_dlmutex_register (gnash_mutex_lock, gnash_mutex_unlock,
-//                                 gnash_mutex_seterror, gnash_mutex_geterror);
-#endif
     _filespec = filespec;
     scoped_lock lock(_libMutex);
     
@@ -91,8 +77,6 @@
     int errors = lt_dlinit ();
     if (errors) {
         log_error (_("Couldn't initialize ltdl: %s"), lt_dlerror());
-//     } else {
-//         log_debug ("Initialized ltdl");
     }
     
     string pluginsdir;
@@ -103,14 +87,10 @@
         pluginsdir = PLUGINSDIR;
     }
     
-    //lt_dladdsearchdir(pluginsdir.c_str());
 }
 
 SharedLib::~SharedLib()
 {
-    //   GNASH_REPORT_FUNCTION;
-//    closeLib();
-//    lt_dlexit();
 }
 
 bool
@@ -152,7 +132,6 @@
 SharedLib::initentry *
 SharedLib::getInitEntry (const std::string& symbol)
 {
-    GNASH_REPORT_FUNCTION;
     lt_ptr run = NULL;
     
     scoped_lock lock(_libMutex);

=== modified file 'libbase/sharedlib.h'
--- a/libbase/sharedlib.h       2009-09-14 00:37:36 +0000
+++ b/libbase/sharedlib.h       2009-11-05 09:16:59 +0000
@@ -54,7 +54,6 @@
     typedef bool entrypoint (void *obj);
     typedef void initentry(as_object &obj);
     
-    SharedLib();
     SharedLib(const std::string& filespec);
     DSOEXPORT SharedLib(const std::string& filespec, const std::string& 
envvar);
     ~SharedLib();

=== modified file 'libcore/asobj/Array_as.h'
--- a/libcore/asobj/Array_as.h  2009-10-21 11:35:19 +0000
+++ b/libcore/asobj/Array_as.h  2009-11-05 08:57:59 +0000
@@ -88,7 +88,6 @@
 }
 
 /// Initialize the global.Array object
-// needed by SWFHandlers::ActionInitArray
 void array_class_init(as_object& global, const ObjectURI& uri);
 
 void registerArrayNative(as_object& global);


reply via email to

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