gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/avm2 r9496: Add int actionscript class for


From: Tom Stellard
Subject: [Gnash-commit] /srv/bzr/gnash/avm2 r9496: Add int actionscript class for real.
Date: Wed, 20 Aug 2008 00:33:48 +0800
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9496
committer: Tom Stellard <address@hidden>
branch nick: gnash_dev
timestamp: Wed 2008-08-20 00:33:48 +0800
message:
  Add int actionscript class for real.
added:
  libcore/asobj/int_as.cpp
  libcore/asobj/int_as.h
=== added file 'libcore/asobj/int_as.cpp'
--- a/libcore/asobj/int_as.cpp  1970-01-01 00:00:00 +0000
+++ b/libcore/asobj/int_as.cpp  2008-08-19 16:33:48 +0000
@@ -0,0 +1,82 @@
+// EventDispatcher.cpp:  Implementation of ActionScript int class, for Gnash.
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008 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
+//
+
+#include "smart_ptr.h"
+#include "fn_call.h"
+#include "as_object.h" // for inheritance
+#include "builtin_function.h" // need builtin_function
+#include "Object.h"
+
+#include "log.h"
+
+#include <string>
+#include <sstream>
+
+namespace gnash {
+class int_as_object : public as_object
+{
+
+public:
+
+       int_as_object()
+               :
+               as_object()
+       {
+       }
+
+};
+
+static as_value
+int_ctor(const fn_call& fn)
+{
+       boost::intrusive_ptr<as_object> obj = new int_as_object();
+       
+       return as_value(obj.get()); // will keep alive
+}
+
+as_object*
+getintInterface()
+{
+       static boost::intrusive_ptr<as_object> o;
+       if ( ! o )
+       {
+               o = new as_object(getObjectInterface());
+       }
+       return o.get();
+}
+
+// extern (used by Global.cpp)
+void int_class_init(as_object& global)
+{
+    static boost::intrusive_ptr<builtin_function> cl;
+
+       cl=new builtin_function(&int_ctor, getintInterface());
+
+       // Register _global.DisplayObject
+       global.init_member("int", cl.get());
+}
+
+std::auto_ptr<as_object>
+init_int_instance()
+{
+       return std::auto_ptr<as_object>(new int_as_object);
+}
+
+
+}
\ No newline at end of file

=== added file 'libcore/asobj/int_as.h'
--- a/libcore/asobj/int_as.h    1970-01-01 00:00:00 +0000
+++ b/libcore/asobj/int_as.h    2008-08-19 16:33:48 +0000
@@ -0,0 +1,44 @@
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008 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
+
+// 
+//
+//
+
+// Implementation for ActionScript int object.
+
+#ifndef GNASH_INT_AS_H
+#define GNASH_INT_AS_H
+
+#include <memory> // for auto_ptr
+
+namespace gnash {
+
+class as_object;
+
+/// Initialize the global int class
+void int_class_init(as_object& global);
+
+/// Return an int instance
+std::auto_ptr<as_object> init_int_instance();
+
+as_object* getintInterface();
+
+
+}
+
+#endif // GNASH_INT_AS_H


reply via email to

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