[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/vm/ASHandlers.cpp server...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/vm/ASHandlers.cpp server... |
Date: |
Tue, 19 Dec 2006 18:00:12 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 06/12/19 18:00:12
Modified files:
. : ChangeLog
server/vm : ASHandlers.cpp ActionExec.cpp ActionExec.h
Log message:
* server/vm/ASHandlers.cpp: use ActionExec methods for variables
manipulation.
* server/vm/ActionExec.{cpp,h}: added variable manipulation
functions.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1972&r2=1.1973
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.cpp?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.h?cvsroot=gnash&r1=1.3&r2=1.4
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1972
retrieving revision 1.1973
diff -u -b -r1.1972 -r1.1973
--- ChangeLog 19 Dec 2006 16:13:46 -0000 1.1972
+++ ChangeLog 19 Dec 2006 18:00:12 -0000 1.1973
@@ -1,5 +1,9 @@
2006-12-19 Sandro Santilli <address@hidden>
+ * server/vm/ASHandlers.cpp: use ActionExec methods for variables
+ manipulation.
+ * server/vm/ActionExec.{cpp,h}: added variable manipulation
+ functions.
* testsuite/misc-ming.all/timeline_var_test.c: added
additional check for timeline variables.
Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/vm/ASHandlers.cpp 18 Dec 2006 10:40:53 -0000 1.19
+++ server/vm/ASHandlers.cpp 19 Dec 2006 18:00:12 -0000 1.20
@@ -16,7 +16,7 @@
//
-/* $Id: ASHandlers.cpp,v 1.19 2006/12/18 10:40:53 strk Exp $ */
+/* $Id: ASHandlers.cpp,v 1.20 2006/12/19 18:00:12 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1010,7 +1010,7 @@
std::string var_string(ptr);
- top_value = env.get_variable(var_string, thread.getWithStack());
+ top_value = thread.getVariable(var_string);
IF_VERBOSE_ACTION
(
@@ -1038,8 +1038,7 @@
ensure_stack(env, 2);
assert(env.top(1).to_string());
- env.set_variable(env.top(1).to_string(), env.top(0),
- thread.getWithStack());
+ thread.setVariable(env.top(1).to_std_string(), env.top(0));
IF_VERBOSE_ACTION (
log_action("-- set var: %s", env.top(1).to_string());
@@ -2108,7 +2107,7 @@
as_value value = env.pop();
as_value varname = env.pop();
- env.set_local(varname.to_std_string(), value);
+ thread.setLocalVariable(varname.to_std_string(), value);
}
void
@@ -2127,7 +2126,7 @@
{
// Function is a string; lookup the function.
const std::string function_name(env.top(0).to_string());
- function = env.get_variable(function_name);
+ function = thread.getVariable(function_name);
if (function.get_type() != as_value::AS_FUNCTION &&
function.get_type() != as_value::C_FUNCTION)
@@ -2233,7 +2232,7 @@
ensure_stack(env, nargs); // previous 2 entries popped
- as_value constructor = env.get_variable(classname);
+ as_value constructor = thread.getVariable(classname);
as_value new_obj = construct_object(constructor, env, nargs,
env.get_top_index());
@@ -2407,7 +2406,7 @@
// Get the object
as_value& var_name = env.top(0);
std::string var_string = var_name.to_std_string();
- as_value variable = env.get_variable(var_string);
+ as_value variable = thread.getVariable(var_string);
const as_object* obj = variable.to_object();
// The end of the enumeration, don't set top(0) *before*
@@ -3028,8 +3027,8 @@
as_value function_value(func);
if (name.length() > 0)
{
- // @@ NOTE: should this be m_target->set_variable()???
- env.set_member(name, function_value);
+ //env.set_member(name, function_value);
+ thread.setVariable(name, function_value);
}
// Also leave it on the stack.
@@ -3158,8 +3157,8 @@
as_value function_value(func);
if (name.length() > 0)
{
- // @@ NOTE: should this be m_target->set_variable()???
- env.set_member(name, function_value);
+ //env.set_member(name, function_value);
+ thread.setVariable(name, function_value);
}
// Also leave it on the stack.
Index: server/vm/ActionExec.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ActionExec.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/vm/ActionExec.cpp 15 Dec 2006 00:06:02 -0000 1.6
+++ server/vm/ActionExec.cpp 19 Dec 2006 18:00:12 -0000 1.7
@@ -16,7 +16,7 @@
//
-/* $Id: ActionExec.cpp,v 1.6 2006/12/15 00:06:02 strk Exp $ */
+/* $Id: ActionExec.cpp,v 1.7 2006/12/19 18:00:12 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -75,7 +75,7 @@
:
with_stack(initial_with_stack),
_with_stack_limit(7),
- _function2_var(nIsFunction2),
+ _function_var(nIsFunction2?2:1),
code(abuf),
pc(nStartPC),
stop_pc(nStartPC+exec_bytes),
@@ -93,7 +93,7 @@
:
with_stack(),
_with_stack_limit(7),
- _function2_var(false),
+ _function_var(0),
code(abuf),
pc(0),
stop_pc(code.size()),
@@ -275,6 +275,34 @@
return env.del_variable_raw(name, with_stack);
}
+void
+ActionExec::setVariable(const std::string& name, const as_value& val)
+{
+ return env.set_variable(name, val, getWithStack());
+}
+
+void
+ActionExec::setLocalVariable(const std::string& name, const as_value& val)
+{
+ if ( isFunction() )
+ {
+ // TODO: set local in the function object?
+ env.set_local(name, val);
+ }
+ else
+ {
+ // TODO: set target member ?
+ // what about 'with' stack ?
+ env.set_variable(name, val);
+ }
+}
+
+as_value
+ActionExec::getVariable(const std::string& name)
+{
+ return env.get_variable(name, getWithStack());
+}
+
} // end of namespace gnash
Index: server/vm/ActionExec.h
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ActionExec.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/vm/ActionExec.h 8 Dec 2006 23:11:25 -0000 1.3
+++ server/vm/ActionExec.h 19 Dec 2006 18:00:12 -0000 1.4
@@ -48,7 +48,8 @@
/// See: http://sswf.sourceforge.net/SWFalexref.html#action_with
size_t _with_stack_limit;
- bool _function2_var;
+ /// 1 for function execution, 2 for function2 execution, 0 otherwise.
+ int _function_var;
public:
@@ -82,7 +83,7 @@
/// Create an execution thread
ActionExec(const action_buffer& abuf, as_environment& newEnv);
- /// Create an execution thread (for a function call ?)
+ /// Create an execution thread for a function call.
//
/// @param abuf
/// the action code
@@ -113,7 +114,10 @@
bool nIsFunction2);
/// Is this execution thread a function2 call ?
- bool isFunction2() { return _function2_var; }
+ bool isFunction2() { return _function_var==2; }
+
+ /// Is this execution thread a function call ?
+ bool isFunction() { return _function_var!=0; }
/// Returns 'with' stack associated with this execution thread
//
@@ -154,6 +158,24 @@
//
bool delVariable(const std::string& name);
+ /// \brief
+ /// Set a named variable, seeking for
+ /// it in the with stack if any
+ //
+ void setVariable(const std::string& name, const as_value& val);
+
+ /// \brief
+ /// If in a function context set a local variable,
+ /// otherwise, set a normal variable.
+ //
+ void setLocalVariable(const std::string& name, const as_value& val);
+
+ /// \brief
+ /// Get a named variable, seeking for
+ /// it in the with stack if any
+ //
+ as_value getVariable(const std::string& name);
+
/// Execute.
void operator() ();
};