gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ./ChangeLog server/Function.cpp server/Fu...


From: strk
Subject: [Gnash-commit] gnash ./ChangeLog server/Function.cpp server/Fu...
Date: Thu, 27 Apr 2006 08:41:45 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Branch:         
Changes by:     strk <address@hidden>   06/04/27 08:41:45

Modified files:
        .              : ChangeLog 
        server         : Function.cpp Function.h Global.cpp System.cpp 
                         System.h 

Log message:
        * server/: (Function.h, Function.cpp): added new constructor
        taking exported interface as argument.
        * server/: (System.cpp, System.h, Global.cpp): added System
        AS class registration, System.capabilities.version
        implementation and scheleton for AS instanciation of it
        (the latter being untested).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/ChangeLog.diff?tr1=1.240&tr2=1.241&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Function.cpp.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Function.h.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Global.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.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/System.h.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: gnash/ChangeLog
diff -u gnash/ChangeLog:1.240 gnash/ChangeLog:1.241
--- gnash/ChangeLog:1.240       Thu Apr 27 07:27:25 2006
+++ gnash/ChangeLog     Thu Apr 27 08:41:45 2006
@@ -2,6 +2,12 @@
 
        * testsuite/actionscript.all/array.as: turned length()
        method calls to length data member accesses.
+       * server/: (Function.h, Function.cpp): added new constructor
+       taking exported interface as argument.
+       * server/: (System.cpp, System.h, Global.cpp): added System
+       AS class registration, System.capabilities.version
+       implementation and scheleton for AS instanciation of it
+       (the latter being untested).
 
 2006-04-26  Timo Lindfors <address@hidden>
 
Index: gnash/server/Function.cpp
diff -u gnash/server/Function.cpp:1.11 gnash/server/Function.cpp:1.12
--- gnash/server/Function.cpp:1.11      Wed Apr 26 13:12:53 2006
+++ gnash/server/Function.cpp   Thu Apr 27 08:41:45 2006
@@ -137,6 +137,33 @@
        // Caller will take care of it 
 }
 
+function_as_object::function_as_object(as_object* export_iface)
+               :
+               as_object(getFunctionPrototype()),
+               m_action_buffer(NULL),
+               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(export_iface)
+{
+       init();
+
+       if ( m_properties )
+       {
+               m_properties->add_ref();
+
+               m_properties->set_member("constructor", this); 
+               m_properties->set_member_flags("constructor", 1);
+
+               set_member("prototype", as_value(m_properties));
+       }
+
+}
+
 function_as_object::function_as_object(action_buffer* ab, as_environment* env,
                int start, const std::vector<with_stack_entry>& with_stack)
                :
Index: gnash/server/Function.h
diff -u gnash/server/Function.h:1.7 gnash/server/Function.h:1.8
--- gnash/server/Function.h:1.7 Mon Apr 24 23:05:56 2006
+++ gnash/server/Function.h     Thu Apr 27 08:41:45 2006
@@ -90,8 +90,18 @@
        ~function_as_object();
 
        /// Default constructor
+       //
+       /// Creates a Function object inheriting
+       /// the Function interface (apply,call)
+       ///
        function_as_object();
 
+       /// Construct a function specifying exported interface
+       //
+       /// This is intended for use by built-in ActionScript classes
+       ///
+       function_as_object(as_object* export_iface);
+
        /// NULL environment is allowed -- if so, then
        /// functions will be executed in the caller's
        /// environment, rather than the environment where they
Index: gnash/server/Global.cpp
diff -u gnash/server/Global.cpp:1.1 gnash/server/Global.cpp:1.2
--- gnash/server/Global.cpp:1.1 Wed Apr 26 22:10:09 2006
+++ gnash/server/Global.cpp     Thu Apr 27 08:41:45 2006
@@ -480,58 +480,59 @@
        :
        as_object()
 {
-           set_member("trace", as_value(as_global_trace));
-           set_member("Object", as_value(as_global_object_ctor));
-           set_member("Sound", as_value(sound_new));
-           set_member("Array", as_value(array_new));
+       set_member("trace", as_value(as_global_trace));
+       set_member("Object", as_value(as_global_object_ctor));
+       set_member("Sound", as_value(sound_new));
+       set_member("Array", as_value(array_new));
 
-           set_member("TextFormat", as_value(textformat_new));
+       set_member("TextFormat", as_value(textformat_new));
 #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));
+       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("MovieClipLoader", as_value(moviecliploader_new));
-           set_member("String", as_value(string_ctor));
-           // This next set are all the unimplemented classes whose
-           // code was machine generated.
-           set_member("Boolean", as_value(boolean_new));
-           set_member("Camera", as_value(camera_new));
-           set_member("Color", as_value(color_new));
-           set_member("ContextMenu", as_value(contextmenu_new));
-           set_member("CustomActions", as_value(customactions_new));
-           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));
-           set_member("TextSnapshot", as_value(textsnapshot_new));
-           set_member("Video", as_value(video_new));
-           // ASSetPropFlags
-           set_member("ASSetPropFlags", as_global_assetpropflags);
-           // unescape
-           set_member("unescape", as_global_unescape);
-           // parseFloat
-           set_member("parseFloat", as_global_parsefloat);
-           // parseInt
-           set_member("parseInt", as_global_parseint);
-           // isNan
-           set_member("isNan", as_global_isnan);
-           // isFinite
-           set_member("isFinite", as_global_isfinite);
+       set_member("MovieClipLoader", as_value(moviecliploader_new));
+       set_member("String", as_value(string_ctor));
+       // This next set are all the unimplemented classes whose
+       // code was machine generated.
+       set_member("Boolean", as_value(boolean_new));
+       set_member("Camera", as_value(camera_new));
+       set_member("Color", as_value(color_new));
+       set_member("ContextMenu", as_value(contextmenu_new));
+       set_member("CustomActions", as_value(customactions_new));
+       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));
+       set_member("TextSnapshot", as_value(textsnapshot_new));
+       set_member("Video", as_value(video_new));
+       // ASSetPropFlags
+       set_member("ASSetPropFlags", as_global_assetpropflags);
+       // unescape
+       set_member("unescape", as_global_unescape);
+       // parseFloat
+       set_member("parseFloat", as_global_parsefloat);
+       // parseInt
+       set_member("parseInt", as_global_parseint);
+       // isNan
+       set_member("isNan", as_global_isnan);
+       // isFinite
+       set_member("isFinite", as_global_isfinite);
 
-           function_init(this);
-           movieclip_init(this);
-           math_init(this);
-           key_init(this);
+       function_init(this);
+       movieclip_init(this);
+       math_init(this);
+       key_init(this);
+       system_init(this);
 }
 
 
Index: gnash/server/System.cpp
diff -u gnash/server/System.cpp:1.4 gnash/server/System.cpp:1.5
--- gnash/server/System.cpp:1.4 Mon Apr 24 23:05:56 2006
+++ gnash/server/System.cpp     Thu Apr 27 08:41:45 2006
@@ -81,34 +81,103 @@
 {
     log_msg("%s:unimplemented \n", __FUNCTION__);
 }
+
+static as_object*
+getSystemSecurityInterface()
+{
+       static as_object* proto = NULL;
+       if ( proto == NULL )
+       {
+               proto = new as_object();
+               proto->set_member("allowdomain", &system_security_allowdomain);
+               proto->set_member("allowinsecuredomain", 
&system_security_allowinsecuredomain);
+               proto->set_member("loadpolicyfile", 
&system_security_loadpolicyfile);
+       }
+       return proto;
+}
+
+static as_object*
+getSystemCapabilitiesInterface()
+{
+       static as_object* proto = NULL;
+       if ( proto == NULL )
+       {
+               proto = new as_object();
+               proto->set_member("version", "Gnash-" VERSION);
+       }
+       return proto;
+}
+
+static void
+attachSystemInterface(as_object* proto)
+{
+       // Initialize Function prototype
+       proto->set_member("security", getSystemSecurityInterface());
+       proto->set_member("capabilities", getSystemCapabilitiesInterface());
+       proto->set_member("setclipboard", &system_setclipboard);
+       proto->set_member("showsettings", &system_showsettings);
+}
+
+static as_object*
+getSystemInterface()
+{
+       static as_object* proto = NULL;
+       if ( proto == NULL )
+       {
+               proto = new as_object();
+               attachSystemInterface(proto);
+       }
+       return proto;
+}
+
+system_as_object::system_as_object()
+       :
+       function_as_object(getSystemInterface())
+{
+}
+
 void
 system_new(const fn_call& fn)
 {
-    system_as_object *system_obj = new system_as_object;
-
-    system_obj->set_member("security.allowdomain", 
&system_security_allowdomain);
-    system_obj->set_member("security.allowinsecuredomain", 
&system_security_allowinsecuredomain);
-    system_obj->set_member("security.loadpolicyfile", 
&system_security_loadpolicyfile);
-    system_obj->set_member("setclipboard", &system_setclipboard);
-    system_obj->set_member("showsettings", &system_showsettings);
+    system_as_object *system_obj = new system_as_object();
 
     fn.result->set_as_object(system_obj);
 }
+
 void system_security_allowdomain(const fn_call& fn) {
     log_msg("%s:unimplemented \n", __FUNCTION__);
 }
+
 void system_security_allowinsecuredomain(const fn_call& fn) {
     log_msg("%s:unimplemented \n", __FUNCTION__);
 }
+
 void system_security_loadpolicyfile(const fn_call& fn) {
     log_msg("%s:unimplemented \n", __FUNCTION__);
 }
+
 void system_setclipboard(const fn_call& fn) {
     log_msg("%s:unimplemented \n", __FUNCTION__);
 }
+
 void system_showsettings(const fn_call& fn) {
     log_msg("%s:unimplemented \n", __FUNCTION__);
 }
 
+void
+system_init(as_object* glob)
+{
+       // This is going to be the global System "class"/"function"
+       static function_as_object* sys=new system_as_object();
+
+       // We replicate interface to the System class itself
+       attachSystemInterface(sys);
+
+       // Register _global.System
+       glob->set_member("System", sys);
+
+}
+
+
 } // end of gnaash namespace
 
Index: gnash/server/System.h
diff -u gnash/server/System.h:1.3 gnash/server/System.h:1.4
--- gnash/server/System.h:1.3   Mon Apr 24 23:05:56 2006
+++ gnash/server/System.h       Thu Apr 27 08:41:45 2006
@@ -45,6 +45,7 @@
 
 #include "impl.h"
 #include "log.h"
+#include "Function.h"
 
 namespace gnash {
   
@@ -91,9 +92,11 @@
     bool _useCodepage;
 };
 
-struct system_as_object : public as_object
+class system_as_object : public function_as_object
 {
-    System obj;
+    //System obj;
+public:
+       system_as_object();
 };
 
 void system_new(const fn_call& fn);
@@ -103,6 +106,8 @@
 void system_setclipboard(const fn_call& fn);
 void system_showsettings(const fn_call& fn);
 
+void system_init(as_object* global);
+
 } // end of gnash namespace
 
 // __SYSTEM_H__




reply via email to

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