[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/asobj/Key.h server/asobj...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/asobj/Key.h server/asobj... |
Date: |
Mon, 20 Nov 2006 21:38:12 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 06/11/20 21:38:11
Modified files:
. : ChangeLog
server/asobj : Key.h LocalConnection.h Global.cpp Error.h
Error.cpp LoadVars.h LoadVars.cpp Microphone.h
Microphone.cpp Mouse.h Mouse.cpp Selection.h
Selection.cpp
Log message:
* server/asobj/: Key.h, LocalConnection.h:
streamlined headers inclusion.
* server/asobj: Global.cpp, Error.{h,cpp}, LoadVars.{h,cpp},
Microphone.{h,cpp}, Mouse.{cpp,h}, Selection.{cpp,h}:
ported ActionScript class stubs to new layout.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1678&r2=1.1679
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Key.h?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/LocalConnection.h?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Global.cpp?cvsroot=gnash&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Error.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Error.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/LoadVars.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/LoadVars.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Microphone.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Microphone.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Mouse.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Mouse.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Selection.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Selection.cpp?cvsroot=gnash&r1=1.2&r2=1.3
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1678
retrieving revision 1.1679
diff -u -b -r1.1678 -r1.1679
--- ChangeLog 20 Nov 2006 21:28:58 -0000 1.1678
+++ ChangeLog 20 Nov 2006 21:38:11 -0000 1.1679
@@ -1,5 +1,13 @@
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},
+ Microphone.{h,cpp}, Mouse.{cpp,h}, Selection.{cpp,h}:
+ ported ActionScript class stubs to new layout.
+
+2006-11-20 Sandro Santilli <address@hidden>
+
* server/asobj/Date.h: streamlined headers inclusion.
* server/asobj: Global.cpp, Camera.{h,cpp}, Color.{cpp,h},
ContextMenu.{h,cpp}, CustomActions.{cpp,h}:
Index: server/asobj/Key.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Key.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- server/asobj/Key.h 11 Nov 2006 22:44:54 -0000 1.8
+++ server/asobj/Key.h 20 Nov 2006 21:38:11 -0000 1.9
@@ -16,7 +16,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: Key.h,v 1.8 2006/11/11 22:44:54 strk Exp $ */
+/* $Id: Key.h,v 1.9 2006/11/20 21:38:11 strk Exp $ */
#ifndef __KEY_H__
#define __KEY_H__
@@ -26,8 +26,9 @@
#endif
#include "tu_config.h"
-#include "impl.h"
-//#include "as_object.h" // for inheritance
+#include "as_object.h" // for inheritance
+#include "fn_call.h"
+#include "gnash.h" // for gnash::key namespace
#ifdef WIN32
# undef _CONTROL
Index: server/asobj/LocalConnection.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/LocalConnection.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/asobj/LocalConnection.h 29 Oct 2006 18:34:12 -0000 1.6
+++ server/asobj/LocalConnection.h 20 Nov 2006 21:38:11 -0000 1.7
@@ -28,7 +28,9 @@
#include <string>
#include <map>
-#include "impl.h"
+#include "as_object.h" // for inheritance
+#include "fn_call.h"
+
#ifdef NETWORK_CONN
#include "network.h"
#else
Index: server/asobj/Global.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Global.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- server/asobj/Global.cpp 20 Nov 2006 21:28:58 -0000 1.20
+++ server/asobj/Global.cpp 20 Nov 2006 21:38:11 -0000 1.21
@@ -18,7 +18,7 @@
// Implementation of the Global ActionScript Object
-/* $Id: Global.cpp,v 1.20 2006/11/20 21:28:58 strk Exp $ */
+/* $Id: Global.cpp,v 1.21 2006/11/20 21:38:11 strk Exp $ */
#include "as_object.h"
#include "as_prop_flags.h"
@@ -405,21 +405,15 @@
#ifdef HAVE_LIBXML
set_member("XML", as_value(xml_new));
set_member("XMLNode", as_value(xmlnode_new));
- //set_member("XML", as_value(xmlsocket_xml_new));
set_member("XMLSocket", as_value(xmlsocket_new));
#endif // HAVE_LIBXML
- //set_member("String", as_value(string_ctor));
+
// This next set are all the unimplemented classes whose
// code was machine generated.
set_member("Date", as_value(date_new));
- set_member("Error", as_value(error_new));
- set_member("LoadVars", as_value(loadvars_new));
set_member("LocalConnection", as_value(localconnection_new));
- set_member("Microphone", as_value(microphone_new));
- set_member("Mouse", as_value(mouse_new));
set_member("NetConnection", as_value(netconnection_new));
set_member("NetStream", as_value(netstream_new));
- set_member("Selection", as_value(selection_new));
set_member("SharedObject", as_value(sharedobject_new));
set_member("Stage", as_value(stage_new));
set_member("System", as_value(system_new));
@@ -438,6 +432,11 @@
// isFinite
set_member("isFinite", as_global_isfinite);
+ selection_class_init(*this);
+ mouse_class_init(*this);
+ microphone_class_init(*this);
+ loadvars_class_init(*this);
+ error_class_init(*this);
customactions_class_init(*this);
contextmenu_class_init(*this);
color_class_init(*this);
Index: server/asobj/Error.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Error.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/asobj/Error.h 29 Oct 2006 18:34:12 -0000 1.4
+++ server/asobj/Error.h 20 Nov 2006 21:38:11 -0000 1.5
@@ -10,46 +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 __ERROR_H__
-#define __ERROR_H__
+#ifndef __GNASH_ASOBJ_ERROR_H__
+#define __GNASH_ASOBJ_ERROR_H__
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "impl.h"
+#include <memory> // for auto_ptr
namespace gnash {
-class Error {
-public:
- Error();
- ~Error();
- void toString();
-private:
- bool _message;
- bool _name;
-};
-
-class error_as_object : public as_object
-{
-public:
- Error obj;
-};
+class as_object;
+
+/// Initialize the global Error class
+void error_class_init(as_object& global);
-void error_new(const fn_call& fn);
-void error_tostring(const fn_call& fn);
+/// Return a Error instance (in case the core lib needs it)
+//std::auto_ptr<as_object> init_error_instance();
} // end of gnash namespace
-// __ERROR_H__
+// __GNASH_ASOBJ_ERROR_H__
#endif
Index: server/asobj/Error.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Error.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/asobj/Error.cpp 29 Oct 2006 18:34:12 -0000 1.2
+++ server/asobj/Error.cpp 20 Nov 2006 21:38:11 -0000 1.3
@@ -10,48 +10,95 @@
// 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 "Error.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 {
-Error::Error() {
+void error_tostring(const fn_call& fn);
+void error_ctor(const fn_call& fn);
+
+static void
+attachErrorInterface(as_object& o)
+{
+ o.set_member("tostring", &error_tostring);
}
-Error::~Error() {
+static as_object*
+getErrorInterface()
+{
+ static boost::intrusive_ptr<as_object> o;
+ if ( ! o )
+ {
+ o = new as_object();
+ attachErrorInterface(*o);
+ }
+ return o.get();
}
+class error_as_object: public as_object
+{
+
+public:
+
+ error_as_object()
+ :
+ as_object(getErrorInterface())
+ {}
+
+ // override from as_object ?
+ //const char* get_text_value() const { return "Error"; }
+
+ // override from as_object ?
+ //double get_numeric_value() const { return 0; }
+};
+
+void error_tostring(const fn_call& /*fn*/) {
+ log_warning("%s: unimplemented \n", __FUNCTION__);
+}
void
-Error::toString()
+error_ctor(const fn_call& fn)
{
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ boost::intrusive_ptr<as_object> obj = new error_as_object;
+
+ fn.result->set_as_object(obj.get()); // will keep alive
}
-void
-error_new(const fn_call& fn)
+
+// extern (used by Global.cpp)
+void error_class_init(as_object& global)
{
- error_as_object *error_obj = new error_as_object;
+ // This is going to be the global Error "class"/"function"
+ static boost::intrusive_ptr<builtin_function> cl;
- error_obj->set_member("tostring", &error_tostring);
+ if ( cl == NULL )
+ {
+ cl=new builtin_function(&error_ctor, getErrorInterface());
+ // replicate all interface to class, to be able to access
+ // all methods as static functions
+ attachErrorInterface(*cl);
+
+ }
+
+ // Register _global.Error
+ global.set_member("Error", cl.get());
- fn.result->set_as_object(error_obj);
-}
-void error_tostring(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
}
+
} // end of gnash namespace
Index: server/asobj/LoadVars.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/LoadVars.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/asobj/LoadVars.h 29 Oct 2006 18:34:12 -0000 1.4
+++ server/asobj/LoadVars.h 20 Nov 2006 21:38:11 -0000 1.5
@@ -10,62 +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 __LOADVARS_H__
-#define __LOADVARS_H__
+#ifndef __GNASH_ASOBJ_LOADVARS_H__
+#define __GNASH_ASOBJ_LOADVARS_H__
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "impl.h"
+#include <memory> // for auto_ptr
namespace gnash {
-class LoadVars {
-public:
- LoadVars();
- ~LoadVars();
- void addRequestHeader();
- void decode();
- void getBytesLoaded();
- void getBytesTotal();
- void load();
- void send();
- void sendAndLoad();
- void toString();
-private:
- bool _contentType;
- bool _loaded;
- bool _onData;
- bool _onLoad;
-};
-
-class loadvars_as_object : public as_object
-{
-public:
- LoadVars obj;
-};
-
-void loadvars_new(const fn_call& fn);
-void loadvars_addrequestheader(const fn_call& fn);
-void loadvars_decode(const fn_call& fn);
-void loadvars_getbytesloaded(const fn_call& fn);
-void loadvars_getbytestotal(const fn_call& fn);
-void loadvars_load(const fn_call& fn);
-void loadvars_send(const fn_call& fn);
-void loadvars_sendandload(const fn_call& fn);
-void loadvars_tostring(const fn_call& fn);
+class as_object;
+
+/// Initialize the global LoadVars class
+void loadvars_class_init(as_object& global);
+
+/// Return a LoadVars instance (in case the core lib needs it)
+//std::auto_ptr<as_object> init_loadvars_instance();
} // end of gnash namespace
-// __LOADVARS_H__
+// __GNASH_ASOBJ_LOADVARS_H__
#endif
Index: server/asobj/LoadVars.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/LoadVars.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/asobj/LoadVars.cpp 29 Oct 2006 18:34:12 -0000 1.2
+++ server/asobj/LoadVars.cpp 20 Nov 2006 21:38:11 -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 "LoadVars.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 {
-LoadVars::LoadVars() {
-}
-
-LoadVars::~LoadVars() {
-}
-
-
-void
-LoadVars::addRequestHeader()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-
-void
-LoadVars::decode()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-
-void
-LoadVars::getBytesLoaded()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-
-void
-LoadVars::getBytesTotal()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-
-void
-LoadVars::load()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
+void loadvars_addrequestheader(const fn_call& fn);
+void loadvars_decode(const fn_call& fn);
+void loadvars_getbytesloaded(const fn_call& fn);
+void loadvars_getbytestotal(const fn_call& fn);
+void loadvars_load(const fn_call& fn);
+void loadvars_send(const fn_call& fn);
+void loadvars_sendandload(const fn_call& fn);
+void loadvars_tostring(const fn_call& fn);
+void loadvars_ctor(const fn_call& fn);
+
+static void
+attachLoadVarsInterface(as_object& o)
+{
+ o.set_member("addrequestheader", &loadvars_addrequestheader);
+ o.set_member("decode", &loadvars_decode);
+ o.set_member("getbytesloaded", &loadvars_getbytesloaded);
+ o.set_member("getbytestotal", &loadvars_getbytestotal);
+ o.set_member("load", &loadvars_load);
+ o.set_member("send", &loadvars_send);
+ o.set_member("sendandload", &loadvars_sendandload);
+ o.set_member("tostring", &loadvars_tostring);
+}
+
+static as_object*
+getLoadVarsInterface()
+{
+ static boost::intrusive_ptr<as_object> o;
+ if ( ! o )
+ {
+ o = new as_object();
+ attachLoadVarsInterface(*o);
+ }
+ return o.get();
+}
+
+class loadvars_as_object: public as_object
+{
+
+public:
+
+ loadvars_as_object()
+ :
+ as_object(getLoadVarsInterface())
+ {}
+
+ // override from as_object ?
+ //const char* get_text_value() const { return "LoadVars"; }
+
+ // override from as_object ?
+ //double get_numeric_value() const { return 0; }
+};
-void
-LoadVars::send()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-
-void
-LoadVars::sendAndLoad()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-
-void
-LoadVars::toString()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-void
-loadvars_new(const fn_call& fn)
-{
- loadvars_as_object *loadvars_obj = new loadvars_as_object;
-
- loadvars_obj->set_member("addrequestheader", &loadvars_addrequestheader);
- loadvars_obj->set_member("decode", &loadvars_decode);
- loadvars_obj->set_member("getbytesloaded", &loadvars_getbytesloaded);
- loadvars_obj->set_member("getbytestotal", &loadvars_getbytestotal);
- loadvars_obj->set_member("load", &loadvars_load);
- loadvars_obj->set_member("send", &loadvars_send);
- loadvars_obj->set_member("sendandload", &loadvars_sendandload);
- loadvars_obj->set_member("tostring", &loadvars_tostring);
-
- fn.result->set_as_object(loadvars_obj);
-}
void loadvars_addrequestheader(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void loadvars_decode(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void loadvars_getbytesloaded(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void loadvars_getbytestotal(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void loadvars_load(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void loadvars_send(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void loadvars_sendandload(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void loadvars_tostring(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
+}
+
+void
+loadvars_ctor(const fn_call& fn)
+{
+ boost::intrusive_ptr<as_object> obj = new loadvars_as_object;
+
+ fn.result->set_as_object(obj.get()); // will keep alive
+}
+
+// extern (used by Global.cpp)
+void loadvars_class_init(as_object& global)
+{
+ // This is going to be the global LoadVars "class"/"function"
+ static boost::intrusive_ptr<builtin_function> cl;
+
+ if ( cl == NULL )
+ {
+ cl=new builtin_function(&loadvars_ctor, getLoadVarsInterface());
+ // replicate all interface to class, to be able to access
+ // all methods as static functions
+ attachLoadVarsInterface(*cl);
+
+ }
+
+ // Register _global.LoadVars
+ global.set_member("LoadVars", cl.get());
+
}
-} // end of gnaash namespace
+
+} // end of gnash namespace
Index: server/asobj/Microphone.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Microphone.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/asobj/Microphone.h 29 Oct 2006 18:34:12 -0000 1.4
+++ server/asobj/Microphone.h 20 Nov 2006 21:38:11 -0000 1.5
@@ -10,64 +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 __MICROPHONE_H__
-#define __MICROPHONE_H__
+#ifndef __GNASH_ASOBJ_MICROPHONE_H__
+#define __GNASH_ASOBJ_MICROPHONE_H__
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "impl.h"
+#include <memory> // for auto_ptr
namespace gnash {
-class Microphone {
-public:
- Microphone();
- ~Microphone();
- void get();
- void setGain();
- void setRate();
- void setSilenceLevel();
- void setUseEchoSuppression();
-private:
- bool _activityLevel;
- bool _gain;
- bool _index;
- bool _muted;
- bool _name;
- bool _names;
- bool _onActivity;
- bool _onStatus;
- bool _rate;
- bool _silenceLevel;
- bool _silenceTimeOut;
- bool _useEchoSuppression;
-};
-
-class microphone_as_object : public as_object
-{
-public:
- Microphone obj;
-};
-
-void microphone_new(const fn_call& fn);
-void microphone_get(const fn_call& fn);
-void microphone_setgain(const fn_call& fn);
-void microphone_setrate(const fn_call& fn);
-void microphone_setsilencelevel(const fn_call& fn);
-void microphone_setuseechosuppression(const fn_call& fn);
+class as_object;
+
+/// Initialize the global Microphone class
+void microphone_class_init(as_object& global);
+
+/// Return a Microphone instance (in case the core lib needs it)
+//std::auto_ptr<as_object> init_microphone_instance();
} // end of gnash namespace
-// __MICROPHONE_H__
+// __GNASH_ASOBJ_MICROPHONE_H__
#endif
Index: server/asobj/Microphone.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Microphone.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/asobj/Microphone.cpp 29 Oct 2006 18:34:12 -0000 1.2
+++ server/asobj/Microphone.cpp 20 Nov 2006 21:38:11 -0000 1.3
@@ -10,88 +10,115 @@
// 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 "Microphone.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 {
-Microphone::Microphone() {
-}
-
-Microphone::~Microphone() {
-}
-
+void microphone_get(const fn_call& fn);
+void microphone_setgain(const fn_call& fn);
+void microphone_setrate(const fn_call& fn);
+void microphone_setsilencelevel(const fn_call& fn);
+void microphone_setuseechosuppression(const fn_call& fn);
+void microphone_ctor(const fn_call& fn);
-void
-Microphone::get()
+static void
+attachMicrophoneInterface(as_object& o)
{
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ o.set_member("get", µphone_get);
+ o.set_member("setgain", µphone_setgain);
+ o.set_member("setrate", µphone_setrate);
+ o.set_member("setsilencelevel", µphone_setsilencelevel);
+ o.set_member("setuseechosuppression",
µphone_setuseechosuppression);
}
-void
-Microphone::setGain()
+static as_object*
+getMicrophoneInterface()
{
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ static boost::intrusive_ptr<as_object> o;
+ if ( ! o )
+ {
+ o = new as_object();
+ attachMicrophoneInterface(*o);
+ }
+ return o.get();
}
-void
-Microphone::setRate()
+class microphone_as_object: public as_object
{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-void
-Microphone::setSilenceLevel()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
+public:
-void
-Microphone::setUseEchoSuppression()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-void
-microphone_new(const fn_call& fn)
-{
- microphone_as_object *microphone_obj = new microphone_as_object;
+ microphone_as_object()
+ :
+ as_object(getMicrophoneInterface())
+ {}
- microphone_obj->set_member("get", µphone_get);
- microphone_obj->set_member("setgain", µphone_setgain);
- microphone_obj->set_member("setrate", µphone_setrate);
- microphone_obj->set_member("setsilencelevel", µphone_setsilencelevel);
- microphone_obj->set_member("setuseechosuppression",
µphone_setuseechosuppression);
+ // override from as_object ?
+ //const char* get_text_value() const { return "Microphone"; }
+
+ // override from as_object ?
+ //double get_numeric_value() const { return 0; }
+};
- fn.result->set_as_object(microphone_obj);
-}
void microphone_get(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void microphone_setgain(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void microphone_setrate(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void microphone_setsilencelevel(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void microphone_setuseechosuppression(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
+}
+
+void
+microphone_ctor(const fn_call& fn)
+{
+ boost::intrusive_ptr<as_object> obj = new microphone_as_object;
+
+ fn.result->set_as_object(obj.get()); // will keep alive
}
-} // end of gnaash namespace
+// extern (used by Global.cpp)
+void microphone_class_init(as_object& global)
+{
+ // This is going to be the global Microphone "class"/"function"
+ static boost::intrusive_ptr<builtin_function> cl;
+
+ if ( cl == NULL )
+ {
+ cl=new builtin_function(µphone_ctor,
getMicrophoneInterface());
+ // replicate all interface to class, to be able to access
+ // all methods as static functions
+ attachMicrophoneInterface(*cl);
+
+ }
+
+ // Register _global.Microphone
+ global.set_member("Microphone", cl.get());
+
+}
+
+
+} // end of gnash namespace
Index: server/asobj/Mouse.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Mouse.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/asobj/Mouse.h 29 Oct 2006 18:34:12 -0000 1.4
+++ server/asobj/Mouse.h 20 Nov 2006 21:38:11 -0000 1.5
@@ -10,54 +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 __MOUSE_H__
-#define __MOUSE_H__
+#ifndef __GNASH_ASOBJ_MOUSE_H__
+#define __GNASH_ASOBJ_MOUSE_H__
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "impl.h"
+#include <memory> // for auto_ptr
namespace gnash {
-class Mouse {
-public:
- Mouse();
- ~Mouse();
- void addListener();
- void hide();
- void removeListener();
- void show();
-private:
- bool _onown;
- bool _onove;
- bool _onp;
- bool _onheel;
-};
-
-class mouse_as_object : public as_object
-{
-public:
- Mouse obj;
-};
-
-void mouse_new(const fn_call& fn);
-void mouse_addlistener(const fn_call& fn);
-void mouse_hide(const fn_call& fn);
-void mouse_removelistener(const fn_call& fn);
-void mouse_show(const fn_call& fn);
+class as_object;
+
+/// Initialize the global Mouse class
+void mouse_class_init(as_object& global);
+
+/// Return a Mouse instance (in case the core lib needs it)
+//std::auto_ptr<as_object> init_mouse_instance();
} // end of gnash namespace
-// __MOUSE_H__
+// __GNASH_ASOBJ_MOUSE_H__
#endif
Index: server/asobj/Mouse.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Mouse.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/asobj/Mouse.cpp 29 Oct 2006 18:34:12 -0000 1.2
+++ server/asobj/Mouse.cpp 20 Nov 2006 21:38:11 -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 "Mouse.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 {
-Mouse::Mouse() {
-}
-
-Mouse::~Mouse() {
-}
+void mouse_addlistener(const fn_call& fn);
+void mouse_hide(const fn_call& fn);
+void mouse_removelistener(const fn_call& fn);
+void mouse_show(const fn_call& fn);
+void mouse_ctor(const fn_call& fn);
-
-void
-Mouse::addListener()
+static void
+attachMouseInterface(as_object& o)
{
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ o.set_member("addlistener", &mouse_addlistener);
+ o.set_member("hide", &mouse_hide);
+ o.set_member("removelistener", &mouse_removelistener);
+ o.set_member("show", &mouse_show);
}
-void
-Mouse::hide()
+static as_object*
+getMouseInterface()
{
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ static boost::intrusive_ptr<as_object> o;
+ if ( ! o )
+ {
+ o = new as_object();
+ attachMouseInterface(*o);
+ }
+ return o.get();
}
-void
-Mouse::removeListener()
+class mouse_as_object: public as_object
{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-void
-Mouse::show()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-void
-mouse_new(const fn_call& fn)
-{
- mouse_as_object *mouse_obj = new mouse_as_object;
+public:
- mouse_obj->set_member("addlistener", &mouse_addlistener);
- mouse_obj->set_member("hide", &mouse_hide);
- mouse_obj->set_member("removelistener", &mouse_removelistener);
- mouse_obj->set_member("show", &mouse_show);
+ mouse_as_object()
+ :
+ as_object(getMouseInterface())
+ {}
+
+ // override from as_object ?
+ //const char* get_text_value() const { return "Mouse"; }
+
+ // override from as_object ?
+ //double get_numeric_value() const { return 0; }
+};
- fn.result->set_as_object(mouse_obj);
-}
void mouse_addlistener(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void mouse_hide(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void mouse_removelistener(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void mouse_show(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ log_warning("%s: unimplemented \n", __FUNCTION__);
+}
+
+void
+mouse_ctor(const fn_call& fn)
+{
+ boost::intrusive_ptr<as_object> obj = new mouse_as_object;
+
+ fn.result->set_as_object(obj.get()); // will keep alive
}
-} // end of gnaash namespace
+// extern (used by Global.cpp)
+void mouse_class_init(as_object& global)
+{
+ // This is going to be the global Mouse "class"/"function"
+ static boost::intrusive_ptr<builtin_function> cl;
+
+ if ( cl == NULL )
+ {
+ cl=new builtin_function(&mouse_ctor, getMouseInterface());
+ // replicate all interface to class, to be able to access
+ // all methods as static functions
+ attachMouseInterface(*cl);
+
+ }
+
+ // Register _global.Mouse
+ global.set_member("Mouse", cl.get());
+
+}
+
+
+} // end of gnash namespace
Index: server/asobj/Selection.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Selection.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/asobj/Selection.h 29 Oct 2006 18:34:12 -0000 1.4
+++ server/asobj/Selection.h 20 Nov 2006 21:38:11 -0000 1.5
@@ -10,57 +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 __SELECTION_H__
-#define __SELECTION_H__
+#ifndef __GNASH_ASOBJ_SELECTION_H__
+#define __GNASH_ASOBJ_SELECTION_H__
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "impl.h"
+#include <memory> // for auto_ptr
namespace gnash {
-class Selection {
-public:
- Selection();
- ~Selection();
- void addListener();
- void getBeginIndex();
- void getCaretIndex();
- void getEndIndex();
- void getFocus();
- void removeListener();
- void setFocus();
-private:
- bool _onSetFocus;
-};
-
-class selection_as_object : public as_object
-{
-public:
- Selection obj;
-};
-
-void selection_new(const fn_call& fn);
-void selection_addlistener(const fn_call& fn);
-void selection_getbeginindex(const fn_call& fn);
-void selection_getcaretindex(const fn_call& fn);
-void selection_getendindex(const fn_call& fn);
-void selection_getfocus(const fn_call& fn);
-void selection_removelistener(const fn_call& fn);
-void selection_setfocus(const fn_call& fn);
+class as_object;
+
+/// Initialize the global Selection class
+void selection_class_init(as_object& global);
+
+/// Return a Selection instance (in case the core lib needs it)
+//std::auto_ptr<as_object> init_selection_instance();
} // end of gnash namespace
-// __SELECTION_H__
+// __GNASH_ASOBJ_SELECTION_H__
#endif
Index: server/asobj/Selection.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Selection.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/asobj/Selection.cpp 29 Oct 2006 18:34:12 -0000 1.2
+++ server/asobj/Selection.cpp 20 Nov 2006 21:38:11 -0000 1.3
@@ -10,109 +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 "Selection.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 {
-Selection::Selection() {
-}
+void selection_addlistener(const fn_call& fn);
+void selection_getbeginindex(const fn_call& fn);
+void selection_getcaretindex(const fn_call& fn);
+void selection_getendindex(const fn_call& fn);
+void selection_getfocus(const fn_call& fn);
+void selection_removelistener(const fn_call& fn);
+void selection_setfocus(const fn_call& fn);
+void selection_setselection(const fn_call& fn);
+void selection_ctor(const fn_call& fn);
+
+static void
+attachSelectionInterface(as_object& o)
+{
+ o.set_member("addlistener", &selection_addlistener);
+ o.set_member("getbeginindex", &selection_getbeginindex);
+ o.set_member("getcaretindex", &selection_getcaretindex);
+ o.set_member("getendindex", &selection_getendindex);
+ o.set_member("getfocus", &selection_getfocus);
+ o.set_member("removelistener", &selection_removelistener);
+ o.set_member("setfocus", &selection_setfocus);
+ o.set_member("setselection", &selection_setselection);
+}
+
+static as_object*
+getSelectionInterface()
+{
+ static boost::intrusive_ptr<as_object> o;
+ if ( ! o )
+ {
+ o = new as_object();
+ attachSelectionInterface(*o);
+ }
+ return o.get();
+}
+
+class selection_as_object: public as_object
+{
+
+public:
+
+ selection_as_object()
+ :
+ as_object(getSelectionInterface())
+ {}
+
+ // override from as_object ?
+ //const char* get_text_value() const { return "Selection"; }
+
+ // override from as_object ?
+ //double get_numeric_value() const { return 0; }
+};
-Selection::~Selection() {
+void selection_addlistener(const fn_call& /*fn*/) {
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
-
-
-void
-Selection::addListener()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
+void selection_getbeginindex(const fn_call& /*fn*/) {
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
-
-void
-Selection::getBeginIndex()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
+void selection_getcaretindex(const fn_call& /*fn*/) {
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
-
-void
-Selection::getCaretIndex()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
+void selection_getendindex(const fn_call& /*fn*/) {
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
-
-void
-Selection::getEndIndex()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
+void selection_getfocus(const fn_call& /*fn*/) {
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
-
-void
-Selection::getFocus()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
+void selection_removelistener(const fn_call& /*fn*/) {
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
-
-void
-Selection::removeListener()
-{
- log_msg("%s:unimplemented \n", __FUNCTION__);
+void selection_setfocus(const fn_call& /*fn*/) {
+ log_warning("%s: unimplemented \n", __FUNCTION__);
+}
+void selection_setselection(const fn_call& /*fn*/) {
+ log_warning("%s: unimplemented \n", __FUNCTION__);
}
void
-Selection::setFocus()
+selection_ctor(const fn_call& fn)
{
- log_msg("%s:unimplemented \n", __FUNCTION__);
+ boost::intrusive_ptr<as_object> obj = new selection_as_object;
+
+ fn.result->set_as_object(obj.get()); // will keep alive
}
-void
-selection_new(const fn_call& fn)
+// extern (used by Global.cpp)
+void selection_class_init(as_object& global)
{
- selection_as_object *selection_obj = new selection_as_object;
+ // This is going to be the global Selection "class"/"function"
+ static boost::intrusive_ptr<builtin_function> cl;
- selection_obj->set_member("addlistener", &selection_addlistener);
- selection_obj->set_member("getbeginindex", &selection_getbeginindex);
- selection_obj->set_member("getcaretindex", &selection_getcaretindex);
- selection_obj->set_member("getendindex", &selection_getendindex);
- selection_obj->set_member("getfocus", &selection_getfocus);
- selection_obj->set_member("removelistener", &selection_removelistener);
- selection_obj->set_member("setfocus", &selection_setfocus);
+ if ( cl == NULL )
+ {
+ cl=new builtin_function(&selection_ctor,
getSelectionInterface());
+ // replicate all interface to class, to be able to access
+ // all methods as static functions
+ attachSelectionInterface(*cl);
+
+ }
+
+ // Register _global.Selection
+ global.set_member("Selection", cl.get());
- fn.result->set_as_object(selection_obj);
-}
-void selection_addlistener(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-void selection_getbeginindex(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-void selection_getcaretindex(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-void selection_getendindex(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-void selection_getfocus(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-void selection_removelistener(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
-}
-void selection_setfocus(const fn_call& /*fn*/) {
- log_msg("%s:unimplemented \n", __FUNCTION__);
}
-} // end of gnaash namespace
+
+} // end of gnash namespace
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/asobj/Key.h server/asobj...,
Sandro Santilli <=