[Swfdec] Branch 'vivi' - 4 commits - doc/swfdec-sections.txt libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_string.c vivified/core

Benjamin Otte company at kemper.freedesktop.org
Tue Aug 21 05:02:16 PDT 2007


 doc/swfdec-sections.txt          |    1 
 libswfdec/swfdec_as_frame.c      |   17 +++++++++++++++
 libswfdec/swfdec_as_frame.h      |    1 
 libswfdec/swfdec_as_string.c     |    9 ++++++++
 vivified/core/vivi_initialize.as |    2 +
 vivified/core/vivi_wrap_as.c     |   43 +++++++++++++++++++++++++++++++++++++++
 6 files changed, 73 insertions(+)

New commits:
diff-tree 3e6829af094100400d58f5540f3c13d7f6d7f63a (from 70040fde674cc20d5c9fa91250493cf81271542b)
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Aug 21 14:02:05 2007 +0200

    add a Wrap.get() function to get variables

diff --git a/vivified/core/vivi_initialize.as b/vivified/core/vivi_initialize.as
index 94507bc..68c4c09 100644
--- a/vivified/core/vivi_initialize.as
+++ b/vivified/core/vivi_initialize.as
@@ -21,6 +21,7 @@
 
 Wrap = function () {};
 Wrap.prototype = {};
+Wrap.prototype.get = Native.wrap_get;
 Wrap.prototype.toString = Native.wrap_toString;
 
 Frame = function () extends Wrap {};
diff --git a/vivified/core/vivi_wrap_as.c b/vivified/core/vivi_wrap_as.c
index 86aaca2..8110286 100644
--- a/vivified/core/vivi_wrap_as.c
+++ b/vivified/core/vivi_wrap_as.c
@@ -44,6 +44,29 @@ vivi_wrap_toString (SwfdecAsContext *cx,
   SWFDEC_AS_VALUE_SET_STRING (retval, swfdec_as_context_give_string (cx, s));
 }
 
+VIVI_FUNCTION ("wrap_get", vivi_wrap_get)
+void
+vivi_wrap_get (SwfdecAsContext *cx, SwfdecAsObject *this,
+    guint argc, SwfdecAsValue *argv, SwfdecAsValue *retval)
+{
+  ViviApplication *app = VIVI_APPLICATION (cx);
+  ViviWrap *wrap;
+  SwfdecAsValue val;
+  const char *name;
+
+  if (!VIVI_IS_WRAP (this) || argc == 0)
+    return;
+  wrap = VIVI_WRAP (this);
+  if (wrap->wrap == NULL)
+    return;
+  
+  name = swfdec_as_value_to_string (cx, &argv[0]);
+  swfdec_as_object_get_variable (wrap->wrap, 
+      swfdec_as_context_get_string (SWFDEC_AS_CONTEXT (app->player), name), 
+      &val);
+  vivi_wrap_value (app, retval, &val);
+}
+
 /*** FRAME specific code ***/
 
 VIVI_FUNCTION ("frame_name_get", vivi_wrap_name_get)
diff-tree 70040fde674cc20d5c9fa91250493cf81271542b (from ef85440d2e8a21ddaa688035b6071ce5eef6cc3b)
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Aug 21 13:30:39 2007 +0200

    implement Frame.this

diff --git a/vivified/core/vivi_initialize.as b/vivified/core/vivi_initialize.as
index 964f5b3..94507bc 100644
--- a/vivified/core/vivi_initialize.as
+++ b/vivified/core/vivi_initialize.as
@@ -28,6 +28,7 @@ Frame.prototype = new Wrap ();
 Frame.prototype.addProperty ("code", Native.frame_code_get, null);
 Frame.prototype.addProperty ("name", Native.frame_name_get, null);
 Frame.prototype.addProperty ("next", Native.frame_next_get, null);
+Frame.prototype.addProperty ("this", Native.frame_this_get, null);
 
 /*** breakpoints ***/
 
diff --git a/vivified/core/vivi_wrap_as.c b/vivified/core/vivi_wrap_as.c
index c905f34..86aaca2 100644
--- a/vivified/core/vivi_wrap_as.c
+++ b/vivified/core/vivi_wrap_as.c
@@ -106,4 +106,24 @@ vivi_wrap_next_get (SwfdecAsContext *cx,
     SWFDEC_AS_VALUE_SET_OBJECT (retval, vivi_wrap_object (VIVI_APPLICATION (cx), obj));
 }
 
+VIVI_FUNCTION ("frame_this_get", vivi_wrap_this_get)
+void
+vivi_wrap_this_get (SwfdecAsContext *cx, SwfdecAsObject *this,
+    guint argc, SwfdecAsValue *argv, SwfdecAsValue *retval)
+{
+  ViviWrap *wrap;
+  SwfdecAsObject *obj;
+
+  if (!VIVI_IS_WRAP (this))
+    return;
+  
+  wrap = VIVI_WRAP (this);
+  if (!SWFDEC_IS_AS_FRAME (wrap->wrap))
+    return;
+  
+  obj = SWFDEC_AS_OBJECT (swfdec_as_frame_get_this (SWFDEC_AS_FRAME (wrap->wrap)));
+  if (obj)
+    SWFDEC_AS_VALUE_SET_OBJECT (retval, vivi_wrap_object (VIVI_APPLICATION (cx), obj));
+}
+
 
diff-tree ef85440d2e8a21ddaa688035b6071ce5eef6cc3b (from 7f9eebf1183d28ceaaaf06d5910c9144eb5cc435)
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Aug 21 13:28:10 2007 +0200

    implement swfdec_as_frame_get_this ()

diff --git a/doc/swfdec-sections.txt b/doc/swfdec-sections.txt
index c5f9076..019380c 100644
--- a/doc/swfdec-sections.txt
+++ b/doc/swfdec-sections.txt
@@ -375,6 +375,7 @@ SwfdecAsFrame
 swfdec_as_frame_get_next
 swfdec_as_frame_get_function_name
 swfdec_as_frame_get_script
+swfdec_as_frame_get_this
 SwfdecAsStackIterator
 swfdec_as_stack_iterator_init
 swfdec_as_stack_iterator_init_arguments
diff --git a/libswfdec/swfdec_as_frame.c b/libswfdec/swfdec_as_frame.c
index a9fe372..b7cb037 100644
--- a/libswfdec/swfdec_as_frame.c
+++ b/libswfdec/swfdec_as_frame.c
@@ -787,3 +787,20 @@ swfdec_as_frame_get_script (SwfdecAsFram
 
   return frame->script;
 }
+
+/**
+ * swfdec_as_frame_get_this:
+ * @frame: a #SwfdecAsFrame
+ *
+ * Gets the this object of the given @frame. If the frame has no this object,
+ * %NULL is returned.
+ *
+ * Returns: The this object of the frame or %NULL if none.
+ **/
+SwfdecAsObject *
+swfdec_as_frame_get_this (SwfdecAsFrame *frame)
+{
+  g_return_val_if_fail (SWFDEC_IS_AS_FRAME (frame), NULL);
+
+  return frame->thisp;
+}
diff --git a/libswfdec/swfdec_as_frame.h b/libswfdec/swfdec_as_frame.h
index 8157858..344eaa7 100644
--- a/libswfdec/swfdec_as_frame.h
+++ b/libswfdec/swfdec_as_frame.h
@@ -49,6 +49,7 @@ GType		swfdec_as_frame_get_type	(void);
 SwfdecAsFrame *	swfdec_as_frame_get_next	(SwfdecAsFrame *		frame);
 const char *	swfdec_as_frame_get_function_name (SwfdecAsFrame *		frame);
 SwfdecScript *	swfdec_as_frame_get_script	(SwfdecAsFrame *		frame);
+SwfdecAsObject *swfdec_as_frame_get_this	(SwfdecAsFrame *		frame);
 
 SwfdecAsValue *	swfdec_as_stack_iterator_init	(SwfdecAsStackIterator *	iter,
 						 SwfdecAsFrame *		frame);
diff-tree 7f9eebf1183d28ceaaaf06d5910c9144eb5cc435 (from 9ee0631673a83e6a59448873ab93b90311d8d88b)
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Aug 21 13:26:13 2007 +0200

    implement debug-printing for SwfdecAsString

diff --git a/libswfdec/swfdec_as_string.c b/libswfdec/swfdec_as_string.c
index 720bc5c..96f311d 100644
--- a/libswfdec/swfdec_as_string.c
+++ b/libswfdec/swfdec_as_string.c
@@ -43,12 +43,21 @@ swfdec_as_string_do_mark (SwfdecAsObject
   SWFDEC_AS_OBJECT_CLASS (swfdec_as_string_parent_class)->mark (object);
 }
 
+static char *
+swfdec_as_string_debug (SwfdecAsObject *object)
+{
+  SwfdecAsString *string = SWFDEC_AS_STRING (object);
+
+  return g_strdup (string->string);
+}
+
 static void
 swfdec_as_string_class_init (SwfdecAsStringClass *klass)
 {
   SwfdecAsObjectClass *asobject_class = SWFDEC_AS_OBJECT_CLASS (klass);
 
   asobject_class->mark = swfdec_as_string_do_mark;
+  asobject_class->debug = swfdec_as_string_debug;
 }
 
 static void


More information about the Swfdec mailing list