[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/asobj/NetConnection.h se...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/asobj/NetConnection.h se... |
Date: |
Mon, 20 Nov 2006 21:44:24 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 06/11/20 21:44:24
Modified files:
. : ChangeLog
server/asobj : NetConnection.h System.h Global.cpp
SharedObject.cpp SharedObject.h Stage.cpp
Stage.h Video.cpp Video.h TextSnapshot.cpp
TextSnapshot.h
Log message:
* server/asobj/: NetConnection.h, System.h:
streamlined headers inclusion.
* server/asobj: Global.cpp, SharedObject.{h,cpp}, Stage.{h,cpp},
Video.{h,cpp}, TextSnapshot.{cpp,h}:
ported ActionScript class stubs to new layout.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1679&r2=1.1680
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetConnection.h?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/System.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Global.cpp?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/SharedObject.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/SharedObject.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Stage.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Stage.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Video.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Video.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/TextSnapshot.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/TextSnapshot.h?cvsroot=gnash&r1=1.4&r2=1.5
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1679
retrieving revision 1.1680
diff -u -b -r1.1679 -r1.1680
--- ChangeLog 20 Nov 2006 21:38:11 -0000 1.1679
+++ ChangeLog 20 Nov 2006 21:44:23 -0000 1.1680
@@ -1,5 +1,13 @@
2006-11-20 Sandro Santilli <address@hidden>
+ * server/asobj/: NetConnection.h, System.h:
+ streamlined headers inclusion.
+ * server/asobj: Global.cpp, SharedObject.{h,cpp}, Stage.{h,cpp},
+ Video.{h,cpp}, TextSnapshot.{cpp,h}:
+ ported ActionScript class stubs to new layout.
+
+2006-11-20 Sandro Santilli <address@hidden>
+
* server/asobj/: Key.h, LocalConnection.h:
streamlined headers inclusion.
* server/asobj: Global.cpp, Error.{h,cpp}, LoadVars.{h,cpp},
Index: server/asobj/NetConnection.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetConnection.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- server/asobj/NetConnection.h 31 Oct 2006 17:59:30 -0000 1.8
+++ server/asobj/NetConnection.h 20 Nov 2006 21:44:24 -0000 1.9
@@ -27,7 +27,10 @@
#include <string>
-#include "impl.h"
+// TODO: port to new AS architecture
+//
+#include "as_object.h" // for inheritance
+#include "fn_call.h"
#include "network.h"
namespace gnash {
Index: server/asobj/System.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/System.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/asobj/System.h 29 Oct 2006 18:34:12 -0000 1.3
+++ server/asobj/System.h 20 Nov 2006 21:44:24 -0000 1.4
@@ -25,8 +25,8 @@
#include "config.h"
#endif
-#include "impl.h"
-//#include "Function.h"
+#include "as_object.h" // for inheritance
+#include "fn_call.h"
namespace gnash {
Index: server/asobj/Global.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Global.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- server/asobj/Global.cpp 20 Nov 2006 21:38:11 -0000 1.21
+++ server/asobj/Global.cpp 20 Nov 2006 21:44:24 -0000 1.22
@@ -18,7 +18,7 @@
// Implementation of the Global ActionScript Object
-/* $Id: Global.cpp,v 1.21 2006/11/20 21:38:11 strk Exp $ */
+/* $Id: Global.cpp,v 1.22 2006/11/20 21:44:24 strk Exp $ */
#include "as_object.h"
#include "as_prop_flags.h"
@@ -414,11 +414,7 @@
set_member("LocalConnection", as_value(localconnection_new));
set_member("NetConnection", as_value(netconnection_new));
set_member("NetStream", as_value(netstream_new));
- set_member("SharedObject", as_value(sharedobject_new));
- set_member("Stage", as_value(stage_new));
set_member("System", as_value(system_new));
- set_member("TextSnapshot", as_value(textsnapshot_new));
- set_member("Video", as_value(video_new));
// ASSetPropFlags
set_member("ASSetPropFlags", as_global_assetpropflags);
// unescape
@@ -432,6 +428,10 @@
// isFinite
set_member("isFinite", as_global_isfinite);
+ textsnapshot_class_init(*this);
+ video_class_init(*this);
+ stage_class_init(*this);
+ sharedobject_class_init(*this);
selection_class_init(*this);
mouse_class_init(*this);
microphone_class_init(*this);
Index: server/asobj/SharedObject.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/SharedObject.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/asobj/SharedObject.cpp 29 Oct 2006 18:34:12 -0000 1.2
+++ server/asobj/SharedObject.cpp 20 Nov 2006 21:44:24 -0000 1.3
@@ -10,78 +10,110 @@
// 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 "config.h"
#endif
-#include "log.h"
#include "SharedObject.h"
+#include "as_object.h" // for inheritance
+#include "log.h"
#include "fn_call.h"
+#include "smart_ptr.h" // for boost intrusive_ptr
+#include "builtin_function.h" // need builtin_function
namespace gnash {
-SharedObject::SharedObject() {
-}
-
-SharedObject::~SharedObject() {
-}
+void sharedobject_clear(const fn_call& fn);
+void sharedobject_flush(const fn_call& fn);
+void sharedobject_getlocal(const fn_call& fn);
+void sharedobject_getsize(const fn_call& fn);
+void sharedobject_ctor(const fn_call& fn);
-
-void
-SharedObject::clear()
+static void
+attachSharedObjectInterface(as_object& o)
{
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ o.set_member("clear", &sharedobject_clear);
+ o.set_member("flush", &sharedobject_flush);
+ o.set_member("getlocal", &sharedobject_getlocal);
+ o.set_member("getsize", &sharedobject_getsize);
}
-void
-SharedObject::flush()
+static as_object*
+getSharedObjectInterface()
{
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ static boost::intrusive_ptr<as_object> o;
+ if ( ! o )
+ {
+ o = new as_object();
+ attachSharedObjectInterface(*o);
+ }
+ return o.get();
}
-void
-SharedObject::getLocal()
+class sharedobject_as_object: public as_object
{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-void
-SharedObject::getSize()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-void
-sharedobject_new(const fn_call& fn)
-{
- sharedobject_as_object *sharedobject_obj = new sharedobject_as_object;
+public:
- sharedobject_obj->set_member("clear", &sharedobject_clear);
- sharedobject_obj->set_member("flush", &sharedobject_flush);
- sharedobject_obj->set_member("getlocal", &sharedobject_getlocal);
- sharedobject_obj->set_member("getsize", &sharedobject_getsize);
+ sharedobject_as_object()
+ :
+ as_object(getSharedObjectInterface())
+ {}
+
+ // override from as_object ?
+ //const char* get_text_value() const { return "SharedObject"; }
+
+ // override from as_object ?
+ //double get_numeric_value() const { return 0; }
+};
- fn.result->set_as_object(sharedobject_obj);
-}
void sharedobject_clear(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void sharedobject_flush(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void sharedobject_getlocal(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void sharedobject_getsize(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
+}
+
+void
+sharedobject_ctor(const fn_call& fn)
+{
+ boost::intrusive_ptr<as_object> obj = new sharedobject_as_object;
+
+ fn.result->set_as_object(obj.get()); // will keep alive
}
-} // end of gnaash namespace
+// extern (used by Global.cpp)
+void sharedobject_class_init(as_object& global)
+{
+ // This is going to be the global SharedObject "class"/"function"
+ static boost::intrusive_ptr<builtin_function> cl;
+
+ if ( cl == NULL )
+ {
+ cl=new builtin_function(&sharedobject_ctor,
getSharedObjectInterface());
+ // replicate all interface to class, to be able to access
+ // all methods as static functions
+ attachSharedObjectInterface(*cl);
+
+ }
+
+ // Register _global.SharedObject
+ global.set_member("SharedObject", cl.get());
+
+}
+
+
+} // end of gnash namespace
Index: server/asobj/SharedObject.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/SharedObject.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/asobj/SharedObject.h 29 Oct 2006 18:34:12 -0000 1.4
+++ server/asobj/SharedObject.h 20 Nov 2006 21:44:24 -0000 1.5
@@ -10,52 +10,33 @@
// 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 __SHAREDOBJECT_H__
-#define __SHAREDOBJECT_H__
+#ifndef __GNASH_ASOBJ_SHAREDOBJECT_H__
+#define __GNASH_ASOBJ_SHAREDOBJECT_H__
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "impl.h"
+#include <memory> // for auto_ptr
namespace gnash {
-class SharedObject {
-public:
- SharedObject();
- ~SharedObject();
- void clear();
- void flush();
- void getLocal();
- void getSize();
-private:
- bool _data;
- bool _onStatus;
-};
-
-class sharedobject_as_object : public as_object
-{
-public:
- SharedObject obj;
-};
-
-void sharedobject_new(const fn_call& fn);
-void sharedobject_clear(const fn_call& fn);
-void sharedobject_flush(const fn_call& fn);
-void sharedobject_getlocal(const fn_call& fn);
-void sharedobject_getsize(const fn_call& fn);
+class as_object;
+
+/// Initialize the global SharedObject class
+void sharedobject_class_init(as_object& global);
+
+/// Return a SharedObject instance (in case the core lib needs it)
+//std::auto_ptr<as_object> init_sharedobject_instance();
} // end of gnash namespace
-// __SHAREDOBJECT_H__
+// __GNASH_ASOBJ_SHAREDOBJECT_H__
#endif
Index: server/asobj/Stage.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Stage.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/asobj/Stage.cpp 29 Oct 2006 18:34:12 -0000 1.2
+++ server/asobj/Stage.cpp 20 Nov 2006 21:44:24 -0000 1.3
@@ -10,58 +10,100 @@
// 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 "config.h"
#endif
-#include "log.h"
#include "Stage.h"
+#include "as_object.h" // for inheritance
+#include "log.h"
#include "fn_call.h"
+#include "smart_ptr.h" // for boost intrusive_ptr
+#include "builtin_function.h" // need builtin_function
namespace gnash {
-Stage::Stage() {
-}
+void stage_addlistener(const fn_call& fn);
+void stage_removelistener(const fn_call& fn);
+void stage_ctor(const fn_call& fn);
-Stage::~Stage() {
+static void
+attachStageInterface(as_object& o)
+{
+ o.set_member("addlistener", &stage_addlistener);
+ o.set_member("removelistener", &stage_removelistener);
}
+static as_object*
+getStageInterface()
+{
+ static boost::intrusive_ptr<as_object> o;
+ if ( ! o )
+ {
+ o = new as_object();
+ attachStageInterface(*o);
+ }
+ return o.get();
+}
-void
-Stage::addListener()
+class stage_as_object: public as_object
{
- log_msg("%s:unimplemented \n", __FUNCTION__);
+
+public:
+
+ stage_as_object()
+ :
+ as_object(getStageInterface())
+ {}
+
+ // override from as_object ?
+ //const char* get_text_value() const { return "Stage"; }
+
+ // override from as_object ?
+ //double get_numeric_value() const { return 0; }
+};
+
+void stage_addlistener(const fn_call& /*fn*/) {
+ log_warning("%s: unimplemented \n", __FUNCTION__);
+}
+void stage_removelistener(const fn_call& /*fn*/) {
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void
-Stage::removeListener()
+stage_ctor(const fn_call& fn)
{
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ boost::intrusive_ptr<as_object> obj = new stage_as_object;
+
+ fn.result->set_as_object(obj.get()); // will keep alive
}
-void
-stage_new(const fn_call& fn)
+
+// extern (used by Global.cpp)
+void stage_class_init(as_object& global)
{
- stage_as_object *stage_obj = new stage_as_object;
+ // This is going to be the global Stage "class"/"function"
+ static boost::intrusive_ptr<builtin_function> cl;
- stage_obj->set_member("addlistener", &stage_addlistener);
- stage_obj->set_member("removelistener", &stage_removelistener);
+ if ( cl == NULL )
+ {
+ cl=new builtin_function(&stage_ctor, getStageInterface());
+ // replicate all interface to class, to be able to access
+ // all methods as static functions
+ attachStageInterface(*cl);
+
+ }
+
+ // Register _global.Stage
+ global.set_member("Stage", cl.get());
- fn.result->set_as_object(stage_obj);
-}
-void stage_addlistener(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-void stage_removelistener(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
}
-} // end of gnaash namespace
+
+} // end of gnash namespace
Index: server/asobj/Stage.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Stage.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/asobj/Stage.h 29 Oct 2006 18:34:12 -0000 1.4
+++ server/asobj/Stage.h 20 Nov 2006 21:44:24 -0000 1.5
@@ -10,52 +10,33 @@
// 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 __STAGE_H__
-#define __STAGE_H__
+#ifndef __GNASH_ASOBJ_STAGE_H__
+#define __GNASH_ASOBJ_STAGE_H__
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "impl.h"
+#include <memory> // for auto_ptr
namespace gnash {
-class Stage {
-public:
- Stage();
- ~Stage();
- void addListener();
- void removeListener();
-private:
- bool _align;
- bool _height;
- bool _onResize;
- bool _scaleMode;
- bool _showMenu;
- bool _width;
-};
-
-class stage_as_object : public as_object
-{
-public:
- Stage obj;
-};
-
-void stage_new(const fn_call& fn);
-void stage_addlistener(const fn_call& fn);
-void stage_removelistener(const fn_call& fn);
+class as_object;
+
+/// Initialize the global Stage class
+void stage_class_init(as_object& global);
+
+/// Return a Stage instance (in case the core lib needs it)
+//std::auto_ptr<as_object> init_stage_instance();
} // end of gnash namespace
-// __STAGE_H__
+// __GNASH_ASOBJ_STAGE_H__
#endif
Index: server/asobj/Video.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Video.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/asobj/Video.cpp 29 Oct 2006 18:34:12 -0000 1.3
+++ server/asobj/Video.cpp 20 Nov 2006 21:44:24 -0000 1.4
@@ -10,62 +10,100 @@
// 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 "config.h"
#endif
-#include "log.h"
#include "Video.h"
+#include "as_object.h" // for inheritance
+#include "log.h"
#include "fn_call.h"
+#include "smart_ptr.h" // for boost intrusive_ptr
+#include "builtin_function.h" // need builtin_function
namespace gnash {
-Video::Video()
+void video_attachvideo(const fn_call& fn);
+void video_clear(const fn_call& fn);
+void video_ctor(const fn_call& fn);
+
+static void
+attachVideoInterface(as_object& o)
{
- GNASH_REPORT_FUNCTION;
+ o.set_member("attachvideo", &video_attachvideo);
+ o.set_member("clear", &video_clear);
}
-Video::~Video()
+static as_object*
+getVideoInterface()
{
- GNASH_REPORT_FUNCTION;
+ static boost::intrusive_ptr<as_object> o;
+ if ( ! o )
+ {
+ o = new as_object();
+ attachVideoInterface(*o);
+ }
+ return o.get();
}
-
-void
-Video::attach()
+class video_as_object: public as_object
{
- log_msg("%s: unimplemented \n", __PRETTY_FUNCTION__);
+
+public:
+
+ video_as_object()
+ :
+ as_object(getVideoInterface())
+ {}
+
+ // override from as_object ?
+ //const char* get_text_value() const { return "Video"; }
+
+ // override from as_object ?
+ //double get_numeric_value() const { return 0; }
+};
+
+void video_attachvideo(const fn_call& /*fn*/) {
+ log_warning("%s: unimplemented \n", __FUNCTION__);
+}
+void video_clear(const fn_call& /*fn*/) {
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void
-Video::clear()
+video_ctor(const fn_call& fn)
{
- log_msg("%s: unimplemented \n", __PRETTY_FUNCTION__);
+ boost::intrusive_ptr<as_object> obj = new video_as_object;
+
+ fn.result->set_as_object(obj.get()); // will keep alive
}
-void
-video_new(const fn_call& fn)
+
+// extern (used by Global.cpp)
+void video_class_init(as_object& global)
{
- video_as_object *video_obj = new video_as_object;
+ // This is going to be the global Video "class"/"function"
+ static boost::intrusive_ptr<builtin_function> cl;
- video_obj->set_member("attach", &video_attach);
- video_obj->set_member("clear", &video_clear);
+ if ( cl == NULL )
+ {
+ cl=new builtin_function(&video_ctor, getVideoInterface());
+ // replicate all interface to class, to be able to access
+ // all methods as static functions
+ attachVideoInterface(*cl);
+
+ }
+
+ // Register _global.Video
+ global.set_member("Video", cl.get());
- fn.result->set_as_object(video_obj);
-}
-void video_attach(const fn_call& /*fn*/) {
- log_msg("%s: unimplemented \n", __PRETTY_FUNCTION__);
-}
-void video_clear(const fn_call& /*fn*/) {
- log_msg("%s: unimplemented \n", __PRETTY_FUNCTION__);
}
-} // end of gnaash namespace
+
+} // end of gnash namespace
Index: server/asobj/Video.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Video.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/asobj/Video.h 29 Oct 2006 18:34:12 -0000 1.4
+++ server/asobj/Video.h 20 Nov 2006 21:44:24 -0000 1.5
@@ -10,50 +10,33 @@
// 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 __VIDEO_H__
-#define __VIDEO_H__
+#ifndef __GNASH_ASOBJ_VIDEO_H__
+#define __GNASH_ASOBJ_VIDEO_H__
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "impl.h"
+#include <memory> // for auto_ptr
namespace gnash {
-class Video {
-public:
- Video();
- ~Video();
- void attach();
- void clear();
-private:
- bool _deblocking;
- bool _height;
- bool _smoothing;
- bool _width;
-};
-
-class video_as_object : public as_object
-{
-public:
- Video obj;
-};
-
-void video_new(const fn_call& fn);
-void video_attach(const fn_call& fn);
-void video_clear(const fn_call& fn);
+class as_object;
+
+/// Initialize the global Video class
+void video_class_init(as_object& global);
+
+/// Return a Video instance (in case the core lib needs it)
+//std::auto_ptr<as_object> init_video_instance();
} // end of gnash namespace
-// __VIDEO_H__
+// __GNASH_ASOBJ_VIDEO_H__
#endif
Index: server/asobj/TextSnapshot.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/TextSnapshot.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/asobj/TextSnapshot.cpp 29 Oct 2006 18:34:12 -0000 1.2
+++ server/asobj/TextSnapshot.cpp 20 Nov 2006 21:44:24 -0000 1.3
@@ -10,118 +10,130 @@
// 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 "config.h"
#endif
-#include "log.h"
#include "TextSnapshot.h"
+#include "as_object.h" // for inheritance
+#include "log.h"
#include "fn_call.h"
+#include "smart_ptr.h" // for boost intrusive_ptr
+#include "builtin_function.h" // need builtin_function
namespace gnash {
-TextSnapshot::TextSnapshot() {
-}
-
-TextSnapshot::~TextSnapshot() {
-}
-
-
-void
-TextSnapshot::findText()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-
-void
-TextSnapshot::getCount()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-
-void
-TextSnapshot::getSelected()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-
-void
-TextSnapshot::getSelectedText()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-
-void
-TextSnapshot::getText()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
+void textsnapshot_findtext(const fn_call& fn);
+void textsnapshot_getcount(const fn_call& fn);
+void textsnapshot_getselected(const fn_call& fn);
+void textsnapshot_getselectedtext(const fn_call& fn);
+void textsnapshot_gettext(const fn_call& fn);
+void textsnapshot_hittesttextnearpos(const fn_call& fn);
+void textsnapshot_setselectcolor(const fn_call& fn);
+void textsnapshot_setselected(const fn_call& fn);
+void textsnapshot_ctor(const fn_call& fn);
+
+static void
+attachTextSnapshotInterface(as_object& o)
+{
+ o.set_member("findtext", &textsnapshot_findtext);
+ o.set_member("getcount", &textsnapshot_getcount);
+ o.set_member("getselected", &textsnapshot_getselected);
+ o.set_member("getselectedtext", &textsnapshot_getselectedtext);
+ o.set_member("gettext", &textsnapshot_gettext);
+ o.set_member("hittesttextnearpos", &textsnapshot_hittesttextnearpos);
+ o.set_member("setselectcolor", &textsnapshot_setselectcolor);
+ o.set_member("setselected", &textsnapshot_setselected);
+}
+
+static as_object*
+getTextSnapshotInterface()
+{
+ static boost::intrusive_ptr<as_object> o;
+ if ( ! o )
+ {
+ o = new as_object();
+ attachTextSnapshotInterface(*o);
+ }
+ return o.get();
+}
+
+class textsnapshot_as_object: public as_object
+{
+
+public:
+
+ textsnapshot_as_object()
+ :
+ as_object(getTextSnapshotInterface())
+ {}
+
+ // override from as_object ?
+ //const char* get_text_value() const { return "TextSnapshot"; }
+
+ // override from as_object ?
+ //double get_numeric_value() const { return 0; }
+};
-void
-TextSnapshot::hitTestTextNearPos()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-
-void
-TextSnapshot::setSelectColor()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-
-void
-TextSnapshot::setSelected()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-void
-textsnapshot_new(const fn_call& fn)
-{
- textsnapshot_as_object *textsnapshot_obj = new textsnapshot_as_object;
-
- textsnapshot_obj->set_member("findtext", &textsnapshot_findtext);
- textsnapshot_obj->set_member("getcount", &textsnapshot_getcount);
- textsnapshot_obj->set_member("getselected", &textsnapshot_getselected);
- textsnapshot_obj->set_member("getselectedtext",
&textsnapshot_getselectedtext);
- textsnapshot_obj->set_member("gettext", &textsnapshot_gettext);
- textsnapshot_obj->set_member("hittesttextnearpos",
&textsnapshot_hittesttextnearpos);
- textsnapshot_obj->set_member("setselectcolor",
&textsnapshot_setselectcolor);
- textsnapshot_obj->set_member("setselected", &textsnapshot_setselected);
-
- fn.result->set_as_object(textsnapshot_obj);
-}
void textsnapshot_findtext(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void textsnapshot_getcount(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void textsnapshot_getselected(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void textsnapshot_getselectedtext(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void textsnapshot_gettext(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void textsnapshot_hittesttextnearpos(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void textsnapshot_setselectcolor(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void textsnapshot_setselected(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
+}
+
+void
+textsnapshot_ctor(const fn_call& fn)
+{
+ boost::intrusive_ptr<as_object> obj = new textsnapshot_as_object;
+
+ fn.result->set_as_object(obj.get()); // will keep alive
+}
+
+// extern (used by Global.cpp)
+void textsnapshot_class_init(as_object& global)
+{
+ // This is going to be the global TextSnapshot "class"/"function"
+ static boost::intrusive_ptr<builtin_function> cl;
+
+ if ( cl == NULL )
+ {
+ cl=new builtin_function(&textsnapshot_ctor,
getTextSnapshotInterface());
+ // replicate all interface to class, to be able to access
+ // all methods as static functions
+ attachTextSnapshotInterface(*cl);
+
+ }
+
+ // Register _global.TextSnapshot
+ global.set_member("TextSnapshot", cl.get());
+
}
-} // end of gnaash namespace
+
+} // end of gnash namespace
Index: server/asobj/TextSnapshot.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/TextSnapshot.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/asobj/TextSnapshot.h 29 Oct 2006 18:34:12 -0000 1.4
+++ server/asobj/TextSnapshot.h 20 Nov 2006 21:44:24 -0000 1.5
@@ -10,58 +10,33 @@
// 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 __TEXTSNAPSHOT_H__
-#define __TEXTSNAPSHOT_H__
+#ifndef __GNASH_ASOBJ_TEXTSNAPSHOT_H__
+#define __GNASH_ASOBJ_TEXTSNAPSHOT_H__
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "impl.h"
+#include <memory> // for auto_ptr
namespace gnash {
-class TextSnapshot {
-public:
- TextSnapshot();
- ~TextSnapshot();
- void findText();
- void getCount();
- void getSelected();
- void getSelectedText();
- void getText();
- void hitTestTextNearPos();
- void setSelectColor();
- void setSelected();
-private:
-};
-
-class textsnapshot_as_object : public as_object
-{
-public:
- TextSnapshot obj;
-};
-
-void textsnapshot_new(const fn_call& fn);
-void textsnapshot_findtext(const fn_call& fn);
-void textsnapshot_getcount(const fn_call& fn);
-void textsnapshot_getselected(const fn_call& fn);
-void textsnapshot_getselectedtext(const fn_call& fn);
-void textsnapshot_gettext(const fn_call& fn);
-void textsnapshot_hittesttextnearpos(const fn_call& fn);
-void textsnapshot_setselectcolor(const fn_call& fn);
-void textsnapshot_setselected(const fn_call& fn);
+class as_object;
+
+/// Initialize the global TextSnapshot class
+void textsnapshot_class_init(as_object& global);
+
+/// Return a TextSnapshot instance (in case the core lib needs it)
+//std::auto_ptr<as_object> init_textsnapshot_instance();
} // end of gnash namespace
-// __TEXTSNAPSHOT_H__
+// __GNASH_ASOBJ_TEXTSNAPSHOT_H__
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/asobj/NetConnection.h se...,
Sandro Santilli <=