gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, master, updated. ff92b67ee9d7ece16213


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. ff92b67ee9d7ece1621341c23d6e1cc515b11f20
Date: Wed, 17 Nov 2010 15:15:49 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  ff92b67ee9d7ece1621341c23d6e1cc515b11f20 (commit)
       via  22adfb046d4ee061811dfae86693aa5752cbd0c4 (commit)
       via  03679b2637f24786f12bb4a1dc3376d710f666b9 (commit)
       via  3ad160969c5b3839fbed6b8f244c3d44dccf775d (commit)
       via  a506b9308aef3ce14f55a9ba061a1857f593b6c0 (commit)
       via  26e1bb59ae8344a7c52b653df45a76a1573e97c0 (commit)
       via  9fa69e902ad68e7595cddfda8682df4e11cf89f4 (commit)
       via  883f3e536d4a8eeb9fc447e673463e8ffb9d7639 (commit)
       via  3066d3ea8aa1f096a20ff7d3d8c133937e7c3271 (commit)
       via  54d537224f5875f243ba02802854964ffc13ffd1 (commit)
       via  ed4839cd8ee1b625cae0f72928aef9b51a10a280 (commit)
      from  ae8ac63d8c2fed12f8796b7a57f548e35a414b9a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=ff92b67ee9d7ece1621341c23d6e1cc515b11f20


commit ff92b67ee9d7ece1621341c23d6e1cc515b11f20
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Nov 17 15:44:11 2010 +0100

    Test that target change in event code doesn't affect later code.
    Gnash did this, but didn't test that it did.

diff --git a/testsuite/misc-ming.all/timeline_var_test.c 
b/testsuite/misc-ming.all/timeline_var_test.c
index a873ed9..911ee81 100644
--- a/testsuite/misc-ming.all/timeline_var_test.c
+++ b/testsuite/misc-ming.all/timeline_var_test.c
@@ -81,7 +81,6 @@ SWFAction  action_in_frame4()
   SWFAction ac;
   ac = compileSWFActionCode(" \
     if ( ++loop_back < 2 ) gotoAndPlay(2); \
-    else { _root.totals(); stop(); } \
   " );
   return ac;
 }
@@ -92,6 +91,10 @@ int main(int argc, char** argv)
   SWFMovie  movie;
   SWFMovieClip dejagnuclip;
   SWFAction ac[FRAME_COUNT];
+
+  SWFDisplayItem it;
+  SWFMovieClip mc1;
+
   int i;
   const char *srcdir=".";
 
@@ -120,7 +123,31 @@ int main(int argc, char** argv)
     SWFMovie_add(movie, (SWFBlock)ac[i]);
     SWFMovie_nextFrame(movie); 
   }
+
+  SWFMovie_add(movie, (SWFBlock)newSWFAction("_level0.ar = [];"));
+
+  // This checks that a change of target in onEnterFrame code does
+  // not change the target for other code.
+  mc1 = newSWFMovieClip();
+  SWFMovieClip_add(mc1, (SWFBlock)newSWFAction("this.g = 'moo'; 
_level0.ar.push(g);"));
+  SWFMovieClip_nextFrame(mc1);
+  SWFMovieClip_add(mc1, (SWFBlock)newSWFAction("_level0.ar.push(g);"));
+  SWFMovieClip_nextFrame(mc1);
+
+  it = SWFMovie_add(movie, (SWFBlock)mc1);
+  SWFDisplayItem_addAction(it,
+    compileSWFActionCode(" _root.note('onEnterFrame');"
+                         " _level0.ar.push('setTarget');"
+                         " asm { push '_level0' settargetexpr }; "),
+                         SWFACTION_ENTERFRAME);  
   
+  SWFMovie_nextFrame(movie); 
+
+  check_equals(movie, "ar.toString()", "'moo,setTarget,moo'");
+
+  SWFMovie_add(movie, (SWFBlock)newSWFAction("_root.totals(); stop();"));
+  SWFMovie_nextFrame(movie); 
+
   // save files
   puts("Saving " OUTPUT_FILENAME );
   SWFMovie_save(movie, OUTPUT_FILENAME);

http://git.savannah.gnu.org/cgit//commit/?id=22adfb046d4ee061811dfae86693aa5752cbd0c4


commit 22adfb046d4ee061811dfae86693aa5752cbd0c4
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Nov 17 13:43:38 2010 +0100

    Drop obsolete comments and ifdefs.

diff --git a/libcore/vm/ExecutableCode.h b/libcore/vm/ExecutableCode.h
index 006532a..acc98ae 100644
--- a/libcore/vm/ExecutableCode.h
+++ b/libcore/vm/ExecutableCode.h
@@ -32,7 +32,6 @@ namespace gnash {
 /// Any executable code 
 class ExecutableCode : boost::noncopyable
 {
-
 public:
 
     ExecutableCode(DisplayObject* t) : _target(t) {}
@@ -43,13 +42,11 @@ public:
 
     virtual void setReachable() const {}
 
-#ifdef GNASH_USE_GC
     /// Mark reachable resources (for the GC)
     void markReachableResources() const {
         setReachable();
         if (_target) _target->setReachable();
     }
-#endif 
 
     DisplayObject* target() const { 
         return _target;
@@ -61,8 +58,8 @@ private:
 };
 
 /// Global code (out of any function)
-class GlobalCode : public ExecutableCode {
-
+class GlobalCode : public ExecutableCode
+{
 public:
 
     GlobalCode(const action_buffer& nBuffer, DisplayObject* nTarget)
@@ -71,8 +68,7 @@ public:
         buffer(nBuffer)
     {}
 
-    virtual void execute()
-    {
+    virtual void execute() {
         if (!target()->unloaded()) {
             ActionExec exec(buffer, target()->get_environment());
             exec();
@@ -80,14 +76,12 @@ public:
     }
 
 private:
-
     const action_buffer& buffer;
-
 };
 
 /// Event code 
-class EventCode : public ExecutableCode {
-
+class EventCode : public ExecutableCode
+{
 public:
 
     typedef std::vector<const action_buffer*> BufferList;
@@ -110,8 +104,7 @@ public:
     /// and not copied, so make sure it's kept
     /// alive for the whole EventCode lifetime.
     ///
-    void addAction(const action_buffer& buffer)
-    {
+    void addAction(const action_buffer& buffer) {
         // don't push actions for destroyed DisplayObjects, 
         // our opcode guard is bogus at the moment.
         if (!target()->isDestroyed()) {
@@ -119,14 +112,13 @@ public:
         }
     }
 
-    virtual void execute()
-    {
-        for (BufferList::iterator it=_buffers.begin(), itEnd=_buffers.end();
-                it != itEnd; ++it)
-        {
+    virtual void execute() {
+        for (BufferList::iterator it = _buffers.begin(),
+            itEnd = _buffers.end(); it != itEnd; ++it) {
+
             // onClipEvents code are guarded by isDestroyed(),
             // still might be also guarded by unloaded()
-            if (target()->isDestroyed())  break;
+            if (target()->isDestroyed()) break;
 
             ActionExec exec(*(*it), target()->get_environment(), false);
             exec();
@@ -134,14 +126,12 @@ public:
     }
 
 private:
-
     BufferList _buffers;
-
 };
 
 /// Generic event  (constructed by id, invoked using notifyEvent
-class QueuedEvent: public ExecutableCode {
-
+class QueuedEvent : public ExecutableCode
+{
 public:
 
     QueuedEvent(DisplayObject* nTarget, const event_id& id)
@@ -150,19 +140,15 @@ public:
         _eventId(id)
     {}
 
-    virtual void execute()
-    {
+    virtual void execute() {
         // don't execute any events for destroyed DisplayObject.
-        if (!target()->isDestroyed() )
-        {
+        if (!target()->isDestroyed()) {
             target()->notifyEvent(_eventId);
         }
     }
 
 private:
-
     const event_id _eventId;
-
 };
 
 /// This class is used to queue a function call action
@@ -178,7 +164,6 @@ private:
 ///
 class DelayedFunctionCall : public ExecutableCode
 {
-
 public:
 
     DelayedFunctionCall(DisplayObject* target,
@@ -192,31 +177,21 @@ public:
         _arg2(arg2)
     {}
 
-    virtual void execute()
-    {
+    virtual void execute() {
         callMethod(_obj, _name, _arg1, _arg2);
     }
 
-#ifdef GNASH_USE_GC
     /// Mark reachable resources (for the GC)
-    //
-    /// Reachable resources are:
-    ///  - the action target (_target)
-    ///
-    virtual void setReachable() const
-    {
+    virtual void setReachable() const {
         _obj->setReachable();
         _arg1.setReachable();
         _arg2.setReachable();
     }
-#endif // GNASH_USE_GC
 
 private:
-
     as_object* _obj;
     string_table::key _name;
     as_value _arg1, _arg2;
-
 };
 
 

http://git.savannah.gnu.org/cgit//commit/?id=03679b2637f24786f12bb4a1dc3376d710f666b9


commit 03679b2637f24786f12bb4a1dc3376d710f666b9
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Nov 17 12:46:04 2010 +0100

    Move findObject out of class.

diff --git a/libcore/TextField.cpp b/libcore/TextField.cpp
index 33c4fe7..0b0ac7f 100644
--- a/libcore/TextField.cpp
+++ b/libcore/TextField.cpp
@@ -1978,7 +1978,7 @@ TextField::parseTextVariableRef(const std::string& 
variableName) const
 #endif
         // find target for the path component
         // we use our parent's environment for this
-        target = env.find_object(path);
+        target = findObject(env, path);
 
         parsedName = var;
     }
diff --git a/libcore/as_environment.cpp b/libcore/as_environment.cpp
index 062aa82..e993bcb 100644
--- a/libcore/as_environment.cpp
+++ b/libcore/as_environment.cpp
@@ -114,14 +114,14 @@ as_environment::as_environment(VM& vm)
 }
 
 as_object*
-as_environment::find_object(const std::string& path,
-        const ScopeStack* scope) const
+findObject(const as_environment& ctx, const std::string& path,
+        const as_environment::ScopeStack* scope)
 {
     if (path.empty()) {
-        return getObject(_target);
+        return getObject(ctx.target());
     }
     
-    VM& vm = _vm;
+    VM& vm = ctx.getVM();
     string_table& st = vm.getStringTable();
     const int swfVersion = vm.getSWFVersion();
     ObjectURI globalURI(NSV::PROP_uGLOBAL);
@@ -137,10 +137,10 @@ as_environment::find_object(const std::string& path,
     if (*p == '/') {
 
         MovieClip* root = 0;
-        if (_target) root = _target->getAsRoot();
+        if (ctx.target()) root = ctx.target()->getAsRoot();
         else {
-            if (_original_target) {
-                root = _original_target->getAsRoot();
+            if (ctx.get_original_target()) {
+                root = ctx.get_original_target()->getAsRoot();
             }
             return 0;
         }
@@ -155,12 +155,13 @@ as_environment::find_object(const std::string& path,
 
     }
     else {
-        env = getObject(_target);
+        env = getObject(ctx.target());
     }
     
     assert (*p);
 
     std::string subpart;
+
     while (1) {
 
         // Skip past all colons (why?)
@@ -229,14 +230,14 @@ as_environment::find_object(const std::string& path,
                 }
 
                 // Try current target  (if any)
-                assert(env == getObject(_target));
+                assert(env == getObject(ctx.target()));
                 if (env) {
                     element = getElement(env, subpartURI);
                     if (element) break;
                 }
 
                 // Looking for _global ?
-                as_object* global = _vm.getGlobal();
+                as_object* global = vm.getGlobal();
                 const bool nocase = caseless(*global);
 
                 if (swfVersion > 5) {
@@ -252,13 +253,7 @@ as_environment::find_object(const std::string& path,
 
             } while (0);
 
-            if (!element) {
-#ifdef DEBUG_TARGET_FINDING 
-                log_debug("subpart %s of path %s not found in any "
-                "scope stack element", subpart, path);
-#endif
-                return NULL;
-            }
+            if (!element) return 0;
 
             env = element;
             firstElementParsed = true;
@@ -266,24 +261,12 @@ as_environment::find_object(const std::string& path,
         else {
 
             assert(env);
-
-#ifdef DEBUG_TARGET_FINDING 
-            log_debug(_("Invoking get_path_element(%s) on object "
-                    "%p"), subpart, (void *)env);
-#endif
-
             as_object* element = getElement(env, subpartURI);
-            if (!element) {
-#ifdef DEBUG_TARGET_FINDING 
-                log_debug(_("Path element %s not found in "
-                            "object %p"), subpart, (void *)env);
-#endif
-                return NULL;
-            }
+            if (!element) return 0;
             env = element;
         }
 
-        if (next_slash == NULL) break;
+        if (!next_slash) break;
         
         p = next_slash + 1;
     }
@@ -314,7 +297,7 @@ getVariable(const as_environment& env, const std::string& 
varname,
     if (parsePath(varname, path, var)) {
         // TODO: let find_target return generic as_objects, or use 'with' 
stack,
         //       see player2.swf or bug #18758 (strip.swf)
-        as_object* target = env.find_object(path, &scope); 
+        as_object* target = findObject(env, path, &scope); 
 
         if (target) {
             as_value val;
@@ -331,7 +314,7 @@ getVariable(const as_environment& env, const std::string& 
varname,
             varname.find(':') == std::string::npos) {
 
         // Consider it all a path ...
-        as_object* target = env.find_object(varname, &scope); 
+        as_object* target = findObject(env, varname, &scope); 
         if (target) {
             // ... but only if it resolves to a sprite
             DisplayObject* d = target->displayObject();
@@ -355,7 +338,7 @@ setVariable(const as_environment& env, const std::string& 
varname,
     std::string var;
 
     if (parsePath(varname, path, var)) {
-        as_object* target = env.find_object(path, &scope); 
+        as_object* target = findObject(env, path, &scope); 
         if (target) {
             target->set_member(env.getVM().getStringTable().find(var), val);
         }
@@ -651,7 +634,7 @@ next_slash_or_dot(const char* word)
 DisplayObject*
 findTarget(const as_environment& env, const std::string& path)
 {
-    return get<DisplayObject>(env.find_object(path));
+    return get<DisplayObject>(findObject(env, path));
 }
 
 
diff --git a/libcore/as_environment.h b/libcore/as_environment.h
index 9b0bb49..6e19c2a 100644
--- a/libcore/as_environment.h
+++ b/libcore/as_environment.h
@@ -120,12 +120,6 @@ public:
     //
     /// Only the targets are reachable.
     void markReachableResources() const;
-
-    /// Find the object referenced by the given path.
-    //
-    /// Supports both /slash/syntax and dot.syntax
-    as_object* find_object(const std::string& path,
-            const ScopeStack* scope = 0) const;
     
     /// Return the SWF version we're running for.
     //
@@ -202,10 +196,22 @@ bool delVariable(const as_environment& ctx, const 
std::string& varname,
 bool parsePath(const std::string& var_path, std::string& path,
         std::string& var);
 
+/// Find the object referenced by the given path.
+//
+/// This is exposed to allow AS-scoped lookup from C++.
+//
+/// Supports both /slash/syntax and dot.syntax
+//
+/// @param ctx     Timeline context to use for variable finding.
+/// @param path    Variable path. 
+/// @param scope   The Scope stack to use for lookups.
+as_object* findObject(const as_environment& ctx, const std::string& path,
+        const as_environment::ScopeStack* scope = 0);
+
 /// Find the DisplayObject referenced by the given path.
 //
 /// Supports both /slash/syntax and dot.syntax. This is a wrapper round
-/// get_object().
+/// findObject().
 //
 /// Note that only AS-referenceable DisplayObjects can be found by path,
 /// so that the returned object (if it exists) will have an associated
diff --git a/libcore/asobj/Global_as.h b/libcore/asobj/Global_as.h
index c070e59..c237f8a 100644
--- a/libcore/asobj/Global_as.h
+++ b/libcore/asobj/Global_as.h
@@ -246,7 +246,7 @@ BOOST_PP_REPEAT(BOOST_PP_INC(MAX_ARGS), CALL_METHOD, )
 inline as_function*
 getClassConstructor(const fn_call& fn, const std::string& s)
 {
-    const as_value ctor(fn.env().find_object(s));
+    const as_value ctor(findObject(fn.env(), s));
     return ctor.to_function();
 }
 
diff --git a/libcore/asobj/MovieClip_as.cpp b/libcore/asobj/MovieClip_as.cpp
index f786f84..55e5c61 100644
--- a/libcore/asobj/MovieClip_as.cpp
+++ b/libcore/asobj/MovieClip_as.cpp
@@ -1195,7 +1195,7 @@ movieclip_getTextSnapshot(const fn_call& fn)
     MovieClip* movieclip = ensure<IsDisplayObject<MovieClip> >(fn);
 
     // If not found, construction fails.
-    as_value textSnapshot(fn.env().find_object("TextSnapshot"));
+    as_value textSnapshot(findObject(fn.env(), "TextSnapshot"));
 
     boost::intrusive_ptr<as_function> tsCtor = textSnapshot.to_function();
 
@@ -2087,7 +2087,7 @@ movieclip_transform(const fn_call& fn)
     MovieClip* ptr = ensure<IsDisplayObject<MovieClip> >(fn);
 
     // If not found, construction fails.
-    as_value transform(fn.env().find_object("flash.geom.Transform"));
+    as_value transform(findObject(fn.env(), "flash.geom.Transform"));
 
     boost::intrusive_ptr<as_function> transCtor = transform.to_function();
 
diff --git a/libcore/asobj/flash/display/BitmapData_as.cpp 
b/libcore/asobj/flash/display/BitmapData_as.cpp
index a0626f3..db20bb0 100644
--- a/libcore/asobj/flash/display/BitmapData_as.cpp
+++ b/libcore/asobj/flash/display/BitmapData_as.cpp
@@ -784,7 +784,7 @@ bitmapdata_rectangle(const fn_call& fn)
     if (ptr->disposed()) return -1;
 
     // If it's not found construction will fail.
-    as_value rectangle(fn.env().find_object("flash.geom.Rectangle"));
+    as_value rectangle(findObject(fn.env(), "flash.geom.Rectangle"));
     boost::intrusive_ptr<as_function> rectCtor = rectangle.to_function();
 
     if (!rectCtor) {
diff --git a/libcore/asobj/flash/external/ExternalInterface_as.cpp 
b/libcore/asobj/flash/external/ExternalInterface_as.cpp
index 640f4e4..47e5dfc 100644
--- a/libcore/asobj/flash/external/ExternalInterface_as.cpp
+++ b/libcore/asobj/flash/external/ExternalInterface_as.cpp
@@ -115,7 +115,7 @@ public:
         newAdd(_ret, static_cast<double>(_count), vm);
         newAdd(_ret, "\">", vm);
         as_object* ei = 
-            _fn.env().find_object("flash.external.ExternalInterface");
+            findObject(_fn.env(), "flash.external.ExternalInterface");
         const as_value& x = callMethod(ei, st.find("_toXML"), val);
         newAdd(_ret, x, vm);
         newAdd(_ret, "</property>", vm);
@@ -139,7 +139,7 @@ public:
     void operator()(const as_value& val) {
         VM& vm = getVM(_fn);
         as_object* ei = 
-            _fn.env().find_object("flash.external.ExternalInterface");
+            findObject(_fn.env(), "flash.external.ExternalInterface");
         string_table& st = getStringTable(_fn);
         const as_value& x = callMethod(ei, st.find("_toXML"), val);
         newAdd(_ret, x, vm);
@@ -566,7 +566,7 @@ externalinterface_uObjectToXML(const fn_call& fn)
                 newAdd(ret, "\">", vm);
 
                 as_object* ei = 
-                    fn.env().find_object("flash.external.ExternalInterface");
+                    findObject(fn.env(), "flash.external.ExternalInterface");
                 const as_value& val = getMember(*obj, *i); 
                 newAdd(ret, callMethod(ei, st.find("_toXML"), val), vm);
                 newAdd(ret, "</property>", vm);
@@ -594,7 +594,7 @@ externalinterface_uToXML(const fn_call& fn)
     if (fn.nargs) {
 
         as_object* ei = 
-            fn.env().find_object("flash.external.ExternalInterface");
+            findObject(fn.env(), "flash.external.ExternalInterface");
         string_table& st = getStringTable(fn);
         VM& vm = getVM(fn);
 
@@ -659,7 +659,7 @@ externalinterface_uToAS(const fn_call& fn)
     }
     if (equals(nn, as_value("string"), getVM(fn))) {
         as_object* ei =
-            fn.env().find_object("flash.external.ExternalInterface");
+            findObject(fn.env(), "flash.external.ExternalInterface");
         as_value fc = getMember(*o, firstChild);
         return callMethod(ei, st.find("_unescapeXML"),
                 fc.to_string(getSWFVersion(fn)));
@@ -680,17 +680,17 @@ externalinterface_uToAS(const fn_call& fn)
     }
     if (equals(nn, as_value("object"), getVM(fn))) {
         as_object* ei =
-            fn.env().find_object("flash.external.ExternalInterface");
+            findObject(fn.env(), "flash.external.ExternalInterface");
         return callMethod(ei, st.find("_objectToXML"), o);
     }
     if (equals(nn, as_value("array"), getVM(fn))) {
         as_object* ei =
-            fn.env().find_object("flash.external.ExternalInterface");
+            findObject(fn.env(), "flash.external.ExternalInterface");
         return callMethod(ei, st.find("_arrayToXML"), o);
     }
     if (equals(nn, as_value("class"), getVM(fn))) {
         as_value fc = getMember(*o, firstChild);
-        return fn.env().find_object(fc.to_string(getSWFVersion(fn)));
+        return findObject(fn.env(), fc.to_string(getSWFVersion(fn)));
     }
     return as_value();
 }
diff --git a/libcore/asobj/flash/geom/Matrix_as.cpp 
b/libcore/asobj/flash/geom/Matrix_as.cpp
index a6fe271..55e12cb 100644
--- a/libcore/asobj/flash/geom/Matrix_as.cpp
+++ b/libcore/asobj/flash/geom/Matrix_as.cpp
@@ -157,7 +157,7 @@ matrix_clone(const fn_call& fn)
     fn_call::Args args;
     args += a, b, c, d, tx, ty;
 
-    as_value matrixClass(fn.env().find_object("flash.geom.Matrix"));
+    as_value matrixClass(findObject(fn.env(), "flash.geom.Matrix"));
 
     as_function* ctor = matrixClass.to_function();
     if (!ctor) {
@@ -410,7 +410,7 @@ matrix_deltaTransformPoint(const fn_call& fn)
     const PointType& point = transformPoint(*obj, *ptr);
 
     // Construct a Point and set its properties.
-    as_value pointClass(fn.env().find_object("flash.geom.Point"));
+    as_value pointClass(findObject(fn.env(), "flash.geom.Point"));
 
     boost::intrusive_ptr<as_function> pointCtor = pointClass.to_function();
 
@@ -732,7 +732,7 @@ matrix_transformPoint(const fn_call& fn)
     const PointType& point = transformPoint(*obj, *ptr);
 
     // Construct a Point and set its properties.
-    as_value pointClass(fn.env().find_object("flash.geom.Point"));
+    as_value pointClass(findObject(fn.env(), "flash.geom.Point"));
 
     boost::intrusive_ptr<as_function> pointCtor = pointClass.to_function();
 
diff --git a/libcore/asobj/flash/geom/Rectangle_as.cpp 
b/libcore/asobj/flash/geom/Rectangle_as.cpp
index 26b7063..b7c8138 100644
--- a/libcore/asobj/flash/geom/Rectangle_as.cpp
+++ b/libcore/asobj/flash/geom/Rectangle_as.cpp
@@ -466,7 +466,7 @@ Rectangle_bottomRight(const fn_call& fn)
         newAdd(x, w, vm);
         newAdd(y, h, vm);
 
-        as_value point(fn.env().find_object("flash.geom.Point"));
+        as_value point(findObject(fn.env(), "flash.geom.Point"));
 
         boost::intrusive_ptr<as_function> pointCtor = point.to_function();
 
diff --git a/libcore/asobj/flash/geom/Transform_as.cpp 
b/libcore/asobj/flash/geom/Transform_as.cpp
index 507847a..f3422f9 100644
--- a/libcore/asobj/flash/geom/Transform_as.cpp
+++ b/libcore/asobj/flash/geom/Transform_as.cpp
@@ -119,7 +119,7 @@ transform_colorTransform(const fn_call& fn)
     if (!fn.nargs) {
 
         // If it's not found, construction will fail.
-        as_value colorTrans(fn.env().find_object("flash.geom.ColorTransform"));
+        as_value colorTrans(findObject(fn.env(), "flash.geom.ColorTransform"));
 
         as_function* colorTransformCtor = colorTrans.to_function();
 
@@ -195,7 +195,7 @@ transform_concatenatedColorTransform(const fn_call& fn)
     if (!fn.nargs) {
 
         // If it's not found, construction will fail.
-        as_value colorTrans(fn.env().find_object("flash.geom.ColorTransform"));
+        as_value colorTrans(findObject(fn.env(), "flash.geom.ColorTransform"));
 
         as_function* colorTransformCtor = colorTrans.to_function();
 
@@ -232,7 +232,7 @@ transform_concatenatedMatrix(const fn_call& fn)
     {
 
         // If it's not found, construction will fail.
-        as_value matrix(fn.env().find_object("flash.geom.Matrix"));
+        as_value matrix(findObject(fn.env(), "flash.geom.Matrix"));
 
         as_function* matrixCtor = matrix.to_function();
 
@@ -276,7 +276,7 @@ transform_matrix(const fn_call& fn)
     {
 
         // If it's not found, construction will fail.
-        as_value matrix(fn.env().find_object("flash.geom.Matrix"));
+        as_value matrix(findObject(fn.env(), "flash.geom.Matrix"));
 
         as_function* matrixCtor = matrix.to_function();
 

http://git.savannah.gnu.org/cgit//commit/?id=3ad160969c5b3839fbed6b8f244c3d44dccf775d


commit 3ad160969c5b3839fbed6b8f244c3d44dccf775d
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Nov 17 12:14:23 2010 +0100

    Rename get_target() to target() to see where it's used.

diff --git a/libcore/DisplayObject.h b/libcore/DisplayObject.h
index 216f1f0..055c8d4 100644
--- a/libcore/DisplayObject.h
+++ b/libcore/DisplayObject.h
@@ -229,9 +229,6 @@ public:
     static const int noClipDepthValue = -1000000;
 
     /// Return a reference to the variable scope of this DisplayObject.
-    //
-    /// TODO: make const/return const& ?
-    ///
     virtual as_environment& get_environment() {
         // MovieClip must override this
         // and any other DisplayObject will have
diff --git a/libcore/Function.cpp b/libcore/Function.cpp
index 4cc7d23..f898dec 100644
--- a/libcore/Function.cpp
+++ b/libcore/Function.cpp
@@ -47,7 +47,7 @@ TargetGuard::TargetGuard(as_environment& e, DisplayObject* ch,
         DisplayObject* och)
     :
     env(e),
-    from(env.get_target()),
+    from(env.target()),
     from_orig(env.get_original_target())
 {
     env.set_target(ch);
@@ -74,7 +74,7 @@ Function::call(const fn_call& fn)
        FrameGuard guard(getVM(fn), *this);
     CallFrame& cf = guard.callFrame();
 
-       DisplayObject* target = _env.get_target();
+       DisplayObject* target = _env.target();
        DisplayObject* orig_target = _env.get_original_target();
 
        // Some features are version-dependant.
diff --git a/libcore/Function2.cpp b/libcore/Function2.cpp
index 9563556..c5b1cab 100644
--- a/libcore/Function2.cpp
+++ b/libcore/Function2.cpp
@@ -54,7 +54,7 @@ Function2::call(const fn_call& fn)
        FrameGuard guard(getVM(fn), *this);
     CallFrame& cf = guard.callFrame();
 
-       DisplayObject* target = _env.get_target();
+       DisplayObject* target = _env.target();
        DisplayObject* orig_target = _env.get_original_target();
 
        // Some features are version-dependant.
@@ -156,7 +156,7 @@ Function2::call(const fn_call& fn)
 
     if (_function2Flags & PRELOAD_ROOT) {
         // Put '_root' (if any) in a register.
-        DisplayObject* tgtch = _env.get_target();
+        DisplayObject* tgtch = _env.target();
         if (tgtch) {
             // NOTE: _lockroot will be handled by getAsRoot()
             as_object* r = getObject(tgtch->getAsRoot());
@@ -166,7 +166,7 @@ Function2::call(const fn_call& fn)
     }
 
     if (_function2Flags & PRELOAD_PARENT) {
-        DisplayObject* tgtch = _env.get_target();
+        DisplayObject* tgtch = _env.target();
         if (tgtch) {
             as_object* p = getObject(tgtch->parent());
             cf.setLocalRegister(current_reg, p);
@@ -211,17 +211,9 @@ Function2::call(const fn_call& fn)
     }
 
        // Execute the actions.
-       // Do this in a try block to proper drop the pushed call frame 
-       // in case of problems (most interesting action limits)
-       try {
-        as_value result;
-               ActionExec exec(*this, _env, &result, fn.this_ptr);
-               exec();
-        return result;
-       }
-       catch (ActionLimitException& ale) {
-               throw;
-       }
+    as_value result;
+    ActionExec(*this, _env, &result, fn.this_ptr)();
+    return result;
 }
 
 } // end of gnash namespace
diff --git a/libcore/MovieClip.h b/libcore/MovieClip.h
index 9a07bff..209cbbd 100644
--- a/libcore/MovieClip.h
+++ b/libcore/MovieClip.h
@@ -26,6 +26,12 @@
 #include "gnashconfig.h" // GNASH_USE_GC, USE_SWFTREE
 #endif
 
+#include <boost/intrusive_ptr.hpp>
+#include <vector>
+#include <list>
+#include <map>
+#include <string>
+
 #include "ControlTag.h"
 #include "movie_definition.h" // for inlines
 #include "DisplayList.h" // DisplayList 
@@ -35,12 +41,6 @@
 #include "snappingrange.h"
 #include "dsodefs.h" // for DSOEXPORT
 
-#include <boost/intrusive_ptr.hpp>
-#include <vector>
-#include <list>
-#include <map>
-#include <string>
-
 // Forward declarations
 namespace gnash {
     class Movie;
@@ -56,8 +56,7 @@ namespace gnash {
     }
 }
 
-namespace gnash
-{
+namespace gnash {
 
 /// A MovieClip is a container for DisplayObjects.
 //
@@ -500,7 +499,7 @@ public:
     virtual void notifyEvent(const event_id& id);
 
     // inherited from DisplayObject class, see dox in DisplayObject.h
-    as_environment& get_environment() {
+    virtual as_environment& get_environment() {
         return _environment;
     }
 
diff --git a/libcore/TextField.cpp b/libcore/TextField.cpp
index 4151762..33c4fe7 100644
--- a/libcore/TextField.cpp
+++ b/libcore/TextField.cpp
@@ -1953,11 +1953,10 @@ TextField::parseTextVariableRef(const std::string& 
variableName) const
 #endif
 
     /// Why isn't get_environment const again ?
-    as_environment& env = const_cast<TextField*>(this)->get_environment();
+    const as_environment& env = 
const_cast<TextField*>(this)->get_environment();
 
-    as_object* target = getObject(env.get_target());
-    if ( ! target )
-    {
+    as_object* target = getObject(env.target());
+    if (!target) {
         IF_VERBOSE_MALFORMED_SWF(
             log_swferror(_("Current environment has no target, "
                 "can't bind VariableName (%s) associated to "
diff --git a/libcore/as_environment.cpp b/libcore/as_environment.cpp
index e63b117..062aa82 100644
--- a/libcore/as_environment.cpp
+++ b/libcore/as_environment.cpp
@@ -108,7 +108,7 @@ as_environment::as_environment(VM& vm)
     :
     _vm(vm),
     _stack(_vm.getStack()),
-    m_target(0),
+    _target(0),
     _original_target(0)
 {
 }
@@ -118,7 +118,7 @@ as_environment::find_object(const std::string& path,
         const ScopeStack* scope) const
 {
     if (path.empty()) {
-        return getObject(m_target);
+        return getObject(_target);
     }
     
     VM& vm = _vm;
@@ -137,7 +137,7 @@ as_environment::find_object(const std::string& path,
     if (*p == '/') {
 
         MovieClip* root = 0;
-        if (m_target) root = m_target->getAsRoot();
+        if (_target) root = _target->getAsRoot();
         else {
             if (_original_target) {
                 root = _original_target->getAsRoot();
@@ -155,7 +155,7 @@ as_environment::find_object(const std::string& path,
 
     }
     else {
-        env = getObject(m_target);
+        env = getObject(_target);
     }
     
     assert (*p);
@@ -229,7 +229,7 @@ as_environment::find_object(const std::string& path,
                 }
 
                 // Try current target  (if any)
-                assert(env == getObject(m_target));
+                assert(env == getObject(_target));
                 if (env) {
                     element = getElement(env, subpartURI);
                     if (element) break;
@@ -299,7 +299,7 @@ as_environment::get_version() const
 void
 as_environment::markReachableResources() const
 {
-    if (m_target) m_target->setReachable();
+    if (_target) _target->setReachable();
     if (_original_target) _original_target->setReachable();
 }
 
@@ -400,7 +400,7 @@ delVariable(const as_environment& ctx, const std::string& 
varname,
     }
 
     // Try target
-    std::pair<bool, bool> ret = 
getObject(ctx.get_target())->delProperty(varkey);
+    std::pair<bool, bool> ret = getObject(ctx.target())->delProperty(varkey);
     if (ret.first) {
         return ret.second;
     }
@@ -484,8 +484,8 @@ setVariableRaw(const as_environment& env, const 
std::string& varname,
        if (setLocal(vm.currentCall().locals(), varname, val)) return;
     }
     
-    // TODO: shouldn't m_target be in the scope chain ?
-    if (env.get_target()) getObject(env.get_target())->set_member(varkey, val);
+    // TODO: shouldn't _target be in the scope chain ?
+    if (env.target()) getObject(env.target())->set_member(varkey, val);
     else if (env.get_original_target()) {
         getObject(env.get_original_target())->set_member(varkey, val);
     }
@@ -535,8 +535,8 @@ getVariableRaw(const as_environment& env, const 
std::string& varname,
     }
 
     // Check current target members. TODO: shouldn't target be in scope stack ?
-    if (env.get_target()) {
-        as_object* obj = getObject(env.get_target());
+    if (env.target()) {
+        as_object* obj = getObject(env.target());
         assert(obj);
         if (obj->get_member(key, &val)) {
             if (retTarget) *retTarget = obj;
diff --git a/libcore/as_environment.h b/libcore/as_environment.h
index 85af2ab..9b0bb49 100644
--- a/libcore/as_environment.h
+++ b/libcore/as_environment.h
@@ -58,7 +58,7 @@ public:
 
     VM& getVM() const { return _vm; }
 
-    DisplayObject* get_target() const { return m_target; }
+    DisplayObject* target() const { return _target; }
 
     /// Set default target for timeline opcodes
     //
@@ -67,7 +67,7 @@ public:
     ///                 opcodes (would get ignored).
     void set_target(DisplayObject* target) {
         if (!_original_target) _original_target = target;
-        m_target = target;
+        _target = target;
     }
 
     void set_original_target(DisplayObject* target) {
@@ -77,7 +77,7 @@ public:
     DisplayObject* get_original_target() const { return _original_target; }
 
     // Reset target to its original value
-    void reset_target() { m_target = _original_target; }
+    void reset_target() { _target = _original_target; }
 
     /// Push a value on the stack
     void push(const as_value& val) {
@@ -140,7 +140,7 @@ private:
     SafeStack<as_value>& _stack;
 
     /// Movie target. 
-    DisplayObject* m_target;
+    DisplayObject* _target;
 
     /// Movie target. 
     DisplayObject* _original_target;
diff --git a/libcore/asobj/Object.cpp b/libcore/asobj/Object.cpp
index f4329cc..c68e0d8 100644
--- a/libcore/asobj/Object.cpp
+++ b/libcore/asobj/Object.cpp
@@ -295,7 +295,7 @@ object_registerClass(const fn_call& fn)
 
     // Using definition of current target fixes the youtube beta case
     // https://savannah.gnu.org/bugs/index.php?23130
-    DisplayObject* tgt = fn.env().get_target();
+    DisplayObject* tgt = fn.env().target();
     if (!tgt) {
         log_error("current environment has no target, wouldn't know "
                 "where to look for symbol required for registerClass"); 
diff --git a/libcore/asobj/flash/display/BitmapData_as.cpp 
b/libcore/asobj/flash/display/BitmapData_as.cpp
index e592a9c..a0626f3 100644
--- a/libcore/asobj/flash/display/BitmapData_as.cpp
+++ b/libcore/asobj/flash/display/BitmapData_as.cpp
@@ -815,7 +815,7 @@ bitmapdata_loadBitmap(const fn_call& fn)
     }
 
     const std::string linkage = fn.arg(0).to_string();
-    DisplayObject* tgt = fn.env().get_target();
+    DisplayObject* tgt = fn.env().target();
     if (!tgt) return as_value();
 
     Movie* root = tgt->get_root();
diff --git a/libcore/vm/ASHandlers.cpp b/libcore/vm/ASHandlers.cpp
index 7bfb397..8a7373e 100644
--- a/libcore/vm/ASHandlers.cpp
+++ b/libcore/vm/ASHandlers.cpp
@@ -480,7 +480,7 @@ ActionNextFrame(ActionExec& thread)
     assert(thread.atActionTag(SWF::ACTION_NEXTFRAME));
 #endif
 
-    DisplayObject* tgtch = env.get_target();
+    DisplayObject* tgtch = env.target();
     MovieClip* tgt = tgtch ? tgtch->to_movie() : 0;
     if (tgt) tgt->goto_frame(tgt->get_current_frame() + 1);
     else log_debug(_("ActionNextFrame: as_environment target is null or not a 
sprite"));
@@ -495,7 +495,7 @@ ActionPrevFrame(ActionExec& thread)
     assert(thread.atActionTag(SWF::ACTION_PREVFRAME));
 #endif
 
-    DisplayObject* tgtch = env.get_target();
+    DisplayObject* tgtch = env.target();
     MovieClip* tgt = tgtch ? tgtch->to_movie() : 0;
     if (tgt) tgt->goto_frame(tgt->get_current_frame() - 1);
     else log_debug(_("ActionPrevFrame: as_environment target is null or not a 
sprite"));
@@ -510,7 +510,7 @@ ActionPlay(ActionExec& thread)
     assert(thread.atActionTag(SWF::ACTION_PLAY));
 #endif
 
-    DisplayObject* tgtch = env.get_target();
+    DisplayObject* tgtch = env.target();
     MovieClip* tgt = tgtch ? tgtch->to_movie() : 0;
     if (tgt) tgt->setPlayState(MovieClip::PLAYSTATE_PLAY);
     else log_debug(_("ActionPlay: as_environment target is null or not a 
sprite"));
@@ -525,7 +525,7 @@ ActionStop(ActionExec& thread)
     assert(thread.atActionTag(SWF::ACTION_STOP));
 #endif
 
-    DisplayObject* tgtch = env.get_target();
+    DisplayObject* tgtch = env.target();
     MovieClip* tgt = tgtch ? tgtch->to_movie() : 0;
     if (tgt) tgt->setPlayState(MovieClip::PLAYSTATE_STOP);
     else log_debug(_("ActionStop: as_environment target is null or not a 
sprite"));
@@ -568,7 +568,7 @@ ActionGotoFrame(ActionExec& thread)
 
     size_t frame = code.read_int16(thread.getCurrentPC() + 3);
 
-    DisplayObject* tgtch = env.get_target();
+    DisplayObject* tgtch = env.target();
     MovieClip* tgt = tgtch ? tgtch->to_movie() : 0;
 
     // frame number within this tag is hard-coded and 0-based
@@ -639,7 +639,7 @@ ActionWaitForFrame(ActionExec& thread)
     unsigned int framenum = code.read_int16(thread.getCurrentPC()+3);
     boost::uint8_t skip = code[thread.getCurrentPC()+5];
 
-    DisplayObject* target = env.get_target();
+    DisplayObject* target = env.target();
     MovieClip* target_sprite = target ? target->to_movie() : 0;
     if (!target_sprite) {
         log_error(_("%s: environment target is null or not a MovieClip"),
@@ -689,7 +689,7 @@ ActionGotoLabel(ActionExec& thread)
     const action_buffer& code = thread.code;
 
     const char* frame_label = code.read_string(thread.getCurrentPC()+3);
-    DisplayObject *target = env.get_target();
+    DisplayObject *target = env.target();
     MovieClip *target_sprite = target ? target->to_movie() : 0;
     if (!target_sprite) {
         log_error(_("GotoLabel: environment target is null or not a "
@@ -1263,7 +1263,7 @@ void
 ActionStopDragMovie(ActionExec& thread)
 {
     as_environment& env = thread.env;
-    DisplayObject* tgtch = env.get_target();
+    DisplayObject* tgtch = env.target();
     MovieClip* root_movie = tgtch ? tgtch->get_root() : 0;
     if (root_movie) root_movie->stop_drag();
     else log_debug(_("ActionStopDragMovie: as_environment target is "
@@ -1711,7 +1711,7 @@ ActionWaitForFrameExpression(ActionExec& thread)
     // evaluated as for ActionGotoExpression
     as_value framespec = env.pop();
 
-    DisplayObject* tgtch = env.get_target();
+    DisplayObject* tgtch = env.target();
     MovieClip* target_sprite = tgtch ? tgtch->to_movie() : 0;
     if (!target_sprite) {
         log_error(_("%s: environment target is null or not a MovieClip"),
@@ -1981,7 +1981,7 @@ ActionCallFrame(ActionExec& thread)
     }
     else {
         frame_var = target_frame;
-        target = env.get_target();
+        target = env.target();
     }
 
     MovieClip* target_sprite = target ? target->to_movie() : 0;
@@ -2034,7 +2034,7 @@ ActionGotoExpression(ActionExec& thread)
     // we should check if a sprite named '4' is supposed to work
     // in that case
     if (!target) {
-        target = env.get_target();
+        target = env.target();
         frame_var = target_frame;
     }
 
@@ -3600,7 +3600,7 @@ commonGetURL(as_environment& env, as_value target,
         //         no matter the target found on stack (which
         //         is the target to load the resource into).
         //
-        as_object* curtgt = getObject(env.get_target());
+        as_object* curtgt = getObject(env.target());
         if (!curtgt) {
             log_error(_("commonGetURL: current target is undefined"));
             return;
diff --git a/libcore/vm/ActionExec.cpp b/libcore/vm/ActionExec.cpp
index d3b48cd..97948a7 100644
--- a/libcore/vm/ActionExec.cpp
+++ b/libcore/vm/ActionExec.cpp
@@ -137,7 +137,7 @@ ActionExec::operator()()
 
     static const SWF::SWFHandlers& ash = SWF::SWFHandlers::instance();
         
-    _originalTarget = env.get_target();
+    _originalTarget = env.target();
 
     _initialStackSize = env.stack_size();
 
@@ -257,7 +257,7 @@ ActionExec::operator()()
             
             // curveball.swf and feed.swf suggest that it is the
             // *current* target, not the *original* one that matters.
-            DisplayObject* guardedChar = env.get_target();
+            DisplayObject* guardedChar = env.target();
 
             if (_abortOnUnload && guardedChar && guardedChar->unloaded()) {
 
@@ -653,7 +653,7 @@ as_object*
 ActionExec::getTarget()
 {
     if (_withStack.empty()) {
-        return getObject(env.get_target());
+        return getObject(env.target());
     }
     return _withStack.back().object();
 }

http://git.savannah.gnu.org/cgit//commit/?id=a506b9308aef3ce14f55a9ba061a1857f593b6c0


commit a506b9308aef3ce14f55a9ba061a1857f593b6c0
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Nov 17 11:49:36 2010 +0100

    Rearrange.

diff --git a/libcore/as_environment.cpp b/libcore/as_environment.cpp
index 5e066ff..e63b117 100644
--- a/libcore/as_environment.cpp
+++ b/libcore/as_environment.cpp
@@ -113,46 +113,6 @@ as_environment::as_environment(VM& vm)
 {
 }
 
-bool
-delVariableRaw(const as_environment& ctx, const std::string& varname,
-    const as_environment::ScopeStack& scope) 
-{
-    // varname must be a plain variable name; no path parsing.
-    assert(varname.find_first_of(":/.") == std::string::npos);
-
-    VM& vm = ctx.getVM();
-
-    string_table::key varkey = vm.getStringTable().find(varname);
-
-    // Check the with-stack.
-    for (size_t i = scope.size(); i > 0; --i) {
-        as_object* obj = scope[i - 1];
-
-        if (obj) {
-            std::pair<bool, bool> ret = obj->delProperty(varkey);
-            if (ret.first) {
-                return ret.second;
-            }
-        }
-    }
-
-    // Check locals for deletion.
-    if (vm.calling() && deleteLocal(vm.currentCall().locals(), varname)) {
-        return true;
-    }
-
-    // Try target
-    std::pair<bool, bool> ret = 
getObject(ctx.get_target())->delProperty(varkey);
-    if (ret.first) {
-        return ret.second;
-    }
-
-    // TODO: try 'this' ? Add a testcase for it !
-
-    // Try _global 
-    return vm.getGlobal()->delProperty(varkey).second;
-}
-
 as_object*
 as_environment::find_object(const std::string& path,
         const ScopeStack* scope) const
@@ -412,6 +372,46 @@ setVariable(const as_environment& env, const std::string& 
varname,
 }
 
 bool
+delVariable(const as_environment& ctx, const std::string& varname,
+    const as_environment::ScopeStack& scope) 
+{
+    // varname must be a plain variable name; no path parsing.
+    assert(varname.find_first_of(":/.") == std::string::npos);
+
+    VM& vm = ctx.getVM();
+
+    string_table::key varkey = vm.getStringTable().find(varname);
+
+    // Check the with-stack.
+    for (size_t i = scope.size(); i > 0; --i) {
+        as_object* obj = scope[i - 1];
+
+        if (obj) {
+            std::pair<bool, bool> ret = obj->delProperty(varkey);
+            if (ret.first) {
+                return ret.second;
+            }
+        }
+    }
+
+    // Check locals for deletion.
+    if (vm.calling() && deleteLocal(vm.currentCall().locals(), varname)) {
+        return true;
+    }
+
+    // Try target
+    std::pair<bool, bool> ret = 
getObject(ctx.get_target())->delProperty(varkey);
+    if (ret.first) {
+        return ret.second;
+    }
+
+    // TODO: try 'this' ? Add a testcase for it !
+
+    // Try _global 
+    return vm.getGlobal()->delProperty(varkey).second;
+}
+
+bool
 parsePath(const std::string& var_path_in, std::string& path, std::string& var)
 {
 

http://git.savannah.gnu.org/cgit//commit/?id=26e1bb59ae8344a7c52b653df45a76a1573e97c0


commit 26e1bb59ae8344a7c52b653df45a76a1573e97c0
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Nov 17 11:40:28 2010 +0100

    Move delVariable out of class.

diff --git a/libcore/as_environment.cpp b/libcore/as_environment.cpp
index de22f22..5e066ff 100644
--- a/libcore/as_environment.cpp
+++ b/libcore/as_environment.cpp
@@ -114,13 +114,15 @@ as_environment::as_environment(VM& vm)
 }
 
 bool
-as_environment::delVariableRaw(const std::string& varname,
-        const ScopeStack& scope) 
+delVariableRaw(const as_environment& ctx, const std::string& varname,
+    const as_environment::ScopeStack& scope) 
 {
     // varname must be a plain variable name; no path parsing.
     assert(varname.find_first_of(":/.") == std::string::npos);
 
-    string_table::key varkey = _vm.getStringTable().find(varname);
+    VM& vm = ctx.getVM();
+
+    string_table::key varkey = vm.getStringTable().find(varname);
 
     // Check the with-stack.
     for (size_t i = scope.size(); i > 0; --i) {
@@ -135,12 +137,12 @@ as_environment::delVariableRaw(const std::string& varname,
     }
 
     // Check locals for deletion.
-    if (_vm.calling() && deleteLocal(_vm.currentCall().locals(), varname)) {
+    if (vm.calling() && deleteLocal(vm.currentCall().locals(), varname)) {
         return true;
     }
 
     // Try target
-    std::pair<bool, bool> ret = getObject(m_target)->delProperty(varkey);
+    std::pair<bool, bool> ret = 
getObject(ctx.get_target())->delProperty(varkey);
     if (ret.first) {
         return ret.second;
     }
@@ -148,7 +150,7 @@ as_environment::delVariableRaw(const std::string& varname,
     // TODO: try 'this' ? Add a testcase for it !
 
     // Try _global 
-    return _vm.getGlobal()->delProperty(varkey).second;
+    return vm.getGlobal()->delProperty(varkey).second;
 }
 
 as_object*
diff --git a/libcore/as_environment.h b/libcore/as_environment.h
index 23748e2..85af2ab 100644
--- a/libcore/as_environment.h
+++ b/libcore/as_environment.h
@@ -116,13 +116,6 @@ public:
 
     size_t stack_size() const { return _stack.size(); }
 
-    /// Delete a variable, without support for the path, using a ScopeStack.
-    //
-    /// @param varname      Variable name. Must not contain path elements.
-    /// @param scope   The Scope stack to use for lookups.
-    bool delVariableRaw(const std::string& varname,
-            const ScopeStack& scope);
-
     /// Mark all reachable resources.
     //
     /// Only the targets are reachable.
@@ -180,6 +173,14 @@ as_value getVariable(const as_environment& ctx, const 
std::string& varname,
 void setVariable(const as_environment& ctx, const std::string& path,
     const as_value& val, const as_environment::ScopeStack& scope);
 
+/// Delete a variable, without support for the path, using a ScopeStack.
+//
+/// @param ctx      Timeline context to use for variable finding.
+/// @param varname  Variable name. Must not contain path elements.
+/// @param scope    The Scope stack to use for lookups.
+bool delVariable(const as_environment& ctx, const std::string& varname,
+        const as_environment::ScopeStack& scope);
+
 /// See if the given variable name is actually a sprite path
 /// followed by a variable name.  These come in the format:
 ///
diff --git a/libcore/vm/ActionExec.cpp b/libcore/vm/ActionExec.cpp
index fdf46c1..d3b48cd 100644
--- a/libcore/vm/ActionExec.cpp
+++ b/libcore/vm/ActionExec.cpp
@@ -606,7 +606,7 @@ ActionExec::pushWith(const With& entry)
 bool
 ActionExec::delVariable(const std::string& name)
 {
-    return env.delVariableRaw(name, getScopeStack());
+    return gnash::delVariable(env, name, getScopeStack());
 }
 
 bool

http://git.savannah.gnu.org/cgit//commit/?id=9fa69e902ad68e7595cddfda8682df4e11cf89f4


commit 9fa69e902ad68e7595cddfda8682df4e11cf89f4
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Nov 17 11:31:28 2010 +0100

    Documentation, variable rename.

diff --git a/libcore/as_environment.cpp b/libcore/as_environment.cpp
index 0010553..de22f22 100644
--- a/libcore/as_environment.cpp
+++ b/libcore/as_environment.cpp
@@ -88,11 +88,11 @@ namespace {
     /// found variable (if found).
     as_value getVariableRaw(const as_environment& env,
         const std::string& varname,
-        const as_environment::ScopeStack& scopeStack,
+        const as_environment::ScopeStack& scope,
         as_object** retTarget = 0);
 
     void setVariableRaw(const as_environment& env, const std::string& varname,
-        const as_value& val, const as_environment::ScopeStack& scopeStack);
+        const as_value& val, const as_environment::ScopeStack& scope);
 
     // Search for next '.' or '/' character in this word.  Return
     // a pointer to it, or null if it wasn't found.
@@ -115,7 +115,7 @@ as_environment::as_environment(VM& vm)
 
 bool
 as_environment::delVariableRaw(const std::string& varname,
-        const ScopeStack& scopeStack) 
+        const ScopeStack& scope) 
 {
     // varname must be a plain variable name; no path parsing.
     assert(varname.find_first_of(":/.") == std::string::npos);
@@ -123,8 +123,8 @@ as_environment::delVariableRaw(const std::string& varname,
     string_table::key varkey = _vm.getStringTable().find(varname);
 
     // Check the with-stack.
-    for (size_t i = scopeStack.size(); i > 0; --i) {
-        as_object* obj = scopeStack[i - 1];
+    for (size_t i = scope.size(); i > 0; --i) {
+        as_object* obj = scope[i - 1];
 
         if (obj) {
             std::pair<bool, bool> ret = obj->delProperty(varkey);
@@ -153,7 +153,7 @@ as_environment::delVariableRaw(const std::string& varname,
 
 as_object*
 as_environment::find_object(const std::string& path,
-        const ScopeStack* scopeStack) const
+        const ScopeStack* scope) const
 {
     if (path.empty()) {
         return getObject(m_target);
@@ -256,9 +256,9 @@ as_environment::find_object(const std::string& path,
 
             do {
                 // Try scope stack
-                if (scopeStack) {
-                    for (size_t i = scopeStack->size(); i > 0; --i) {
-                        as_object* obj = (*scopeStack)[i-1];
+                if (scope) {
+                    for (size_t i = scope->size(); i > 0; --i) {
+                        as_object* obj = (*scope)[i-1];
                         
                         element = getElement(obj, subpartURI);
                         if (element) break;
@@ -343,7 +343,7 @@ as_environment::markReachableResources() const
 
 as_value
 getVariable(const as_environment& env, const std::string& varname,
-        const as_environment::ScopeStack& scopeStack, as_object** retTarget)
+        const as_environment::ScopeStack& scope, as_object** retTarget)
 {
     // Path lookup rigamarole.
     std::string path;
@@ -352,7 +352,7 @@ getVariable(const as_environment& env, const std::string& 
varname,
     if (parsePath(varname, path, var)) {
         // TODO: let find_target return generic as_objects, or use 'with' 
stack,
         //       see player2.swf or bug #18758 (strip.swf)
-        as_object* target = env.find_object(path, &scopeStack); 
+        as_object* target = env.find_object(path, &scope); 
 
         if (target) {
             as_value val;
@@ -369,7 +369,7 @@ getVariable(const as_environment& env, const std::string& 
varname,
             varname.find(':') == std::string::npos) {
 
         // Consider it all a path ...
-        as_object* target = env.find_object(varname, &scopeStack); 
+        as_object* target = env.find_object(varname, &scope); 
         if (target) {
             // ... but only if it resolves to a sprite
             DisplayObject* d = target->displayObject();
@@ -377,12 +377,12 @@ getVariable(const as_environment& env, const std::string& 
varname,
             if (m) return as_value(getObject(m));
         }
     }
-    return getVariableRaw(env, varname, scopeStack, retTarget);
+    return getVariableRaw(env, varname, scope, retTarget);
 }
 
 void
 setVariable(const as_environment& env, const std::string& varname,
-    const as_value& val, const as_environment::ScopeStack& scopeStack)
+    const as_value& val, const as_environment::ScopeStack& scope)
 {
     IF_VERBOSE_ACTION(
         log_action("-------------- %s = %s", varname, val);
@@ -393,7 +393,7 @@ setVariable(const as_environment& env, const std::string& 
varname,
     std::string var;
 
     if (parsePath(varname, path, var)) {
-        as_object* target = env.find_object(path, &scopeStack); 
+        as_object* target = env.find_object(path, &scope); 
         if (target) {
             target->set_member(env.getVM().getStringTable().find(var), val);
         }
@@ -406,7 +406,7 @@ setVariable(const as_environment& env, const std::string& 
varname,
         return;
     }
 
-    setVariableRaw(env, varname, val, scopeStack);
+    setVariableRaw(env, varname, val, scope);
 }
 
 bool
@@ -453,7 +453,7 @@ validRawVariableName(const std::string& varname)
 // No path rigamarole.
 void
 setVariableRaw(const as_environment& env, const std::string& varname,
-    const as_value& val, const as_environment::ScopeStack& scopeStack)
+    const as_value& val, const as_environment::ScopeStack& scope)
 {
 
     if (!validRawVariableName(varname)) {
@@ -470,8 +470,8 @@ setVariableRaw(const as_environment& env, const 
std::string& varname,
     // in SWF5 and lower, scope stack should just contain 'with' elements 
 
     // Check the scope stack.
-    for (size_t i = scopeStack.size(); i > 0; --i) {
-        as_object* obj = scopeStack[i - 1];
+    for (size_t i = scope.size(); i > 0; --i) {
+        as_object* obj = scope[i - 1];
         if (obj && obj->set_member(varkey, val, true)) {
             return;
         }
@@ -497,7 +497,7 @@ setVariableRaw(const as_environment& env, const 
std::string& varname,
 
 as_value
 getVariableRaw(const as_environment& env, const std::string& varname,
-    const as_environment::ScopeStack& scopeStack, as_object** retTarget)
+    const as_environment::ScopeStack& scope, as_object** retTarget)
 {
 
     if (!validRawVariableName(varname)) {
@@ -515,9 +515,9 @@ getVariableRaw(const as_environment& env, const 
std::string& varname,
     string_table::key key = st.find(varname);
 
     // Check the scope stack.
-    for (size_t i = scopeStack.size(); i > 0; --i) {
+    for (size_t i = scope.size(); i > 0; --i) {
 
-        as_object* obj = scopeStack[i - 1];
+        as_object* obj = scope[i - 1];
         if (obj && obj->get_member(key, &val)) {
             if (retTarget) *retTarget = obj;
             return val;
diff --git a/libcore/as_environment.h b/libcore/as_environment.h
index f909a1e..23748e2 100644
--- a/libcore/as_environment.h
+++ b/libcore/as_environment.h
@@ -38,7 +38,15 @@ namespace gnash {
 
 namespace gnash {
 
-/// ActionScript execution environment.
+
+/// Provides information about timeline context.
+//
+/// This class stores information about the current and original "target"
+/// of execution. A target is a MovieClip or other AS-referenceable 
+/// DisplayObject. Non-timeline code has no target.
+//
+/// Why should a timeline context provide access to the VM stack? It shouldn't!
+/// TODO: remove stack access proxy functions, SWF version, etc.
 class as_environment
 {
 public:
@@ -111,9 +119,9 @@ public:
     /// Delete a variable, without support for the path, using a ScopeStack.
     //
     /// @param varname      Variable name. Must not contain path elements.
-    /// @param scopeStack   The Scope stack to use for lookups.
+    /// @param scope   The Scope stack to use for lookups.
     bool delVariableRaw(const std::string& varname,
-            const ScopeStack& scopeStack);
+            const ScopeStack& scope);
 
     /// Mark all reachable resources.
     //
@@ -124,7 +132,7 @@ public:
     //
     /// Supports both /slash/syntax and dot.syntax
     as_object* find_object(const std::string& path,
-            const ScopeStack* scopeStack = 0) const;
+            const ScopeStack* scope = 0) const;
     
     /// Return the SWF version we're running for.
     //
@@ -150,13 +158,13 @@ private:
 
 /// Return the (possibly undefined) value of the named var.
 //
-/// @param varname      Variable name. Can contain path elements.
-/// @param scopeStack   The Scope stack to use for lookups.
-/// @param retTarget    If not null, the pointer will be set to
-///                     the actual object containing the
-///                     found variable (if found).
-as_value getVariable(const as_environment& env, const std::string& varname,
-    const as_environment::ScopeStack& scopeStack, as_object** retTarget = 0);
+/// @param ctx         Timeline context to use for variable finding.
+/// @param varname     Variable name. Can contain path elements.
+/// @param scope       The Scope stack to use for lookups.
+/// @param retTarget   If not null, the pointer will be set to the actual
+///                    object containing the found variable (if found).
+as_value getVariable(const as_environment& ctx, const std::string& varname,
+    const as_environment::ScopeStack& scope, as_object** retTarget = 0);
 
 /// Given a path to variable, set its value.
 //
@@ -164,13 +172,13 @@ as_value getVariable(const as_environment& env, const 
std::string& varname,
 ///
 /// For path-less variables, this would act as a proxy for
 /// set_variable_raw.
-///
-/// @param path         Variable path. 
-/// @param val          The value to assign to the variable.
-/// @param scopeStack   The Scope stack to use for lookups.
-void setVariable(const as_environment& env, const std::string& path,
-    const as_value& val, const as_environment::ScopeStack& scopeStack);
-
+//
+/// @param ctx     Timeline context to use for variable finding.
+/// @param path    Variable path. 
+/// @param val     The value to assign to the variable.
+/// @param scope   The Scope stack to use for lookups.
+void setVariable(const as_environment& ctx, const std::string& path,
+    const as_value& val, const as_environment::ScopeStack& scope);
 
 /// See if the given variable name is actually a sprite path
 /// followed by a variable name.  These come in the format:

http://git.savannah.gnu.org/cgit//commit/?id=883f3e536d4a8eeb9fc447e673463e8ffb9d7639


commit 883f3e536d4a8eeb9fc447e673463e8ffb9d7639
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Nov 17 11:04:57 2010 +0100

    Move get and set variable out of as_environment class.

diff --git a/libcore/as_environment.cpp b/libcore/as_environment.cpp
index a25441f..0010553 100644
--- a/libcore/as_environment.cpp
+++ b/libcore/as_environment.cpp
@@ -113,67 +113,6 @@ as_environment::as_environment(VM& vm)
 {
 }
 
-// Return the value of the given var, if it's defined.
-as_value
-as_environment::get_variable(const std::string& varname,
-        const ScopeStack& scopeStack, as_object** retTarget) const
-{
-
-#ifdef GNASH_DEBUG_GET_VARIABLE
-    log_debug(_("get_variable(%s)"), varname);
-#endif
-
-    // Path lookup rigamarole.
-    std::string path;
-    std::string var;
-
-    if (parsePath(varname, path, var))
-    {
-        // TODO: let find_target return generic as_objects, or use 'with' 
stack,
-        //       see player2.swf or bug #18758 (strip.swf)
-        as_object* target = find_object(path, &scopeStack); 
-
-        if (target)
-        {
-            as_value val;
-            target->get_member(_vm.getStringTable().find(var), &val);
-            if ( retTarget ) *retTarget = target;
-            return val;
-        }
-        else
-        {
-            IF_VERBOSE_ASCODING_ERRORS(
-                log_aserror(_("find_object(\"%s\") [ varname = '%s' - "
-                            "current target = '%s' ] failed"),
-                            path, varname, m_target);
-                as_value tmp = getVariableRaw(*this, path, scopeStack, 
retTarget);
-                if (!tmp.is_undefined()) {
-                    log_aserror(_("...but getVariableRaw(%s, <scopeStack>) "
-                                "succeeded (%s)!"), path, tmp);
-                }
-            );
-            // TODO: should we check getVariableRaw ?
-            return as_value();
-        }
-    }
-    else {
-        // TODO: have this checked by parse_path as an optimization 
-        if (varname.find('/') != std::string::npos &&
-                varname.find(':') == std::string::npos) {
-
-            // Consider it all a path ...
-            as_object* target = find_object(varname, &scopeStack); 
-            if (target) {
-                // ... but only if it resolves to a sprite
-                DisplayObject* d = target->displayObject();
-                MovieClip* m = d ? d->to_movie() : 0;
-                if (m) return as_value(getObject(m));
-            }
-        }
-        return getVariableRaw(*this, varname, scopeStack, retTarget);
-    }
-}
-
 bool
 as_environment::delVariableRaw(const std::string& varname,
         const ScopeStack& scopeStack) 
@@ -212,41 +151,6 @@ as_environment::delVariableRaw(const std::string& varname,
     return _vm.getGlobal()->delProperty(varkey).second;
 }
 
-// Given a path to variable, set its value.
-void
-as_environment::set_variable(const std::string& varname, const as_value& val,
-    const ScopeStack& scopeStack)
-{
-    IF_VERBOSE_ACTION (
-    log_action("-------------- %s = %s",
-           varname, val);
-    );
-
-    // Path lookup rigamarole.
-    as_object* target = getObject(m_target);
-    std::string path;
-    std::string var;
-    //log_debug(_("set_variable(%s, %s)"), varname, val);
-
-    if (parsePath(varname, path, var)) {
-        target = find_object(path, &scopeStack); 
-        if (target)
-        {
-            target->set_member(_vm.getStringTable().find(var), val);
-        }
-        else
-        {
-            IF_VERBOSE_ASCODING_ERRORS(
-            log_aserror(_("Path target '%s' not found while setting %s=%s"),
-                path, varname, val);
-            );
-        }
-    }
-    else {
-        setVariableRaw(*this, varname, val, scopeStack);
-    }
-}
-
 as_object*
 as_environment::find_object(const std::string& path,
         const ScopeStack* scopeStack) const
@@ -437,6 +341,74 @@ as_environment::markReachableResources() const
     if (_original_target) _original_target->setReachable();
 }
 
+as_value
+getVariable(const as_environment& env, const std::string& varname,
+        const as_environment::ScopeStack& scopeStack, as_object** retTarget)
+{
+    // Path lookup rigamarole.
+    std::string path;
+    std::string var;
+
+    if (parsePath(varname, path, var)) {
+        // TODO: let find_target return generic as_objects, or use 'with' 
stack,
+        //       see player2.swf or bug #18758 (strip.swf)
+        as_object* target = env.find_object(path, &scopeStack); 
+
+        if (target) {
+            as_value val;
+            target->get_member(env.getVM().getStringTable().find(var), &val);
+            if (retTarget) *retTarget = target;
+            return val;
+        }
+        else {
+            return as_value();
+        }
+    }
+
+    if (varname.find('/') != std::string::npos &&
+            varname.find(':') == std::string::npos) {
+
+        // Consider it all a path ...
+        as_object* target = env.find_object(varname, &scopeStack); 
+        if (target) {
+            // ... but only if it resolves to a sprite
+            DisplayObject* d = target->displayObject();
+            MovieClip* m = d ? d->to_movie() : 0;
+            if (m) return as_value(getObject(m));
+        }
+    }
+    return getVariableRaw(env, varname, scopeStack, retTarget);
+}
+
+void
+setVariable(const as_environment& env, const std::string& varname,
+    const as_value& val, const as_environment::ScopeStack& scopeStack)
+{
+    IF_VERBOSE_ACTION(
+        log_action("-------------- %s = %s", varname, val);
+    );
+
+    // Path lookup rigamarole.
+    std::string path;
+    std::string var;
+
+    if (parsePath(varname, path, var)) {
+        as_object* target = env.find_object(path, &scopeStack); 
+        if (target) {
+            target->set_member(env.getVM().getStringTable().find(var), val);
+        }
+        else {
+            IF_VERBOSE_ASCODING_ERRORS(
+            log_aserror(_("Path target '%s' not found while setting %s=%s"),
+                path, varname, val);
+            );
+        }
+        return;
+    }
+
+    setVariableRaw(env, varname, val, scopeStack);
+}
+
 bool
 parsePath(const std::string& var_path_in, std::string& path, std::string& var)
 {
diff --git a/libcore/as_environment.h b/libcore/as_environment.h
index 280105d..f909a1e 100644
--- a/libcore/as_environment.h
+++ b/libcore/as_environment.h
@@ -115,29 +115,6 @@ public:
     bool delVariableRaw(const std::string& varname,
             const ScopeStack& scopeStack);
 
-    /// Return the (possibly undefined) value of the named var.
-    //
-    /// @param varname      Variable name. Can contain path elements.
-    /// @param scopeStack   The Scope stack to use for lookups.
-    /// @param retTarget    If not null, the pointer will be set to
-    ///                     the actual object containing the
-    ///                     found variable (if found).
-    as_value get_variable(const std::string& varname,
-        const ScopeStack& scopeStack, as_object** retTarget=NULL) const;
-
-    /// Given a path to variable, set its value.
-    //
-    /// If no variable with that name is found, a new one is created.
-    ///
-    /// For path-less variables, this would act as a proxy for
-    /// set_variable_raw.
-    ///
-    /// @param path         Variable path. 
-    /// @param val          The value to assign to the variable.
-    /// @param scopeStack   The Scope stack to use for lookups.
-    void set_variable(const std::string& path, const as_value& val,
-        const ScopeStack& scopeStack);
-
     /// Mark all reachable resources.
     //
     /// Only the targets are reachable.
@@ -171,6 +148,30 @@ private:
         
 };
 
+/// Return the (possibly undefined) value of the named var.
+//
+/// @param varname      Variable name. Can contain path elements.
+/// @param scopeStack   The Scope stack to use for lookups.
+/// @param retTarget    If not null, the pointer will be set to
+///                     the actual object containing the
+///                     found variable (if found).
+as_value getVariable(const as_environment& env, const std::string& varname,
+    const as_environment::ScopeStack& scopeStack, as_object** retTarget = 0);
+
+/// Given a path to variable, set its value.
+//
+/// If no variable with that name is found, a new one is created.
+///
+/// For path-less variables, this would act as a proxy for
+/// set_variable_raw.
+///
+/// @param path         Variable path. 
+/// @param val          The value to assign to the variable.
+/// @param scopeStack   The Scope stack to use for lookups.
+void setVariable(const as_environment& env, const std::string& path,
+    const as_value& val, const as_environment::ScopeStack& scopeStack);
+
+
 /// See if the given variable name is actually a sprite path
 /// followed by a variable name.  These come in the format:
 ///
diff --git a/libcore/vm/ActionExec.cpp b/libcore/vm/ActionExec.cpp
index ba06d38..fdf46c1 100644
--- a/libcore/vm/ActionExec.cpp
+++ b/libcore/vm/ActionExec.cpp
@@ -620,19 +620,19 @@ ActionExec::delObjectMember(as_object& obj, const 
std::string& name)
 void
 ActionExec::setVariable(const std::string& name, const as_value& val)
 {
-    return env.set_variable(name, val, getScopeStack());
+    gnash::setVariable(env, name, val, getScopeStack());
 }
 
 as_value
 ActionExec::getVariable(const std::string& name)
 {
-    return env.get_variable(name, getScopeStack());
+    return gnash::getVariable(env, name, getScopeStack());
 }
 
 as_value
 ActionExec::getVariable(const std::string& name, as_object** target)
 {
-    return env.get_variable(name, getScopeStack(), target);
+    return gnash::getVariable(env, name, getScopeStack(), target);
 }
 
 void
@@ -645,7 +645,7 @@ ActionExec::setLocalVariable(const std::string& name, const 
as_value& val)
     } else {
         // TODO: set target member  ?
         //       what about 'with' stack ?
-        env.set_variable(name, val, getScopeStack());
+        gnash::setVariable(env, name, val, getScopeStack());
     }
 }
 

http://git.savannah.gnu.org/cgit//commit/?id=3066d3ea8aa1f096a20ff7d3d8c133937e7c3271


commit 3066d3ea8aa1f096a20ff7d3d8c133937e7c3271
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Nov 17 10:51:00 2010 +0100

    Clean up.

diff --git a/libcore/as_environment.cpp b/libcore/as_environment.cpp
index 10afffb..a25441f 100644
--- a/libcore/as_environment.cpp
+++ b/libcore/as_environment.cpp
@@ -98,6 +98,8 @@ namespace {
     // a pointer to it, or null if it wasn't found.
     static const char* next_slash_or_dot(const char* word);
 
+    static bool validRawVariableName(const std::string& varname);
+
 }
 
 as_value as_environment::undefVal;
@@ -172,20 +174,6 @@ as_environment::get_variable(const std::string& varname,
     }
 }
 
-static bool
-validRawVariableName(const std::string& varname)
-{
-    if (varname.empty()) return false;
-
-    if (varname[0] == '.') return false;
-   
-    if (varname[0] == ':' &&
-            varname.find_first_of(":.", 1) == std::string::npos) {
-        return false;
-    }
-    return (varname.find(":::") == std::string::npos);
-}
-
 bool
 as_environment::delVariableRaw(const std::string& varname,
         const ScopeStack& scopeStack) 
@@ -443,13 +431,6 @@ as_environment::get_version() const
 }
 
 void
-as_environment::set_target(DisplayObject* target)
-{
-    if (!_original_target) _original_target = target;
-    m_target = target;
-}
-
-void
 as_environment::markReachableResources() const
 {
     if (m_target) m_target->setReachable();
@@ -483,6 +464,20 @@ parsePath(const std::string& var_path_in, std::string& 
path, std::string& var)
 
 namespace {
 
+static bool
+validRawVariableName(const std::string& varname)
+{
+    if (varname.empty()) return false;
+
+    if (varname[0] == '.') return false;
+   
+    if (varname[0] == ':' &&
+            varname.find_first_of(":.", 1) == std::string::npos) {
+        return false;
+    }
+    return (varname.find(":::") == std::string::npos);
+}
+
 // No path rigamarole.
 void
 setVariableRaw(const as_environment& env, const std::string& varname,
diff --git a/libcore/as_environment.h b/libcore/as_environment.h
index c84f541..280105d 100644
--- a/libcore/as_environment.h
+++ b/libcore/as_environment.h
@@ -57,7 +57,10 @@ public:
     /// @param target   A DisplayObject to apply timeline opcodes on.
     ///                 Zero is a valid target, disabling timeline
     ///                 opcodes (would get ignored).
-    void set_target(DisplayObject* target);
+    void set_target(DisplayObject* target) {
+        if (!_original_target) _original_target = target;
+        m_target = target;
+    }
 
     void set_original_target(DisplayObject* target) {
         _original_target = target;

http://git.savannah.gnu.org/cgit//commit/?id=54d537224f5875f243ba02802854964ffc13ffd1


commit 54d537224f5875f243ba02802854964ffc13ffd1
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Nov 17 10:45:50 2010 +0100

    Don't need extra null check.

diff --git a/libcore/Function.cpp b/libcore/Function.cpp
index ecc0f5f..4cc7d23 100644
--- a/libcore/Function.cpp
+++ b/libcore/Function.cpp
@@ -84,14 +84,11 @@ Function::call(const fn_call& fn)
                // In SWF5, when 'this' is a DisplayObject it becomes
                // the target for this function call.
                // See actionscript.all/setProperty.as
-               // 
-               if (fn.this_ptr) {
-                       DisplayObject* ch = get<DisplayObject>(fn.this_ptr);
-                       if (ch) {
-                               target = ch;
-                               orig_target = ch;
-                       }
-               }
+        DisplayObject* ch = get<DisplayObject>(fn.this_ptr);
+        if (ch) {
+            target = ch;
+            orig_target = ch;
+        }
        }
 
        /// This is only needed for SWF5 (temp switch of target)
@@ -103,11 +100,9 @@ Function::call(const fn_call& fn)
        ///       (target, in particular).
        TargetGuard targetGuard(_env, target, orig_target);
 
-    // Conventional function.
-
     // Push the arguments onto the local frame.
-    for (size_t i=0, n=_args.size(); i<n; ++i)
-    {
+    for (size_t i = 0, n = _args.size(); i < n; ++i) {
+
         assert(_args[i].reg == 0);
         if (i < fn.nargs) {
             setLocal(cf, _args[i].name, fn.arg(i));
@@ -139,8 +134,7 @@ Function::call(const fn_call& fn)
 
        // Execute the actions.
     as_value result;
-    ActionExec exec(*this, _env, &result, fn.this_ptr);
-    exec();
+    ActionExec(*this, _env, &result, fn.this_ptr)();
     return result;
 }
 

http://git.savannah.gnu.org/cgit//commit/?id=ed4839cd8ee1b625cae0f72928aef9b51a10a280


commit ed4839cd8ee1b625cae0f72928aef9b51a10a280
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Nov 17 10:29:32 2010 +0100

    Don't need a try block.

diff --git a/libcore/Function.cpp b/libcore/Function.cpp
index 4361bad..ecc0f5f 100644
--- a/libcore/Function.cpp
+++ b/libcore/Function.cpp
@@ -138,17 +138,10 @@ Function::call(const fn_call& fn)
     setLocal(cf, NSV::PROP_ARGUMENTS, getArguments(*this, *args, fn, caller));
 
        // Execute the actions.
-       // Do this in a try block to proper drop the pushed call frame 
-       // in case of problems (most interesting action limits)
-       try {
-        as_value result;
-               ActionExec exec(*this, _env, &result, fn.this_ptr);
-               exec();
-        return result;
-       }
-       catch (ActionLimitException& ale) {
-               throw;
-       }
+    as_value result;
+    ActionExec exec(*this, _env, &result, fn.this_ptr);
+    exec();
+    return result;
 }
 
 void

-----------------------------------------------------------------------

Summary of changes:
 libcore/DisplayObject.h                            |    3 -
 libcore/Function.cpp                               |   37 +--
 libcore/Function2.cpp                              |   20 +-
 libcore/MovieClip.h                                |   17 +-
 libcore/TextField.cpp                              |    9 +-
 libcore/as_environment.cpp                         |  356 +++++++++-----------
 libcore/as_environment.h                           |  103 ++++---
 libcore/asobj/Global_as.h                          |    2 +-
 libcore/asobj/MovieClip_as.cpp                     |    4 +-
 libcore/asobj/Object.cpp                           |    2 +-
 libcore/asobj/flash/display/BitmapData_as.cpp      |    4 +-
 .../asobj/flash/external/ExternalInterface_as.cpp  |   16 +-
 libcore/asobj/flash/geom/Matrix_as.cpp             |    6 +-
 libcore/asobj/flash/geom/Rectangle_as.cpp          |    2 +-
 libcore/asobj/flash/geom/Transform_as.cpp          |    8 +-
 libcore/vm/ASHandlers.cpp                          |   24 +-
 libcore/vm/ActionExec.cpp                          |   16 +-
 libcore/vm/ExecutableCode.h                        |   59 +---
 testsuite/misc-ming.all/timeline_var_test.c        |   29 ++-
 19 files changed, 332 insertions(+), 385 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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