search for: swfdec_action_random_numb

Displaying 11 results from an estimated 11 matches for "swfdec_action_random_numb".

2007 Oct 26
0
2 commits - libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_object.h test/trace
...fdec_action_cast } }, - [SWFDEC_AS_ACTION_IMPLEMENTS] = { "Implements", NULL }, + [SWFDEC_AS_ACTION_IMPLEMENTS] = { "Implements", NULL, -1, 0, { NULL, NULL, NULL, NULL, swfdec_action_implements } }, /* version 4 */ [0x30] = { "RandomNumber", NULL, 1, 1, { NULL, swfdec_action_random_number, swfdec_action_random_number, swfdec_action_random_number, swfdec_action_random_number } }, [SWFDEC_AS_ACTION_MB_STRING_LENGTH] = { "MBStringLength", NULL }, diff --git a/libswfdec/swfdec_as_object.h b/libswfdec/swfdec_as_object.h index 1877817..4fcddb4 100644 --- a/libswfdec/swfdec_...
2007 Oct 25
0
6 commits - libswfdec/swfdec_as_interpret.c test/trace
...TION_CAST] = { "Cast", NULL }, + [SWFDEC_AS_ACTION_CAST] = { "Cast", NULL, 2, 1, { NULL, NULL, NULL, NULL, swfdec_action_cast } }, [SWFDEC_AS_ACTION_IMPLEMENTS] = { "Implements", NULL }, /* version 4 */ [0x30] = { "RandomNumber", NULL, 1, 1, { NULL, swfdec_action_random_number, swfdec_action_random_number, swfdec_action_random_number, swfdec_action_random_number } }, commit 78828b96e49c946e2c3aab29fc9bbd0fbd2dfeb0 Author: Pekka Lampila <pekka.lampila at iki.fi> Date: Thu Oct 25 19:21:53 2007 +0300 Reorganize instanceOf code to get separate swfdec_action_is...
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
...ActionSpec swfdec_as_actions[256] = { [SWFDEC_AS_ACTION_CAST] = { "Cast", NULL, 2, 1, swfdec_action_cast, 7 }, [SWFDEC_AS_ACTION_IMPLEMENTS] = { "Implements", NULL, -1, 0, swfdec_action_implements, 7 }, /* version 4 */ - [0x30] = { "RandomNumber", NULL, 1, 1, swfdec_action_random_number, 4 }, + [SWFDEC_AS_ACTION_RANDOM] = { "RandomNumber", NULL, 1, 1, swfdec_action_random_number, 4 }, [SWFDEC_AS_ACTION_MB_STRING_LENGTH] = { "MBStringLength", NULL, -1, -1, NULL, 4 }, [SWFDEC_AS_ACTION_CHAR_TO_ASCII] = { "CharToAscii", NULL, 1, 1, swfdec_action...
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
...JSVAL_TO_DOUBLE (val); } else if (JSVAL_IS_BOOLEAN (val)) { return JSVAL_TO_BOOLEAN (val); + } else if (JSVAL_IS_STRING (val)) { + double d; + if (!JS_ValueToNumber (cx, val, &d)) + return 0; + return isnan (d) ? 0 : d; } else { return 0; } @@ -872,6 +878,27 @@ swfdec_action_random_number (JSContext * return JS_NewNumberValue(cx, result, &cx->fp->sp[-1]); } +static JSBool +swfdec_action_less (JSContext *cx, guint action, const guint8 *data, guint len) +{ + jsval rval, lval; + double l, r; + JSBool cond; + + rval = cx->fp->sp[-1]; + lval = cx->fp->s...
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
...c index 9e052c4..cc2bf34 100644 --- a/libswfdec/swfdec_as_interpret.c +++ b/libswfdec/swfdec_as_interpret.c @@ -981,23 +981,22 @@ swfdec_action_push_duplicate (SwfdecAsCo *swfdec_as_stack_push (cx->frame->stack) = *swfdec_as_stack_peek (cx->frame->stack, 1); } -#if 0 static void swfdec_action_random_number (SwfdecAsContext *cx, guint action, const guint8 *data, guint len) { - gint32 max, result; + gint32 max; + SwfdecAsValue *val; - if (!JS_ValueToECMAInt32 (cx, cx->fp->sp[-1], &max)) - return JS_FALSE; + val = swfdec_as_stack_peek (cx->frame->stack, 1); + max = swfdec_a...
2007 Apr 12
0
Branch 'as' - 14 commits - libswfdec-gtk/swfdec_playback_alsa.c 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
...s", NULL }, + /* version 7 */ + [SWFDEC_AS_ACTION_THROW] = { "Throw", NULL }, + [SWFDEC_AS_ACTION_CAST] = { "Cast", NULL }, + [SWFDEC_AS_ACTION_IMPLEMENTS] = { "Implements", NULL }, /* version 4 */ [0x30] = { "RandomNumber", NULL, 1, 1, { NULL, swfdec_action_random_number, swfdec_action_random_number, swfdec_action_random_number, swfdec_action_random_number } }, + [SWFDEC_AS_ACTION_MB_STRING_LENGTH] = { "MBStringLength", NULL }, + [SWFDEC_AS_ACTION_CHAR_TO_ASCII] = { "CharToAscii", NULL }, + [SWFDEC_AS_ACTION_ASCII_TO_CHAR] = { "AsciiTo...
2007 Jul 02
0
Branch 'as' - 4 commits - libswfdec/swfdec_as_interpret.c test/trace
...0]); + g_free (uni); + } +} + +static void swfdec_action_ascii_to_char (SwfdecAsContext *cx, guint action, const guint8 *data, guint len) { char *s; @@ -2381,7 +2417,7 @@ const SwfdecActionSpec swfdec_as_actions /* version 4 */ [0x30] = { "RandomNumber", NULL, 1, 1, { NULL, swfdec_action_random_number, swfdec_action_random_number, swfdec_action_random_number, swfdec_action_random_number } }, [SWFDEC_AS_ACTION_MB_STRING_LENGTH] = { "MBStringLength", NULL }, - [SWFDEC_AS_ACTION_CHAR_TO_ASCII] = { "CharToAscii", NULL }, + [SWFDEC_AS_ACTION_CHAR_TO_ASCII] = { "CharToA...
2007 Jan 31
0
Branch 'interpreter' - 3 commits - libswfdec/js libswfdec/swfdec_script.c
...implement Equals This is the last action that the compiler had implemented and this branch hadn't diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index 7c24b10..9b3a328 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -1019,7 +1019,7 @@ swfdec_action_random_number (JSContext * } static JSBool -swfdec_action_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 *c...
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
...--; + cx->fp->sp[-1] = STRING_TO_JSVAL (lval); + return JS_TRUE; +} + +static void +swfdec_action_push_duplicate (SwfdecAsContext *cx, guint action, const guint8 *data, guint len) +{ + cx->fp->sp++; + cx->fp->sp[-1] = cx->fp->sp[-2]; + return JS_TRUE; +} + +static void +swfdec_action_random_number (SwfdecAsContext *cx, guint action, const guint8 *data, guint len) +{ + gint32 max, result; + + if (!JS_ValueToECMAInt32 (cx, cx->fp->sp[-1], &max)) + return JS_FALSE; + + if (max <= 0) + result = 0; + else + result = g_random_int_range (0, max); + + return JS_NewNumb...
2007 Apr 16
0
Branch 'as' - 3 commits - libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_object.h
...;otte@gnome.org> Date: Sun Apr 15 16:46:04 2007 +0200 implement Less and Equals diff --git a/libswfdec/swfdec_as_interpret.c b/libswfdec/swfdec_as_interpret.c index dfcefb1..7ea1f82 100644 --- a/libswfdec/swfdec_as_interpret.c +++ b/libswfdec/swfdec_as_interpret.c @@ -1016,18 +1016,14 @@ swfdec_action_random_number (SwfdecAsCon SWFDEC_AS_VALUE_SET_NUMBER (val, g_rand_int_range (cx->rand, 0, max)); } -#if 0 static void swfdec_action_old_compare (SwfdecAsContext *cx, guint action, const guint8 *data, guint len) { - jsval rval, lval; double l, r; - void cond; + gboolean cond; - rval = cx...
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
...implement Equals This is the last action that the compiler had implemented and this branch hadn't diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index 7c24b10..9b3a328 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -1019,7 +1019,7 @@ swfdec_action_random_number (JSContext * } static JSBool -swfdec_action_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 *c...