[Swfdec] 4 commits - configure.ac libswfdec/swfdec_as_internal.h libswfdec/swfdec_as_object.h libswfdec/swfdec_scriptable.c libswfdec/swfdec_scriptable.h NEWS
Benjamin Otte
company at kemper.freedesktop.org
Fri Jul 13 13:08:04 PDT 2007
NEWS | 16 ++
configure.ac | 2
libswfdec/swfdec_as_internal.h | 3
libswfdec/swfdec_as_object.h | 3
libswfdec/swfdec_scriptable.c | 304 -----------------------------------------
libswfdec/swfdec_scriptable.h | 78 ----------
6 files changed, 20 insertions(+), 386 deletions(-)
New commits:
diff-tree 7cc9628502fc44902e0fbe812569c533b87a02b2 (from 448b339d6fc1719b265dac580eea335a07f2f1f8)
Author: Benjamin Otte <otte at gnome.org>
Date: Fri Jul 13 21:54:59 2007 +0200
release 0.5.0
diff --git a/configure.ac b/configure.ac
index bc89a09..1775f6e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_PREREQ([2.58])
-AC_INIT(swfdec,0.4.99.1)
+AC_INIT(swfdec,0.5.0)
[nano=$(echo $PACKAGE_VERSION | sed 's/[0-9]\.[0-9]\.[0-9][0-9]*\.*//')]
if test x"$nano" = x1 ; then
diff-tree 448b339d6fc1719b265dac580eea335a07f2f1f8 (from 7b8a7526b5fec8d7129f461bb318baa85eb3d257)
Author: Benjamin Otte <otte at gnome.org>
Date: Fri Jul 13 21:54:47 2007 +0200
update NEWS
diff --git a/NEWS b/NEWS
index 8713fb7..fc07dc9 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,20 @@
+ 0.5.0 ("Meet Plan Party!")
+
+Here's the long overdue update. Lots of backend stuff was rewritten. The only
+thing that is missing now is more features. Expect them in the next releases.
+- New and more correct script interpreter engine. The engine is even exported
+ for your coding pleasure.
+- New instance placement handling algorithm. This one seems to produce much
+ better correctness results than the old one.
+- More ActionScript bytecodes are supported, in particular CloneSprite and
+ RemoveSprite
+- improve String reading in earlier Flash versions (Flash <=5 is Latin1, not
+ UTF8)
+- implement some more Actionscript functions (most important is probably
+ createEmptyMovieClip ())
+- lots of bugfixes
+
0.4.5 ("Death of the Desktop")
This is strictly a bugfix release. Have fun.
diff-tree 7b8a7526b5fec8d7129f461bb318baa85eb3d257 (from d617bb496e5aa49a138dd34a62dc20b240aed089)
Author: Benjamin Otte <otte at gnome.org>
Date: Fri Jul 13 21:14:16 2007 +0200
remove swfdec_as_object_run() from exported headers
SwfdecScript is not exported, so it cannot be public
diff --git a/libswfdec/swfdec_as_internal.h b/libswfdec/swfdec_as_internal.h
index 00d56db..ca6ab2d 100644
--- a/libswfdec/swfdec_as_internal.h
+++ b/libswfdec/swfdec_as_internal.h
@@ -41,6 +41,7 @@ void swfdec_as_function_init_context (S
typedef SwfdecAsVariableForeach SwfdecAsVariableForeachRemove;
typedef const char *(* SwfdecAsVariableForeachRename) (SwfdecAsObject *object,
const char *variable, SwfdecAsValue *value, guint flags, gpointer data);
+
void swfdec_as_object_collect (SwfdecAsObject * object);
guint swfdec_as_object_foreach_remove (SwfdecAsObject * object,
SwfdecAsVariableForeach func,
@@ -48,6 +49,8 @@ guint swfdec_as_object_foreach_remove (
void swfdec_as_object_foreach_rename (SwfdecAsObject * object,
SwfdecAsVariableForeachRename func,
gpointer data);
+void swfdec_as_object_run (SwfdecAsObject * object,
+ SwfdecScript * script);
void swfdec_as_object_init_context (SwfdecAsContext * context,
guint version);
diff --git a/libswfdec/swfdec_as_object.h b/libswfdec/swfdec_as_object.h
index d109a72..d796518 100644
--- a/libswfdec/swfdec_as_object.h
+++ b/libswfdec/swfdec_as_object.h
@@ -22,7 +22,6 @@
#include <glib-object.h>
#include <libswfdec/swfdec_as_types.h>
-#include <libswfdec/swfdec_types.h>
G_BEGIN_DECLS
@@ -143,8 +142,6 @@ SwfdecAsFunction *swfdec_as_object_add_f
SwfdecAsNative native,
guint min_args);
-void swfdec_as_object_run (SwfdecAsObject * object,
- SwfdecScript * script);
gboolean swfdec_as_object_has_function (SwfdecAsObject * object,
const char * name);
void swfdec_as_object_call (SwfdecAsObject * object,
diff-tree d617bb496e5aa49a138dd34a62dc20b240aed089 (from 6748f0ab9c6c1c49667e186bce8dc618cab95ad1)
Author: Benjamin Otte <otte at gnome.org>
Date: Fri Jul 13 21:12:36 2007 +0200
remove 2 old files that aren't in use anymore
diff --git a/libswfdec/swfdec_scriptable.c b/libswfdec/swfdec_scriptable.c
deleted file mode 100644
index 951a726..0000000
--- a/libswfdec/swfdec_scriptable.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/* Swfdec
- * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "swfdec_scriptable.h"
-#include "swfdec_debug.h"
-#include "swfdec_loader_internal.h"
-#include "js/jsapi.h"
-#include "js/jsfun.h"
-#include "js/jsinterp.h"
-
-G_DEFINE_ABSTRACT_TYPE (SwfdecScriptable, swfdec_scriptable, G_TYPE_OBJECT)
-
-static void
-swfdec_scriptable_dispose (GObject *object)
-{
- SwfdecScriptable *script = SWFDEC_SCRIPTABLE (object);
-
- g_assert (script->jsobj == NULL);
-
- G_OBJECT_CLASS (swfdec_scriptable_parent_class)->dispose (object);
-}
-
-static JSObject *
-swfdec_scriptable_create_js_object (SwfdecScriptable *scriptable)
-{
- SwfdecScriptableClass *klass;
- JSContext *cx;
- JSObject *obj;
-
- klass = SWFDEC_SCRIPTABLE_GET_CLASS (scriptable);
- g_return_val_if_fail (klass->jsclass != NULL, NULL);
- cx = scriptable->jscx;
-
- obj = JS_NewObject (cx, (JSClass *) klass->jsclass, NULL, NULL);
- if (obj == NULL) {
- SWFDEC_ERROR ("failed to create JS object for %s %p",
- G_OBJECT_TYPE_NAME (scriptable), scriptable);
- return NULL;
- }
- SWFDEC_LOG ("created JSObject %p for %s %p", obj,
- G_OBJECT_TYPE_NAME (scriptable), scriptable);
- g_object_ref (scriptable);
- JS_SetPrivate (cx, obj, scriptable);
- return obj;
-}
-
-static void
-swfdec_scriptable_class_init (SwfdecScriptableClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->dispose = swfdec_scriptable_dispose;
-
- klass->create_js_object = swfdec_scriptable_create_js_object;
-}
-
-static void
-swfdec_scriptable_init (SwfdecScriptable *stream)
-{
-}
-
-/*** PUBLIC API ***/
-
-/**
- * swfdec_scriptable_finalize:
- * @cx: a #JSContext
- * @obj: a #JSObject to finalize
- *
- * This function is intended to be used as the finalizer in the #JSClass used
- * by a scriptable subtype.
- **/
-void
-swfdec_scriptable_finalize (JSContext *cx, JSObject *obj)
-{
- SwfdecScriptable *script;
-
- script = JS_GetPrivate (cx, obj);
- /* since we also finalize the prototype, not everyone has a private object */
- if (script) {
- g_assert (SWFDEC_IS_SCRIPTABLE (script));
- g_assert (script->jsobj != NULL);
-
- SWFDEC_LOG ("destroying JSObject %p for %s %p", obj,
- G_OBJECT_TYPE_NAME (script), script);
- script->jsobj = NULL;
- g_object_unref (script);
- } else {
- SWFDEC_LOG ("destroying JSObject %p without Scriptable (probably a prototype)", obj);
- }
-}
-
-JSObject *
-swfdec_scriptable_get_object (SwfdecScriptable *scriptable)
-{
- SwfdecScriptableClass *klass;
-
- g_return_val_if_fail (SWFDEC_IS_SCRIPTABLE (scriptable), NULL);
-
- if (scriptable->jsobj)
- return scriptable->jsobj;
- klass = SWFDEC_SCRIPTABLE_GET_CLASS (scriptable);
- g_return_val_if_fail (klass->create_js_object, NULL);
- scriptable->jsobj = klass->create_js_object (scriptable);
-
- return scriptable->jsobj;
-}
-
-/**
- * swfdec_scriptable_from_object:
- * @cx: a #JSContext
- * @object: the JSObject to convert (NULL is a valid value)
- * @type: type of the object to get.
- *
- * Converts the given @object to a #SwfdecScriptable, if it represents one.
- * The object must be of @type, otherwise %NULL will be returned.
- *
- * Returns: the scriptable represented by @object or NULL if it does not
- * reference a @scriptable
- **/
-gpointer
-swfdec_scriptable_from_object (JSContext *cx, JSObject *object, GType type)
-{
- SwfdecScriptableClass *klass;
-
- g_return_val_if_fail (g_type_is_a (type, SWFDEC_TYPE_SCRIPTABLE), NULL);
-
- if (object == NULL)
- return NULL;
- klass = g_type_class_peek (type);
- if (klass == NULL)
- return NULL; /* class doesn't exist -> no object of this type exists */
- if (!JS_InstanceOf (cx, object, klass->jsclass, NULL))
- return NULL;
- return JS_GetPrivate (cx, object);
-}
-
-/**
- * swfdec_scriptable_from_jsval:
- * @cx: a #JSContext
- * @val: the jsval to convert
- * @type: type of the object to get.
- *
- * Converts the given value @val to a #SwfdecScriptable, if it represents one.
- * The object must be of @type, otherwise %NULL will be returned.
- *
- * Returns: the scriptable represented by @val or NULL if @val does not
- * reference a @scriptable
- **/
-gpointer
-swfdec_scriptable_from_jsval (JSContext *cx, jsval val, GType type)
-{
- JSObject *object;
-
- g_return_val_if_fail (g_type_is_a (type, SWFDEC_TYPE_SCRIPTABLE), NULL);
-
- if (!JSVAL_IS_OBJECT (val))
- return NULL;
- object = JSVAL_TO_OBJECT (val);
- return swfdec_scriptable_from_object (cx, object, type);
-}
-
-/**
- * swfdec_scriptable_set_variables:
- * @script: a #SwfdecScriptable
- * @variables: variables to set on @script in application-x-www-form-urlencoded
- * format
- *
- * Verifies @variables to be encoded correctly and sets them as string
- * properties on the JSObject of @script.
- **/
-void
-swfdec_scriptable_set_variables (SwfdecScriptable *script, const char *variables)
-{
- JSObject *object;
-
- g_return_if_fail (SWFDEC_IS_SCRIPTABLE (script));
- g_return_if_fail (variables != NULL);
-
- SWFDEC_DEBUG ("setting variables on %p: %s", script, variables);
- object = swfdec_scriptable_get_object (script);
- while (TRUE) {
- char *name, *value;
- JSString *string;
- jsval val;
-
- if (!swfdec_urldecode_one (variables, &name, &value, &variables)) {
- SWFDEC_WARNING ("variables invalid at \"%s\"", variables);
- break;
- }
- if (*variables != '\0' && *variables != '&') {
- SWFDEC_WARNING ("variables not delimited with & at \"%s\"", variables);
- g_free (name);
- g_free (value);
- break;
- }
- string = JS_NewStringCopyZ (script->jscx, value);
- if (string == NULL) {
- g_free (name);
- g_free (value);
- SWFDEC_ERROR ("could not create string");
- break;
- }
- val = STRING_TO_JSVAL (string);
- if (!JS_SetProperty (script->jscx, object, name, &val)) {
- g_free (name);
- g_free (value);
- SWFDEC_ERROR ("error setting property \"%s\"", name);
- break;
- }
- SWFDEC_DEBUG ("Set variable \"%s\" to \"%s\"", name, value);
- g_free (name);
- g_free (value);
- if (*variables == '\0')
- break;
- variables++;
- }
-}
-
-/**
- * swfdec_scriptable_execute:
- * @script: a #SwfdecScriptable
- * @name: property name that contains the handler
- * @n_args: number of arguments to pass to handler
- * @args: @n_args arguments that will be passed to handler
- *
- * Executes a callback function (like onMouseMove) on the scriptable if it is
- * defined.
- **/
-void
-swfdec_scriptable_execute (SwfdecScriptable *script, const char *name,
- guint n_args, jsval *args)
-{
- JSObject *obj;
- jsval fun;
-
- g_return_if_fail (SWFDEC_IS_SCRIPTABLE (script));
- g_return_if_fail (name != NULL);
- g_return_if_fail (n_args == 0 || args != NULL);
-
- obj = swfdec_scriptable_get_object (script);
- if (!obj)
- return;
- if (!JS_GetProperty (script->jscx, obj, name, &fun))
- return;
- if (!JSVAL_IS_OBJECT (fun) || fun == JSVAL_NULL ||
- JS_GetClass (JSVAL_TO_OBJECT (fun)) != &js_FunctionClass) {
- SWFDEC_LOG ("scriptable has no handler for %s event", name);
- return;
- }
- js_InternalCall (script->jscx, obj, fun, n_args, args, &fun);
-}
-
-/**
- * swfdec_scriptable_can_execute:
- * @script: a #SwfdecScriptable
- * @name: name of the function
- *
- * Checks if @script contains a function property named @name that can be
- * executed via swfdec_scriptable_execute().
- *
- * Returns: %TRUE if such a function exists, %FALSE otherwise
- **/
-gboolean
-swfdec_scriptable_can_execute (SwfdecScriptable *script, const char *name)
-{
- JSObject *obj;
- jsval fun;
-
- g_return_val_if_fail (SWFDEC_IS_SCRIPTABLE (script), FALSE);
- g_return_val_if_fail (name != NULL, FALSE);
-
- obj = swfdec_scriptable_get_object (script);
- if (!obj)
- return FALSE;
- if (!JS_GetProperty (script->jscx, obj, name, &fun))
- return FALSE;
- if (!JSVAL_IS_OBJECT (fun) || fun == JSVAL_NULL ||
- JS_GetClass (JSVAL_TO_OBJECT (fun)) != &js_FunctionClass) {
- SWFDEC_LOG ("scriptable has no handler for %s event", name);
- return FALSE;
- }
- return TRUE;
-}
-
diff --git a/libswfdec/swfdec_scriptable.h b/libswfdec/swfdec_scriptable.h
deleted file mode 100644
index a53ca4a..0000000
--- a/libswfdec/swfdec_scriptable.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Swfdec
- * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef _SWFDEC_SCRIPTABLE_H_
-#define _SWFDEC_SCRIPTABLE_H_
-
-#include <libswfdec/swfdec.h>
-#include <libswfdec/swfdec_types.h>
-#include <libswfdec/js/jspubtd.h>
-
-G_BEGIN_DECLS
-
-//typedef struct _SwfdecScriptable SwfdecScriptable;
-typedef struct _SwfdecScriptableClass SwfdecScriptableClass;
-
-#define SWFDEC_TYPE_SCRIPTABLE (swfdec_scriptable_get_type())
-#define SWFDEC_IS_SCRIPTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_SCRIPTABLE))
-#define SWFDEC_IS_SCRIPTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_SCRIPTABLE))
-#define SWFDEC_SCRIPTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_SCRIPTABLE, SwfdecScriptable))
-#define SWFDEC_SCRIPTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_SCRIPTABLE, SwfdecScriptableClass))
-#define SWFDEC_SCRIPTABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_SCRIPTABLE, SwfdecScriptableClass))
-
-struct _SwfdecScriptable {
- GObject object;
-
- JSContext * jscx; /* context for jsobj */
- JSObject * jsobj; /* JS object belonging to us or NULL if none */
-};
-
-struct _SwfdecScriptableClass {
- GObjectClass object_class;
-
- const JSClass * jsclass; /* class used by objects of this type (filled by subclasses) */
- /* the default should be good enough most of the time */
- JSObject * (* create_js_object) (SwfdecScriptable * scriptable);
-};
-
-GType swfdec_scriptable_get_type (void);
-
-void swfdec_scriptable_finalize (JSContext * cx,
- JSObject * obj);
-
-JSObject * swfdec_scriptable_get_object (SwfdecScriptable * scriptable);
-gpointer swfdec_scriptable_from_jsval (JSContext * cx,
- jsval val,
- GType type);
-gpointer swfdec_scriptable_from_object (JSContext * cx,
- JSObject * object,
- GType type);
-
-void swfdec_scriptable_set_variables (SwfdecScriptable * script,
- const char * variables);
-gboolean swfdec_scriptable_can_execute (SwfdecScriptable * script,
- const char * name);
-void swfdec_scriptable_execute (SwfdecScriptable * script,
- const char * name,
- guint n_args,
- jsval * args);
-
-
-G_END_DECLS
-#endif
More information about the Swfdec
mailing list