gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/avm2 r9463: Use call_method to execute act


From: Tom Stellard
Subject: [Gnash-commit] /srv/bzr/gnash/avm2 r9463: Use call_method to execute actionscript functions.
Date: Fri, 15 Aug 2008 00:40:50 +0800
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9463
committer: Tom Stellard <address@hidden>
branch nick: gnash_dev
timestamp: Fri 2008-08-15 00:40:50 +0800
message:
  Use call_method to execute actionscript functions.
modified:
  libcore/vm/Machine.cpp
  libcore/vm/Machine.h
    ------------------------------------------------------------
    revno: 9461.1.1
    committer: Tom Stellard <address@hidden>
    branch nick: gnash_dev
    timestamp: Thu 2008-08-14 01:52:10 +0800
    message:
      Add some useful debug statements to push_stack and pop_stack.
    modified:
      libcore/vm/Machine.h
    ------------------------------------------------------------
    revno: 9461.1.2
    committer: Tom Stellard <address@hidden>
    branch nick: gnash_dev
    timestamp: Thu 2008-08-14 19:31:01 +0800
    message:
      Don't resize the arg vector.
    modified:
      libcore/vm/Machine.h
    ------------------------------------------------------------
    revno: 9461.1.3
    committer: Tom Stellard <address@hidden>
    branch nick: gnash_dev
    timestamp: Thu 2008-08-14 19:32:42 +0800
    message:
      Use an as_object pointer when calling an actionscript method.
    modified:
      libcore/vm/Machine.cpp
    ------------------------------------------------------------
    revno: 9461.1.4
    committer: Tom Stellard <address@hidden>
    branch nick: gnash_dev
    timestamp: Thu 2008-08-14 19:38:11 +0800
    message:
      Use as_value object when pushing a string onto the stack.
    modified:
      libcore/vm/Machine.cpp
    ------------------------------------------------------------
    revno: 9461.1.5
    committer: Tom Stellard <address@hidden>
    branch nick: gnash_dev
    timestamp: Thu 2008-08-14 22:00:00 +0800
    message:
      Use call_method to make function calls.
    modified:
      libcore/vm/Machine.cpp
      libcore/vm/Machine.h
=== modified file 'libcore/vm/Machine.cpp'
--- a/libcore/vm/Machine.cpp    2008-08-12 17:18:51 +0000
+++ b/libcore/vm/Machine.cpp    2008-08-14 14:00:00 +0000
@@ -25,6 +25,7 @@
 #include "abc_block.h"
 #include "fn_call.h"
 #include "abc_function.h"
+#include "action.h"
 
 //#define PRETEND
 namespace gnash {
@@ -928,7 +929,7 @@
 ///  value -- String object from string_pool[index]
        case SWF::ABC_ACTION_PUSHSTRING:
        {
-               push_stack(pool_string(mStream->read_V32(), mPoolObject));
+               push_stack(as_value(pool_string(mStream->read_V32(), 
mPoolObject)));
                break;
        }
 /// 0x2D ABC_ACTION_PUSHINT
@@ -1171,9 +1172,14 @@
 //             bool lex_only = (opcode == SWF::ABC_ACTION_CALLPROPLEX);
                asName a = pool_name(mStream->read_V32(), mPoolObject);
                boost::uint32_t argc = mStream->read_V32();
-               std::vector<as_value> args = get_args(argc);
-               as_object object = pop_stack().to_object();
-               object.callMethod(a.getGlobalName(),args[0]);
+               as_environment env = get_args(argc);
+               as_object *object = pop_stack().to_object().get();
+               
+               //TODO: Determine namespace.
+               as_value property = object->getMember(a.getGlobalName(),0);
+               call_method(property,&env,object,argc,env.stack_size() - 1);
+               env.drop(argc);
+
 /*             int shift = completeName(a, argc);
                ENSURE_OBJECT(mStack.top(shift + argc));
                as_object *obj = mStack.top(argc + shift).to_object().get();
@@ -1251,7 +1257,7 @@
                LOG_AVM_UNIMPLEMENTED();
                boost::uint32_t argc = mStream->read_V32();
                LOG_DEBUG_AVM("There are %u arguments.",argc);
-               std::vector<as_value> args = get_args(argc);
+               get_args(argc);
 //             ENSURE_OBJECT(mStack.top(argc));
                as_object *super = pop_stack().to_object().get()->get_super();
                //TODO: Actually construct the super.

=== modified file 'libcore/vm/Machine.h'
--- a/libcore/vm/Machine.h      2008-08-12 17:03:21 +0000
+++ b/libcore/vm/Machine.h      2008-08-14 14:00:00 +0000
@@ -25,6 +25,7 @@
 #include "as_value.h"
 #include "asClass.h"
 #include "swf.h"
+#include "as_environment.h"
 
 #define LOG_DEBUG_AVM(fmt,...) log_action("AVM2: " fmt, ## __VA_ARGS__);
 
@@ -253,14 +254,15 @@
        }
 
        void push_stack(as_value object){
-               LOG_DEBUG_AVM("Pushing value onto stack.");
+               LOG_DEBUG_AVM("Pushing value %s onto 
stack.",object.toDebugString());
                mStack.push(object);
                LOG_DEBUG_AVM("There are now %u items in the 
stack",mStack.size());
        }
 
        as_value pop_stack(){
-               LOG_DEBUG_AVM("Poping value off the stack.  There will be %u 
items in the stack",mStack.size()-1);
-               return mStack.pop();
+               as_value value = mStack.pop();
+               LOG_DEBUG_AVM("Poping value %s off the stack.  There are now %u 
items in the stack",value.toDebugString(),mStack.size());
+               return value;
        }
 
        void push_scope_stack(as_value object){
@@ -310,13 +312,12 @@
                mStack.push(value);
        }
 
-       std::vector<as_value> get_args(int argc){
-               std::vector<as_value> args;
-               args.resize(argc);
+       as_environment get_args(int argc){
+               as_environment env;
                for(unsigned int i=0;i<argc;i++){
-                       args.push_back(pop_stack());
+                       env.push(pop_stack());
                }
-               return args;
+               return env;
        }
 
        SafeStack<as_value> mStack;


reply via email to

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