[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ./ChangeLog server/Boolean.cpp server/Cam...
From: |
strk |
Subject: |
[Gnash-commit] gnash ./ChangeLog server/Boolean.cpp server/Cam... |
Date: |
Mon, 13 Feb 2006 10:44:13 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Branch:
Changes by: strk <address@hidden> 06/02/13 10:44:12
Modified files:
. : ChangeLog
server : Boolean.cpp Camera.cpp Color.cpp
ContextMenu.cpp CustomActions.cpp Date.cpp
Error.cpp Function.cpp Function.h LoadVars.cpp
LocalConnection.cpp Makefile.am Microphone.cpp
Mouse.cpp MovieClipLoader.cpp NetConnection.cpp
NetStream.cpp Object.cpp Selection.cpp
SharedObject.cpp Sprite.cpp Sprite.h Stage.cpp
System.cpp TextSnapshot.cpp Video.cpp
action.cpp action.h array.cpp gnash.h
string.cpp textformat.cpp xml.cpp xml.h
xmlnode.cpp xmlsocket.cpp xmlsocket.h
testsuite/actionscript.all: Makefile.am xtrace.as
Added files:
server : Object.h
testsuite/actionscript.all: Inheritance.as
Log message:
* testsuite/actionscript.all/xtrace.as: trace window enlarged.
* testsuite/actionscript.all/Inheritance.as: inheritance test
* server/Object.h: new header file for definitions from as_object up to
as_value (will split again at sometime). gnash::as_object_interface
class
definition merged with gnash::as_object, now directly derived from
gnash::resource.
* server/action.cpp: doActionEquals and doActionStrictEquals private
action_buffer methods. Made as_value::to_object valid for AS_FUNCTION
value types
* server/Function.{cpp,h}: Made 'Function' an AS_FUNCTION to allow for
'prototype' based inheritance.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/ChangeLog.diff?tr1=1.129&tr2=1.130&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Boolean.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Camera.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Color.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/ContextMenu.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/CustomActions.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Date.cpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Error.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Function.cpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Function.h.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/LoadVars.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/LocalConnection.cpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Makefile.am.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Microphone.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Mouse.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/MovieClipLoader.cpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/NetConnection.cpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/NetStream.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Object.cpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Object.h?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Selection.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/SharedObject.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Sprite.cpp.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Sprite.h.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Stage.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/System.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/TextSnapshot.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Video.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/action.cpp.diff?tr1=1.44&tr2=1.45&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/action.h.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/array.cpp.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/gnash.h.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/string.cpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/textformat.cpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/xml.cpp.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/xml.h.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/xmlnode.cpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/xmlsocket.cpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/xmlsocket.h.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/testsuite/actionscript.all/Inheritance.as?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/testsuite/actionscript.all/Makefile.am.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/testsuite/actionscript.all/xtrace.as.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: gnash/ChangeLog
diff -u gnash/ChangeLog:1.129 gnash/ChangeLog:1.130
--- gnash/ChangeLog:1.129 Mon Feb 13 06:14:28 2006
+++ gnash/ChangeLog Mon Feb 13 10:44:11 2006
@@ -1,3 +1,18 @@
+2006-02-13 Sandro Santilli <address@hidden>
+
+ * testsuite/actionscript.all/xtrace.as: trace window enlarged.
+ * testsuite/actionscript.all/Inheritance.as: inheritance test
+ * server/Object.h: new header file for definitions from as_object up to
+ as_value (will split again at sometime). gnash::as_object_interface
class
+ definition merged with gnash::as_object, now directly derived from
+ gnash::resource.
+ * server/action.cpp: doActionEquals and doActionStrictEquals private
+ action_buffer methods. Made as_value::to_object valid for AS_FUNCTION
+ value types
+ * server/Function.{cpp,h}: Made 'Function' an AS_FUNCTION to allow for
+ 'prototype' based inheritance.
+
+
2006-02-09 Michael Carlson <address@hidden>
* server/action.cpp: Fix silly '!' that breaks _global.isfinite
Index: gnash/server/Boolean.cpp
diff -u gnash/server/Boolean.cpp:1.1 gnash/server/Boolean.cpp:1.2
--- gnash/server/Boolean.cpp:1.1 Wed Feb 1 23:52:44 2006
+++ gnash/server/Boolean.cpp Mon Feb 13 10:44:11 2006
@@ -51,7 +51,7 @@
boolean_obj->set_member("tostring", &boolean_tostring);
boolean_obj->set_member("valueof", &boolean_valueof);
- fn.result->set_as_object_interface(boolean_obj);
+ fn.result->set_as_object(boolean_obj);
}
void boolean_tostring(const fn_call& fn) {
log_msg("%s:unimplemented \n", __FUNCTION__);
Index: gnash/server/Camera.cpp
diff -u gnash/server/Camera.cpp:1.1 gnash/server/Camera.cpp:1.2
--- gnash/server/Camera.cpp:1.1 Wed Feb 1 23:52:44 2006
+++ gnash/server/Camera.cpp Mon Feb 13 10:44:11 2006
@@ -65,7 +65,7 @@
camera_obj->set_member("setmotionlevel", &camera_setmotionlevel);
camera_obj->set_member("setquality", &camera_setquality);
- fn.result->set_as_object_interface(camera_obj);
+ fn.result->set_as_object(camera_obj);
}
void camera_get(const fn_call& fn) {
log_msg("%s:unimplemented \n", __FUNCTION__);
Index: gnash/server/Color.cpp
diff -u gnash/server/Color.cpp:1.1 gnash/server/Color.cpp:1.2
--- gnash/server/Color.cpp:1.1 Wed Feb 1 23:52:44 2006
+++ gnash/server/Color.cpp Mon Feb 13 10:44:12 2006
@@ -65,7 +65,7 @@
color_obj->set_member("setrgb", &color_setrgb);
color_obj->set_member("settransform", &color_settransform);
- fn.result->set_as_object_interface(color_obj);
+ fn.result->set_as_object(color_obj);
}
void color_getrgb(const fn_call& fn) {
log_msg("%s:unimplemented \n", __FUNCTION__);
Index: gnash/server/ContextMenu.cpp
diff -u gnash/server/ContextMenu.cpp:1.1 gnash/server/ContextMenu.cpp:1.2
--- gnash/server/ContextMenu.cpp:1.1 Wed Feb 1 23:52:44 2006
+++ gnash/server/ContextMenu.cpp Mon Feb 13 10:44:12 2006
@@ -51,7 +51,7 @@
contextmenu_obj->set_member("copy", &contextmenu_copy);
contextmenu_obj->set_member("hidebuiltinitems",
&contextmenu_hidebuiltinitems);
- fn.result->set_as_object_interface(contextmenu_obj);
+ fn.result->set_as_object(contextmenu_obj);
}
void contextmenu_copy(const fn_call& fn) {
log_msg("%s:unimplemented \n", __FUNCTION__);
Index: gnash/server/CustomActions.cpp
diff -u gnash/server/CustomActions.cpp:1.1 gnash/server/CustomActions.cpp:1.2
--- gnash/server/CustomActions.cpp:1.1 Wed Feb 1 23:52:44 2006
+++ gnash/server/CustomActions.cpp Mon Feb 13 10:44:12 2006
@@ -65,7 +65,7 @@
customactions_obj->set_member("list", &customactions_list);
customactions_obj->set_member("uninstall", &customactions_uninstall);
- fn.result->set_as_object_interface(customactions_obj);
+ fn.result->set_as_object(customactions_obj);
}
void customactions_get(const fn_call& fn) {
log_msg("%s:unimplemented \n", __FUNCTION__);
Index: gnash/server/Date.cpp
diff -u gnash/server/Date.cpp:1.3 gnash/server/Date.cpp:1.4
--- gnash/server/Date.cpp:1.3 Sat Feb 4 04:35:54 2006
+++ gnash/server/Date.cpp Mon Feb 13 10:44:12 2006
@@ -267,7 +267,7 @@
else
log_error("date_new constructor with %d arguments
unimplemented!",fn.nargs);
- fn.result->set_as_object_interface(date_obj);
+ fn.result->set_as_object(date_obj);
}
void date_getdate(const fn_call& fn) {
date_as_object* date = (date_as_object*) (as_object*) fn.this_ptr;
Index: gnash/server/Error.cpp
diff -u gnash/server/Error.cpp:1.1 gnash/server/Error.cpp:1.2
--- gnash/server/Error.cpp:1.1 Wed Feb 1 23:52:44 2006
+++ gnash/server/Error.cpp Mon Feb 13 10:44:12 2006
@@ -44,7 +44,7 @@
error_obj->set_member("tostring", &error_tostring);
- fn.result->set_as_object_interface(error_obj);
+ fn.result->set_as_object(error_obj);
}
void error_tostring(const fn_call& fn) {
log_msg("%s:unimplemented \n", __FUNCTION__);
Index: gnash/server/Function.cpp
diff -u gnash/server/Function.cpp:1.4 gnash/server/Function.cpp:1.5
--- gnash/server/Function.cpp:1.4 Fri Feb 10 16:10:13 2006
+++ gnash/server/Function.cpp Mon Feb 13 10:44:12 2006
@@ -28,25 +28,77 @@
namespace gnash {
+static as_object* getFunctionPrototype()
+{
+ static as_object* proto = NULL;
+
+ if ( proto == NULL ) {
+ // Initialize Function prototype
+ proto = new as_object();
+ proto->set_member("apply", &function_apply);
+ proto->set_member("call", &function_call);
+ }
+
+ return proto;
+
+}
+
+
+void function_init(as_object* global)
+{
+ // This is going to be the global Function "class"/"function"
+ static function_as_object *func=new function_as_object();
+
+ // We make the 'prototype' element be a reference to
+ // the __proto__ element
+ as_object* proto = func->m_prototype;
+ proto->add_ref();
+
+ proto->set_member("constructor", func); //as_value(func));
+ proto->set_member_flags("constructor", 1);
+
+ func->set_member("prototype", as_value(proto));
+
+ // Register _global.Function
+ global->set_member("Function", func);
+
+}
+
+
+function_as_object::~function_as_object()
+{
+ if ( m_properties ) m_properties->drop_ref();
+}
+
+void
+function_as_object::init()
+{
+#if 1
+#endif
+}
-function_as_object::function_as_object(as_environment* env)
+function_as_object::function_as_object()
:
+ as_object(getFunctionPrototype()),
m_action_buffer(NULL),
- m_env(env),
+ m_env(NULL),
m_with_stack(),
m_start_pc(0),
m_length(0),
m_is_function2(false),
m_local_register_count(0),
- m_function2_flags(0),
- m_properties(NULL)
+ m_function2_flags(0)
{
- //log_msg("function_as_object %p reduced ctor\n", this);
+ init();
+
+ // We do not define a new 'prototype' member.
+ // Caller will take care of it
}
function_as_object::function_as_object(action_buffer* ab, as_environment* env,
int start, const array<with_stack_entry>& with_stack)
:
+ as_object(getFunctionPrototype()),
m_action_buffer(ab),
m_env(env),
m_with_stack(with_stack),
@@ -54,11 +106,21 @@
m_length(0),
m_is_function2(false),
m_local_register_count(0),
- m_function2_flags(0),
- m_properties(NULL)
+ m_function2_flags(0)
{
assert(m_action_buffer);
- //log_msg("function_as_object %p full ctor\n", this);
+ init();
+
+ // Define the 'prototype' member as a new object with
+ // only the 'constructor' element defined.
+ m_properties = new as_object();
+ as_object* proto = m_properties;
+ proto->add_ref();
+
+ proto->set_member("constructor", this); //as_value(func));
+ proto->set_member_flags("constructor", 1);
+
+ set_member("prototype", as_value(proto));
}
// Dispatch.
@@ -128,7 +190,7 @@
if (m_function2_flags & 0x01)
{
// preload 'this' into a register.
-
(*(our_env->local_register_ptr(current_reg))).set_as_object_interface(our_env->m_target);
+
(*(our_env->local_register_ptr(current_reg))).set_as_object(our_env->m_target);
current_reg++;
}
@@ -159,7 +221,7 @@
if (m_function2_flags & 0x04)
{
// preload 'arguments' into a register.
-
(*(our_env->local_register_ptr(current_reg))).set_as_object_interface(arg_array.get_ptr());
+
(*(our_env->local_register_ptr(current_reg))).set_as_object(arg_array.get_ptr());
current_reg++;
}
@@ -194,7 +256,7 @@
if (m_function2_flags & 0x40)
{
// Put '_root' in a register.
-
(*(our_env->local_register_ptr(current_reg))).set_as_object_interface(
+
(*(our_env->local_register_ptr(current_reg))).set_as_object(
our_env->m_target->get_root_movie());
current_reg++;
}
@@ -211,7 +273,7 @@
if (m_function2_flags & 0x100)
{
// Put '_global' in a register.
-
(*(our_env->local_register_ptr(current_reg))).set_as_object_interface(s_global.get_ptr());
+
(*(our_env->local_register_ptr(current_reg))).set_as_object(s_global.get_ptr());
current_reg++;
}
}
@@ -229,42 +291,6 @@
}
}
-void
-function_as_object::lazy_create_properties()
-{
- if (m_properties == NULL)
- {
- m_properties = new as_object();
-//log_msg("m_properties for function %p @ %p\n", this, m_properties);
- m_properties->add_ref();
-
- // Create new empty prototype
- as_object *proto_obj = new as_object();
-
- proto_obj->set_member("apply", &function_apply);
- proto_obj->set_member("call", &function_call);
-
- proto_obj->set_member("constructor", this);
- proto_obj->set_member_flags("constructor", 1);
-
- as_value proto(proto_obj);
- m_properties->set_member("prototype", proto);
- }
-}
-
-void
-function_new(const fn_call& fn)
-{
- function_as_object *function_obj = new function_as_object(fn.env);
-
- for (int i=0; i<fn.nargs; i++)
- {
- function_obj->add_arg(0, fn.arg(i).to_tu_string().c_str());
- }
-
- fn.result->set_as_object_interface(function_obj);
-}
-
void function_apply(const fn_call& fn)
{
int pushed=0; // new values we push on the stack
@@ -285,7 +311,7 @@
else
{
// Get the object to use as 'this' reference
- as_object_interface *this_ptr = fn.arg(0).to_object();
+ as_object *this_ptr = fn.arg(0).to_object();
new_fn_call.this_ptr = this_ptr;
if ( fn.nargs > 1 )
@@ -296,7 +322,7 @@
IF_VERBOSE_DEBUG(log_msg("Function.apply() with more then 2 args\n"));
}
- as_object_interface *arg1 = fn.arg(1).to_object();
+ as_object *arg1 = fn.arg(1).to_object();
assert(arg1);
as_array_object *arg_array = \
@@ -341,5 +367,6 @@
log_msg("%s:unimplemented \n", __FUNCTION__);
}
-} // end of gnaash namespace
+
+} // end of gnash namespace
Index: gnash/server/Function.h
diff -u gnash/server/Function.h:1.3 gnash/server/Function.h:1.4
--- gnash/server/Function.h:1.3 Fri Feb 10 16:10:13 2006
+++ gnash/server/Function.h Mon Feb 13 10:44:12 2006
@@ -28,18 +28,13 @@
namespace gnash {
-class Function {
-public:
- Function();
- ~Function();
- void apply();
- void call();
-private:
-};
-
/// ActionScript Function.
class function_as_object : public as_object
{
+private:
+ // Common things to do, whatever constructor is used.
+ void init();
+
public:
action_buffer* m_action_buffer;
@@ -72,8 +67,10 @@
///
as_object* m_properties;
- /// Constructor for 'new Function' constructor
- function_as_object(as_environment* newEnv);
+ ~function_as_object();
+
+ /// Default constructor
+ function_as_object();
/// NULL environment is allowed -- if so, then
/// functions will be executed in the caller's
@@ -99,18 +96,16 @@
/// Dispatch.
void operator()(const fn_call& fn);
- /// This ensures that this as_function has a valid
- /// prototype in its properties. This is done lazily
- /// so that functions/methods which are not used as
- /// constructors don't carry along extra unnecessary
- /// baggage.
- void lazy_create_properties();
+ //void lazy_create_properties();
};
-void function_new(const fn_call& fn);
+
void function_apply(const fn_call& fn);
void function_call(const fn_call& fn);
+/// Initialize the global Function constructor
+void function_init(as_object* global);
+
} // end of gnash namespace
// __FUNCTION_H__
Index: gnash/server/LoadVars.cpp
diff -u gnash/server/LoadVars.cpp:1.1 gnash/server/LoadVars.cpp:1.2
--- gnash/server/LoadVars.cpp:1.1 Wed Feb 1 23:52:44 2006
+++ gnash/server/LoadVars.cpp Mon Feb 13 10:44:12 2006
@@ -93,7 +93,7 @@
loadvars_obj->set_member("sendandload", &loadvars_sendandload);
loadvars_obj->set_member("tostring", &loadvars_tostring);
- fn.result->set_as_object_interface(loadvars_obj);
+ fn.result->set_as_object(loadvars_obj);
}
void loadvars_addrequestheader(const fn_call& fn) {
log_msg("%s:unimplemented \n", __FUNCTION__);
Index: gnash/server/LocalConnection.cpp
diff -u gnash/server/LocalConnection.cpp:1.3
gnash/server/LocalConnection.cpp:1.4
--- gnash/server/LocalConnection.cpp:1.3 Sun Feb 5 05:42:02 2006
+++ gnash/server/LocalConnection.cpp Mon Feb 13 10:44:12 2006
@@ -161,7 +161,7 @@
#endif
#endif
- fn.result->set_as_object_interface(localconnection_obj);
+ fn.result->set_as_object(localconnection_obj);
}
/// \brief The callback for LocalConnection::close()
Index: gnash/server/Makefile.am
diff -u gnash/server/Makefile.am:1.20 gnash/server/Makefile.am:1.21
--- gnash/server/Makefile.am:1.20 Thu Feb 9 02:33:53 2006
+++ gnash/server/Makefile.am Mon Feb 13 10:44:12 2006
@@ -137,6 +137,7 @@
network.h \
Movie.h \
MovieClipLoader.h \
+ Object.h \
render.h \
shape.h \
shm.h \
Index: gnash/server/Microphone.cpp
diff -u gnash/server/Microphone.cpp:1.1 gnash/server/Microphone.cpp:1.2
--- gnash/server/Microphone.cpp:1.1 Wed Feb 1 23:52:44 2006
+++ gnash/server/Microphone.cpp Mon Feb 13 10:44:12 2006
@@ -72,7 +72,7 @@
microphone_obj->set_member("setsilencelevel", µphone_setsilencelevel);
microphone_obj->set_member("setuseechosuppression",
µphone_setuseechosuppression);
- fn.result->set_as_object_interface(microphone_obj);
+ fn.result->set_as_object(microphone_obj);
}
void microphone_get(const fn_call& fn) {
log_msg("%s:unimplemented \n", __FUNCTION__);
Index: gnash/server/Mouse.cpp
diff -u gnash/server/Mouse.cpp:1.1 gnash/server/Mouse.cpp:1.2
--- gnash/server/Mouse.cpp:1.1 Wed Feb 1 23:52:44 2006
+++ gnash/server/Mouse.cpp Mon Feb 13 10:44:12 2006
@@ -65,7 +65,7 @@
mouse_obj->set_member("removelistener", &mouse_removelistener);
mouse_obj->set_member("show", &mouse_show);
- fn.result->set_as_object_interface(mouse_obj);
+ fn.result->set_as_object(mouse_obj);
}
void mouse_addlistener(const fn_call& fn) {
log_msg("%s:unimplemented \n", __FUNCTION__);
Index: gnash/server/MovieClipLoader.cpp
diff -u gnash/server/MovieClipLoader.cpp:1.7
gnash/server/MovieClipLoader.cpp:1.8
--- gnash/server/MovieClipLoader.cpp:1.7 Sun Feb 12 02:12:07 2006
+++ gnash/server/MovieClipLoader.cpp Mon Feb 13 10:44:12 2006
@@ -581,7 +581,7 @@
(as_c_function_ptr)&event_test);
#endif
- fn.result->set_as_object_interface(mov_obj);
+ fn.result->set_as_object(mov_obj);
}
void
@@ -617,7 +617,7 @@
mcl_obj->set_member("bytesLoaded", mcl_data->bytes_loaded);
mcl_obj->set_member("bytesTotal", mcl_data->bytes_total);
- fn.result->set_as_object_interface(mcl_obj);
+ fn.result->set_as_object(mcl_obj);
}
// Invoked when a file loaded with MovieClipLoader.loadClip() has
Index: gnash/server/NetConnection.cpp
diff -u gnash/server/NetConnection.cpp:1.4 gnash/server/NetConnection.cpp:1.5
--- gnash/server/NetConnection.cpp:1.4 Sun Feb 5 01:10:58 2006
+++ gnash/server/NetConnection.cpp Mon Feb 13 10:44:12 2006
@@ -122,7 +122,7 @@
netconnection_obj->set_member("getport", &network_getport);
netconnection_obj->set_member("getpath", &network_getpath);
#endif
- fn.result->set_as_object_interface(netconnection_obj);
+ fn.result->set_as_object(netconnection_obj);
}
void netconnection_connect(const fn_call& fn)
Index: gnash/server/NetStream.cpp
diff -u gnash/server/NetStream.cpp:1.1 gnash/server/NetStream.cpp:1.2
--- gnash/server/NetStream.cpp:1.1 Wed Feb 1 23:52:44 2006
+++ gnash/server/NetStream.cpp Mon Feb 13 10:44:12 2006
@@ -72,7 +72,7 @@
netstream_obj->set_member("seek", &netstream_seek);
netstream_obj->set_member("setbuffertime", &netstream_setbuffertime);
- fn.result->set_as_object_interface(netstream_obj);
+ fn.result->set_as_object(netstream_obj);
}
void netstream_close(const fn_call& fn) {
log_msg("%s:unimplemented \n", __FUNCTION__);
Index: gnash/server/Object.cpp
diff -u gnash/server/Object.cpp:1.4 gnash/server/Object.cpp:1.5
--- gnash/server/Object.cpp:1.4 Sat Feb 11 01:57:02 2006
+++ gnash/server/Object.cpp Mon Feb 13 10:44:12 2006
@@ -30,12 +30,13 @@
bool
as_object::get_member(const tu_stringi& name, as_value* val)
{
-// IF_VERBOSE_DEBUG(
-// log_msg(" get member: %s (at %p) for object %p\n",
name.c_str(), val, this);
-// );
+ IF_VERBOSE_ACTION(
+ log_msg(" get member: %s (at %p) for object %p\n",
name.c_str(), val, this);
+ );
if (name == "__proto__")
{
- val->set_as_object_interface(m_prototype);
+ if ( m_prototype == NULL ) log_msg("as_object %p has no
prototype\n", this);
+ val->set_as_object(m_prototype);
return true;
}
else {
@@ -43,19 +44,19 @@
if (m_members.get(name, &m) == false)
{
-// IF_VERBOSE_DEBUG(log_msg(" not found on first
level\n"));
+ IF_VERBOSE_ACTION(log_msg(" not found on first
level\n"));
if (m_prototype == NULL)
{
-// IF_VERBOSE_DEBUG(log_msg(" no __proto__
(m_prototype) defined\n"));
+ IF_VERBOSE_ACTION(log_msg(" no __proto__
(m_prototype) defined\n"));
return false;
}
else
{
- IF_VERBOSE_DEBUG(log_msg(" checkin in
__proto__ (m_prototype) %p\n",m_prototype));
+ IF_VERBOSE_ACTION(log_msg(" checkin in
__proto__ (m_prototype) %p\n",m_prototype));
return m_prototype->get_member(name, val);
}
} else {
-// IF_VERBOSE_DEBUG(log_msg(" found on first level"));
+ IF_VERBOSE_ACTION(log_msg(" found on first level\n"));
*val=m.get_member_value();
return true;
}
@@ -75,7 +76,7 @@
as_object::set_member(const tu_stringi& name, const as_value& val )
{
//printf("SET MEMBER: %s at %p for object %p\n", name.c_str(),
val.to_object(), this);
- if (name == "__proto__") // isn't this readonly?
+ if (name == "__proto__")
{
if (m_prototype) m_prototype->drop_ref();
m_prototype = val.to_object();
Index: gnash/server/Selection.cpp
diff -u gnash/server/Selection.cpp:1.1 gnash/server/Selection.cpp:1.2
--- gnash/server/Selection.cpp:1.1 Wed Feb 1 23:52:44 2006
+++ gnash/server/Selection.cpp Mon Feb 13 10:44:12 2006
@@ -87,7 +87,7 @@
selection_obj->set_member("removelistener", &selection_removelistener);
selection_obj->set_member("setfocus", &selection_setfocus);
- fn.result->set_as_object_interface(selection_obj);
+ fn.result->set_as_object(selection_obj);
}
void selection_addlistener(const fn_call& fn) {
log_msg("%s:unimplemented \n", __FUNCTION__);
Index: gnash/server/SharedObject.cpp
diff -u gnash/server/SharedObject.cpp:1.1 gnash/server/SharedObject.cpp:1.2
--- gnash/server/SharedObject.cpp:1.1 Wed Feb 1 23:52:44 2006
+++ gnash/server/SharedObject.cpp Mon Feb 13 10:44:12 2006
@@ -65,7 +65,7 @@
sharedobject_obj->set_member("getlocal", &sharedobject_getlocal);
sharedobject_obj->set_member("getsize", &sharedobject_getsize);
- fn.result->set_as_object_interface(sharedobject_obj);
+ fn.result->set_as_object(sharedobject_obj);
}
void sharedobject_clear(const fn_call& fn) {
log_msg("%s:unimplemented \n", __FUNCTION__);
Index: gnash/server/Sprite.cpp
diff -u gnash/server/Sprite.cpp:1.11 gnash/server/Sprite.cpp:1.12
--- gnash/server/Sprite.cpp:1.11 Mon Feb 6 04:11:04 2006
+++ gnash/server/Sprite.cpp Mon Feb 13 10:44:12 2006
@@ -185,7 +185,7 @@
static void sprite_create_text_field(const fn_call& fn)
{
- as_object_interface *target=fn.this_ptr;
+ as_object *target=fn.this_ptr;
if ( target == NULL )
{
target=fn.env->get_target();
@@ -285,7 +285,7 @@
// We should return a ref to the newly created
// TextField here
- //fn.result->set_as_object_interface(txt.get_ptr());
+ //fn.result->set_as_object(txt.get_ptr());
@@ -551,8 +551,8 @@
}
else
{
-
assert(dynamic_cast<as_object_interface*>(m_parent));
-
val->set_as_object_interface(static_cast<as_object_interface*>(m_parent));
+ assert(dynamic_cast<as_object*>(m_parent));
+
val->set_as_object(static_cast<as_object*>(m_parent));
return true;
}
}
@@ -579,7 +579,7 @@
if (ch)
{
// Found object.
-
val->set_as_object_interface(static_cast<as_object_interface*>(ch));
+ val->set_as_object(static_cast<as_object*>(ch));
return true;
}
@@ -596,7 +596,7 @@
void sprite_instance::do_actions()
{
// Keep m_as_environment alive during any method calls!
- smart_ptr<as_object_interface> this_ptr(this);
+ smart_ptr<as_object> this_ptr(this);
execute_actions(&m_as_environment, m_action_list);
m_action_list.resize(0);
@@ -696,7 +696,7 @@
bool sprite_instance::on_event(event_id id)
{
// Keep m_as_environment alive during any method calls!
- smart_ptr<as_object_interface> this_ptr(this);
+ smart_ptr<as_object> this_ptr(this);
bool called = false;
@@ -1000,7 +1000,7 @@
// printf("%s:\n", __PRETTY_FUNCTION__); // FIXME:
// Keep this (particularly m_as_environment) alive during execution!
- smart_ptr<as_object_interface> this_ptr(this);
+ smart_ptr<as_object> this_ptr(this);
assert(m_def != NULL && m_root != NULL);
@@ -1053,7 +1053,7 @@
bool state_only)
{
// Keep this (particularly m_as_environment) alive during execution!
- smart_ptr<as_object_interface> this_ptr(this);
+ smart_ptr<as_object> this_ptr(this);
assert(frame >= 0);
assert(frame < m_def->get_frame_count());
@@ -1095,7 +1095,7 @@
void sprite_instance::execute_frame_tags_reverse(int frame)
{
// Keep this (particularly m_as_environment) alive during execution!
- smart_ptr<as_object_interface> this_ptr(this);
+ smart_ptr<as_object> this_ptr(this);
assert(frame >= 0);
assert(frame < m_def->get_frame_count());
@@ -1526,8 +1526,8 @@
// It's an ActionScript function. Call it.
as_value method;
//log_msg("Calling ActionScript function for interval timer\n");
- (*as_func)(fn_call(&val, (as_object_interface *)this_ptr,
as_env, 0, 0));
- //(*as_func)(&val, (as_object_interface *)this_ptr,
&m_as_environment, 1, 1);
+ (*as_func)(fn_call(&val, (as_object *)this_ptr, as_env, 0, 0));
+ //(*as_func)(&val, (as_object *)this_ptr, &m_as_environment, 1,
1);
} else {
log_error("error in call_method(): method is not a function\n");
}
Index: gnash/server/Sprite.h
diff -u gnash/server/Sprite.h:1.6 gnash/server/Sprite.h:1.7
--- gnash/server/Sprite.h:1.6 Sun Feb 12 02:12:07 2006
+++ gnash/server/Sprite.h Mon Feb 13 10:44:12 2006
@@ -700,7 +700,7 @@
const char* method_arg_fmt, va_list args)
{
// Keep m_as_environment alive during any method calls!
- smart_ptr<as_object_interface> this_ptr(this);
+ smart_ptr<as_object> this_ptr(this);
return call_method_parsed(&m_as_environment, this,
method_name, method_arg_fmt, args);
@@ -715,7 +715,7 @@
array<with_stack_entry> dummy;
as_value obj =
m_as_environment.get_variable(tu_string(path_to_object), dummy);
- as_object_interface* as_obj = obj.to_object();
+ as_object* as_obj = obj.to_object();
if (as_obj)
{
movie* m = as_obj->to_movie();
Index: gnash/server/Stage.cpp
diff -u gnash/server/Stage.cpp:1.1 gnash/server/Stage.cpp:1.2
--- gnash/server/Stage.cpp:1.1 Wed Feb 1 23:52:44 2006
+++ gnash/server/Stage.cpp Mon Feb 13 10:44:12 2006
@@ -51,7 +51,7 @@
stage_obj->set_member("addlistener", &stage_addlistener);
stage_obj->set_member("removelistener", &stage_removelistener);
- fn.result->set_as_object_interface(stage_obj);
+ fn.result->set_as_object(stage_obj);
}
void stage_addlistener(const fn_call& fn) {
log_msg("%s:unimplemented \n", __FUNCTION__);
Index: gnash/server/System.cpp
diff -u gnash/server/System.cpp:1.1 gnash/server/System.cpp:1.2
--- gnash/server/System.cpp:1.1 Wed Feb 1 23:52:44 2006
+++ gnash/server/System.cpp Mon Feb 13 10:44:12 2006
@@ -72,7 +72,7 @@
system_obj->set_member("setclipboard", &system_setclipboard);
system_obj->set_member("showsettings", &system_showsettings);
- fn.result->set_as_object_interface(system_obj);
+ fn.result->set_as_object(system_obj);
}
void system_security_allowdomain(const fn_call& fn) {
log_msg("%s:unimplemented \n", __FUNCTION__);
Index: gnash/server/TextSnapshot.cpp
diff -u gnash/server/TextSnapshot.cpp:1.1 gnash/server/TextSnapshot.cpp:1.2
--- gnash/server/TextSnapshot.cpp:1.1 Wed Feb 1 23:52:44 2006
+++ gnash/server/TextSnapshot.cpp Mon Feb 13 10:44:12 2006
@@ -93,7 +93,7 @@
textsnapshot_obj->set_member("setselectcolor",
&textsnapshot_setselectcolor);
textsnapshot_obj->set_member("setselected", &textsnapshot_setselected);
- fn.result->set_as_object_interface(textsnapshot_obj);
+ fn.result->set_as_object(textsnapshot_obj);
}
void textsnapshot_findtext(const fn_call& fn) {
log_msg("%s:unimplemented \n", __FUNCTION__);
Index: gnash/server/Video.cpp
diff -u gnash/server/Video.cpp:1.1 gnash/server/Video.cpp:1.2
--- gnash/server/Video.cpp:1.1 Wed Feb 1 23:52:44 2006
+++ gnash/server/Video.cpp Mon Feb 13 10:44:12 2006
@@ -51,7 +51,7 @@
video_obj->set_member("attach", &video_attach);
video_obj->set_member("clear", &video_clear);
- fn.result->set_as_object_interface(video_obj);
+ fn.result->set_as_object(video_obj);
}
void video_attach(const fn_call& fn) {
log_msg("%s:unimplemented \n", __FUNCTION__);
Index: gnash/server/action.cpp
diff -u gnash/server/action.cpp:1.44 gnash/server/action.cpp:1.45
--- gnash/server/action.cpp:1.44 Mon Feb 13 06:14:28 2006
+++ gnash/server/action.cpp Mon Feb 13 10:44:12 2006
@@ -11,6 +11,7 @@
#include <pthread.h>
#include "action.h"
+#include "Object.h"
#include "impl.h"
#include "log.h"
#include "stream.h"
@@ -229,7 +230,7 @@
as_value call_method(
const as_value& method,
as_environment* env,
- as_object_interface* this_ptr, // this is ourself
+ as_object* this_ptr, // this is ourself
int nargs,
int first_arg_bottom_index)
// first_arg_bottom_index is the stack index, from the bottom, of the
first argument.
@@ -261,14 +262,14 @@
as_value call_method0(
const as_value& method,
as_environment* env,
- as_object_interface* this_ptr)
+ as_object* this_ptr)
{
return call_method(method, env, this_ptr, 0,
env->get_top_index() + 1);
}
const char* call_method_parsed(
as_environment* env,
- as_object_interface* this_ptr,
+ as_object* this_ptr,
const char* method_name,
const char* method_arg_fmt,
va_list args)
@@ -550,7 +551,7 @@
#if 0
// One-argument simple functions.
#define MATH_WRAP_FUNC1(funcname)
\
- void math_##funcname(as_value* result, as_object_interface*
this_ptr, \
+ void math_##funcname(as_value* result, as_object* this_ptr,
\
as_environment* env, int nargs, int
first_arg_bottom_index) \
{
\
double arg = env->bottom(first_arg_bottom_index).to_number();
\
@@ -582,7 +583,7 @@
#if 0
// Two-argument functions.
#define MATH_WRAP_FUNC2_EXP(funcname, expr)
\
- void math_##funcname(as_value* result, as_object_interface*
this_ptr, as_environment* env, int nargs, int first_arg_bottom_index) \
+ void math_##funcname(as_value* result, as_object* this_ptr,
as_environment* env, int nargs, int first_arg_bottom_index) \
{
\
double arg0 = env->bottom(first_arg_bottom_index).to_number();
\
double arg1 = env->bottom(first_arg_bottom_index -
1).to_number(); \
@@ -668,7 +669,7 @@
struct key_as_object : public as_object
{
Uint8 m_keymap[key::KEYCOUNT / 8 + 1]; // bit-array
- array<weak_ptr<as_object_interface> > m_listeners;
+ array<weak_ptr<as_object> > m_listeners;
int m_last_key_pressed;
key_as_object()
@@ -717,7 +718,7 @@
int n = m_listeners.size();
for (i = 0; i < n; i++)
{
- smart_ptr<as_object_interface> listener =
m_listeners[i];
+ smart_ptr<as_object> listener =
m_listeners[i];
as_value method;
if (listener != NULL
&&
listener->get_member(event_id(event_id::KEY_DOWN).get_function_name(), &method))
@@ -742,7 +743,7 @@
// Notify listeners.
for (int i = 0, n = m_listeners.size(); i < n; i++)
{
- smart_ptr<as_object_interface> listener =
m_listeners[i];
+ smart_ptr<as_object> listener =
m_listeners[i];
as_value method;
if (listener != NULL
@@ -767,7 +768,7 @@
}
}
- void add_listener(as_object_interface* listener)
+ void add_listener(as_object* listener)
{
cleanup_listeners();
@@ -783,7 +784,7 @@
m_listeners.push_back(listener);
}
- void remove_listener(as_object_interface* listener)
+ void remove_listener(as_object* listener)
{
cleanup_listeners();
@@ -811,7 +812,7 @@
return;
}
- as_object_interface* listener = fn.arg(0).to_object();
+ as_object* listener = fn.arg(0).to_object();
if (listener == NULL)
{
log_error("key_add_listener passed a NULL object;
ignored\n");
@@ -888,7 +889,7 @@
return;
}
- as_object_interface* listener = fn.arg(0).to_object();
+ as_object* listener = fn.arg(0).to_object();
if (listener == NULL)
{
log_error("key_remove_listener passed a NULL object;
ignored\n");
@@ -973,10 +974,13 @@
{
assert(fn.nargs >= 1);
+// @@ NOTHING should get special treatment,
+// as_value::to_string() will take care of everything
+#if 0
// Special case for objects: try the toString() method.
if (fn.arg(0).get_type() == as_value::OBJECT)
{
- as_object_interface* obj = fn.arg(0).to_object();
+ as_object* obj = fn.arg(0).to_object();
assert(obj);
as_value method;
@@ -989,12 +993,15 @@
return;
}
}
+#endif
// Log our argument.
//
// @@ what if we get extra args?
//
// @@ Array gets special treatment.
+ // @@ NOTHING should get special treatment,
+ // as_value::to_string() will take care of everything
const char* arg0 = fn.arg(0).to_string();
log_msg("%s\n", arg0);
}
@@ -1010,7 +1017,7 @@
sound_obj->set_member("start", &sound_start);
sound_obj->set_member("stop", &sound_stop);
- fn.result->set_as_object_interface(sound_obj.get_ptr());
+ fn.result->set_as_object(sound_obj.get_ptr());
}
@@ -1025,7 +1032,7 @@
}
else if ( fn.nargs == 1 ) // copy constructor
{
- as_object_interface *src_obj = fn.arg(0).to_object();
+ as_object *src_obj = fn.arg(0).to_object();
new_obj = new as_object(src_obj);
}
else
@@ -1034,7 +1041,7 @@
new_obj = new as_object();
}
- fn.result->set_as_object_interface(new_obj);
+ fn.result->set_as_object(new_obj);
}
void as_global_isnan(const fn_call& fn)
@@ -1277,11 +1284,11 @@
assert((version == 5) ? (fn.nargs == 3) : true);
// object
- as_object_interface* const obj = fn.arg(0).to_object();
+ as_object* const obj = fn.arg(0).to_object();
assert(obj != NULL);
// list of child names
- as_object_interface* props = fn.arg(1).to_object();
+ as_object* props = fn.arg(1).to_object();
if (props == NULL) {
// tulrich: this fires in test_ASSetPropFlags -- is it
correct?
assert(fn.arg(1).get_type() == as_value::NULLTYPE);
@@ -1424,7 +1431,6 @@
s_global->set_member("CustomActions",
as_value(customactions_new));
s_global->set_member("Date", as_value(date_new));
s_global->set_member("Error", as_value(error_new));
- s_global->set_member("Function",
as_value(function_new));
s_global->set_member("LoadVars",
as_value(loadvars_new));
s_global->set_member("LocalConnection",
as_value(localconnection_new));
s_global->set_member("Microphone",
as_value(microphone_new));
@@ -1450,6 +1456,7 @@
// isFinite
s_global->set_member("isFinite", as_global_isfinite);
+ function_init(s_global.get_ptr());
math_init();
key_init();
}
@@ -1499,7 +1506,7 @@
};
- static as_value get_property(as_object_interface* obj, int prop_number)
+ static as_value get_property(as_object* obj, int prop_number)
{
as_value val;
if (prop_number >= 0 && prop_number <
int(sizeof(s_property_names)/sizeof(s_property_names[0])))
@@ -1513,7 +1520,7 @@
return val;
}
- static void set_property(as_object_interface* obj, int prop_number,
const as_value& val)
+ static void set_property(as_object* obj, int prop_number, const
as_value& val)
{
if (prop_number >= 0 && prop_number <
int(sizeof(s_property_names)/sizeof(s_property_names[0])))
{
@@ -1752,10 +1759,12 @@
IF_VERBOSE_ACTION(log_msg("---new object: %s\n",
classname.to_tu_string().c_str()));
int nargs = (int) env->pop().to_number();
+
as_value constructor =
env->get_variable(classname.to_tu_string(), with_stack);
as_value new_obj;
if (constructor.get_type() == as_value::C_FUNCTION)
{
+ //log_msg("Constructor is a C_FUNCTION\n");
// C function is responsible for creating the new
object and setting members.
(constructor.to_c_function())(fn_call(&new_obj, NULL,
env, nargs, env->get_top_index()));
}
@@ -1763,19 +1772,20 @@
{
// This function is being used as a constructor; make
sure
// it has a prototype object.
- ctor_as_func->lazy_create_properties();
- assert(ctor_as_func->m_properties);
+ //log_msg("Constructor is an AS_FUNCTION\n");
// Set up the prototype.
as_value proto;
- ctor_as_func->m_properties->get_member("prototype",
&proto);
+ bool func_has_prototype = \
+ ctor_as_func->get_member("prototype", &proto);
+ assert(func_has_prototype);
- assert(proto.to_object() != NULL);
+ //log_msg("constructor prototype is %s\n",
proto.to_string());
// Create an empty object, with a ref to the
constructor's prototype.
smart_ptr<as_object> new_obj_ptr(new
as_object(proto.to_object()));
- new_obj.set_as_object_interface(new_obj_ptr.get_ptr());
+ new_obj.set_as_object(new_obj_ptr.get_ptr());
// Call the actual constructor function; new_obj is its
'this'.
// We don't need the function result.
@@ -1864,7 +1874,7 @@
// Get an object
as_value& obj_value = env->top(1);
- as_object_interface* obj = obj_value.to_object();
+ as_object* obj = obj_value.to_object();
//log_msg(" method object: %p\n", obj);
// Get number of arguments
@@ -1947,6 +1957,8 @@
action_buffer::doActionDefineFunction(as_environment* env,
array<with_stack_entry>& with_stack, int pc, int*
next_pc)
{
+
+ // Create a new function_as_object
function_as_object* func = new function_as_object(this, env,
*next_pc, with_stack);
int i = pc;
@@ -1988,7 +2000,6 @@
// Also leave it on the stack.
env->push_val(function_value);
-
}
/*private*/
@@ -2061,42 +2072,58 @@
// Some corner case behaviors depend on the SWF file version.
int version =
env->get_target()->get_movie_definition()->get_version();
- as_value& target = env->top(1);
- as_object_interface* obj = target.to_object();
+ as_value member_name = env->top(0);
+ as_value target = env->top(1);
+
+ as_object* obj = target.to_object();
+ if (! obj)
+ {
+ IF_VERBOSE_DEBUG(log_msg("getMember called against "
+ "a value that does not cast "
+ "to an as_object: %s\n", target.to_string()));
+ env->top(1).set_undefined();
+ env->drop(1);
+ return;
+ }
-// IF_VERBOSE_DEBUG(log_msg(" doActionGetMember: target: %p\n",
obj));
+ IF_VERBOSE_ACTION(log_msg(" doActionGetMember: target: %s
(object %p)\n", target.to_string(), obj));
// Special case: String has a member "length"
// @@ FIXME: we shouldn't have all this "special" cases --strk;
- if (obj == NULL && env->top(1).get_type() == as_value::STRING
&& env->top(0).to_tu_stringi() == "length")
+ if (target.get_type() == as_value::STRING &&
member_name.to_tu_stringi() == "length")
{
- int len =
env->top(1).to_tu_string_versioned(version).utf8_length();
- env->top(1).set_int(len);
+ int len =
target.to_tu_string_versioned(version).utf8_length();
+ env->top(1).set_int(len);
}
else
{
- env->top(1).set_undefined();
- // int nargs = (int) env->top(1).to_number();
- if (obj) {
- obj->get_member(env->top(0).to_tu_string(),
&(env->top(1)));
- if (env->top(1).to_object() == NULL) {
- IF_VERBOSE_ACTION(log_msg("--
get_member %s=%s\n",
-
env->top(0).to_tu_string().c_str(),
-
env->top(1).to_tu_string().c_str()));
- } else {
- IF_VERBOSE_ACTION(log_msg("--
get_member %s=%s at %p\n",
-
env->top(0).to_tu_string().c_str(),
-
env->top(1).to_tu_string().c_str(), env->top(1).to_object()));
- }
- }
- else
- {
- // @@ log error?
- }
+ if ( ! obj->get_member(member_name.to_tu_string(),
&(env->top(1))) )
+ env->top(1).set_undefined();
+
+ IF_VERBOSE_ACTION(log_msg("-- get_member %s=%s\n",
+ member_name.to_tu_string().c_str(),
+ env->top(1).to_tu_string().c_str()));
}
env->drop(1);
}
+ /*private*/
+ void action_buffer::doActionStrictEquals(as_environment* env)
+ {
+//log_msg("%s\n", __PRETTY_FUNCTION__);
+ // @@ identical to untyped equal, as far as I can tell...
+ env->top(1).set_bool(env->top(1) == env->top(0));
+ env->drop(1);
+ }
+
+ /*private*/
+ void action_buffer::doActionEquals(as_environment* env)
+ {
+//log_msg("%s\n", __PRETTY_FUNCTION__);
+ env->top(1).set_bool(env->top(1).to_tu_string() ==
env->top(0).to_tu_string());
+ env->drop(1);
+ }
+
void action_buffer::execute(
@@ -2235,11 +2262,8 @@
break;
}
case SWF::ACTION_STRINGEQ: // string equal
- {
-
env->top(1).set_bool(env->top(1).to_tu_string() == env->top(0).to_tu_string());
- env->drop(1);
+ doActionEquals(env);
break;
- }
case SWF::ACTION_STRINGLENGTH: // string length
{
env->top(0).set_int(env->top(0).to_tu_string_versioned(version).utf8_length());
@@ -2595,7 +2619,7 @@
as_value result;
as_global_array_ctor(fn_call(&result,
NULL, env, 0, env->get_top_index()));
- as_object_interface* ao =
result.to_object();
+ as_object* ao = result.to_object();
assert(ao);
// Fill the elements with the initial
values from the stack.
@@ -2640,7 +2664,7 @@
//log_error("checkme opcode: %02X\n",
action_id);
as_value new_obj;
-
new_obj.set_as_object_interface(new_obj_ptr.get_ptr());
+
new_obj.set_as_object(new_obj_ptr.get_ptr());
//env->drop(nmembers*2);
env->push(new_obj);
@@ -2770,12 +2794,8 @@
break;
}
case SWF::ACTION_NEWEQUALS: // equal (typed)
- {
- // @@ identical to untyped equal, as
far as I can tell...
- env->top(1).set_bool(env->top(1) ==
env->top(0));
- env->drop(1);
+ doActionStrictEquals(env);
break;
- }
case SWF::ACTION_TONUMBER: // to number
{
env->top(0).convert_to_number();
@@ -2802,7 +2822,7 @@
break;
case SWF::ACTION_SETMEMBER: // set member
{
- as_object_interface* obj =
env->top(2).to_object();
+ as_object* obj =
env->top(2).to_object();
if (obj)
{
obj->set_member(env->top(1).to_tu_string(), env->top(0));
@@ -3079,7 +3099,7 @@
{
int block_length =
m_buffer[pc + 3] | (m_buffer[pc + 4] << 8);
int block_end = next_pc +
block_length;
- as_object_interface*
with_obj = env->top(0).to_object();
+ as_object* with_obj =
env->top(0).to_object();
with_stack.push_back(with_stack_entry(with_obj, block_end));
}
env->drop(1);
@@ -3408,7 +3428,7 @@
//
- as_value::as_value(as_object_interface* obj)
+ as_value::as_value(as_object* obj)
:
m_type(OBJECT),
m_object_value(obj)
@@ -3540,7 +3560,6 @@
return m_string_value;
}
-
const tu_string& as_value::to_tu_string_versioned(int version)
const
// Conversion to const tu_string&.
{
@@ -3672,7 +3691,7 @@
}
- as_object_interface* as_value::to_object() const
+ as_object* as_value::to_object() const
// Return value as an object.
{
if (m_type == OBJECT)
@@ -3680,15 +3699,10 @@
// OK.
return m_object_value;
}
- else if (m_type == AS_FUNCTION && m_as_function_value != NULL)
+ else if (m_type == AS_FUNCTION)
{
- // Make sure this as_function has properties &
- // a prototype object attached to it, since those
- // may be about to be referenced.
- m_as_function_value->lazy_create_properties();
- assert(m_as_function_value->m_properties);
-
- return m_as_function_value->m_properties;
+ // An AS_FUNCTION *is* an object
+ return m_as_function_value;
}
else
{
@@ -3751,7 +3765,7 @@
}
- void as_value::set_as_object_interface(as_object_interface* obj)
+ void as_value::set_as_object(as_object* obj)
{
if (m_type != OBJECT || m_object_value != obj)
{
@@ -3801,6 +3815,18 @@
{
return m_boolean_value == v.to_bool();
}
+ else if (m_type == OBJECT)
+ {
+ return m_object_value == v.to_object();
+ }
+ else if (m_type == AS_FUNCTION)
+ {
+ return m_as_function_value == v.to_object();
+ }
+ else if (m_type == C_FUNCTION)
+ {
+ return m_c_function_value == v.to_c_function();
+ }
else
{
// Evan: what about objects???
@@ -3895,7 +3921,7 @@
// Check the with-stack.
for (int i = with_stack.size() - 1; i >= 0; i--)
{
- as_object_interface* obj =
with_stack[i].m_object.get_ptr();
+ as_object* obj = with_stack[i].m_object.get_ptr();
if (obj && obj->get_member(varname, &val))
{
// Found the var in this context.
@@ -3914,7 +3940,7 @@
// Looking for "this"?
if (varname == "this")
{
- val.set_as_object_interface(m_target);
+ val.set_as_object(m_target);
return val;
}
@@ -3980,7 +4006,7 @@
// Check the with-stack.
for (int i = with_stack.size() - 1; i >= 0; i--)
{
- as_object_interface* obj =
with_stack[i].m_object.get_ptr();
+ as_object* obj = with_stack[i].m_object.get_ptr();
as_value dummy;
if (obj && obj->get_member(varname, &dummy))
{
Index: gnash/server/action.h
diff -u gnash/server/action.h:1.17 gnash/server/action.h:1.18
--- gnash/server/action.h:1.17 Sat Feb 11 01:57:02 2006
+++ gnash/server/action.h Mon Feb 13 10:44:12 2006
@@ -28,6 +28,7 @@
#include "gnash.h"
+#include "Object.h"
#include "types.h"
#include <wchar.h>
@@ -40,7 +41,6 @@
struct movie;
struct as_environment;
struct as_object;
- struct as_object_interface;
struct as_value;
struct function_as_object;
@@ -134,7 +134,7 @@
/// The "with" stack is for Pascal-like with-scoping.
struct with_stack_entry
{
- smart_ptr<as_object_interface> m_object;
+ smart_ptr<as_object> m_object;
int m_block_end_pc;
with_stack_entry()
@@ -144,7 +144,7 @@
{
}
- with_stack_entry(as_object_interface* obj, int end)
+ with_stack_entry(as_object* obj, int end)
:
m_object(obj),
m_block_end_pc(end)
@@ -222,6 +222,10 @@
array<with_stack_entry>& with_stack, int pc, int*
next_pc);
void doActionGetMember(as_environment* env);
+
+ void doActionStrictEquals(as_environment* env);
+
+ void doActionEquals(as_environment* env);
};
@@ -236,273 +240,6 @@
};
- /// ActionScript value type.
- struct as_value
- {
- enum type
- {
- UNDEFINED,
- NULLTYPE,
- BOOLEAN,
- STRING,
- NUMBER,
- OBJECT,
- C_FUNCTION,
- AS_FUNCTION, // ActionScript function.
- };
- type m_type;
- mutable tu_string m_string_value;
- union
- {
- bool m_boolean_value;
- // @@ hm, what about PS2, where double is bad? should
maybe have int&float types.
- mutable double m_number_value;
- as_object_interface* m_object_value;
- as_c_function_ptr m_c_function_value;
- function_as_object* m_as_function_value;
- };
-
- /// Construct an UNDEFINED value
- as_value()
- :
- m_type(UNDEFINED),
- m_number_value(0.0)
- {
- }
-
- as_value(const as_value& v)
- :
- m_type(UNDEFINED),
- m_number_value(0.0)
- {
- *this = v;
- }
-
- /// Construct a STRING value
- as_value(const char* str)
- :
- m_type(STRING),
- m_string_value(str),
- m_number_value(0.0)
- {
- }
-
- /// Construct a STRING value
- as_value(const wchar_t* wstr)
- :
- m_type(STRING),
- m_string_value(""),
- m_number_value(0.0)
- {
- // Encode the string value as UTF-8.
- //
- // Is this dumb? Alternatives:
- //
- // 1. store a tu_wstring instead of tu_string?
- // Bloats typical ASCII strings, needs a
- // tu_wstring type, and conversion back the
- // other way to interface with char[].
- //
- // 2. store a tu_wstring as a union with
- // tu_string? Extra complexity.
- //
- // 3. ??
- //
- // Storing UTF-8 seems like a pretty decent
- // way to do it. Everything else just
- // continues to work.
-
-#if (WCHAR_MAX != MAXINT)
- tu_string::encode_utf8_from_wchar(&m_string_value,
(const uint16 *)wstr);
-#else
-# if (WCHAR_MAX != MAXSHORT)
-# error "Can't determine the size of wchar_t"
-# else
- tu_string::encode_utf8_from_wchar(&m_string_value,
(const uint32 *)wstr);
-# endif
-#endif
- }
-
- /// Construct a BOOLEAN value
- as_value(bool val)
- :
- m_type(BOOLEAN),
- m_boolean_value(val)
- {
- }
-
- /// Construct a NUMBER value
- as_value(int val)
- :
- m_type(NUMBER),
- m_number_value(double(val))
- {
- }
-
- /// Construct a NUMBER value
- as_value(float val)
- :
- m_type(NUMBER),
- m_number_value(double(val))
- {
- }
-
- /// Construct a NUMBER value
- as_value(double val)
- :
- m_type(NUMBER),
- m_number_value(val)
- {
- }
-
- /// Construct an OBJECT value
- as_value(as_object_interface* obj);
-
- /// Construct a C_FUNCTION value
- as_value(as_c_function_ptr func)
- :
- m_type(C_FUNCTION),
- m_c_function_value(func)
- {
- m_c_function_value = func;
- }
-
- /// Construct an AS_FUNCTION value
- as_value(function_as_object* func);
-
- ~as_value() { drop_refs(); }
-
- /// Drop any ref counts we have.
- //
- /// This happens prior to changing our value.
- /// Useful when changing types/values.
- ///
- void drop_refs();
-
- type get_type() const { return m_type; }
-
- /// \brief
- /// Return true if this value is callable
- /// (C_FUNCTION or AS_FUNCTION).
- bool is_function() const
- {
- return m_type == C_FUNCTION || m_type == AS_FUNCTION;
- }
-
- /// Get a C string representation of this value.
- const char* to_string() const;
-
- /// Get a tu_string representation for this value.
- const tu_string& to_tu_string() const;
-
- /// Get a tu_string representation for this value.
- //
- /// This differs from to_tu_string() in that returned
- /// representation will depend on version of the SWF
- /// source.
- /// @@ shouldn't this be the default ?
- ///
- const tu_string& to_tu_string_versioned(int version)
const;
-
- /// Calls to_tu_string() returning a cast to tu_stringi
- const tu_stringi& to_tu_stringi() const;
-
- /// Conversion to double.
- double to_number() const;
-
- /// Conversion to boolean.
- bool to_bool() const;
-
- /// \brief
- /// Return value as an object
- /// or NULL if this is not possible.
- as_object_interface* to_object() const;
-
-
- /// \brief
- /// Return value as a C function ptr
- /// or NULL if it is not a C function.
- as_c_function_ptr to_c_function() const;
-
- /// \brief
- /// Return value as an ActionScript function ptr
- /// or NULL if it is not an ActionScript function.
- function_as_object* to_as_function() const;
-
- /// Force type to number.
- void convert_to_number();
-
- /// Force type to string.
- void convert_to_string();
-
- /// Force type to string.
- //
- /// uses swf-version-aware converter
- ///
- /// @see to_tu_string_versionioned
- ///
- void convert_to_string_versioned(int version);
-
- // These set_*()'s are more type-safe; should be used
- // in preference to generic overloaded set(). You are
- // more likely to get a warning/error if misused.
-
- void set_tu_string(const tu_string& str) { drop_refs();
m_type = STRING; m_string_value = str; }
-
- void set_string(const char* str) { drop_refs(); m_type =
STRING; m_string_value = str; }
- void set_double(double val) { drop_refs(); m_type = NUMBER;
m_number_value = val; }
- void set_bool(bool val) { drop_refs(); m_type = BOOLEAN;
m_boolean_value = val; }
- void set_int(int val) { set_double(val); }
- void set_nan() { double x = 0.0; set_double(x/x); }
-
- /// Make this value an as_object_interface.
- /// Internally adds a reference to the ref-counted
as_object_interface.
- void set_as_object_interface(as_object_interface* obj);
-
- void set_as_c_function_ptr(as_c_function_ptr func)
- {
- drop_refs(); m_type = C_FUNCTION; m_c_function_value =
func;
- }
- void set_function_as_object(function_as_object* func);
- void set_undefined() { drop_refs(); m_type = UNDEFINED; }
- void set_null() { drop_refs(); m_type = NULLTYPE; }
-
- void operator=(const as_value& v)
- {
- if (v.m_type == UNDEFINED) set_undefined();
- else if (v.m_type == NULLTYPE) set_null();
- else if (v.m_type == BOOLEAN)
set_bool(v.m_boolean_value);
- else if (v.m_type == STRING)
set_tu_string(v.m_string_value);
- else if (v.m_type == NUMBER)
set_double(v.m_number_value);
- else if (v.m_type == OBJECT)
set_as_object_interface(v.m_object_value);
- else if (v.m_type == C_FUNCTION)
set_as_c_function_ptr(v.m_c_function_value);
- else if (v.m_type == AS_FUNCTION)
set_function_as_object(v.m_as_function_value);
- }
-
- bool is_nan() const { return (m_type == NUMBER &&
isnan(m_number_value)); }
- bool is_inf() const { return (m_type == NUMBER &&
isinf(m_number_value)); }
- bool is_finite() const { return (m_type == NUMBER &&
isfinite(m_number_value)); }
-
- bool operator==(const as_value& v) const;
- bool operator!=(const as_value& v) const;
- bool operator<(const as_value& v) const { return to_number()
< v.to_number(); }
- void operator+=(const as_value& v) {
set_double(this->to_number() + v.to_number()); }
- void operator-=(const as_value& v) {
set_double(this->to_number() - v.to_number()); }
- void operator*=(const as_value& v) {
set_double(this->to_number() * v.to_number()); }
- void operator/=(const as_value& v) {
set_double(this->to_number() / v.to_number()); } // @@ check for div/0
- void operator&=(const as_value& v) {
set_int(int(this->to_number()) & int(v.to_number())); }
- void operator|=(const as_value& v) {
set_int(int(this->to_number()) | int(v.to_number())); }
- void operator^=(const as_value& v) {
set_int(int(this->to_number()) ^ int(v.to_number())); }
- void shl(const as_value& v) { set_int(int(this->to_number())
<< int(v.to_number())); }
- void asr(const as_value& v) { set_int(int(this->to_number())
>> int(v.to_number())); }
- void lsr(const as_value& v) {
set_int((Uint32(this->to_number()) >> int(v.to_number()))); }
-
- /// Sets this value to this string plus the given string.
- void string_concat(const tu_string& str);
-
- tu_string* get_mutable_tu_string() { assert(m_type == STRING);
return &m_string_value; }
- };
-
// tulrich: I'm not too sure this is useful. For things like
// xml_as_object, is it sufficient to always store the event handlers
@@ -510,9 +247,9 @@
// special table? I have a feeling that's what Macromedia does
// (though I'm not sure).
#if 0
- // This class is just as_object_interface, with an event
+ // This class is just as_object, with an event
// handler table added.
- struct as_object_with_handlers : public as_object_interface
+ struct as_object_with_handlers : public as_object
{
// ActionScript event handler table.
hash<event_id, gnash::as_value> m_event_handlers;
@@ -533,168 +270,6 @@
#endif // 0
- //
- // as_prop_flags
- //
-
- /// Flags defining the level of protection of a member
- struct as_prop_flags
- {
- /// Numeric flags
- int m_flags;
-
- /// if true, this value is protected (internal to gnash)
- bool m_is_protected;
-
- /// mask for flags
- const static int as_prop_flags_mask = 0x7;
-
- /// Default constructor
- as_prop_flags() : m_flags(0), m_is_protected(false)
- {
- }
-
- /// Constructor
- as_prop_flags(const bool read_only, const bool dont_delete,
const bool dont_enum)
- :
- m_flags(((read_only) ? 0x4 : 0) | ((dont_delete) ? 0x2
: 0) | ((dont_enum) ? 0x1 : 0)),
- m_is_protected(false)
- {
- }
-
- /// Constructor, from numerical value
- as_prop_flags(const int flags)
- : m_flags(flags), m_is_protected(false)
- {
- }
-
- /// accessor to m_readOnly
- bool get_read_only() const { return (((this->m_flags &
0x4)!=0)?true:false); }
-
- /// accessor to m_dontDelete
- bool get_dont_delete() const { return (((this->m_flags &
0x2)!=0)?true:false); }
-
- /// accessor to m_dontEnum
- bool get_dont_enum() const { return (((this->m_flags &
0x1)!=0)?true:false); }
-
- /// accesor to the numerical flags value
- int get_flags() const { return this->m_flags; }
-
- /// accessor to m_is_protected
- bool get_is_protected() const { return this->m_is_protected; }
-
- /// setter to m_is_protected
- void set_get_is_protected(const bool is_protected) {
this->m_is_protected = is_protected; }
-
- /// set the numerical flags value (return the new value )
- /// If unlocked is false, you cannot un-protect from over-write,
- /// you cannot un-protect from deletion and you cannot
- /// un-hide from the for..in loop construct
- int set_flags(const int setTrue, const int set_false = 0)
- {
- if (!this->get_is_protected())
- {
- this->m_flags = this->m_flags & (~set_false);
- this->m_flags |= setTrue;
- }
-
- return get_flags();
- }
- };
-
- //
- // as_member
- //
-
- /// Member for as_object: value + flags
- struct as_member {
- /// value
- as_value m_value;
- /// Properties flags
- as_prop_flags m_flags;
-
- /// Default constructor
- as_member() {
- }
-
- /// Constructor
- as_member(const as_value &value,const as_prop_flags
flags=as_prop_flags())
- :
- m_value(value),
- m_flags(flags)
- {
- }
-
- /// accessor to the value
- as_value get_member_value() const { return m_value; }
-
- /// accessor to the properties flags
- as_prop_flags get_member_flags() const { return m_flags; }
-
- /// set the value
- void set_member_value(const as_value &value) { m_value =
value; }
- /// accessor to the properties flags
- void set_member_flags(const as_prop_flags &flags) { m_flags =
flags; }
- };
-
-
- /// \brief
- /// A generic bag of attributes.
- //
- /// Base-class for ActionScript script-defined objects.
- /// This would likely be ActionScript's 'Object' class.
- ///
- struct as_object : public as_object_interface
- {
- /// Members of this objects in an hash
- stringi_hash<as_member> m_members;
-
- /// Reference to this object's '__proto__'
- as_object_interface* m_prototype;
-
- /// Construct an ActionScript object with no prototype
associated.
- as_object() : m_prototype(NULL) { }
-
- /// \brief
- /// Construct an ActionScript object based on the given
prototype.
- /// Adds a reference to the prototype, if any.
- as_object(as_object_interface* proto) : m_prototype(proto)
- {
- if (m_prototype) m_prototype->add_ref();
- }
-
- /// \brief
- /// Default destructor for ActionScript objects.
- /// Drops reference on prototype member, if any.
- virtual ~as_object()
- {
- if (m_prototype) m_prototype->drop_ref();
- }
-
- /// Return a text representation for this object
- virtual const char* get_text_value() const { return NULL; }
-
- /// Set a member value
- virtual void set_member(const tu_stringi& name,
- const as_value& val );
-
- /// Get a member as_value by name
- virtual bool get_member(const tu_stringi& name, as_value* val);
-
- /// Get an member pointer by name
- virtual bool get_member(const tu_stringi& name,
- as_member* member) const;
-
- /// Set member flags (probably used by ASSetPropFlags)
- virtual bool set_member_flags(const tu_stringi& name,
- const int flags);
-
- /// This object is not a movie; no conversion.
- virtual movie* to_movie() { return NULL; }
-
- void clear();
- };
-
/// ActionScript "environment", essentially VM state?
struct as_environment
@@ -835,12 +410,12 @@
struct fn_call
{
as_value* result;
- as_object_interface* this_ptr;
+ as_object* this_ptr;
as_environment* env;
int nargs;
int first_arg_bottom_index;
- fn_call(as_value* res_in, as_object_interface* this_in,
+ fn_call(as_value* res_in, as_object* this_in,
as_environment* env_in,
int nargs_in, int first_in)
:
@@ -870,21 +445,21 @@
void action_clear();
// Dispatching methods from C++.
- as_value call_method0(const as_value& method, as_environment*
env, as_object_interface* this_ptr);
+ as_value call_method0(const as_value& method, as_environment*
env, as_object* this_ptr);
as_value call_method1(
- const as_value& method, as_environment* env,
as_object_interface* this_ptr,
+ const as_value& method, as_environment* env, as_object*
this_ptr,
const as_value& arg0);
as_value call_method2(
- const as_value& method, as_environment* env,
as_object_interface* this_ptr,
+ const as_value& method, as_environment* env, as_object*
this_ptr,
const as_value& arg0, const as_value& arg1);
as_value call_method3(
- const as_value& method, as_environment* env,
as_object_interface* this_ptr,
+ const as_value& method, as_environment* env, as_object*
this_ptr,
const as_value& arg0, const as_value& arg1, const as_value&
arg2);
const char* call_method_parsed(
as_environment* env,
- as_object_interface* this_ptr,
+ as_object* this_ptr,
const char* method_name,
const char* method_arg_fmt,
va_list args);
Index: gnash/server/array.cpp
diff -u gnash/server/array.cpp:1.9 gnash/server/array.cpp:1.10
--- gnash/server/array.cpp:1.9 Wed Feb 1 23:52:44 2006
+++ gnash/server/array.cpp Mon Feb 13 10:44:12 2006
@@ -264,7 +264,7 @@
for (int i=0;i<fn.nargs;i++)
newarray->elements.push_back(fn.arg(i));
- fn.result->set_as_object_interface(newarray);
+ fn.result->set_as_object(newarray);
}
// Callback to slice part of an array to a new array without changing
the original
@@ -319,7 +319,7 @@
// They passed no arguments: simply duplicate the array
and return the new one
as_array_object* newarray = new as_array_object;
newarray->elements = array->elements;
- fn.result->set_as_object_interface(newarray);
+ fn.result->set_as_object(newarray);
return;
}
@@ -330,7 +330,7 @@
for (int i=startindex;i<endindex;i++)
newarray->elements[i-startindex] = array->elements[i];
- fn.result->set_as_object_interface(newarray);
+ fn.result->set_as_object(newarray);
}
// this sets all the callback members for an array function
@@ -386,6 +386,6 @@
}
}
- fn.result->set_as_object_interface(ao.get_ptr());
+ fn.result->set_as_object(ao.get_ptr());
}
};
Index: gnash/server/gnash.h
diff -u gnash/server/gnash.h:1.10 gnash/server/gnash.h:1.11
--- gnash/server/gnash.h:1.10 Sat Feb 11 01:57:03 2006
+++ gnash/server/gnash.h Mon Feb 13 10:44:12 2006
@@ -31,6 +31,8 @@
#include <ctype.h> // for poxy wchar_t
#include <stdarg.h> // for va_list arg to
movie_interface::call_method_args()
+#include "Object.h"
+
// FIXME: The local usage of these constants should probably be renamed in this
// file because they conflict with definitions in the system header files.
Luckily
// they are used in files we don't need, so we should be able to safely
redefine
@@ -144,56 +146,10 @@
sound_handler* create_sound_handler_sdl();
-/// For stuff that's tricky to keep track of w/r/t ownership & cleanup.
-struct ref_counted
-{
- ref_counted();
- virtual ~ref_counted();
- void add_ref() const;
- void drop_ref() const;
- int get_ref_count() const { return m_ref_count; }
- weak_proxy* get_weak_proxy() const;
-private:
- mutable int m_ref_count;
- mutable weak_proxy* m_weak_proxy;
-};
-
struct font;
struct character_def;
struct sound_sample;
-/// An interface for casting to different types of resources.
-struct resource : public ref_counted
-{
- virtual ~resource() {}
-
- // Override in derived classes that implement corresponding interfaces.
- virtual font* cast_to_font() { return 0; }
- virtual character_def* cast_to_character_def() { return 0; }
- virtual sound_sample* cast_to_sound_sample() { return 0; }
-};
-
-
-/// This is the base class for all ActionScript-able objects
-//
-// ("as_" stands for ActionScript).
-struct as_object_interface : public resource
-{
- virtual ~as_object_interface() {}
-
- /// So that text_character's can return something reasonable.
- virtual const char* get_text_value() const { return 0; }
-
- /// Set a member of this ActionScript object
- virtual void set_member(const tu_stringi& name, const as_value& val)
= 0;
-
- /// Get a member of this ActionScript object
- virtual bool get_member(const tu_stringi& name, as_value* val) = 0;
- /// Convert this object to a movie
- virtual movie* to_movie() = 0;
-};
-
-
/// For caching precomputed stuff. Generally of
/// interest to gnash_processor and programs like it.
struct cache_options
@@ -349,7 +305,7 @@
/// This is the client program's interface to an instance of a
/// movie.
///
-struct movie_interface : public as_object_interface
+struct movie_interface : public as_object
{
virtual movie_definition* get_movie_definition() = 0;
Index: gnash/server/string.cpp
diff -u gnash/server/string.cpp:1.3 gnash/server/string.cpp:1.4
--- gnash/server/string.cpp:1.3 Mon Jan 23 17:01:13 2006
+++ gnash/server/string.cpp Mon Feb 13 10:44:12 2006
@@ -217,7 +217,7 @@
str->set_member("charCodeAt", &string_char_code_at);
str->set_member("lastIndexOf", &string_last_index_of);
- fn.result->set_as_object_interface(str.get_ptr());
+ fn.result->set_as_object(str.get_ptr());
}
} // namespace gnash
Index: gnash/server/textformat.cpp
diff -u gnash/server/textformat.cpp:1.4 gnash/server/textformat.cpp:1.5
--- gnash/server/textformat.cpp:1.4 Sun Feb 12 02:12:07 2006
+++ gnash/server/textformat.cpp Mon Feb 13 10:44:12 2006
@@ -125,7 +125,7 @@
// instead of doing this.
fn.env->set_variable("setTextFormat", &textformat_setformat,
array<with_stack_entry>());
- fn.result->set_as_object_interface(text_obj);
+ fn.result->set_as_object(text_obj);
}
Index: gnash/server/xml.cpp
diff -u gnash/server/xml.cpp:1.10 gnash/server/xml.cpp:1.11
--- gnash/server/xml.cpp:1.10 Sun Feb 12 02:12:07 2006
+++ gnash/server/xml.cpp Mon Feb 13 10:44:12 2006
@@ -1058,7 +1058,7 @@
xml_as_object* xml_obj =
(xml_as_object*)fn.env->top(0).to_object();
//log_msg("\tCloned the XML object at %p\n", xml_obj);
//result->set(xml_obj);
- fn.result->set_as_object_interface(xml_obj);
+ fn.result->set_as_object(xml_obj);
return;
}
} else {
@@ -1087,7 +1087,7 @@
}
- fn.result->set_as_object_interface(xml_obj);
+ fn.result->set_as_object(xml_obj);
}
//
@@ -1150,7 +1150,7 @@
xml_obj->set_member("appendChild", &xmlnode_appendchild);
#endif
ptr->obj.cloneNode(xml_obj->obj, deep);
- fn.result->set_as_object_interface(xml_obj);
+ fn.result->set_as_object(xml_obj);
} else {
log_msg("ERROR: no Depth paramater!\n");
}
@@ -1174,7 +1174,7 @@
#endif
xml_obj->obj.nodeNameSet((char *)text);
xml_obj->obj._type = XML_ELEMENT_NODE;
- fn.result->set_as_object_interface(xml_obj);
+ fn.result->set_as_object(xml_obj);
} else {
log_msg("ERROR: no text for element creation!\n");
}
@@ -1199,7 +1199,7 @@
#endif
xml_obj->obj.nodeValueSet((char *)text);
xml_obj->obj._type = XML_TEXT_NODE;
- fn.result->set_as_object_interface(xml_obj);
+ fn.result->set_as_object(xml_obj);
// log_msg("%s: xml obj is %p\n", __PRETTY_FUNCTION__, xml_obj);
} else {
log_msg("ERROR: no text for text node creation!\n");
Index: gnash/server/xml.h
diff -u gnash/server/xml.h:1.11 gnash/server/xml.h:1.12
--- gnash/server/xml.h:1.11 Sat Feb 11 01:57:03 2006
+++ gnash/server/xml.h Mon Feb 13 10:44:12 2006
@@ -192,7 +192,7 @@
if ((name == "firstChild") || (name == "childNodes")) {
// printf("Returning a self reference for %s for object at %p\n",
// name.c_str(), this);
- val->set_as_object_interface(this);
+ val->set_as_object(this);
return true;
}
Index: gnash/server/xmlnode.cpp
diff -u gnash/server/xmlnode.cpp:1.3 gnash/server/xmlnode.cpp:1.4
--- gnash/server/xmlnode.cpp:1.3 Sat Feb 11 18:09:43 2006
+++ gnash/server/xmlnode.cpp Mon Feb 13 10:44:12 2006
@@ -331,7 +331,7 @@
xml_obj->set_member("parentNode", as_value(""));
xml_obj->set_member("previousSibling", as_value(""));
- fn.result->set_as_object_interface(xml_obj);
+ fn.result->set_as_object(xml_obj);
}
void xmlnode_appendchild(const fn_call& fn)
@@ -375,7 +375,7 @@
bool deep = fn.env->bottom(fn.first_arg_bottom_index).to_bool();
xmlnode_obj = new xmlnode_as_object;
ptr->obj.cloneNode(xmlnode_obj->obj, deep);
- fn.result->set_as_object_interface(xmlnode_obj);
+ fn.result->set_as_object(xmlnode_obj);
} else {
log_msg("ERROR: no Depth paramater!\n");
}
Index: gnash/server/xmlsocket.cpp
diff -u gnash/server/xmlsocket.cpp:1.5 gnash/server/xmlsocket.cpp:1.6
--- gnash/server/xmlsocket.cpp:1.5 Mon Feb 6 04:11:04 2006
+++ gnash/server/xmlsocket.cpp Mon Feb 13 10:44:12 2006
@@ -448,7 +448,7 @@
}
void
-XMLSocket::push(as_object_interface *obj)
+XMLSocket::push(as_object *obj)
{
_nodes.push_back(obj);
}
@@ -758,7 +758,7 @@
{
#if 0
as_value* result = fn.result;
- as_object_interface* this_ptr = fn.this_ptr;
+ as_object* this_ptr = fn.this_ptr;
int nargs = fn.nargs;
int first_arg = fn.first_arg_bottom_index;
#else
@@ -818,7 +818,7 @@
{
#if 0
as_value* result = fn.result;
- as_object_interface* this_ptr = fn.this_ptr;
+ as_object* this_ptr = fn.this_ptr;
int nargs = fn.nargs;
int first_arg = fn.first_arg_bottom_index;
#else
Index: gnash/server/xmlsocket.h
diff -u gnash/server/xmlsocket.h:1.4 gnash/server/xmlsocket.h:1.5
--- gnash/server/xmlsocket.h:1.4 Sun Feb 12 02:12:07 2006
+++ gnash/server/xmlsocket.h Mon Feb 13 10:44:12 2006
@@ -66,7 +66,7 @@
void onXML(tu_string);
// These handle the array of XML nodes
- void push(as_object_interface *obj);
+ void push(as_object *obj);
void clear();
int count();
@@ -83,7 +83,7 @@
bool _connect;
bool _processing;
array<tu_string> _messages;
- array<as_object_interface *> _nodes;
+ array<as_object *> _nodes;
};
Index: gnash/testsuite/actionscript.all/Makefile.am
diff -u gnash/testsuite/actionscript.all/Makefile.am:1.12
gnash/testsuite/actionscript.all/Makefile.am:1.13
--- gnash/testsuite/actionscript.all/Makefile.am:1.12 Thu Feb 9 00:37:25 2006
+++ gnash/testsuite/actionscript.all/Makefile.am Mon Feb 13 10:44:12 2006
@@ -72,6 +72,7 @@
Video.swf \
Object.swf \
LocalConnection.swf \
+ Inheritance.swf \
NetConnection.swf \
XML.swf \
Function.swf
Index: gnash/testsuite/actionscript.all/xtrace.as
diff -u gnash/testsuite/actionscript.all/xtrace.as:1.2
gnash/testsuite/actionscript.all/xtrace.as:1.3
--- gnash/testsuite/actionscript.all/xtrace.as:1.2 Thu Feb 9 17:09:48 2006
+++ gnash/testsuite/actionscript.all/xtrace.as Mon Feb 13 10:44:12 2006
@@ -1,4 +1,4 @@
-createTextField("out",300000,0,0,600,600);
+createTextField("out",300000,0,0,600,800);
// FIXME: _global object isn't recognized
//_global.xtrace = function (msg)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ./ChangeLog server/Boolean.cpp server/Cam...,
strk <=