search for: swfdec_action_to_numb

Displaying 17 results from an estimated 17 matches for "swfdec_action_to_numb".

2007 Mar 05
0
11 commits - configure.ac libswfdec/swfdec_js_movie.c libswfdec/swfdec_root_movie.c libswfdec/swfdec_root_movie.h libswfdec/swfdec_script.c libswfdec/swfdec_sprite.c libswfdec/swfdec_sprite.h libswfdec/swfdec_sprite_movie.c libswfdec/swfdec_swf_decoder.c
...er also document swfdec_script_execute diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index 762264c..f51a3d2 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -1814,6 +1814,15 @@ swfdec_action_modulo_7 (JSContext *cx, g } } +static JSBool +swfdec_action_to_number (JSContext *cx, guint action, const guint8 *data, guint len) +{ + double d; + if (!JS_ValueToNumber (cx, cx->fp->sp[-1], &d)) + return JS_FALSE; + return JS_NewNumberValue (cx, d, &cx->fp->sp[-1]); +} + /*** PRINT FUNCTIONS ***/ static char * @@ -2175,7 +2184,7 @@ st...
2007 Apr 11
0
Branch 'as' - 4 commits - libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_types.c libswfdec/swfdec_as_types.h
...erpret.c b/libswfdec/swfdec_as_interpret.c index a679c0a..2421fbd 100644 --- a/libswfdec/swfdec_as_interpret.c +++ b/libswfdec/swfdec_as_interpret.c @@ -1705,27 +1705,21 @@ swfdec_action_swap (SwfdecAsContext *cx, *swfdec_as_stack_peek (cx->frame->stack, 2) = val; } -#if 0 static void swfdec_action_to_number (SwfdecAsContext *cx, guint action, const guint8 *data, guint len) { - double d; - if (!JS_ValueToNumber (cx, cx->fp->sp[-1], &d)) - return JS_FALSE; - return JS_NewNumberValue (cx, d, &cx->fp->sp[-1]); + SWFDEC_AS_VALUE_SET_NUMBER (swfdec_as_stack_peek (cx->frame-&...
2007 Mar 05
0
5 commits - libswfdec/swfdec_js.h libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c test/trace
...ee627f2e) Author: Benjamin Otte <otte@gnome.org> Date: Mon Mar 5 22:07:49 2007 +0100 implement TypeOf diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index 95fdf80..01dd6ae 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -1905,6 +1905,45 @@ swfdec_action_to_number (JSContext *cx, return JS_NewNumberValue (cx, d, &cx->fp->sp[-1]); } +static JSBool +swfdec_action_type_of (JSContext *cx, guint action, const guint8 *data, guint len) +{ + jsval val; + const char *type; + JSString *string; + + val = cx->fp->sp[-1]; + if (JSVAL_IS_NUMB...
2007 Feb 01
0
Branch 'interpreter' - 9 commits - libswfdec/js libswfdec/swfdec_script.c libswfdec/swfdec_script.h player/swfdec_debug_stack.c test/trace
...ValueToObject == NULL in CallMethod - walk the whole scope chain in CallFunction when trying to find the function diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index ad08eef..39b3b8b 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -161,7 +161,7 @@ swfdec_action_to_number (JSContext *cx, static JSBool swfdec_value_to_number_7 (JSContext *cx, jsval val, double *d) { - if (JSVAL_IS_NULL (val)) { + if (JSVAL_IS_OBJECT (val)) { *d = *cx->runtime->jsNaN; return JS_TRUE; } else { @@ -550,8 +550,10 @@ swfdec_action_call_function (JSContext * J...
2007 Jan 29
0
Branch 'interpreter' - 18 commits - libswfdec/swfdec_image.c libswfdec/swfdec_image.h libswfdec/swfdec_js.c libswfdec/swfdec_js_color.c libswfdec/swfdec_js_sound.c libswfdec/swfdec_pattern.c libswfdec/swfdec_scriptable.c libswfdec/swfdec_script.c
...ontext *cx, guint action, const guint8 *data, guint len) +{ + JSStackFrame *fp = cx->fp; + guint stack_size = fp->sp - fp->spbase; + guint n_args = 1; + + if (stack_size < 3) + return JS_FALSE; + if (!swfdec_eval_jsval (cx, NULL, &fp->sp[-1])) + return JS_FALSE; + if (swfdec_action_to_number (cx, fp->sp[-3])) { + jsval tmp; + if (stack_size < 7) + return JS_FALSE; + n_args = 5; + /* yay for order */ + tmp = fp->sp[-4]; + fp->sp[-4] = fp->sp[-7]; + fp->sp[-7] = tmp; + tmp = fp->sp[-6]; + fp->sp[-6] = fp->sp[-5]; + fp->sp...
2007 Jan 25
0
Branch 'interpreter' - 28 commits - configure.ac libswfdec/js libswfdec/swfdec_buffer.c libswfdec/swfdec_edittext_movie.c libswfdec/swfdec_js.c libswfdec/swfdec_js_global.c libswfdec/swfdec_js.h libswfdec/swfdec_js_movie.c libswfdec/swfdec_player.c
...909cba4..171877f 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -753,6 +753,26 @@ swfdec_action_if (JSContext *cx, guint a return JS_TRUE; } +static JSBool +swfdec_action_decrement (JSContext *cx, guint action, const guint8 *data, guint len) +{ + double d; + + d = swfdec_action_to_number (cx, cx->fp->sp[-1]); + d--; + return JS_NewNumberValue (cx, d, &cx->fp->sp[-1]); +} + +static JSBool +swfdec_action_increment (JSContext *cx, guint action, const guint8 *data, guint len) +{ + double d; + + d = swfdec_action_to_number (cx, cx->fp->sp[-1]); + d++; + ret...
2007 Feb 01
0
Branch 'interpreter' - libswfdec/swfdec_script.c
...RITE_MOVIE (movie)) + return -1; + if (strchr (name, ':')) { + SWFDEC_ERROR ("FIXME: handle targets"); + } + frame = swfdec_sprite_get_frame (SWFDEC_SPRITE_MOVIE (movie)->sprite, name); + } else { + /* FIXME: how do we treat undefined etc? */ + frame = swfdec_action_to_number (cx, val); + } + return frame; +} + static JSBool swfdec_action_goto_frame2 (JSContext *cx, guint action, const guint8 *data, guint len) { @@ -274,7 +295,6 @@ swfdec_action_goto_frame2 (JSContext *cx guint bias; gboolean play; jsval val; - int frame; SwfdecMovie *movie; swf...
2007 Jan 31
0
Branch 'interpreter' - 3 commits - libswfdec/js libswfdec/swfdec_script.c
...on_less (JSContext *cx, guint action, const guint8 *data, guint len) +swfdec_action_old_compare (JSContext *cx, guint action, const guint8 *data, guint len) { jsval rval, lval; double l, r; @@ -1029,7 +1029,17 @@ swfdec_action_less (JSContext *cx, guint lval = cx->fp->sp[-2]; l = swfdec_action_to_number (cx, lval); r = swfdec_action_to_number (cx, rval); - cond = l < r; + switch (action) { + case 0x0e: + cond = l == r; + break; + case 0x0f: + cond = l < r; + break; + default: + g_assert_not_reached (); + return JS_FALSE; + } cx->fp->sp...
2007 Apr 12
0
Branch 'as' - 15 commits - 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 libswfdec/swfdec_as_function.h libswfdec/swfdec_as_interpret.c
..._action_new_comparison_6, swfdec_action_new_comparison_7 } }, [SWFDEC_AS_ACTION_EQUALS2] = { "Equals2", NULL, 2, 1, { NULL, NULL, swfdec_action_equals2, swfdec_action_equals2, swfdec_action_equals2 } }, [SWFDEC_AS_ACTION_TO_NUMBER] = { "ToNumber", NULL, 1, 1, { NULL, NULL, swfdec_action_to_number, swfdec_action_to_number, swfdec_action_to_number } }, [SWFDEC_AS_ACTION_TO_STRING] = { "ToString", NULL, 1, 1, { NULL, NULL, swfdec_action_to_string, swfdec_action_to_string, swfdec_action_to_string } }, @@ -2218,13 +2213,15 @@ const SwfdecActionSpec swfdec_as_actions [0x65] = {...
2007 Feb 06
0
109 commits - configure.ac libswfdec/js libswfdec/Makefile.am libswfdec/swfdec_bits.c libswfdec/swfdec_bits.h libswfdec/swfdec_buffer.c libswfdec/swfdec_button_movie.c libswfdec/swfdec_codec_screen.c libswfdec/swfdec_color.c libswfdec/swfdec_color.h
...RITE_MOVIE (movie)) + return -1; + if (strchr (name, ':')) { + SWFDEC_ERROR ("FIXME: handle targets"); + } + frame = swfdec_sprite_get_frame (SWFDEC_SPRITE_MOVIE (movie)->sprite, name); + } else { + /* FIXME: how do we treat undefined etc? */ + frame = swfdec_action_to_number (cx, val); + } + return frame; +} + static JSBool swfdec_action_goto_frame2 (JSContext *cx, guint action, const guint8 *data, guint len) { @@ -274,7 +295,6 @@ swfdec_action_goto_frame2 (JSContext *cx guint bias; gboolean play; jsval val; - int frame; SwfdecMovie *movie; swf...
2007 Nov 07
0
14 commits - libswfdec/swfdec_as_context.c libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_interpret.h libswfdec/swfdec_net_stream.c libswfdec/swfdec_script.c libswfdec/swfdec_sprite_movie.c libswfdec/swfdec_tag.c libswfdec/swfdec_text_field_movie.c
...1, swfdec_action_new_comparison, 5 }, - [SWFDEC_AS_ACTION_EQUALS2] = { "Equals2", NULL, 2, 1, swfdec_action_equals2_5, 5 }, + [SWFDEC_AS_ACTION_EQUALS2] = { "Equals2", NULL, 2, 1, swfdec_action_equals2, 5 }, [SWFDEC_AS_ACTION_TO_NUMBER] = { "ToNumber", NULL, 1, 1, swfdec_action_to_number, 5 }, [SWFDEC_AS_ACTION_TO_STRING] = { "ToString", NULL, 1, 1, swfdec_action_to_string, 5 }, [SWFDEC_AS_ACTION_PUSH_DUPLICATE] = { "PushDuplicate", NULL, 1, 2, swfdec_action_push_duplicate, 5 }, @@ -3205,7 +3195,7 @@ const SwfdecActionSpec swfdec_as_actions[256] = { [...
2007 Feb 16
0
11 commits - libswfdec/swfdec_font.c libswfdec/swfdec_font.h libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c libswfdec/swfdec_script.h test/.gitignore test/trace
...oder.h" #include "swfdec_js.h" #include "swfdec_movie.h" @@ -1691,6 +1692,43 @@ swfdec_action_store_register (JSContext return JS_TRUE; } +static JSBool +swfdec_action_modulo_5 (JSContext *cx, guint action, const guint8 *data, guint len) +{ + double x, y; + + x = swfdec_action_to_number (cx, cx->fp->sp[-1]); + y = swfdec_action_to_number (cx, cx->fp->sp[-2]); + cx->fp->sp--; + errno = 0; + x = fmod (x, y); + if (errno != 0) { + cx->fp->sp[-1] = DOUBLE_TO_JSVAL (cx->runtime->jsNaN); + return JS_TRUE; + } else { + return JS_NewNumberVal...
2007 Jan 31
0
Branch 'interpreter' - 20 commits - autogen.sh configure.ac libswfdec/js libswfdec/swfdec_debug.h libswfdec/swfdec_js.c libswfdec/swfdec_js_color.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_movie.c libswfdec/swfdec_movie.h libswfdec/swfdec_script.c
...ot; #include "swfdec_root_movie.h" +#include "swfdec_sprite.h" +#include "swfdec_sprite_movie.h" #include "js/jsfun.h" #include "js/jsscope.h" @@ -115,6 +117,25 @@ swfdec_action_push_string (JSContext *cx return JS_TRUE; } +static double +swfdec_action_to_number (JSContext *cx, jsval val) +{ + if (JSVAL_IS_INT (val)) { + return JSVAL_TO_INT (val); + } else if (JSVAL_IS_DOUBLE (val)) { + return *JSVAL_TO_DOUBLE (val); + } else if (JSVAL_IS_BOOLEAN (val)) { + return JSVAL_TO_BOOLEAN (val); + } else if (JSVAL_IS_STRING (val)) { + double d; +...
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
..., x, &cx->fp->sp[-1]); + } +} + +static void +swfdec_action_swap (SwfdecAsContext *cx, guint action, const guint8 *data, guint len) +{ + jsval tmp = cx->fp->sp[-2]; + cx->fp->sp[-2] = cx->fp->sp[-1]; + cx->fp->sp[-1] = tmp; + return JS_TRUE; +} + +static void +swfdec_action_to_number (SwfdecAsContext *cx, guint action, const guint8 *data, guint len) +{ + double d; + if (!JS_ValueToNumber (cx, cx->fp->sp[-1], &d)) + return JS_FALSE; + return JS_NewNumberValue (cx, d, &cx->fp->sp[-1]); +} + +static void +swfdec_action_to_string (SwfdecAsContext *cx, gu...
2007 Mar 12
0
11 commits - libswfdec/js libswfdec/swfdec_loader.c libswfdec/swfdec_root_sprite.c libswfdec/swfdec_script.c player/swfdebug.c player/swfdec_player_manager.c test/trace
...ec_action_binary (JSContext *cx, gui static JSString * swfdec_action_to_string_5 (JSContext *cx, jsval val) { - if (JSVAL_IS_VOID (val) || JSVAL_IS_NULL (val)) + if (JSVAL_IS_VOID (val)) return cx->runtime->emptyString; return js_ValueToString (cx, val); } @@ -1936,6 +1985,17 @@ swfdec_action_to_number (JSContext *cx, } static JSBool +swfdec_action_to_string (JSContext *cx, guint action, const guint8 *data, guint len) +{ + JSString *s; + s = JS_ValueToString(cx, cx->fp->sp[-1]); + if (!s) + return JS_FALSE; + cx->fp->sp[-1] = STRING_TO_JSVAL (s); + return JS_TRUE; +} +...
2007 Apr 27
0
Changes to 'refs/tags/0.4.3'
...m fix video scaling is correct : is an unescaped character for formencoded improve debugging register the loader correctly No need for storing the player in the script anymore read DoInitAction contents implement ActionInitArray add array test s/swfdec_action_to_number/swfdec_value_to_number/ implement ActionToNumber implement Delete2 only remove movie as property if it is one allow attaching runtime data to characters use per-character data to check if movie's DoInitAction has been run, oops, the cairo requirement should...
2007 Apr 27
0
Changes to 'refs/tags/0.4.4'
...m fix video scaling is correct : is an unescaped character for formencoded improve debugging register the loader correctly No need for storing the player in the script anymore read DoInitAction contents implement ActionInitArray add array test s/swfdec_action_to_number/swfdec_value_to_number/ implement ActionToNumber implement Delete2 only remove movie as property if it is one allow attaching runtime data to characters use per-character data to check if movie's DoInitAction has been run, oops, the cairo requirement should...