Displaying 10 results from an estimated 10 matches for "swfdec_script_ensure_stack".
2007 Mar 11
0
10 commits - libswfdec/js libswfdec/swfdec_js_color.c libswfdec/swfdec_js_connection.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_js_net_stream.c libswfdec/swfdec_js_video.c libswfdec/swfdec_js_xml.c libswfdec/swfdec_script.c player/.gitignore
...fp->sp - fp->spbase) >= n_args + 2);
+ stacksize = fp->sp - fp->spbase;
+ g_assert (stacksize >= 2);
+ if (n_args + 2 > stacksize) {
+ SWFDEC_WARNING ("broken script. Want %u arguments, only got %u", n_args, stacksize - 2);
+ n_args = stacksize - 2;
+ if (!swfdec_script_ensure_stack (cx, n_args + 2))
+ return JS_FALSE;
+ }
j = -1;
i = - (n_args + 2);
@@ -677,13 +685,13 @@ swfdec_action_call_function (JSContext *
jsval fun;
JSAtom *atom;
+ if (!swfdec_script_ensure_stack (cx, 2))
+ return JS_FALSE;
s = swfdec_js_to_string (cx, fp->sp[-1]);
i...
2007 Mar 09
0
17 commits - libswfdec/js libswfdec/swfdec_js.c libswfdec/swfdec_js_global.c libswfdec/swfdec_js.h libswfdec/swfdec_js_movie.c libswfdec/swfdec_movie.c libswfdec/swfdec_player.c libswfdec/swfdec_player_internal.h libswfdec/swfdec_root_movie.c
...1418491d882421aa)
Author: Benjamin Otte <otte@gnome.org>
Date: Fri Mar 9 17:41:20 2007 +0100
improve stack management
- use new spend member to track end of stack
- in Actionscript, the stack is infinite (initially all values are undefined)
Implement this concept via swfdec_script_ensure_stack
- don't pass the number of free stack spaces to functions anymore now that
we know where the stack ends
diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c
index 428fc4c..50dbf2b 100644
--- a/libswfdec/swfdec_script.c
+++ b/libswfdec/swfdec_script.c
@@ -125,6 +125,42 @...
2007 Apr 04
0
Branch 'as' - 4 commits - libswfdec/Makefile.am libswfdec/swfdec_as_context.c libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_interpret.h libswfdec/swfdec_as_object.c libswfdec/swfdec_as_types.c libswfdec/swfdec_as_types.h
...int i, j;
+ jsval tmp;
+ guint stacksize;
+
+ stacksize = fp->sp - fp->spbase;
+ g_assert (stacksize >= 2);
+ if (n_args + 2 > stacksize) {
+ SWFDEC_WARNING ("broken script. Want %u arguments, only got %u", n_args, stacksize - 2);
+ n_args = stacksize - 2;
+ if (!swfdec_script_ensure_stack (cx, n_args + 2))
+ return JS_FALSE;
+ }
+
+ j = -1;
+ i = - (n_args + 2);
+ while (i < j) {
+ tmp = fp->sp[j];
+ fp->sp[j] = fp->sp[i];
+ fp->sp[i] = tmp;
+ j--;
+ i++;
+ }
+ return js_Invoke (cx, n_args, flags);
+}
+
+/* FIXME: lots of overlap with swfdec_...
2007 Mar 13
0
2 commits - libswfdec/swfdec_debugger.c libswfdec/swfdec_script.c libswfdec/swfdec_script.h
..._area (SwfdecScr
/*** SUPPORT FUNCTIONS ***/
+static void
+swfdec_script_add_to_player (SwfdecScript *script, SwfdecPlayer *player)
+{
+ if (SWFDEC_IS_DEBUGGER (player)) {
+ swfdec_debugger_add_script (SWFDEC_DEBUGGER (player), script);
+ script->debugger = player;
+ }
+}
+
/**
* swfdec_script_ensure_stack:
* @cx: #JSContext to check
@@ -1733,22 +1740,22 @@ swfdec_action_define_function (JSContext
}
if (name == NULL)
name = "unnamed_function";
- script = swfdec_script_new_for_player (JS_GetContextPrivate (cx),
- &bits, name, ((SwfdecScript *) cx->fp->swf)->...
2007 Mar 07
1
2 commits - libswfdec/swfdec_script.c test/trace
libswfdec/swfdec_script.c | 14 ++++++++++++--
test/trace/Makefile.am | 2 ++
test/trace/gotoframe.swf |binary
test/trace/gotoframe.swf.trace | 13 +++++++++++++
4 files changed, 27 insertions(+), 2 deletions(-)
New commits:
diff-tree 12348410a3509928a6e8e4c8ca00292a58ff542c (from 46e62d4410c20c19774a45758d8ebf11cd0bdf96)
Author: Benjamin Otte <otte@gnome.org>
2007 Mar 28
0
Branch 'as' - 3 commits - libswfdec/Makefile.am libswfdec/swfdec_as_context.c libswfdec/swfdec_as_context.h libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_object.c libswfdec/swfdec_as_object.h libswfdec/swfdec_as_types.c
...d */
+ if (spec->exec[version] == NULL) {
+ SWFDEC_ERROR ("cannot interpret action %u %s for version %u", action,
+ spec->name ? spec->name : "Unknown", script->version);
+ goto internal_error;
+ }
+#if 0
+ if (spec->remove > 0) {
+ //!swfdec_script_ensure_stack (cx, spec->remove)) {
+ }
+ if (spec->add > 0 &&
+ TRUE) { //fp->sp + spec->add - MAX (spec->remove, 0) > fp->spend) {
+ SWFDEC_ERROR ("FIXME: implement stack expansion, we got an overflow");
+ goto internal_error;
+ }
+#ifndef G_DISABLE_...
2007 May 29
0
Branch 'as' - 6 commits - libswfdec/swfdec_as_interpret.c libswfdec/swfdec_js_xml.c libswfdec/swfdec_tag.c player/swfplay.c
...D (swfdec_as_stack_peek (cx->frame->stack, 1));
}
-#if 0
static void
swfdec_action_new_method (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
{
- JSStackFrame *fp = cx->fp;
- const char *s;
- guint32 n_args;
- JSObject *object;
- jsval constructor;
-
- if (!swfdec_script_ensure_stack (cx, 3))
- return JS_FALSE;
- s = swfdec_js_to_string (cx, fp->sp[-1]);
- if (s == NULL)
- return JS_FALSE;
- if (!JS_ValueToECMAUint32 (cx, fp->sp[-3], &n_args))
- return JS_FALSE;
-
- if (!JS_ValueToObject (cx, fp->sp[-2], &object))
- return JS_FALSE;
- if (obj...
2007 May 23
0
Branch 'as' - 7 commits - libswfdec/Makefile.am libswfdec/swfdec_as_context.c libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_object.h libswfdec/swfdec_as_strings.c
...t8 *data, guint len)
{
- JSStackFrame *fp = cx->fp;
- JSObject *object;
- guint n_args;
- gulong i;
+ SwfdecAsStack *stack = cx->frame->stack;
+ SwfdecAsObject *object;
+ guint i, n_args;
- if (!JS_ValueToECMAUint32 (cx, fp->sp[-1], &n_args))
- return JS_FALSE;
- if (!swfdec_script_ensure_stack (cx, 2 * n_args + 1))
- return JS_FALSE;
+ n_args = swfdec_as_value_to_integer (cx, swfdec_as_stack_pop (stack));
+ if (n_args * 2 < swfdec_as_stack_get_size (stack)) {
+ SWFDEC_FIXME ("InitObject action with too small stack, help!");
+ n_args = swfdec_as_stack_get_size (sta...
2007 Mar 29
0
Branch 'as' - 9 commits - configure.ac doc/swfdec-sections.txt libswfdec/Makefile.am libswfdec/swfdec_as_context.c libswfdec/swfdec_as_context.h libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_stack.c
...>buffer->data;
endpc = startpc + script->buffer->length;
@@ -352,35 +359,38 @@ swfdec_as_context_run (SwfdecAsContext *
spec->name ? spec->name : "Unknown", script->version);
goto internal_error;
}
-#if 0
if (spec->remove > 0) {
- //!swfdec_script_ensure_stack (cx, spec->remove)) {
- }
- if (spec->add > 0 &&
- TRUE) { //fp->sp + spec->add - MAX (spec->remove, 0) > fp->spend) {
- SWFDEC_ERROR ("FIXME: implement stack expansion, we got an overflow");
- goto internal_error;
+ swfdec_as_stack_ens...
2007 Mar 29
0
Branch 'as' - 9 commits - libswfdec-gtk/swfdec_playback_alsa.c libswfdec/js libswfdec/Makefile.am libswfdec/swfdec_as_context.c libswfdec/swfdec_as_context.h libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_function.c
...nt_pool_get_area (SwfdecScr
g_assert (start + len < buffer->data + buffer->length);
return swfdec_buffer_new_subbuffer (buffer, start - buffer->data, len);
}
+#endif
/*** SUPPORT FUNCTIONS ***/
@@ -152,46 +150,10 @@ swfdec_script_add_to_player (SwfdecScrip
}
}
-/**
- * swfdec_script_ensure_stack:
- * @cx: #JSContext to check
- * @n_elements: number of elements the stack should contain
- *
- * Ensures that the stack is at least @n_elements values. If not enough stack
- * space is available, the stack is filled up with JSVAL_VOID.
- *
- * Returns: JS_TRUE on success or JS_FALSE on OOM
- **/...