Displaying 20 results from an estimated 48 matches for "swfdec_as_value_to_number".
2007 Jun 12
0
Branch 'as' - 3 commits - libswfdec/swfdec_as_array.c libswfdec/swfdec_as_context.c libswfdec/swfdec_as_math.c libswfdec/swfdec_as_native_function.c libswfdec/swfdec_as_number.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_string.c
...ed yet");
}
}
static void
-swfdec_as_context_isFinite (SwfdecAsObject *object, guint argc, SwfdecAsValue *argv, SwfdecAsValue *retval)
+swfdec_as_context_isFinite (SwfdecAsContext *cx, SwfdecAsObject *object,
+ guint argc, SwfdecAsValue *argv, SwfdecAsValue *retval)
{
- double d = swfdec_as_value_to_number (object->context, &argv[0]);
+ double d = swfdec_as_value_to_number (cx, &argv[0]);
SWFDEC_AS_VALUE_SET_BOOLEAN (retval, isfinite (d) ? TRUE : FALSE);
}
static void
-swfdec_as_context_isNaN (SwfdecAsObject *object, guint argc, SwfdecAsValue *argv, SwfdecAsValue *retval)
+swfdec_a...
2007 Oct 14
0
3 commits - doc/Makefile.am libswfdec/swfdec_text_field_movie_as.c
...iff --git a/libswfdec/swfdec_text_field_movie_as.c b/libswfdec/swfdec_text_field_movie_as.c
index 43599a3..121fefc 100644
--- a/libswfdec/swfdec_text_field_movie_as.c
+++ b/libswfdec/swfdec_text_field_movie_as.c
@@ -604,10 +604,10 @@ swfdec_text_field_movie_set_embedFonts (SwfdecAsContext *cx,
swfdec_as_value_to_number (cx, &argv[0]);
- text->text->embed_fonts = value;
-
- if (text->text->embed_fonts)
+ if (!text->text->embed_fonts && value)
SWFDEC_FIXME ("Using embed fonts in TextField not supported");
+
+ text->text->embed_fonts = value;
}
static void...
2007 Jun 20
1
Branch 'as' - 2 commits - libswfdec/swfdec_as_interpret.c
...o arguments were mixed
diff --git a/libswfdec/swfdec_as_interpret.c b/libswfdec/swfdec_as_interpret.c
index 596b632..48b75c9 100644
--- a/libswfdec/swfdec_as_interpret.c
+++ b/libswfdec/swfdec_as_interpret.c
@@ -1732,8 +1732,8 @@ swfdec_action_modulo (SwfdecAsContext *c
{
double x, y;
- x = swfdec_as_value_to_number (cx, swfdec_as_stack_pop (cx->frame->stack));
- y = swfdec_as_value_to_number (cx, swfdec_as_stack_peek (cx->frame->stack, 1));
+ y = swfdec_as_value_to_number (cx, swfdec_as_stack_pop (cx->frame->stack));
+ x = swfdec_as_value_to_number (cx, swfdec_as_stack_peek (cx->frame-...
2007 Jun 28
0
Branch 'as' - 4 commits - doc/Makefile.am doc/swfdec-docs.sgml doc/swfdec-sections.txt libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_types.c libswfdec/swfdec_as_types.h
...178,3 +178,16 @@ SWFDEC_IS_GTK_LOADER
SWFDEC_IS_GTK_LOADER_CLASS
SWFDEC_TYPE_GTK_LOADER
</SECTION>
+
+<SECTION>
+<FILE>SwfdecAsValue</FILE>
+<TITLE>SwfdecAsValue</TITLE>
+SwfdecAsValueType
+SwfdecAsValue
+swfdec_as_value_to_boolean
+swfdec_as_value_to_integer
+swfdec_as_value_to_number
+swfdec_as_value_to_object
+swfdec_as_value_to_primitive
+swfdec_as_value_to_string
+</SECTION>
diff-tree 54d9e25821ca4303c7182c626343ee08c84b1ea2 (from 35053a70dfbdc472fecadb29b21e38dd9e055410)
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Jun 28 18:59:21 2007 +0200
add do...
2007 May 29
0
Branch 'as' - 8 commits - libswfdec/Makefile.am libswfdec/swfdec_as_array.c libswfdec/swfdec_as_context.c libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_math.c libswfdec/swfdec_as_math.h libswfdec/swfdec_as_strings.c libswfdec/swfdec_as_types.c
...quot;swfdec_as_math.h"
+#include "swfdec_as_object.h"
+#include "swfdec_as_context.h"
+#include "swfdec_debug.h"
+
+/*** AS CODE ***/
+
+static void
+swfdec_as_math_ceil (SwfdecAsObject *object, guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
+{
+ double d = swfdec_as_value_to_number (object->context, &argv[0]);
+
+ d = ceil (d);
+ SWFDEC_AS_VALUE_SET_NUMBER (ret, d);
+}
+
+void
+swfdec_as_math_init_context (SwfdecAsContext *context, guint version)
+{
+ SwfdecAsObject *math;
+ SwfdecAsValue val;
+
+ g_return_if_fail (SWFDEC_IS_AS_CONTEXT (context));
+
+ math = swfd...
2007 Dec 03
0
12 commits - libswfdec/Makefile.am libswfdec/swfdec_as_strings.c libswfdec/swfdec_as_types.c libswfdec/swfdec_as_types.h libswfdec/swfdec_gradient_pattern.c libswfdec/swfdec_gradient_pattern.h libswfdec/swfdec_movie_as_drawing.c libswfdec/swfdec_pattern.c
..._SCALE_FACTOR / 2.0);
+ cairo_matrix_scale (mat, SWFDEC_TWIPS_SCALE_FACTOR / 32768.0, SWFDEC_TWIPS_SCALE_FACTOR / 32768.0);
+ if (s == SWFDEC_AS_STR_box) {
+ double x, y, w, h, r;
+ cairo_matrix_t input;
+ swfdec_as_object_get_variable (o, SWFDEC_AS_STR_x, &val);
+ x = swfdec_as_value_to_number (cx, &val);
+ swfdec_as_object_get_variable (o, SWFDEC_AS_STR_y, &val);
+ y = swfdec_as_value_to_number (cx, &val);
+ swfdec_as_object_get_variable (o, SWFDEC_AS_STR_w, &val);
+ w = swfdec_as_value_to_number (cx, &val);
+ swfdec_as_object_get_variable (o...
2007 Oct 11
0
2 commits - libswfdec/swfdec_text_format.c libswfdec/swfdec_xml.c libswfdec/swfdec_xml.h
...AsValue *argv, SwfdecAsValue *ret)
{
+ double d;
+
if (!SWFDEC_IS_XML (object))
return;
@@ -334,7 +337,11 @@ swfdec_xml_set_status (SwfdecAsContext *
if (SWFDEC_AS_VALUE_IS_OBJECT (&argv[0]))
swfdec_as_value_to_string (cx, &argv[0]);
- SWFDEC_XML (object)->status = swfdec_as_value_to_number (cx, &argv[0]);
+ d = swfdec_as_value_to_number (cx, &argv[0]);
+ if (!isfinite (d))
+ SWFDEC_XML (object)->status = G_MININT32;
+ else
+ SWFDEC_XML (object)->status = (int) d;
}
static const char *
diff --git a/libswfdec/swfdec_xml.h b/libswfdec/swfdec_xml.h
index c06562...
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
...onst char *swfdec_as_strings[] = {
SWFDEC_AS_CONSTANT_STRING ("function"),
SWFDEC_AS_CONSTANT_STRING ("object"),
SWFDEC_AS_CONSTANT_STRING ("toString"),
+ SWFDEC_AS_CONSTANT_STRING ("valueOf"),
/* add more here */
NULL
};
@@ -204,8 +205,15 @@ swfdec_as_value_to_number (SwfdecAsConte
return NAN;
}
case SWFDEC_TYPE_AS_ASOBJECT:
- SWFDEC_ERROR ("FIXME");
- return NAN;
+ {
+ SwfdecAsValue ret;
+ swfdec_as_object_call (SWFDEC_AS_VALUE_GET_OBJECT (value), SWFDEC_AS_STR_VALUEOF,
+ 0, NULL, &ret);
+ if (SWFDEC_AS_VALUE_IS...
2007 Apr 11
0
Branch 'as' - 4 commits - libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_types.c libswfdec/swfdec_as_types.h
...EC_TYPE_AS_BOOLEAN:
+ return SWFDEC_AS_VALUE_GET_BOOLEAN (value);
+ case SWFDEC_TYPE_AS_NUMBER:
+ {
+ double d = SWFDEC_AS_VALUE_GET_NUMBER (value);
+ return d != 0.0 && !isnan (d);
+ }
+ case SWFDEC_TYPE_AS_STRING:
+ if (context->version <= 6) {
+ double d = swfdec_as_value_to_number (context, value);
+ return d != 0.0 && !isnan (d);
+ } else {
+ return SWFDEC_AS_VALUE_GET_STRING (value) != SWFDEC_AS_STR_EMPTY;
+ }
+ case SWFDEC_TYPE_AS_ASOBJECT:
+ return TRUE;
+ default:
+ g_assert_not_reached ();
+ return FALSE;
+ }
+}
+
diff --git a/li...
2007 Aug 17
0
3 commits - libswfdec/swfdec_sprite_movie_as.c test/trace
...hitTest (SwfdecAsCon
SWFDEC_OBJECT (other)->extents.x1, SWFDEC_OBJECT (other)->extents.y1);
#endif
SWFDEC_AS_VALUE_SET_BOOLEAN (rval, swfdec_rect_intersect (NULL, &movie_rect, &other_rect));
+ } else if (argc >= 2) {
+ SwfdecRect movie_rect;
+ double x, y;
+
+ x = swfdec_as_value_to_number (cx, &argv[0]);
+ y = swfdec_as_value_to_number (cx, &argv[1]);
+
+ if (argc >= 3) {
+ if (swfdec_as_value_to_boolean (cx, &argv[2])) {
+ SWFDEC_FIXME ("hitTest's shapeFlag parameter not supported");
+ // just continue...
+ }
+ }
+
+ swfdec_movie_u...
2007 Jun 28
0
Branch 'as' - 2 commits - doc/swfdec-sections.txt libswfdec/swfdec_as_types.c libswfdec/swfdec_as_types.h
....txt
@@ -184,10 +184,31 @@ SWFDEC_TYPE_GTK_LOADER
<TITLE>SwfdecAsValue</TITLE>
SwfdecAsValueType
SwfdecAsValue
+SWFDEC_AS_VALUE_SET_UNDEFINED
+SWFDEC_AS_VALUE_GET_BOOLEAN
swfdec_as_value_to_boolean
-swfdec_as_value_to_integer
+SWFDEC_AS_VALUE_SET_BOOLEAN
+SWFDEC_AS_VALUE_GET_NUMBER
swfdec_as_value_to_number
+swfdec_as_value_to_integer
+SWFDEC_AS_VALUE_SET_INT
+SWFDEC_AS_VALUE_SET_NUMBER
+SWFDEC_AS_VALUE_GET_STRING
+swfdec_as_value_to_string
+SWFDEC_AS_VALUE_SET_STRING
+SWFDEC_AS_VALUE_SET_NULL
+SWFDEC_AS_VALUE_GET_OBJECT
swfdec_as_value_to_object
+SWFDEC_AS_VALUE_SET_OBJECT
swfdec_as_value_to_primit...
2007 May 24
0
Branch 'as' - 11 commits - libswfdec/swfdec_as_array.c libswfdec/swfdec_as_context.c libswfdec/swfdec_as_function.c libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_native_function.c libswfdec/swfdec_as_number.c libswfdec/swfdec_as_object.c
...18:43:33 2007 +0200
add swfdec_as_value_to_primitive
diff --git a/libswfdec/swfdec_as_types.c b/libswfdec/swfdec_as_types.c
index 07aa538..2004e71 100644
--- a/libswfdec/swfdec_as_types.c
+++ b/libswfdec/swfdec_as_types.c
@@ -230,24 +230,29 @@ swfdec_as_value_to_printable (SwfdecAsCo
double
swfdec_as_value_to_number (SwfdecAsContext *context, const SwfdecAsValue *value)
{
+ SwfdecAsValue tmp;
+
g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), 0.0);
g_return_val_if_fail (SWFDEC_IS_AS_VALUE (value), 0.0);
- switch (value->type) {
+ tmp = *value;
+ swfdec_as_value_to_primitive (&tmp);
+
+...
2007 Aug 22
0
8 commits - libswfdec/swfdec_movie.c libswfdec/swfdec_movie.h libswfdec/swfdec_player.c libswfdec/swfdec_player_internal.h libswfdec/swfdec_sprite_movie_as.c vivified/core
...nt)
+ swfdec_movie_rect_local_to_global (other->parent, &other_rect);
SWFDEC_AS_VALUE_SET_BOOLEAN (rval, swfdec_rect_intersect (NULL, &movie_rect, &other_rect));
} else if (argc >= 2) {
- SwfdecRect movie_rect;
double x, y;
+ gboolean shape, ret;
- x = swfdec_as_value_to_number (cx, &argv[0]);
- y = swfdec_as_value_to_number (cx, &argv[1]);
+ x = swfdec_as_value_to_number (cx, &argv[0]) * SWFDEC_TWIPS_SCALE_FACTOR;
+ y = swfdec_as_value_to_number (cx, &argv[1]) * SWFDEC_TWIPS_SCALE_FACTOR;
+ shape = (argc >= 3 && swfdec_as_value_to_b...
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
...lse compare as numbers */
- cond = l == r;
+ if (isnan (l) && isnan (r))
+ cond = ltype == rtype;
+ else
+ cond = l == r;
out:
swfdec_as_stack_pop (cx->frame->stack);
@@ -1138,7 +1141,11 @@ swfdec_action_equals2 (SwfdecAsContext *
/* else compare as numbers */
l = swfdec_as_value_to_number (cx, lval);
r = swfdec_as_value_to_number (cx, rval);
- cond = l == r;
+
+ if (isnan (l) && isnan (r))
+ cond = ltype == rtype;
+ else
+ cond = l == r;
out:
swfdec_as_stack_pop (cx->frame->stack);
@@ -1166,7 +1173,12 @@ swfdec_action_strict_equals (SwfdecAsCon
cond...
2007 Apr 05
0
Branch 'as' - 9 commits - configure.ac libswfdec/swfdec_as_context.c libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_function.h libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_object.h
...diff-tree 7f368a0aa96f48fd8e99c40c42b0f22cadef75a5 (from d4da7e1074456705c898d9bb14d431ef21472cb7)
Author: Benjamin Otte <otte@gnome.org>
Date: Thu Apr 5 15:32:37 2007 +0200
Require C99 and implement some functions
I'm too lazy to define NaN and +-Infinity myself. And
swfdec_as_value_to_number needs those.
diff --git a/configure.ac b/configure.ac
index fdf2a31..d04bd19 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,6 +37,9 @@ SWFDEC_LIBVERSION="3:0:0"
AC_SUBST(SWFDEC_LIBVERSION)
AM_PROG_LIBTOOL
+dnl C99 is only required to get definitions for NAN and INFINITY.
+GLOBAL...
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
...dec_action_logical (SwfdecAsContext *cx, guint action, const guint8 *data, gu
// don't call second parameter if not necessary
if ((action == SWFDEC_AS_ACTION_AND && !l) ||
(action != SWFDEC_AS_ACTION_AND && l)) {
- val = swfdec_as_stack_peek (cx, 2);
- r = (swfdec_as_value_to_number (cx, val) != 0);
+ r = (swfdec_as_value_to_number (cx, swfdec_as_stack_peek (cx, 2)) != 0);
+ } else {
+ r = FALSE;
}
} else {
l = swfdec_as_value_to_boolean (cx, swfdec_as_stack_peek (cx, 1));
- val = swfdec_as_stack_peek (cx, 2);
- r = swfdec_as_value_to_boolean (c...
2007 Oct 17
0
6 commits - libswfdec/swfdec_as_strings.c libswfdec/swfdec_movie.c libswfdec/swfdec_movie.h libswfdec/swfdec_text_field.c libswfdec/swfdec_text_field.h libswfdec/swfdec_text_field_movie_as.c libswfdec/swfdec_text_field_movie.c
...ten_variable_text (text,
swfdec_text_field_movie_get_html_text (text));
}
}
@@ -335,7 +335,7 @@ swfdec_text_field_movie_do_set_variable (SwfdecAsContext *cx,
SwfdecAsValue *ret)
{
SwfdecTextFieldMovie *text;
- const char *value, *str;
+ const char *value;
if (argc > 0)
swfdec_as_value_to_number (cx, &argv[0]);
@@ -344,12 +344,10 @@ swfdec_text_field_movie_do_set_variable (SwfdecAsContext *cx,
if (SWFDEC_AS_VALUE_IS_UNDEFINED (&argv[0]) ||
SWFDEC_AS_VALUE_IS_NULL (&argv[0]) || value == SWFDEC_AS_STR_EMPTY) {
- text->variable = NULL;
- } else if (value != text...
2007 Apr 16
0
Branch 'as' - 3 commits - libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_object.h
...are (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
{
- jsval rval, lval;
double l, r;
- void cond;
+ gboolean cond;
- rval = cx->fp->sp[-1];
- lval = cx->fp->sp[-2];
- l = swfdec_value_to_number (cx, lval);
- r = swfdec_value_to_number (cx, rval);
+ l = swfdec_as_value_to_number (cx, swfdec_as_stack_peek (cx->frame->stack, 2));
+ r = swfdec_as_value_to_number (cx, swfdec_as_stack_peek (cx->frame->stack, 1));
switch (action) {
case 0x0e:
cond = l == r;
@@ -1037,17 +1033,15 @@ swfdec_action_old_compare (SwfdecAsConte
break;
default:...
2007 Oct 15
0
6 commits - libswfdec/swfdec_as_strings.c libswfdec/swfdec_codec_audio.c libswfdec/swfdec_codec_video.c libswfdec/swfdec_text_field.c libswfdec/swfdec_text_field.h libswfdec/swfdec_text_field_movie_as.c libswfdec/swfdec_text_field_movie.c
...id
+swfdec_text_field_movie_set_multiline (SwfdecAsContext *cx,
+ SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
+ SwfdecAsValue *ret)
+{
+ SwfdecTextFieldMovie *text;
+ gboolean value;
+
+ SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "b", &value);
+
+ swfdec_as_value_to_number (cx, &argv[0]);
+
+ text->text->multiline = value;
+}
+
+static void
+swfdec_text_field_movie_do_get_type (SwfdecAsContext *cx,
+ SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
+ SwfdecAsValue *ret)
+{
+ SwfdecTextFieldMovie *text;
+
+ SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_...
2007 Oct 14
0
10 commits - libswfdec/swfdec_as_strings.c libswfdec/swfdec_text_field.c libswfdec/swfdec_text_field_movie_as.c libswfdec/swfdec_text_field_movie.c
...void
+swfdec_text_field_movie_set_border (SwfdecAsContext *cx,
+ SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
+ SwfdecAsValue *ret)
+{
+ SwfdecTextFieldMovie *text;
+ gboolean value;
+
+ SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "b", &value);
+
+ swfdec_as_value_to_number (cx, &argv[0]);
+
+ if (text->text->border != value) {
+ text->text->border = value;
+ swfdec_movie_invalidate (SWFDEC_MOVIE (text));
+ }
+}
+
SWFDEC_AS_NATIVE (104, 104, swfdec_text_field_movie_getNewTextFormat)
void
swfdec_text_field_movie_getNewTextFormat (SwfdecAsCont...