[Swfdec] Branch 'as' - 8 commits - libswfdec/.gitignore libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_function.c libswfdec/swfdec_as_object.h libswfdec/swfdec_movie.c libswfdec/swfdec_sprite_movie_as.c
Benjamin Otte
company at kemper.freedesktop.org
Thu May 17 14:44:34 PDT 2007
libswfdec/.gitignore | 2 ++
libswfdec/swfdec_as_frame.c | 23 +++++++++++++++++++----
libswfdec/swfdec_as_function.c | 9 +++++++++
libswfdec/swfdec_as_object.h | 2 +-
libswfdec/swfdec_movie.c | 1 -
libswfdec/swfdec_sprite_movie_as.c | 1 +
6 files changed, 32 insertions(+), 6 deletions(-)
New commits:
diff-tree 40299761a60e06300ee005332213d19f413e2cf7 (from 7aac631b622ceb02bf4786ce0d82601cd6894d9d)
Author: Benjamin Otte <otte at gnome.org>
Date: Thu May 17 21:51:56 2007 +0200
ignore the compute-strings binary
diff --git a/libswfdec/.gitignore b/libswfdec/.gitignore
index 918defb..a203c5e 100644
--- a/libswfdec/.gitignore
+++ b/libswfdec/.gitignore
@@ -14,3 +14,5 @@ Makefile.in
swfdec_as_strings.h
swfdec_enums.[ch]
swfdec_marshal.[ch]
+
+compute-strings
diff-tree 7aac631b622ceb02bf4786ce0d82601cd6894d9d (from 704863faa6c5c74756860b94a3788d066ed7b8b1)
Author: Benjamin Otte <otte at gnome.org>
Date: Thu May 17 21:51:35 2007 +0200
typo in comment
diff --git a/libswfdec/swfdec_as_object.h b/libswfdec/swfdec_as_object.h
index e5fd2a5..c677d51 100644
--- a/libswfdec/swfdec_as_object.h
+++ b/libswfdec/swfdec_as_object.h
@@ -66,7 +66,7 @@ struct _SwfdecAsObjectClass {
void (* mark) (SwfdecAsObject * object);
/* object was added to the context */
void (* add) (SwfdecAsObject * object);
- /* get the valueand flags for a variables */
+ /* get the value and flags for a variables */
gboolean (* get) (SwfdecAsObject * object,
const char * variable,
SwfdecAsValue * val,
diff-tree 704863faa6c5c74756860b94a3788d066ed7b8b1 (from ab019a8f3710c9d4304beb07bff3788ad9935e60)
Author: Benjamin Otte <otte at gnome.org>
Date: Thu May 17 20:01:55 2007 +0200
user-defined function have an implicit prototype property
diff --git a/libswfdec/swfdec_as_function.c b/libswfdec/swfdec_as_function.c
index 9256b31..c6a7c92 100644
--- a/libswfdec/swfdec_as_function.c
+++ b/libswfdec/swfdec_as_function.c
@@ -100,13 +100,22 @@ swfdec_as_function_do_create (SwfdecAsCo
SwfdecAsFunction *
swfdec_as_function_new (SwfdecAsScope *scope)
{
+ SwfdecAsValue val;
SwfdecAsFunction *fun;
+ SwfdecAsObject *proto;
g_return_val_if_fail (SWFDEC_IS_AS_SCOPE (scope), NULL);
fun = swfdec_as_function_do_create (SWFDEC_AS_OBJECT (scope)->context);
if (fun == NULL)
return NULL;
+ proto = swfdec_as_object_new (SWFDEC_AS_OBJECT (scope)->context);
+ if (proto == NULL)
+ return NULL;
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, SWFDEC_AS_OBJECT (fun));
+ swfdec_as_object_set_variable (proto, SWFDEC_AS_STR_constructor, &val);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, proto);
+ swfdec_as_object_set_variable (SWFDEC_AS_OBJECT (fun), SWFDEC_AS_STR_prototype, &val);
fun->scope = scope;
return fun;
diff-tree ab019a8f3710c9d4304beb07bff3788ad9935e60 (from 551a69d50afe92c6e2736a95280e6e96fd5044e2)
Author: Benjamin Otte <otte at gnome.org>
Date: Thu May 17 19:29:06 2007 +0200
change swfdec_as_frame_find_variable() return value semantics
It used to look up the object that contained the variable.
Now it looks up the object in the scope chain that has the variable
in its prototype chain.
Consider this graphical piece of art (* denotes the object containing the variable,
scope chain is X axis, prototypes Y axis):
A => B => C
v v
PA PB*
v
PPB
Previously this function would return PB, now it returns B.
diff --git a/libswfdec/swfdec_as_frame.c b/libswfdec/swfdec_as_frame.c
index 1507326..23b3c41 100644
--- a/libswfdec/swfdec_as_frame.c
+++ b/libswfdec/swfdec_as_frame.c
@@ -170,6 +170,19 @@ swfdec_as_frame_new_native (SwfdecAsObje
return frame;
}
+/**
+ * swfdec_as_frame_find_variable:
+ * @frame: a #SwfdecAsFrame
+ * @variable: name of the variable to find
+ *
+ * Finds the given variable in the current scope chain. Returns the first
+ * object in the scope chain that contains this variable in its prototype
+ * chain. If you want to know the explicit object that contains the variable,
+ * you have to call swfdec_as_object_find_variable() on the result.
+ * If no such variable exist in the scope chain, %NULL is returned.
+ *
+ * Returns: the object that contains @variable or %NULL if none.
+ **/
SwfdecAsObject *
swfdec_as_frame_find_variable (SwfdecAsFrame *frame, const char *variable)
{
@@ -184,7 +197,7 @@ swfdec_as_frame_find_variable (SwfdecAsF
for (i = 0; i < 256; i++) {
ret = swfdec_as_object_find_variable (SWFDEC_AS_OBJECT (cur), variable);
if (ret)
- return ret;
+ return SWFDEC_AS_OBJECT (cur);
if (cur->next == NULL)
break;
cur = cur->next;
@@ -198,15 +211,17 @@ swfdec_as_frame_find_variable (SwfdecAsF
/* 1) the target set via SetTarget */
if (frame->target) {
ret = swfdec_as_object_find_variable (frame->target, variable);
+ if (ret)
+ return frame->target;
} else {
/* The default target is the original object that called into us */
ret = swfdec_as_object_find_variable (SWFDEC_AS_FRAME (cur)->thisp, variable);
+ if (ret)
+ return SWFDEC_AS_FRAME (cur)->thisp;
}
- if (ret)
- return ret;
/* 2) the global object */
ret = swfdec_as_object_find_variable (SWFDEC_AS_OBJECT (frame)->context->global, variable);
- return ret;
+ return ret ? SWFDEC_AS_OBJECT (frame)->context->global : NULL;
}
/**
diff-tree 551a69d50afe92c6e2736a95280e6e96fd5044e2 (from 9ac8b03ed65bbe2e5df855f92ffdbd3b8c29458c)
Author: Benjamin Otte <otte at gnome.org>
Date: Thu May 17 19:26:02 2007 +0200
don't continue after an error
diff --git a/libswfdec/swfdec_sprite_movie_as.c b/libswfdec/swfdec_sprite_movie_as.c
index f278e70..0049ec6 100644
--- a/libswfdec/swfdec_sprite_movie_as.c
+++ b/libswfdec/swfdec_sprite_movie_as.c
@@ -294,6 +294,7 @@ swfdec_sprite_movie_attachMovie (SwfdecA
} else {
SWFDEC_WARNING ("can only use attachMovie with sprites");
}
+ return;
}
depth = swfdec_as_value_to_integer (obj->context, &argv[2]);
if (swfdec_depth_classify (depth) == SWFDEC_DEPTH_CLASS_EMPTY)
diff-tree 9ac8b03ed65bbe2e5df855f92ffdbd3b8c29458c (from f9eafb37d503f8e4eba6bc76cd5e993ae83d2451)
Author: Benjamin Otte <otte at gnome.org>
Date: Thu May 17 19:11:09 2007 +0200
Don't unset the parent
diff --git a/libswfdec/swfdec_movie.c b/libswfdec/swfdec_movie.c
index 8e826a5..a173c3c 100644
--- a/libswfdec/swfdec_movie.c
+++ b/libswfdec/swfdec_movie.c
@@ -347,7 +347,6 @@ swfdec_movie_destroy (SwfdecMovie *movie
g_signal_emit_by_name (player, "movie-removed", movie);
}
movie->parent->list = g_list_remove (movie->parent->list, movie);
- movie->parent = NULL;
} else {
SwfdecPlayer *player = SWFDEC_ROOT_MOVIE (movie)->player;
if (SWFDEC_IS_DEBUGGER (player) &&
diff-tree f9eafb37d503f8e4eba6bc76cd5e993ae83d2451 (from parents)
Merge: 36cad6b2cc5d370bf2bd529080c81c385e370faa d10391223fd0f122ffe420c508e05ed3006f5b57
Author: Benjamin Otte <otte at gnome.org>
Date: Wed May 16 16:37:23 2007 +0200
Merge branch 'as' of ssh://company@git.freedesktop.org/git/swfdec into as
diff-tree 36cad6b2cc5d370bf2bd529080c81c385e370faa (from parents)
Merge: 7bef3635fd567c008f9ba701df691afd15cd28b6 a2d36ad31bc38cf1092f08fbded125afe22534e1
Author: Benjamin Otte <otte at gnome.org>
Date: Wed May 16 16:35:04 2007 +0200
Merge branch 'master' of ssh://company@git.freedesktop.org/git/swfdec into as
More information about the Swfdec
mailing list